forked from Yara724/api
fix: query policies only for current holder
This commit is contained in:
@@ -140,7 +140,7 @@ import {
|
||||
NormalizedInquirySubmission,
|
||||
normalizeInquirySubmission,
|
||||
resolveInquirySubjects,
|
||||
runPlateInquiryWithFallback,
|
||||
runCurrentPlateInquiry,
|
||||
sanitizeStoredInquiryParticipants,
|
||||
} from "./inquiry-participant-resolver";
|
||||
import {
|
||||
@@ -386,17 +386,14 @@ export class RequestManagementService {
|
||||
options?: Record<string, any>,
|
||||
): Promise<any> {
|
||||
const subjects = resolveInquirySubjects(submission);
|
||||
const result = await runPlateInquiryWithFallback({
|
||||
vehicle: submission.vehicle,
|
||||
fallbackCurrentPlate: submission.dto.plate,
|
||||
query: (plate, plateKind) =>
|
||||
const result = await runCurrentPlateInquiry({
|
||||
currentPlate: submission.vehicle?.currentPlate ?? submission.dto.plate,
|
||||
vin: submission.vehicle?.vin,
|
||||
query: (plate) =>
|
||||
this.sandHubService.getTejaratBlockInquiry(
|
||||
{
|
||||
plate: plate as any,
|
||||
nationalCodeOfInsurer:
|
||||
plateKind === "PREVIOUS"
|
||||
? submission.vehicle!.previousPolicyholderNationalCode!
|
||||
: subjects.thirdPartyPolicyNationalCode,
|
||||
nationalCodeOfInsurer: subjects.thirdPartyPolicyNationalCode,
|
||||
},
|
||||
options,
|
||||
),
|
||||
@@ -404,7 +401,6 @@ export class RequestManagementService {
|
||||
!value?.mapped?.Error &&
|
||||
!!value?.mapped?.CompanyName &&
|
||||
isMappedPolicyCurrent(value.mapped),
|
||||
mappedValue: (value) => value?.mapped ?? {},
|
||||
});
|
||||
return {
|
||||
...result.value,
|
||||
@@ -423,15 +419,12 @@ export class RequestManagementService {
|
||||
"اطلاعات بیمهگذار برای استعلام بیمه بدنه الزامی است.",
|
||||
);
|
||||
}
|
||||
const result = await runPlateInquiryWithFallback({
|
||||
vehicle: submission.vehicle,
|
||||
fallbackCurrentPlate: submission.dto.plate,
|
||||
query: (plate, plateKind) =>
|
||||
const result = await runCurrentPlateInquiry({
|
||||
currentPlate: submission.vehicle?.currentPlate ?? submission.dto.plate,
|
||||
vin: submission.vehicle?.vin,
|
||||
query: (plate) =>
|
||||
this.sandHubService.getCarBodyInquiry({
|
||||
nationalCodeOfInsurer:
|
||||
plateKind === "PREVIOUS"
|
||||
? submission.vehicle!.previousPolicyholderNationalCode!
|
||||
: policyholderNationalCode,
|
||||
nationalCodeOfInsurer: policyholderNationalCode,
|
||||
plate: plate as any,
|
||||
}),
|
||||
isUsable: (value) =>
|
||||
@@ -442,7 +435,6 @@ export class RequestManagementService {
|
||||
value.mapped.CompanyName ||
|
||||
value.mapped.companyId
|
||||
),
|
||||
mappedValue: (value) => value?.mapped ?? {},
|
||||
});
|
||||
return {
|
||||
...result.value,
|
||||
|
||||
Reference in New Issue
Block a user