fix inquiry integration and insurer case details

This commit is contained in:
SepehrYahyaee
2026-09-19 16:06:04 +03:30
parent cd36a0f2d4
commit 8071215803
18 changed files with 141 additions and 167 deletions

View File

@@ -189,7 +189,7 @@ describe("SandHubService inquiry mocks", () => {
},
});
const result = await service.getPolicyByChassisInquiry({
const result = await service.getCarByChassisInquiry({
nationalCode: "0012345678",
chassis: "NAAR03HFFRDE07024",
});
@@ -239,7 +239,7 @@ describe("SandHubService inquiry mocks", () => {
});
await expect(
service.getPolicyByChassisInquiry(
service.getCarByChassisInquiry(
{
nationalCode: "1234567890",
chassis: "NAAR03HFFRDE07024",
@@ -256,13 +256,13 @@ describe("SandHubService inquiry mocks", () => {
data: { CmpCod: "8", CmpNam: "بیمه پارسیان" },
});
await service.getPolicyByChassisInquiry({
await service.getCarByChassisInquiry({
nationalCode: "0012345678",
chassis: "NAAR03HFFRDE07024",
});
expect(esg).toHaveBeenCalledWith(
expect.stringContaining("/inquiry/policyByChassis"),
expect.stringContaining("/inquiry/carByChassis"),
{
nationalCode: "0012345678",
chassis: "NAAR03HFFRDE07024",

View File

@@ -1187,7 +1187,7 @@ export class SandHubService {
}
/**
* ESG VIN/chassis-number inquiry (`/inquiry/policyByChassis`).
* ESG two-factor VIN/chassis inquiry (`/inquiry/carByChassis`).
*
* When `vinChassis` inquiry is disabled (mock mode) the response shape mirrors
* `buildMockPlateInquiryRaw` so the downstream mapper (`mapEsgPolicyByPlateToOldFormat`)
@@ -1196,12 +1196,12 @@ export class SandHubService {
* @param identity - policyholder national code and 17-character VIN/chassis
* @param options - optional per-tenant client scope
*/
async getPolicyByChassisInquiry(
async getCarByChassisInquiry(
identity: { nationalCode: string; chassis: string },
options?: SandHubInquiryOptions,
): Promise<{ raw: any; mapped: any }> {
const baseUrl = process.env.ESG_URL ?? "http://192.168.20.22:8085";
const requestUrl = `${baseUrl}/inquiry/policyByChassis`;
const requestUrl = `${baseUrl}/inquiry/carByChassis`;
const requestPayload = {
nationalCode: String(identity.nationalCode),
chassis: String(identity.chassis),
@@ -1213,7 +1213,7 @@ export class SandHubService {
const ctx = await this.mockCompanyContext(options);
const raw = this.buildMockPlateInquiryRaw(ctx);
this.logger.debug(
`[MOCK] getPolicyByChassisInquiry nationalCode=${identity.nationalCode} chassis=${identity.chassis}`,
`[MOCK] getCarByChassisInquiry nationalCode=${identity.nationalCode} chassis=${identity.chassis}`,
);
const mapped = this.mapEsgPolicyByPlateToOldFormat(raw, "thirdPartyVin");
if (!mapped?.Error) {