culprit licence bug fixed , and handled some default values

This commit is contained in:
2026-11-12 11:23:40 +03:30
parent 8b9dabc9f2
commit e215dbdc03
12 changed files with 353 additions and 21 deletions
@@ -299,8 +299,10 @@ import {
pickFanavaranRecordId,
} from './fanavaran-other-people';
import {
FANAVARAN_DUMMY_LICENCE_ISSU_DATE,
resolveDriverFromParty,
resolveDriverIsOwner,
resolveFanavaranIsLicenseReplaced,
resolveFanavaranLicenceIssuDate,
resolveFanavaranLicenceNo,
resolveOwnerFromParty,
@@ -1835,7 +1837,8 @@ export class ClaimRequestManagementService {
result.CulpritLicenceCityId = null;
result.CulpritLicenceCountryId = null;
result.CulpritLicenceForeignCityName = null;
result.CulpritLicenceIssuDate = '1394/10/13';
// Overwritten later from person.driverLicenseDate when present.
result.CulpritLicenceIssuDate = FANAVARAN_DUMMY_LICENCE_ISSU_DATE;
// Must never be empty/null.
result.CulpritLicenceNo = FANAVARAN_DUMMY_LICENCE_NO;
result.DamagedCount = 1;
@@ -1865,7 +1868,8 @@ export class ClaimRequestManagementService {
result.PreviousPolicyEndDate = '';
result.StatusChangeDate = null;
result.TrackingCode = null;
result.IsLicenseReplacement = 0;
// ثالث field name; hull remaps to IsLicenseReplaced. Filled after licence date.
result.IsLicenseReplacement = null;
result.UnknownCulpritCauseId = null;
}
@@ -1892,9 +1896,13 @@ export class ClaimRequestManagementService {
this.fanavaranPayloadDefaultsWithoutExpertIds(
this.TEJARATNO_FANAVARAN_DEFAULTS as unknown as Record<string, unknown>,
);
const accidentCauseFromCase = Number(input.accidentReason?.fanavaran);
const result: Record<string, unknown> = {
...lookupDefaults,
AccidentCauseId: FANAVARAN_DEFAULT_ACCIDENT_CAUSE_ID,
AccidentCauseId:
Number.isFinite(accidentCauseFromCase) && accidentCauseFromCase > 0
? accidentCauseFromCase
: FANAVARAN_DEFAULT_ACCIDENT_CAUSE_ID,
};
if (!input.accidentReason) {
@@ -2641,6 +2649,12 @@ export class ClaimRequestManagementService {
);
input.payload.CulpritLicenceIssuDate =
resolveFanavaranLicenceIssuDate(driverIdentity);
const licenseReplaced = resolveFanavaranIsLicenseReplaced(
input.payload.CulpritLicenceIssuDate,
input.payload.AccidentDate,
);
input.payload.IsLicenseReplaced = licenseReplaced;
input.payload.IsLicenseReplacement = licenseReplaced;
input.payload.CustomerFaultPercent =
FANAVARAN_DEFAULT_HULL_CUSTOMER_FAULT_PERCENT;
@@ -4741,6 +4755,12 @@ export class ClaimRequestManagementService {
);
payload.CulpritLicenceIssuDate =
resolveFanavaranLicenceIssuDate(culpritDriver);
const licenseReplaced = resolveFanavaranIsLicenseReplaced(
payload.CulpritLicenceIssuDate,
payload.AccidentDate,
);
payload.IsLicenseReplacement = licenseReplaced;
payload.IsLicenseReplaced = licenseReplaced;
if (blameCase.type !== BlameRequestType.CAR_BODY) {
payload.CulpritTypeId = resolveThirdPartyCulpritTypeId(
culpritParty as any,