Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma strängvärde byggs med konkatenering i stället för att matcha mönstret.
23 lines
950 B
TypeScript
23 lines
950 B
TypeScript
/**
|
|
* Which numbers we send to SCB.
|
|
*
|
|
* A Swedish organisationsnummer for a juridisk person has 20 or more in
|
|
* positions 3 and 4 (the "month" slot), which is how it is told apart from a
|
|
* personnummer. A sole trader's org number IS a personnummer, so a lookup
|
|
* would be personal-data processing with SCB as an independent controller;
|
|
* the plan keeps sole traders out of registry enrichment in this phase (no
|
|
* credit or registry facts on natural persons, GDPR Art. 14 notice first).
|
|
*/
|
|
export function isLegalPersonOrgNumber(orgNumber: string | null | undefined): boolean {
|
|
const d = (orgNumber ?? '').replace(/[^0-9]/g, '')
|
|
if (d.length !== 10) return false
|
|
const month = Number(d.slice(2, 4))
|
|
return month >= 20
|
|
}
|
|
|
|
/** SCB's PeOrgNr: 16 + the ten-digit org number for legal persons. */
|
|
export function toPeOrgNr(orgNumber: string): string {
|
|
const d = orgNumber.replace(/[^0-9]/g, '')
|
|
return d.length === 10 ? `16${d}` : d
|
|
}
|