forked from Yara724/api
fanavaran driver and owner id (GEN..44 defauts) - culprit type id dynamic
This commit is contained in:
@@ -201,6 +201,31 @@ export function resolveDriverIsOwner(party: PartyLike | null | undefined): boole
|
||||
return party?.person?.driverIsInsurer === true;
|
||||
}
|
||||
|
||||
/** Lookup: `accident-culprit-type` — بیمهگذار */
|
||||
export const FANAVARAN_CULPRIT_TYPE_INSURER = 337;
|
||||
/** Lookup: `accident-culprit-type` — راننده غير از بيمه گذار */
|
||||
export const FANAVARAN_CULPRIT_TYPE_DRIVER_NOT_INSURER = 338;
|
||||
|
||||
/**
|
||||
* GEN.03 ثالث `CulpritTypeId` from whether the guilty party's driver is the insurer.
|
||||
* Never uses 728 (نا معلوم).
|
||||
*/
|
||||
export function resolveThirdPartyCulpritTypeId(
|
||||
party: PartyLike | null | undefined,
|
||||
): number {
|
||||
const driver = resolveDriverFromParty(party);
|
||||
const insurer = resolvePolicyholderFromParty(party, "third-party");
|
||||
if (driver.nationalCode && insurer.nationalCode) {
|
||||
return driver.nationalCode === insurer.nationalCode
|
||||
? FANAVARAN_CULPRIT_TYPE_INSURER
|
||||
: FANAVARAN_CULPRIT_TYPE_DRIVER_NOT_INSURER;
|
||||
}
|
||||
if (party?.person?.driverIsInsurer === false) {
|
||||
return FANAVARAN_CULPRIT_TYPE_DRIVER_NOT_INSURER;
|
||||
}
|
||||
return FANAVARAN_CULPRIT_TYPE_INSURER;
|
||||
}
|
||||
|
||||
/** Licence number for Fanavaran; never empty — uses `dummy` when user value is missing. */
|
||||
export function resolveFanavaranLicenceNo(
|
||||
identity: Pick<FanavaranRoleIdentity, "licenseNo">,
|
||||
|
||||
Reference in New Issue
Block a user