Merge pull request 'main' (#228) from s.hajizadeh/yara724api:main into main

Reviewed-on: Yara724/api#228
This commit is contained in:
2026-07-28 16:59:02 +03:30
2 changed files with 34 additions and 21 deletions

View File

@@ -3889,7 +3889,7 @@ export class ClaimRequestManagementService {
return { return {
BeginDate: insurance.startDate ?? null, BeginDate: insurance.startDate ?? null,
BuiltYear: BuiltYear:
Number(inquiryMapped.ModelField ?? inquiryMapped.ModelCii) || null, Number(inquiryMapped.ModelField ?? inquiryMapped.ModelCii) || Number(inquiryMapped.PrdDate) || null,
ChassisNo: ChassisNo:
inquiryMapped.ChassisNumberField ?? inquiryMapped.ChassisNumberField ??
inquiryMapped.ShsNum ?? inquiryMapped.ShsNum ??
@@ -5066,6 +5066,25 @@ export class ClaimRequestManagementService {
warning, warning,
fileName: candidate.fileName, fileName: candidate.fileName,
}); });
// Schedule a retry for this individual file via autoSubmitFanavaranAttachment,
// which handles idempotency (won't re-upload if already recorded as submitted)
// and has its own inner retry/back-off via scheduleFanavaranRetry.
await this.scheduleFanavaranRetry(
claimCaseId,
"attachments",
() =>
this.autoSubmitFanavaranAttachment(
claimCaseId,
{
path: candidate.path,
fileName: candidate.fileName,
source: candidate.source,
},
{ clientKey, auditSource: FanavaranAuditSource.AUTO_SUBMIT },
),
`${logPrefix} [${i + 1}/${pending.length}] retry`,
);
} }
if (i < pending.length - 1) { if (i < pending.length - 1) {
@@ -9667,6 +9686,7 @@ export class ClaimRequestManagementService {
accepted: boolean; accepted: boolean;
phase?: "PRICED_PARTS_FOR_FACTORS" | "FINAL_APPROVAL"; phase?: "PRICED_PARTS_FOR_FACTORS" | "FINAL_APPROVAL";
fanavaran?: FanavaranAutoSubmitResult; fanavaran?: FanavaranAutoSubmitResult;
fanavaranExpertise?: FanavaranExpertiseSubmitResult;
}> { }> {
if (!Types.ObjectId.isValid(claimRequestId)) { if (!Types.ObjectId.isValid(claimRequestId)) {
throw new BadRequestException("Invalid claim request id"); throw new BadRequestException("Invalid claim request id");
@@ -9940,6 +9960,7 @@ export class ClaimRequestManagementService {
accepted: true, accepted: true,
phase: "FINAL_APPROVAL", phase: "FINAL_APPROVAL",
fanavaran, fanavaran,
fanavaranExpertise,
}; };
} }

View File

@@ -2429,24 +2429,20 @@ export class ExpertClaimService {
await this.claimRequestManagementService.autoSubmitToFanavaranV2OnClaimCompleted( await this.claimRequestManagementService.autoSubmitToFanavaranV2OnClaimCompleted(
claimRequestId, claimRequestId,
); );
const fanavaranExpertise = // Expertise (stage 4) is intentionally NOT submitted here.
await this.claimRequestManagementService.autoSubmitFanavaranExpertiseOnExpertReply( // It is only triggered after the owner's final approval signature
claimRequestId, // (submitOwnerInsurerApprovalSignV2), because until that point the
); // expert review is not considered final — the user can still object.
return { return {
message: this.appendFanavaranAutoSubmitToMessage( message: this.appendFanavaranAutoSubmitToMessage(
this.appendFanavaranAutoSubmitToMessage(
"Factors were reviewed with expert repricing on rejected lines. The claim is completed without an owner signature (temporary policy; may require owner acceptance later).", "Factors were reviewed with expert repricing on rejected lines. The claim is completed without an owner signature (temporary policy; may require owner acceptance later).",
fanavaran, fanavaran,
), ),
fanavaranExpertise,
),
claimRequestId, claimRequestId,
claimStatus: ClaimStatus.APPROVED, claimStatus: ClaimStatus.APPROVED,
caseStatus: ClaimCaseStatus.COMPLETED, caseStatus: ClaimCaseStatus.COMPLETED,
outcome: "REJECTED_REPRICED_AUTO_COMPLETED", outcome: "REJECTED_REPRICED_AUTO_COMPLETED",
fanavaran, fanavaran,
fanavaranExpertise,
}; };
} }
@@ -2463,25 +2459,21 @@ export class ExpertClaimService {
await this.claimRequestManagementService.autoSubmitToFanavaranV2OnClaimCompleted( await this.claimRequestManagementService.autoSubmitToFanavaranV2OnClaimCompleted(
claimRequestId, claimRequestId,
); );
const fanavaranExpertise = // Expertise (stage 4) is intentionally NOT submitted here.
await this.claimRequestManagementService.autoSubmitFanavaranExpertiseOnExpertReply( // It is only triggered after the owner's final approval signature
claimRequestId, // (submitOwnerInsurerApprovalSignV2), because until that point the
); // expert review is not considered final — the user can still object.
return { return {
message: this.appendFanavaranAutoSubmitToMessage( message: this.appendFanavaranAutoSubmitToMessage(
this.appendFanavaranAutoSubmitToMessage(
"All factors were approved by the expert. The claim is completed without an additional owner signature.", "All factors were approved by the expert. The claim is completed without an additional owner signature.",
fanavaran, fanavaran,
), ),
fanavaranExpertise,
),
claimRequestId, claimRequestId,
claimStatus: ClaimStatus.APPROVED, claimStatus: ClaimStatus.APPROVED,
caseStatus: ClaimCaseStatus.COMPLETED, caseStatus: ClaimCaseStatus.COMPLETED,
outcome: "ALL_APPROVED_AUTO_COMPLETED", outcome: "ALL_APPROVED_AUTO_COMPLETED",
fanavaran, fanavaran,
fanavaranExpertise,
}; };
} }