forked from Yara724/api
Merge pull request 'YARA-1267, YARA-1268' (#302) from s.yahyaee/yara724-api:main into main
Reviewed-on: Yara724/api#302
This commit is contained in:
@@ -481,12 +481,17 @@ export class ClaimRequestManagementController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ApiOperation({ deprecated: true })
|
// Legacy V1 owner branch picker — intentionally disabled.
|
||||||
@Get("branches/:insuranceId")
|
// A claim is handled by an expert assigned to the insurer branch, so the
|
||||||
// @ApiParam({ name: "insuranceId" })
|
// owner must not choose an insurer branch while signing. This does not apply
|
||||||
async insuranceBranches(@Param("insuranceId") insuranceId: string) {
|
// to the separate expert-only `daghi.branchId` choice in pricing flows.
|
||||||
return await this.claimRequestManagementService.retrieveInsuranceBranches(insuranceId);
|
//
|
||||||
}
|
// @Get("branches/:insuranceId")
|
||||||
|
// async insuranceBranches(@Param("insuranceId") insuranceId: string) {
|
||||||
|
// return await this.claimRequestManagementService.retrieveInsuranceBranches(
|
||||||
|
// insuranceId,
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
// @ApiOperation({ deprecated: true })
|
// @ApiOperation({ deprecated: true })
|
||||||
@Get("fanavaran-submit/:claimRequestId")
|
@Get("fanavaran-submit/:claimRequestId")
|
||||||
|
|||||||
@@ -184,6 +184,11 @@ describe("SandHubService inquiry mocks", () => {
|
|||||||
|
|
||||||
it("does not accept a policy when CLIENT_ID is not configured", async () => {
|
it("does not accept a policy when CLIENT_ID is not configured", async () => {
|
||||||
delete process.env.CLIENT_ID;
|
delete process.env.CLIENT_ID;
|
||||||
|
externalInquirySettings.isInquiryLive.mockResolvedValue(true);
|
||||||
|
jest.spyOn(service, "getTejaratCarBodyInquiry").mockResolvedValue({
|
||||||
|
raw: { data: { companyId: "15" } },
|
||||||
|
mapped: { companyId: "15", CompanyCode: "15" },
|
||||||
|
});
|
||||||
|
|
||||||
await expect(service.getCarBodyInquiry(userDetail)).rejects.toBeInstanceOf(
|
await expect(service.getCarBodyInquiry(userDetail)).rejects.toBeInstanceOf(
|
||||||
ServiceUnavailableException,
|
ServiceUnavailableException,
|
||||||
@@ -207,6 +212,7 @@ describe("SandHubService inquiry mocks", () => {
|
|||||||
|
|
||||||
it("rejects a CAR_BODY policy from another insurer on the Tejarat lookup route", async () => {
|
it("rejects a CAR_BODY policy from another insurer on the Tejarat lookup route", async () => {
|
||||||
process.env.CLIENT_ID = "15";
|
process.env.CLIENT_ID = "15";
|
||||||
|
externalInquirySettings.isInquiryLive.mockResolvedValue(true);
|
||||||
jest.spyOn(service, "getTejaratCarBodyInquiry").mockResolvedValue({
|
jest.spyOn(service, "getTejaratCarBodyInquiry").mockResolvedValue({
|
||||||
raw: { data: { companyId: "8" } },
|
raw: { data: { companyId: "8" } },
|
||||||
mapped: { companyId: "8", CompanyCode: "8" },
|
mapped: { companyId: "8", CompanyCode: "8" },
|
||||||
@@ -217,6 +223,24 @@ describe("SandHubService inquiry mocks", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("accepts a mocked Parsian CAR_BODY inquiry for the deployment client", async () => {
|
||||||
|
process.env.CLIENT_ID = "15";
|
||||||
|
process.env.FANAVARAN_CLIENT = "parsian";
|
||||||
|
externalInquirySettings.isInquiryLive.mockResolvedValue(false);
|
||||||
|
externalInquirySettings.getMockCompanyContext.mockResolvedValue({
|
||||||
|
companyId: "15",
|
||||||
|
companyName: "بیمه سامان",
|
||||||
|
});
|
||||||
|
|
||||||
|
await expect(service.getCarBodyInquiry(userDetail)).resolves.toEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
source: "ESG_CAR_BODY_INQUIRY",
|
||||||
|
mapped: expect.objectContaining({ companyId: 15 }),
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
expect(lookupsService.findLastProcessedCarPolicy).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
it("uses the processed CAR_BODY lookup when the active Fanavaran client is Parsian", async () => {
|
it("uses the processed CAR_BODY lookup when the active Fanavaran client is Parsian", async () => {
|
||||||
process.env.FANAVARAN_CLIENT = "parsian";
|
process.env.FANAVARAN_CLIENT = "parsian";
|
||||||
externalInquirySettings.isInquiryLive.mockResolvedValue(true);
|
externalInquirySettings.isInquiryLive.mockResolvedValue(true);
|
||||||
|
|||||||
@@ -931,7 +931,31 @@ export class SandHubService {
|
|||||||
raw: any;
|
raw: any;
|
||||||
mapped: Record<string, unknown>;
|
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(
|
const result = await this.getTejaratCarBodyInquiry(
|
||||||
userDetail as SandHubDetailDto,
|
userDetail as SandHubDetailDto,
|
||||||
options,
|
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 plateOrVin = userDetail.plate;
|
||||||
const query =
|
const query =
|
||||||
typeof plateOrVin === "string"
|
typeof plateOrVin === "string"
|
||||||
|
|||||||
Reference in New Issue
Block a user