forked from Yara724/api
Merge pull request 'Disabled Inquiry' (#8) from s.yahyaee/yara724-api:main into main
Reviewed-on: Yara724/api#8
This commit is contained in:
@@ -750,12 +750,12 @@ export class RequestManagementService {
|
|||||||
let inquiryRaw: any;
|
let inquiryRaw: any;
|
||||||
let inquiryMapped: any;
|
let inquiryMapped: any;
|
||||||
try {
|
try {
|
||||||
// const inquiry = await this.sandHubService.getTejaratBlockInquiry({
|
const inquiry = await this.sandHubService.getTejaratBlockInquiry({
|
||||||
// plate: body.plate,
|
plate: body.plate,
|
||||||
// nationalCodeOfInsurer: body.nationalCodeOfInsurer,
|
nationalCodeOfInsurer: body.nationalCodeOfInsurer,
|
||||||
// });
|
});
|
||||||
// inquiryRaw = inquiry.raw;
|
inquiryRaw = inquiry.raw;
|
||||||
// inquiryMapped = inquiry.mapped;
|
inquiryMapped = inquiry.mapped;
|
||||||
this.logger.log(
|
this.logger.log(
|
||||||
`[TEJARAT] block inquiry raw for request=${req._id}: ${JSON.stringify(inquiryRaw)}`,
|
`[TEJARAT] block inquiry raw for request=${req._id}: ${JSON.stringify(inquiryRaw)}`,
|
||||||
);
|
);
|
||||||
@@ -1664,10 +1664,10 @@ export class RequestManagementService {
|
|||||||
// TODO: Activate
|
// TODO: Activate
|
||||||
// --- Proceed with existing logic if the check passes ---
|
// --- Proceed with existing logic if the check passes ---
|
||||||
// 1) Main third-party/block inquiry (existing behavior)
|
// 1) Main third-party/block inquiry (existing behavior)
|
||||||
// const sanHubResponse = await this.sandHubService.getSandHubResponse({
|
const sanHubResponse = await this.sandHubService.getSandHubResponse({
|
||||||
// plate: body.plate,
|
plate: body.plate,
|
||||||
// nationalCodeOfInsurer: body.nationalCodeOfInsurer,
|
nationalCodeOfInsurer: body.nationalCodeOfInsurer,
|
||||||
// });
|
});
|
||||||
|
|
||||||
// if (sanHubResponse.Error) {
|
// if (sanHubResponse.Error) {
|
||||||
// throw new HttpException(
|
// throw new HttpException(
|
||||||
@@ -1696,13 +1696,13 @@ export class RequestManagementService {
|
|||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// return await this.addPlate(
|
return await this.addPlate(
|
||||||
// sanHubResponse,
|
sanHubResponse,
|
||||||
// request,
|
request,
|
||||||
// user,
|
user,
|
||||||
// body,
|
body,
|
||||||
// isFirstParty ? "firstParty" : "secondParty",
|
isFirstParty ? "firstParty" : "secondParty",
|
||||||
// );
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async carBodyFormStep(
|
async carBodyFormStep(
|
||||||
|
|||||||
@@ -183,7 +183,79 @@ export class SandHubService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const requestUrl = `${baseUrl}/block-inquiry-tejarat`;
|
const requestUrl = `${baseUrl}/block-inquiry-tejarat`;
|
||||||
const raw = await this.makeTejaratRequest(requestUrl, requestPayload);
|
// const raw = await this.makeTejaratRequest(requestUrl, requestPayload);
|
||||||
|
const raw = {
|
||||||
|
"PrntPlcyCmpDocNo": "1403/1143-70591/200/35",
|
||||||
|
"MapTypNam": "پرايد هاچ بک -111",
|
||||||
|
"MtrNum": "5215907",
|
||||||
|
"ShsNum": "NAS431100E5798656",
|
||||||
|
"DisFnYrNum": "0",
|
||||||
|
"DisLfYrNum": "0",
|
||||||
|
"DisPrsnYrNum": "0",
|
||||||
|
"DisPrsnYrPrcnt": "0",
|
||||||
|
"DisFnYrPrcnt": "0",
|
||||||
|
"DisLfYrPrcnt": "0",
|
||||||
|
"vin": "IRPC941V2BD798656",
|
||||||
|
"MapVehicleSystemName": "ثبت نشده",
|
||||||
|
"LfCvrCptl": 0,
|
||||||
|
"FnCvrCptl": 0,
|
||||||
|
"PrsnCvrCptl": 0,
|
||||||
|
"VehicleSystemCode": 1,
|
||||||
|
"EdrsJson": "[{\"id\":1,\"Dsc\":\" الحاقيه توضيحات ندارد\"}]",
|
||||||
|
"PersonCvrCptl": 12000000000,
|
||||||
|
"LifeCvrCptl": 16000000000,
|
||||||
|
"FinancialCvrCptl": 4000000000,
|
||||||
|
"CarGroupCode": 3,
|
||||||
|
"CylCnt": 4,
|
||||||
|
"LastCompanyDocumentNumber": "03/1031/2835/1001/662",
|
||||||
|
"UsageCode": "8",
|
||||||
|
"MapUsageCode": 1,
|
||||||
|
"MapUsageName": "شخصي",
|
||||||
|
"Plk1": 59,
|
||||||
|
"Plk2": 16,
|
||||||
|
"Plk3": 419,
|
||||||
|
"PlkSrl": 78,
|
||||||
|
"PrintEndorsCompanyDocumentNumber": "بيمه نامه الحاقيه ندارد.",
|
||||||
|
"EndorseDate": null,
|
||||||
|
"InsuranceFullName": null,
|
||||||
|
"SystemField": "سايپا",
|
||||||
|
"TypeField": "111SE",
|
||||||
|
"UsageField": "سواري",
|
||||||
|
"MainColorField": "سفيد",
|
||||||
|
"SecondColorField": "سفيد شيري",
|
||||||
|
"ModelField": "1394",
|
||||||
|
"CapacityField": "جمعا 4 نفر",
|
||||||
|
"CylinderNumberField": "4",
|
||||||
|
"EngineNumberField": "5215907",
|
||||||
|
"ChassisNumberField": "NAS431100E5798656",
|
||||||
|
"VinNumberField": "IRPC941V2BD798656",
|
||||||
|
"InstallDateField": "1403/03/01",
|
||||||
|
"AxelNumberField": "2",
|
||||||
|
"WheelNumberField": "4",
|
||||||
|
"CompanyName": "بیمه سامان",
|
||||||
|
"CompanyCode": "15",
|
||||||
|
"IssueDate": "1403/04/06",
|
||||||
|
"SatrtDate": "1403/04/06",
|
||||||
|
"EndDate": "1404/04/06",
|
||||||
|
"Thrname": "",
|
||||||
|
"EndorseText": null,
|
||||||
|
"PolicyHealthLossCount": 0,
|
||||||
|
"PolicyFinancialLossCount": 0,
|
||||||
|
"PolicyPersonLossCount": 0,
|
||||||
|
"Tonage": 0,
|
||||||
|
"ThirdPolicyCode": 10502330579,
|
||||||
|
"DiscountPersonPercent": null,
|
||||||
|
"DiscountThirdPercent": null,
|
||||||
|
"SystemCodeCii": 0,
|
||||||
|
"SystemNameCii": "ثبت نشده",
|
||||||
|
"TypeCodeCii": 12189,
|
||||||
|
"TypeNameCii": "پرايد هاچ بک -111",
|
||||||
|
"UsageNameCii": "سواري",
|
||||||
|
"UsageCodeCii": 1,
|
||||||
|
"ModelCii": 1394,
|
||||||
|
"damageTypes": [],
|
||||||
|
"StatusTypeCode": 1
|
||||||
|
}
|
||||||
const mapped = this.mapNewApiResponseToOldFormat(raw);
|
const mapped = this.mapNewApiResponseToOldFormat(raw);
|
||||||
return { raw, mapped };
|
return { raw, mapped };
|
||||||
}
|
}
|
||||||
@@ -293,15 +365,88 @@ export class SandHubService {
|
|||||||
rightTwoDigits: String(userDetail.plate.ir),
|
rightTwoDigits: String(userDetail.plate.ir),
|
||||||
nationalCode: userDetail.nationalCodeOfInsurer,
|
nationalCode: userDetail.nationalCodeOfInsurer,
|
||||||
};
|
};
|
||||||
const requestUrl = `${process.env.SANDHUB_BASE_URL}/block-inquiry-tejarat`;
|
// const requestUrl = `${process.env.SANDHUB_BASE_URL}/block-inquiry-tejarat`;
|
||||||
const response = await this.makeSandHubRequest(requestUrl, requestPayload);
|
// const response = await this.makeSandHubRequest(requestUrl, requestPayload);
|
||||||
|
|
||||||
// Map the new API response format to the old format
|
let response = {
|
||||||
|
"PrntPlcyCmpDocNo": "1403/1143-70591/200/35",
|
||||||
|
"MapTypNam": "پرايد هاچ بک -111",
|
||||||
|
"MtrNum": "5215907",
|
||||||
|
"ShsNum": "NAS431100E5798656",
|
||||||
|
"DisFnYrNum": "0",
|
||||||
|
"DisLfYrNum": "0",
|
||||||
|
"DisPrsnYrNum": "0",
|
||||||
|
"DisPrsnYrPrcnt": "0",
|
||||||
|
"DisFnYrPrcnt": "0",
|
||||||
|
"DisLfYrPrcnt": "0",
|
||||||
|
"vin": "IRPC941V2BD798656",
|
||||||
|
"MapVehicleSystemName": "ثبت نشده",
|
||||||
|
"LfCvrCptl": 0,
|
||||||
|
"FnCvrCptl": 0,
|
||||||
|
"PrsnCvrCptl": 0,
|
||||||
|
"VehicleSystemCode": 1,
|
||||||
|
"EdrsJson": "[{\"id\":1,\"Dsc\":\" الحاقيه توضيحات ندارد\"}]",
|
||||||
|
"PersonCvrCptl": 12000000000,
|
||||||
|
"LifeCvrCptl": 16000000000,
|
||||||
|
"FinancialCvrCptl": 4000000000,
|
||||||
|
"CarGroupCode": 3,
|
||||||
|
"CylCnt": 4,
|
||||||
|
"LastCompanyDocumentNumber": "03/1031/2835/1001/662",
|
||||||
|
"UsageCode": "8",
|
||||||
|
"MapUsageCode": 1,
|
||||||
|
"MapUsageName": "شخصي",
|
||||||
|
"Plk1": 59,
|
||||||
|
"Plk2": 16,
|
||||||
|
"Plk3": 419,
|
||||||
|
"PlkSrl": 78,
|
||||||
|
"PrintEndorsCompanyDocumentNumber": "بيمه نامه الحاقيه ندارد.",
|
||||||
|
"EndorseDate": null,
|
||||||
|
"InsuranceFullName": null,
|
||||||
|
"SystemField": "سايپا",
|
||||||
|
"TypeField": "111SE",
|
||||||
|
"UsageField": "سواري",
|
||||||
|
"MainColorField": "سفيد",
|
||||||
|
"SecondColorField": "سفيد شيري",
|
||||||
|
"ModelField": "1394",
|
||||||
|
"CapacityField": "جمعا 4 نفر",
|
||||||
|
"CylinderNumberField": "4",
|
||||||
|
"EngineNumberField": "5215907",
|
||||||
|
"ChassisNumberField": "NAS431100E5798656",
|
||||||
|
"VinNumberField": "IRPC941V2BD798656",
|
||||||
|
"InstallDateField": "1403/03/01",
|
||||||
|
"AxelNumberField": "2",
|
||||||
|
"WheelNumberField": "4",
|
||||||
|
"CompanyName": "بیمه سامان",
|
||||||
|
"CompanyCode": "15",
|
||||||
|
"IssueDate": "1403/04/06",
|
||||||
|
"SatrtDate": "1403/04/06",
|
||||||
|
"EndDate": "1404/04/06",
|
||||||
|
"Thrname": "",
|
||||||
|
"EndorseText": null,
|
||||||
|
"PolicyHealthLossCount": 0,
|
||||||
|
"PolicyFinancialLossCount": 0,
|
||||||
|
"PolicyPersonLossCount": 0,
|
||||||
|
"Tonage": 0,
|
||||||
|
"ThirdPolicyCode": 10502330579,
|
||||||
|
"DiscountPersonPercent": null,
|
||||||
|
"DiscountThirdPercent": null,
|
||||||
|
"SystemCodeCii": 0,
|
||||||
|
"SystemNameCii": "ثبت نشده",
|
||||||
|
"TypeCodeCii": 12189,
|
||||||
|
"TypeNameCii": "پرايد هاچ بک -111",
|
||||||
|
"UsageNameCii": "سواري",
|
||||||
|
"UsageCodeCii": 1,
|
||||||
|
"ModelCii": 1394,
|
||||||
|
"damageTypes": [],
|
||||||
|
"StatusTypeCode": 1
|
||||||
|
}
|
||||||
|
|
||||||
|
// // Map the new API response format to the old format
|
||||||
let result = this.mapNewApiResponseToOldFormat(response);
|
let result = this.mapNewApiResponseToOldFormat(response);
|
||||||
|
|
||||||
if (result.usgCod !== "8") {
|
// if (result.usgCod !== "8") {
|
||||||
throw new Error("خودرو شما شخصی / سواری نمی باشد")
|
// throw new Error("خودرو شما شخصی / سواری نمی باشد")
|
||||||
}
|
// }
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user