Files
edr-platform/apps/edr-freight-web/portal/src/utils/documentSettingCode.ts
2026-08-12 07:12:04 +00:00

19 lines
788 B
TypeScript

/**
* The company document set a company resolves to — one of three, never a
* combination: a co-operative union or farm uploads its own papers INSTEAD of
* its nationality's (it holds no business licence), and is always Ethiopian.
*
* Mirrors `CompaniesService.documentSettingCodeFor` on the API; prefer the
* server-resolved `documentSettingCode` from onboarding requirements where one
* is available, and use this where only the company is at hand.
*/
export function documentSettingCode(
nationality: string | null | undefined,
cooperative?: boolean | null,
): string {
if (cooperative) return "company_onboarding_documents_cooperative";
return nationality === "foreign"
? "company_onboarding_documents_foreign"
: "company_onboarding_documents_ethiopian";
}