forked from Yara724/api
Mark rejected inquiry results as failed
This commit is contained in:
@@ -9690,20 +9690,50 @@ export class RequestManagementService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (inquiryMapped?.Error) {
|
if (inquiryMapped?.Error) {
|
||||||
await this.persistBlameInquiryAudit(req);
|
const error = new BadRequestException(
|
||||||
throw new BadRequestException(
|
|
||||||
inquiryMapped.Error.Message ||
|
inquiryMapped.Error.Message ||
|
||||||
`${roleLabel} party plate inquiry returned an error`,
|
`${roleLabel} party plate inquiry returned an error`,
|
||||||
);
|
);
|
||||||
|
this.recordPartyCaseInquiryStatus(
|
||||||
|
req,
|
||||||
|
"thirdParty",
|
||||||
|
partyRole,
|
||||||
|
false,
|
||||||
|
{
|
||||||
|
source: inquirySource,
|
||||||
|
plateKind: inquiryPlateKind,
|
||||||
|
attempts: inquiryAttempts,
|
||||||
|
raw: inquiryRaw,
|
||||||
|
mapped: inquiryMapped,
|
||||||
|
},
|
||||||
|
error,
|
||||||
|
);
|
||||||
|
await this.persistBlameInquiryAudit(req);
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
const clientName = inquiryMapped?.CompanyName;
|
const clientName = inquiryMapped?.CompanyName;
|
||||||
const companyCode = inquiryMapped?.CompanyCode;
|
const companyCode = inquiryMapped?.CompanyCode;
|
||||||
if (!clientName && !policyholderUnknown) {
|
if (!clientName && !policyholderUnknown) {
|
||||||
await this.persistBlameInquiryAudit(req);
|
const error = new BadRequestException(
|
||||||
throw new BadRequestException(
|
|
||||||
`CompanyName missing from ${roleLabel} party inquiry response`,
|
`CompanyName missing from ${roleLabel} party inquiry response`,
|
||||||
);
|
);
|
||||||
|
this.recordPartyCaseInquiryStatus(
|
||||||
|
req,
|
||||||
|
"thirdParty",
|
||||||
|
partyRole,
|
||||||
|
false,
|
||||||
|
{
|
||||||
|
source: inquirySource,
|
||||||
|
plateKind: inquiryPlateKind,
|
||||||
|
attempts: inquiryAttempts,
|
||||||
|
raw: inquiryRaw,
|
||||||
|
mapped: inquiryMapped,
|
||||||
|
},
|
||||||
|
error,
|
||||||
|
);
|
||||||
|
await this.persistBlameInquiryAudit(req);
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
const client = clientName
|
const client = clientName
|
||||||
? await this.clientService.findOrCreateClientByCompanyCode(
|
? await this.clientService.findOrCreateClientByCompanyCode(
|
||||||
@@ -9712,10 +9742,25 @@ export class RequestManagementService {
|
|||||||
)
|
)
|
||||||
: null;
|
: null;
|
||||||
if (clientName && !client) {
|
if (clientName && !client) {
|
||||||
await this.persistBlameInquiryAudit(req);
|
const error = new BadRequestException(
|
||||||
throw new BadRequestException(
|
|
||||||
`CompanyCode missing or invalid in ${roleLabel} party inquiry response`,
|
`CompanyCode missing or invalid in ${roleLabel} party inquiry response`,
|
||||||
);
|
);
|
||||||
|
this.recordPartyCaseInquiryStatus(
|
||||||
|
req,
|
||||||
|
"thirdParty",
|
||||||
|
partyRole,
|
||||||
|
false,
|
||||||
|
{
|
||||||
|
source: inquirySource,
|
||||||
|
plateKind: inquiryPlateKind,
|
||||||
|
attempts: inquiryAttempts,
|
||||||
|
raw: inquiryRaw,
|
||||||
|
mapped: inquiryMapped,
|
||||||
|
},
|
||||||
|
error,
|
||||||
|
);
|
||||||
|
await this.persistBlameInquiryAudit(req);
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
const resolvedClientId = (client as any)?._id ?? (client as any)?._doc?._id;
|
const resolvedClientId = (client as any)?._id ?? (client as any)?._doc?._id;
|
||||||
clientId = resolvedClientId ? String(resolvedClientId) : undefined;
|
clientId = resolvedClientId ? String(resolvedClientId) : undefined;
|
||||||
@@ -10543,30 +10588,69 @@ export class RequestManagementService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (inquiryMapped?.Error) {
|
if (inquiryMapped?.Error) {
|
||||||
await this.persistBlameInquiryAudit(req);
|
const error = new BadRequestException(
|
||||||
throw new BadRequestException(
|
|
||||||
inquiryMapped.Error.Message ||
|
inquiryMapped.Error.Message ||
|
||||||
`${roleLabel} party VIN inquiry returned an error`,
|
`${roleLabel} party VIN inquiry returned an error`,
|
||||||
);
|
);
|
||||||
|
this.recordPartyCaseInquiryStatus(
|
||||||
|
req,
|
||||||
|
"thirdParty",
|
||||||
|
partyRole,
|
||||||
|
false,
|
||||||
|
{
|
||||||
|
source: "ESG_VIN_INQUIRY",
|
||||||
|
raw: inquiryRaw,
|
||||||
|
mapped: inquiryMapped,
|
||||||
|
},
|
||||||
|
error,
|
||||||
|
);
|
||||||
|
await this.persistBlameInquiryAudit(req);
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
const clientName = inquiryMapped?.CompanyName;
|
const clientName = inquiryMapped?.CompanyName;
|
||||||
const companyCode = inquiryMapped?.CompanyCode;
|
const companyCode = inquiryMapped?.CompanyCode;
|
||||||
if (!clientName) {
|
if (!clientName) {
|
||||||
await this.persistBlameInquiryAudit(req);
|
const error = new BadRequestException(
|
||||||
throw new BadRequestException(
|
|
||||||
`CompanyName missing from ${roleLabel} party VIN inquiry response`,
|
`CompanyName missing from ${roleLabel} party VIN inquiry response`,
|
||||||
);
|
);
|
||||||
|
this.recordPartyCaseInquiryStatus(
|
||||||
|
req,
|
||||||
|
"thirdParty",
|
||||||
|
partyRole,
|
||||||
|
false,
|
||||||
|
{
|
||||||
|
source: "ESG_VIN_INQUIRY",
|
||||||
|
raw: inquiryRaw,
|
||||||
|
mapped: inquiryMapped,
|
||||||
|
},
|
||||||
|
error,
|
||||||
|
);
|
||||||
|
await this.persistBlameInquiryAudit(req);
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
const client = await this.clientService.findOrCreateClientByCompanyCode(
|
const client = await this.clientService.findOrCreateClientByCompanyCode(
|
||||||
companyCode,
|
companyCode,
|
||||||
clientName,
|
clientName,
|
||||||
);
|
);
|
||||||
if (!client) {
|
if (!client) {
|
||||||
await this.persistBlameInquiryAudit(req);
|
const error = new BadRequestException(
|
||||||
throw new BadRequestException(
|
|
||||||
`CompanyCode missing or invalid in ${roleLabel} party VIN inquiry response`,
|
`CompanyCode missing or invalid in ${roleLabel} party VIN inquiry response`,
|
||||||
);
|
);
|
||||||
|
this.recordPartyCaseInquiryStatus(
|
||||||
|
req,
|
||||||
|
"thirdParty",
|
||||||
|
partyRole,
|
||||||
|
false,
|
||||||
|
{
|
||||||
|
source: "ESG_VIN_INQUIRY",
|
||||||
|
raw: inquiryRaw,
|
||||||
|
mapped: inquiryMapped,
|
||||||
|
},
|
||||||
|
error,
|
||||||
|
);
|
||||||
|
await this.persistBlameInquiryAudit(req);
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
const resolvedClientId = (client as any)?._id ?? (client as any)?._doc?._id;
|
const resolvedClientId = (client as any)?._id ?? (client as any)?._doc?._id;
|
||||||
clientId = resolvedClientId ? String(resolvedClientId) : undefined;
|
clientId = resolvedClientId ? String(resolvedClientId) : undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user