fix: return inquiry-specific Persian not-found messages

This commit is contained in:
2026-11-18 12:31:44 +03:30
parent 7631a94071
commit 2cdbc35d2e
6 changed files with 99 additions and 34 deletions
@@ -147,10 +147,13 @@ import {
sanitizeStoredInquiryParticipants,
} from "./inquiry-participant-resolver";
function mappedInquiryErrorMessage(value: any): string | undefined {
function mappedInquiryErrorMessage(
value: any,
context: "thirdPartyPlate" | "carBodyPlate",
): string | undefined {
const message = value?.mapped?.Error?.Message;
return typeof message === "string" && message.trim()
? message.trim()
? getInquiryErrorMessage(value.mapped, context)
: undefined;
}
@@ -434,7 +437,7 @@ export class RequestManagementService {
!value?.mapped?.Error &&
!!value?.mapped?.CompanyName &&
isMappedPolicyCurrent(value.mapped),
errorMessage: mappedInquiryErrorMessage,
errorMessage: (value) => mappedInquiryErrorMessage(value, "thirdPartyPlate"),
});
return {
...result.value,
@@ -469,7 +472,7 @@ export class RequestManagementService {
value.mapped.CompanyName ||
value.mapped.companyId
),
errorMessage: mappedInquiryErrorMessage,
errorMessage: (value) => mappedInquiryErrorMessage(value, "carBodyPlate"),
});
return {
...result.value,
@@ -1944,8 +1947,7 @@ export class RequestManagementService {
});
await this.persistBlameInquiryAudit(req);
throw new HttpException(
inquiryMapped.Error.Message ||
getInquiryErrorMessage(inquiryMapped, "thirdPartyPlate"),
getInquiryErrorMessage(inquiryMapped, "thirdPartyPlate"),
HttpStatus.BAD_REQUEST,
);
}
@@ -2369,8 +2371,7 @@ export class RequestManagementService {
});
await this.persistBlameInquiryAudit(req);
throw new HttpException(
inquiryMapped.Error.Message ||
getInquiryErrorMessage(inquiryMapped, "thirdPartyVin"),
getInquiryErrorMessage(inquiryMapped, "thirdPartyVin"),
HttpStatus.BAD_REQUEST,
);
}
@@ -6771,8 +6772,7 @@ export class RequestManagementService {
if (inquiryMapped?.Error) {
const error = new BadRequestException(
inquiryMapped.Error.Message ||
getInquiryErrorMessage(inquiryMapped, "thirdPartyPlate"),
getInquiryErrorMessage(inquiryMapped, "thirdPartyPlate"),
);
this.recordPartyCaseInquiryStatus(
req,
@@ -7693,8 +7693,7 @@ export class RequestManagementService {
if (inquiryMapped?.Error) {
const error = new BadRequestException(
inquiryMapped.Error.Message ||
getInquiryErrorMessage(inquiryMapped, "thirdPartyVin"),
getInquiryErrorMessage(inquiryMapped, "thirdPartyVin"),
);
this.recordPartyCaseInquiryStatus(
req,