added offline inquiry in system setting also fix some bugs

This commit is contained in:
2026-08-03 11:49:24 +03:30
parent ab4f667c8d
commit 7f672541ae
19 changed files with 965 additions and 26 deletions

View File

@@ -242,7 +242,7 @@ export class InquiryRefreshService {
if (inquiry.mapped?.Error) {
this.recordPartyInquiry(inquiries, "thirdParty", role, false, {
source: "TEJARAT_BLOCK_INQUIRY",
source: inquiry.offline?.source ?? "TEJARAT_BLOCK_INQUIRY",
raw: inquiry.raw,
mapped: inquiry.mapped,
});
@@ -252,10 +252,18 @@ export class InquiryRefreshService {
message: inquiry.mapped.Error.Message || "third-party inquiry error",
};
} else {
nextParty = this.applyThirdPartyToParty(nextParty, inquiry.raw, inquiry.mapped);
nextParty = this.applyThirdPartyToParty(
nextParty,
inquiry.raw,
inquiry.mapped,
{
source: inquiry.offline?.source,
fanavaranDriverId: inquiry.offline?.fanavaranDriverId,
},
);
partyChanged = true;
this.recordPartyInquiry(inquiries, "thirdParty", role, true, {
source: "TEJARAT_BLOCK_INQUIRY",
source: inquiry.offline?.source ?? "TEJARAT_BLOCK_INQUIRY",
raw: inquiry.raw,
mapped: inquiry.mapped,
refreshedAt: new Date().toISOString(),
@@ -343,21 +351,30 @@ export class InquiryRefreshService {
party: Record<string, any>,
raw: Record<string, any>,
mapped: Record<string, any>,
extras?: {
source?: string;
fanavaranDriverId?: number;
},
): Record<string, any> {
const next = { ...party };
next.vehicle = { ...(next.vehicle || {}) };
next.insurance = { ...(next.insurance || {}) };
next.person = { ...(next.person || {}) };
const existingCarBody = next.vehicle.inquiry?.carBody;
next.vehicle.inquiry = {
source: "TEJARAT_BLOCK_INQUIRY",
source: extras?.source ?? "TEJARAT_BLOCK_INQUIRY",
raw,
mapped,
refreshedAt: new Date().toISOString(),
...(existingCarBody ? { carBody: existingCarBody } : {}),
};
if (extras?.fanavaranDriverId != null) {
next.person.fanavaranDriverId = extras.fanavaranDriverId;
}
const vehicleName = this.resolveVehicleName(mapped, raw);
if (vehicleName) {
next.vehicle.name = vehicleName;