forked from Yara724/api
YARA-1074
This commit is contained in:
@@ -8213,41 +8213,45 @@ export class RequestManagementService {
|
||||
const licenseNumber = partyData.driverIsInsurer
|
||||
? partyData.insurerLicense
|
||||
: partyData.driverLicense;
|
||||
if (!licenseNationalCode || !licenseNumber) {
|
||||
throw new BadRequestException(
|
||||
`${roleLabel} party driving license inquiry requires national code and ${
|
||||
partyData.driverIsInsurer ? "insurerLicense" : "driverLicense"
|
||||
}.`,
|
||||
);
|
||||
}
|
||||
try {
|
||||
const licenseInquiry = await this.sandHubService.getDrivingLicenseInfo(
|
||||
licenseNationalCode,
|
||||
licenseNumber,
|
||||
clientId ? { clientId } : undefined,
|
||||
);
|
||||
this.recordPartyCaseInquiryStatus(
|
||||
req,
|
||||
"drivingLicence",
|
||||
partyRole,
|
||||
true,
|
||||
licenseInquiry,
|
||||
);
|
||||
} catch (err: any) {
|
||||
this.logger.error(
|
||||
`[V3] driving license inquiry failed for ${roleLabel} party request=${req._id}: ${err?.message || err}`,
|
||||
);
|
||||
|
||||
if (!licenseNumber) {
|
||||
this.recordPartyCaseInquiryStatus(
|
||||
req,
|
||||
"drivingLicence",
|
||||
partyRole,
|
||||
false,
|
||||
{},
|
||||
err,
|
||||
);
|
||||
throw new BadRequestException(
|
||||
`${roleLabel} party driving license inquiry failed: ${err?.message || "استعلام در دسترس نیست"}`,
|
||||
{ skipped: true, reason: "No license number provided" },
|
||||
);
|
||||
} else {
|
||||
try {
|
||||
const licenseInquiry = await this.sandHubService.getDrivingLicenseInfo(
|
||||
licenseNationalCode,
|
||||
licenseNumber,
|
||||
clientId ? { clientId } : undefined,
|
||||
);
|
||||
this.recordPartyCaseInquiryStatus(
|
||||
req,
|
||||
"drivingLicence",
|
||||
partyRole,
|
||||
true,
|
||||
licenseInquiry,
|
||||
);
|
||||
} catch (err: any) {
|
||||
this.logger.error(
|
||||
`[V3] driving license inquiry failed for ${roleLabel} party request=${req._id}: ${err?.message || err}`,
|
||||
);
|
||||
this.recordPartyCaseInquiryStatus(
|
||||
req,
|
||||
"drivingLicence",
|
||||
partyRole,
|
||||
false,
|
||||
{},
|
||||
err,
|
||||
);
|
||||
throw new BadRequestException(
|
||||
`${roleLabel} party driving license inquiry failed: ${err?.message || "استعلام در دسترس نیست"}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return { clientId };
|
||||
|
||||
Reference in New Issue
Block a user