YARA-1267, YARA-1268

This commit is contained in:
SepehrYahyaee
2026-09-08 14:51:51 +03:30
parent 0e861ff6d1
commit 55da8188a9
3 changed files with 60 additions and 24 deletions

View File

@@ -931,7 +931,31 @@ export class SandHubService {
raw: any;
mapped: Record<string, unknown>;
}> {
if (!this.shouldUseParsianCarBodyLookup()) {
const useParsianCarBodyLookup = this.shouldUseParsianCarBodyLookup();
const live = await this.isInquiryLive("carBodyPlate", options);
if (!live) {
// Mock results are generated for the active deployment. They must not be
// treated as evidence of a real insurer and therefore do not go through
// the live-policy insurer gate.
const result = await this.getTejaratCarBodyInquiry(
userDetail as SandHubDetailDto,
options,
);
return {
source:
typeof userDetail.plate === "string"
? useParsianCarBodyLookup
? "ESG_CAR_BODY_VIN_INQUIRY"
: "TEJARAT_CAR_BODY_VIN_INQUIRY"
: useParsianCarBodyLookup
? "ESG_CAR_BODY_INQUIRY"
: "TEJARAT_CAR_BODY_INQUIRY",
...result,
};
}
if (!useParsianCarBodyLookup) {
const result = await this.getTejaratCarBodyInquiry(
userDetail as SandHubDetailDto,
options,
@@ -946,23 +970,6 @@ export class SandHubService {
};
}
const live = await this.isInquiryLive("carBodyPlate", options);
if (!live) {
// Reuse the established local mock contract without sending an HTTP request.
const result = await this.getTejaratCarBodyInquiry(
userDetail as SandHubDetailDto,
options,
);
this.assertParsianCarBodyLookupMatchesDeployment();
return {
source:
typeof userDetail.plate === "string"
? "ESG_CAR_BODY_VIN_INQUIRY"
: "ESG_CAR_BODY_INQUIRY",
...result,
};
}
const plateOrVin = userDetail.plate;
const query =
typeof plateOrVin === "string"