mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 08:48:11 +00:00
feat(freight-api): gate poa paper, fayda identity, foreign passport
- dars delegation paper mandatory wherever poa state changes (named, removed, forwarder role applied for/approved), not just onboarding - ethiopian companies verify owner (and poa, once named) via fayda; identity, not general manager, is the verified subject - foreign companies require a typed owner passport number instead, independent of an optional fayda verification - fanNumber removed from client-writable dtos; server-derived only Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import { Injectable, Logger } from "@nestjs/common";
|
||||
import { DataSource } from "typeorm";
|
||||
|
||||
import { FileUploadSetting } from "../modules/file-upload-settings/entities/file-upload-setting.entity";
|
||||
import { poaDelegationField } from "../modules/file-upload-settings/poa-delegation.constants";
|
||||
|
||||
interface OnboardingField {
|
||||
fileKey: string;
|
||||
@@ -17,27 +18,14 @@ interface OnboardingField {
|
||||
|
||||
const DOC_EXTENSIONS = ["pdf", "jpg", "jpeg", "png"];
|
||||
|
||||
/** fileKey of the delegation letter attached to the Power of Attorney step. */
|
||||
export const POA_DELEGATION_FILE_KEY = "poa_delegation_letter";
|
||||
|
||||
/**
|
||||
* Seeded as optional: the delegation letter is only mandatory once a PoA has
|
||||
* been entered, or when the company operates as a freight forwarder. That rule
|
||||
* spans form fields as well as files, so it lives in the onboarding gate
|
||||
* (companies.service.getOnboardingRequirements) rather than in `isRequired`.
|
||||
* Listed in the sets below only so the reference defaults stay a complete
|
||||
* picture of a company onboarding form. Unlike every other field here, the DARS
|
||||
* delegation paper is not admin-managed: `FileUploadSettingsService.getByCode`
|
||||
* injects it from poa-delegation.constants.ts whether or not a row exists.
|
||||
*/
|
||||
const poaDelegationField = (displayOrder: number): OnboardingField => ({
|
||||
fileKey: POA_DELEGATION_FILE_KEY,
|
||||
fileLabel: "PoA Delegation Letter",
|
||||
helpText:
|
||||
"Signed letter in which the General Manager delegates the representative named above.",
|
||||
isRequired: false,
|
||||
isMultiple: false,
|
||||
maxFiles: 1,
|
||||
allowedExtensions: DOC_EXTENSIONS,
|
||||
maxSizeMb: 10,
|
||||
displayOrder,
|
||||
});
|
||||
const poaDelegationDefault = (displayOrder: number): OnboardingField =>
|
||||
poaDelegationField(displayOrder) as unknown as OnboardingField;
|
||||
|
||||
/** Documents required from an Ethiopian company at onboarding. */
|
||||
const ETHIOPIAN_ONBOARDING_FIELDS: OnboardingField[] = [
|
||||
@@ -75,7 +63,7 @@ const ETHIOPIAN_ONBOARDING_FIELDS: OnboardingField[] = [
|
||||
maxSizeMb: 10,
|
||||
displayOrder: 3,
|
||||
},
|
||||
poaDelegationField(4),
|
||||
poaDelegationDefault(4),
|
||||
];
|
||||
|
||||
/** Documents required from a Foreign company at onboarding. */
|
||||
@@ -124,7 +112,7 @@ const FOREIGN_ONBOARDING_FIELDS: OnboardingField[] = [
|
||||
maxSizeMb: 10,
|
||||
displayOrder: 4,
|
||||
},
|
||||
poaDelegationField(5),
|
||||
poaDelegationDefault(5),
|
||||
];
|
||||
|
||||
/** Legacy combined set, kept for the older per-company-type codes. */
|
||||
|
||||
Reference in New Issue
Block a user