fix ESG chassis inquiry payload

This commit is contained in:
SepehrYahyaee
2026-09-19 16:50:34 +03:30
parent b4c1d7bd5f
commit 4ef53f2cc9
8 changed files with 12 additions and 13 deletions

View File

@@ -159,7 +159,7 @@ describe("RequestManagementService policyholder inquiry routing", () => {
).toHaveBeenCalledWith(
{
nationalCode: "0022222222",
chassis: vehicle.vin,
chassisNo: vehicle.vin,
},
undefined,
);

View File

@@ -468,7 +468,7 @@ export class RequestManagementService {
const result = await this.sandHubService.getCarByChassisInquiry(
{
nationalCode: subjects.thirdPartyPolicyNationalCode,
chassis,
chassisNo: chassis,
},
options,
);

View File

@@ -191,7 +191,7 @@ describe("SandHubService inquiry mocks", () => {
const result = await service.getCarByChassisInquiry({
nationalCode: "0012345678",
chassis: "NAAR03HFFRDE07024",
chassisNo: "NAAR03HFFRDE07024",
});
expect(result.mapped.Error.Message).toBe(
@@ -242,7 +242,7 @@ describe("SandHubService inquiry mocks", () => {
service.getCarByChassisInquiry(
{
nationalCode: "1234567890",
chassis: "NAAR03HFFRDE07024",
chassisNo: "NAAR03HFFRDE07024",
},
{ enforceDeploymentClientMatch: true },
),
@@ -258,14 +258,14 @@ describe("SandHubService inquiry mocks", () => {
await service.getCarByChassisInquiry({
nationalCode: "0012345678",
chassis: "NAAR03HFFRDE07024",
chassisNo: "NAAR03HFFRDE07024",
});
expect(esg).toHaveBeenCalledWith(
expect.stringContaining("/inquiry/carByChassis"),
{
nationalCode: "0012345678",
chassis: "NAAR03HFFRDE07024",
chassisNo: "NAAR03HFFRDE07024",
},
"vinChassis",
undefined,

View File

@@ -1197,14 +1197,14 @@ export class SandHubService {
* @param options - optional per-tenant client scope
*/
async getCarByChassisInquiry(
identity: { nationalCode: string; chassis: string },
identity: { nationalCode: string; chassisNo: string },
options?: SandHubInquiryOptions,
): Promise<{ raw: any; mapped: any }> {
const baseUrl = process.env.ESG_URL ?? "http://192.168.20.22:8085";
const requestUrl = `${baseUrl}/inquiry/carByChassis`;
const requestPayload = {
nationalCode: String(identity.nationalCode),
chassis: String(identity.chassis),
chassisNo: String(identity.chassisNo),
};
const live = await this.isInquiryLive("vinChassis", options);
@@ -1213,7 +1213,7 @@ export class SandHubService {
const ctx = await this.mockCompanyContext(options);
const raw = this.buildMockPlateInquiryRaw(ctx);
this.logger.debug(
`[MOCK] getCarByChassisInquiry nationalCode=${identity.nationalCode} chassis=${identity.chassis}`,
`[MOCK] getCarByChassisInquiry nationalCode=${identity.nationalCode} chassisNo=${identity.chassisNo}`,
);
const mapped = this.mapEsgPolicyByPlateToOldFormat(raw, "thirdPartyVin");
if (!mapped?.Error) {