forked from Yara724/api
badane bugs continues
This commit is contained in:
@@ -50,6 +50,7 @@ import {
|
||||
type FanavaranClaimProduct,
|
||||
} from "./fanavaran-claim-product";
|
||||
import {
|
||||
collectFanavaranExpertiseReadinessWarnings,
|
||||
hullExpertiseAssertFields,
|
||||
pickHullVehicleIdentity,
|
||||
toFanavaranHullExpertiseDmgSection,
|
||||
@@ -6154,6 +6155,7 @@ export class ClaimRequestManagementService {
|
||||
|
||||
const url = `${await this.fanavaranClaimsUrlForClaim(claimCaseId)}/${claimCase.claimId}/files`;
|
||||
const fileTypeId = profile.defaults.ClaimFileTypeId;
|
||||
const product = await this.resolveFanavaranClaimProduct(claimCaseId);
|
||||
|
||||
const logPrefix = `[Fanavaran ${clientKey} V2 Attachment Batch] claimCaseId=${claimCaseId}`;
|
||||
|
||||
@@ -6164,6 +6166,7 @@ export class ClaimRequestManagementService {
|
||||
const content = {
|
||||
FileName: candidate.fileName,
|
||||
FileTypeId: fileTypeId,
|
||||
...(product === "car-body" ? { ClaimId: claimCase.claimId } : {}),
|
||||
};
|
||||
|
||||
this.logger.log(
|
||||
@@ -6187,6 +6190,7 @@ export class ClaimRequestManagementService {
|
||||
submitted: true,
|
||||
claimId: claimCase.claimId,
|
||||
fileName: candidate.fileName,
|
||||
submitUrl: url,
|
||||
fanavaranResponse: response.data,
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -6199,6 +6203,8 @@ export class ClaimRequestManagementService {
|
||||
submitted: false,
|
||||
warning,
|
||||
fileName: candidate.fileName,
|
||||
claimId: claimCase.claimId,
|
||||
submitUrl: url,
|
||||
});
|
||||
|
||||
// Schedule a retry for this individual file via autoSubmitFanavaranAttachment,
|
||||
@@ -6318,6 +6324,10 @@ export class ClaimRequestManagementService {
|
||||
Files: [
|
||||
{ FileName: fileName, FileTypeId: profile.defaults.ClaimFileTypeId },
|
||||
],
|
||||
...((await this.resolveFanavaranClaimProduct(claimCaseId)) ===
|
||||
"car-body"
|
||||
? { ClaimId: claimCase.claimId }
|
||||
: {}),
|
||||
};
|
||||
|
||||
const auditSession: FanavaranAuditSession = {
|
||||
@@ -6793,36 +6803,15 @@ export class ClaimRequestManagementService {
|
||||
warnings: string[],
|
||||
options?: { requireDmgCaseId?: boolean; requireThirdPartyLookups?: boolean },
|
||||
): void {
|
||||
const sections = Array.isArray(payload.DmgSections)
|
||||
? payload.DmgSections
|
||||
: [];
|
||||
if (options?.requireDmgCaseId !== false && !payload.DmgCaseId)
|
||||
warnings.push("DmgCaseId is required.");
|
||||
if (options?.requireThirdPartyLookups !== false) {
|
||||
if (!payload.InspectionPlaceId)
|
||||
warnings.push("InspectionPlaceId is required.");
|
||||
if (!payload.DropAmountStatus)
|
||||
warnings.push("DropAmountStatus is required.");
|
||||
}
|
||||
if (!payload.InspectionPlaceId)
|
||||
warnings.push("InspectionPlaceId is required.");
|
||||
if (!payload.DropAmountStatus)
|
||||
warnings.push("DropAmountStatus is required.");
|
||||
if (!sections.length)
|
||||
warnings.push("At least one DmgSections row is required.");
|
||||
for (const [index, section] of sections.entries()) {
|
||||
const row = section as Record<string, unknown>;
|
||||
if (!row.DmgSectionId) {
|
||||
warnings.push(`DmgSections[${index}].DmgSectionId is required.`);
|
||||
}
|
||||
if (!row.AccidentLevel) {
|
||||
warnings.push(`DmgSections[${index}].AccidentLevel is required.`);
|
||||
}
|
||||
}
|
||||
if (warnings.length) {
|
||||
const readyWarnings = collectFanavaranExpertiseReadinessWarnings(
|
||||
payload,
|
||||
options,
|
||||
);
|
||||
const allWarnings = Array.from(new Set([...warnings, ...readyWarnings]));
|
||||
if (allWarnings.length) {
|
||||
throw new BadRequestException({
|
||||
message: "Fanavaran expertise payload is not ready.",
|
||||
warnings: Array.from(new Set(warnings)),
|
||||
warnings: allWarnings,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user