Files
accounted/lib/company-lookup/scb-suggestion.ts
T
admin e7f0070e84
masterplan-lock / check (push) Successful in 19s
ci / sonar (push) Failing after 21s
security / scan (push) Failing after 1m37s
fix(restore): återställ default branch-filer som raderades av docs-publiceringen (7e33543)
Å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.
2026-11-10 09:37:22 +01:00

27 lines
984 B
TypeScript

import { SCB_LEGAL_FORM_SOLE_TRADER, type ScbCandidate } from '@/lib/parties/scb/client'
import type { CompanySuggestion } from './types'
/**
* SCB legal form codes the journey may prefill, expressed in the TIC
* vocabulary `mapSetupEntityType` already understands: 49 (aktiebolag),
* 10 (enskild näringsidkare) and 61 (ideell förening, which the flag may
* still refuse at setup). Bank and insurance AB (41, 42), ekonomisk
* förening (51), stiftelser and the rest stay null: the user picks the
* form, as after a TIC lookup with an unmapped type.
*/
const LEGAL_ENTITY_TYPE_BY_SCB_CODE: Record<string, string> = {
'49': 'AB',
[SCB_LEGAL_FORM_SOLE_TRADER]: 'EF',
'61': 'Ideell förening',
}
export function toCompanySuggestion(c: ScbCandidate): CompanySuggestion {
return {
orgNumber: c.orgNumber,
name: c.name,
city: c.city,
legalEntityType: (c.legalFormCode && LEGAL_ENTITY_TYPE_BY_SCB_CODE[c.legalFormCode]) || null,
active: c.active,
}
}