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:
2026-09-26 16:57:30 +03:30
co-authored by Cursor
parent 4f8fe04380
commit fc1c117b93
9 changed files with 590 additions and 44 deletions
@@ -107,6 +107,29 @@ describe("fanavaran claim product", () => {
expect(nationalCode).toBe("0012345678");
});
it("prefers CAR_BODY_POLICYHOLDER participant over person.nationalCodeOfInsurer", () => {
const nationalCode = pickCarBodyPolicyNationalCode({
parties: [
{
role: PartyRole.FIRST,
person: { nationalCodeOfInsurer: "0012345678" },
participants: [
{
participantId: "CAR_BODY_POLICYHOLDER",
nationalCode: "0499370899",
birthday: "1368/05/20",
},
],
participantRoles: {
carBodyPolicyholder: "CAR_BODY_POLICYHOLDER",
},
},
],
});
expect(nationalCode).toBe("0499370899");
});
it("flattens car-body inquiry fields onto the damage-case aliases", () => {
const { mapped } = fanavaranPartyInquirySources("car-body", {
insurance: {