forked from Yara724/api
Map Fanavaran people and licences by party role; allow unlisted base-info lookups.
Resolve driver, owner, and policyholder from participants when they differ, prefer real licence / driverLicenseDate over dummies, and fall back unknown /lookups/fanavaran/{name} to car/base-info/{name} (including vehicle-groups).
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
parseFanavaranId,
|
||||
type FanavaranCarPolicyProduct,
|
||||
} from "src/lookups/fanavaran-last-car-policy";
|
||||
import { resolvePolicyholderFromParty } from "./fanavaran-party-roles";
|
||||
|
||||
export type FanavaranClaimProduct = FanavaranCarPolicyProduct;
|
||||
|
||||
@@ -101,6 +102,8 @@ export function fanavaranInsuranceLineIdForProduct(
|
||||
type BlamePartyForCarBodyPolicy = {
|
||||
role?: string;
|
||||
person?: { nationalCodeOfInsurer?: unknown };
|
||||
participants?: Array<Record<string, any>>;
|
||||
participantRoles?: Record<string, string | undefined>;
|
||||
insurance?: {
|
||||
carBodyInsurance?: {
|
||||
policyId?: unknown;
|
||||
@@ -168,6 +171,7 @@ export function pickCarBodyPolicyNationalCode(
|
||||
): string | null {
|
||||
const party = firstCarBodyParty(blame);
|
||||
return (
|
||||
resolvePolicyholderFromParty(party, "car-body").nationalCode ??
|
||||
nonEmptyText(party?.person?.nationalCodeOfInsurer) ??
|
||||
nonEmptyText(party?.insurance?.carBodyInsurance?.ownerNationalCode) ??
|
||||
nonEmptyText(party?.insurance?.carBodyInsurance?.insurerNationalCode)
|
||||
|
||||
Reference in New Issue
Block a user