Merge pull request 'fix ESG chassis inquiry payload' (#331) from s.yahyaee/yara724-api:main into main

Reviewed-on: Yara724/api#331
This commit is contained in:
2026-09-19 16:51:31 +03:30
8 changed files with 12 additions and 13 deletions

1
.gitignore vendored
View File

@@ -186,4 +186,3 @@ dist
*.sh *.sh
!scripts/fanavaran-flow-test.sh !scripts/fanavaran-flow-test.sh
!scripts/fanavaran-auth.sh !scripts/fanavaran-auth.sh
*.json

View File

@@ -446,7 +446,7 @@ curl -X POST "$ESG_URL/inquiry/carByChassis" \
-H "Accept: application/json" \ -H "Accept: application/json" \
--data '{ --data '{
"nationalCode": "0012345678", "nationalCode": "0012345678",
"chassis": "NAAR03HFFRDE07024" "chassisNo": "NAAR03HFFRDE07024"
}' }'
``` ```

View File

@@ -359,7 +359,7 @@
<table> <table>
<tr><th style="width:70px">متد</th><th>مسیر</th><th>توضیح</th></tr> <tr><th style="width:70px">متد</th><th>مسیر</th><th>توضیح</th></tr>
<tr><td><span class="method post">POST</span></td><td><code>/inquiry/policyByPlate</code></td><td>جستجوی بیمه‌نامه مبتنی بر پلاک (THIRD_PARTY). بدنه: <code>nationalCode</code>، <code>plk1–plk4</code>. پاسخ قبل از ذخیره به فرمت قدیمی تجارت نگاشت می‌شود.</td></tr> <tr><td><span class="method post">POST</span></td><td><code>/inquiry/policyByPlate</code></td><td>جستجوی بیمه‌نامه مبتنی بر پلاک (THIRD_PARTY). بدنه: <code>nationalCode</code>، <code>plk1–plk4</code>. پاسخ قبل از ذخیره به فرمت قدیمی تجارت نگاشت می‌شود.</td></tr>
<tr><td><span class="method post">POST</span></td><td><code>/inquiry/carByChassis</code></td><td>جایگزین دوعاملی VIN/شاسی برای استعلام پلاک. توسط اندپوینت‌های <code>run-inquiries-vin</code> فراخوانی می‌شود. بدنه: <code>nationalCode</code>، <code>chassis</code>. مسیر تک‌عاملی <code>policyByChassis</code> استفاده نمی‌شود، چون فیلد <code>nationalCode</code> را نمی‌پذیرد.</td></tr> <tr><td><span class="method post">POST</span></td><td><code>/inquiry/carByChassis</code></td><td>جایگزین دوعاملی VIN/شاسی برای استعلام پلاک. توسط اندپوینت‌های <code>run-inquiries-vin</code> فراخوانی می‌شود. بدنه: <code>nationalCode</code>، <code>chassisNo</code>. مسیر تک‌عاملی <code>policyByChassis</code> استفاده نمی‌شود، چون فیلد <code>nationalCode</code> را نمی‌پذیرد.</td></tr>
<tr><td><span class="method post">POST</span></td><td><code>/inquiry/person</code></td><td>بررسی هویت شخصی. بدنه: <code>nationalCode</code>، <code>birthDate</code> (جلالی، نه میلادی).</td></tr> <tr><td><span class="method post">POST</span></td><td><code>/inquiry/person</code></td><td>بررسی هویت شخصی. بدنه: <code>nationalCode</code>، <code>birthDate</code> (جلالی، نه میلادی).</td></tr>
<tr><td><span class="method post">POST</span></td><td><code>/inquiry/sheba</code></td><td>اعتبارسنجی شبا / حساب بانکی.</td></tr> <tr><td><span class="method post">POST</span></td><td><code>/inquiry/sheba</code></td><td>اعتبارسنجی شبا / حساب بانکی.</td></tr>
</table> </table>

View File

@@ -356,7 +356,7 @@
<table> <table>
<tr><th style="width:70px">Method</th><th>Path</th><th>What it does</th></tr> <tr><th style="width:70px">Method</th><th>Path</th><th>What it does</th></tr>
<tr><td><span class="method post">POST</span></td><td><code>/inquiry/policyByPlate</code></td><td>Plate-based policy lookup (THIRD_PARTY). Body: <code>nationalCode</code>, <code>plk1–plk4</code>. Response is mapped to the old Tejarat format before being stored.</td></tr> <tr><td><span class="method post">POST</span></td><td><code>/inquiry/policyByPlate</code></td><td>Plate-based policy lookup (THIRD_PARTY). Body: <code>nationalCode</code>, <code>plk1–plk4</code>. Response is mapped to the old Tejarat format before being stored.</td></tr>
<tr><td><span class="method post">POST</span></td><td><code>/inquiry/carByChassis</code></td><td>Two-factor VIN/chassis alternative to the plate inquiry. Called by <code>run-inquiries-vin</code> endpoints. Body: <code>nationalCode</code>, <code>chassis</code>. The one-factor <code>policyByChassis</code> route is not used because it rejects <code>nationalCode</code>.</td></tr> <tr><td><span class="method post">POST</span></td><td><code>/inquiry/carByChassis</code></td><td>Two-factor VIN/chassis alternative to the plate inquiry. Called by <code>run-inquiries-vin</code> endpoints. Body: <code>nationalCode</code>, <code>chassisNo</code>. The one-factor <code>policyByChassis</code> route is not used because it rejects <code>nationalCode</code>.</td></tr>
<tr><td><span class="method post">POST</span></td><td><code>/inquiry/person</code></td><td>Personal identity check. Body: <code>nationalCode</code>, <code>birthDate</code> (Jalali, NOT Gregorian).</td></tr> <tr><td><span class="method post">POST</span></td><td><code>/inquiry/person</code></td><td>Personal identity check. Body: <code>nationalCode</code>, <code>birthDate</code> (Jalali, NOT Gregorian).</td></tr>
<tr><td><span class="method post">POST</span></td><td><code>/inquiry/sheba</code></td><td>Sheba / bank account validation.</td></tr> <tr><td><span class="method post">POST</span></td><td><code>/inquiry/sheba</code></td><td>Sheba / bank account validation.</td></tr>
</table> </table>

View File

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

View File

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

View File

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

View File

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