forked from Yara724/api
merge upstream
This commit is contained in:
@@ -8232,10 +8232,12 @@ export class ClaimRequestManagementService {
|
||||
|
||||
if (allDocumentsUploaded) {
|
||||
if (options?.v3InPersonFlow) {
|
||||
$set["status"] = ClaimCaseStatus.SELECTING_OUTER_PARTS;
|
||||
$set["workflow.currentStep"] =
|
||||
ClaimWorkflowStep.SELECT_OUTER_PARTS;
|
||||
$set["workflow.nextStep"] = ClaimWorkflowStep.SELECT_OTHER_PARTS;
|
||||
// V4 split flow: mark the claim as waiting for the FileReviewer.
|
||||
// The FileReviewer calls accident-fields then select-outer-parts, at
|
||||
// which point advanceV3ClaimToOuterPartsIfReady() moves the claim to
|
||||
// SELECTING_OUTER_PARTS / SELECT_OUTER_PARTS.
|
||||
$set["status"] = ClaimCaseStatus.WAITING_FOR_FILE_REVIEWER;
|
||||
$set["workflow.nextStep"] = ClaimWorkflowStep.SELECT_OUTER_PARTS;
|
||||
|
||||
completedStepsEntries.push(
|
||||
ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS,
|
||||
@@ -8251,7 +8253,7 @@ export class ClaimRequestManagementService {
|
||||
metadata: {
|
||||
stepKey: ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS,
|
||||
description:
|
||||
"Initial required documents uploaded. Proceed to outer part selection.",
|
||||
"FileMaker documents complete. File sealed — awaiting FileReviewer.",
|
||||
v3InPersonFlow: true,
|
||||
},
|
||||
});
|
||||
@@ -8367,7 +8369,7 @@ export class ClaimRequestManagementService {
|
||||
)
|
||||
: allDocumentsUploaded
|
||||
? options?.v3InPersonFlow
|
||||
? "Initial required documents uploaded. Proceed to outer part selection."
|
||||
? "All FileMaker documents uploaded. File is sealed and ready for FileReviewer pickup."
|
||||
: "All documents uploaded successfully. Your claim is now ready for damage expert review."
|
||||
: `Document uploaded successfully. ${remaining} documents remaining.`;
|
||||
|
||||
@@ -8382,7 +8384,7 @@ export class ClaimRequestManagementService {
|
||||
: ClaimWorkflowStep.CAPTURE_PART_DAMAGES
|
||||
: allDocumentsUploaded
|
||||
? options?.v3InPersonFlow
|
||||
? ClaimWorkflowStep.SELECT_OUTER_PARTS
|
||||
? ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS
|
||||
: ClaimWorkflowStep.USER_SUBMISSION_COMPLETE
|
||||
: ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS,
|
||||
message,
|
||||
@@ -9964,11 +9966,6 @@ export class ClaimRequestManagementService {
|
||||
}
|
||||
}
|
||||
|
||||
private v3PartsFlowNotStarted(claimCase: any): boolean {
|
||||
const parts = claimCase.damage?.selectedParts;
|
||||
return !Array.isArray(parts) || parts.length === 0;
|
||||
}
|
||||
|
||||
private async advanceV3ClaimToOuterPartsIfReady(
|
||||
claimCase: any,
|
||||
blame: any,
|
||||
@@ -9980,12 +9977,16 @@ export class ClaimRequestManagementService {
|
||||
}
|
||||
|
||||
const step = claimCase.workflow?.currentStep;
|
||||
const partsNotStarted = this.v3PartsFlowNotStarted(claimCase);
|
||||
const prematurelyCompleted =
|
||||
step === ClaimWorkflowStep.USER_SUBMISSION_COMPLETE && partsNotStarted;
|
||||
// UPLOAD_REQUIRED_DOCUMENTS: normal V3/V4 path after FileMaker docs.
|
||||
// WAITING_FOR_FILE_REVIEWER (claim status): same DB step but with the new
|
||||
// V4 claim status — FileReviewer is picking up the sealed file.
|
||||
// USER_SUBMISSION_COMPLETE: can occur when documents were uploaded via a
|
||||
// non-V3 path (e.g. generic v2 endpoint). Safe to advance as long as
|
||||
// accident fields are set (checked just below).
|
||||
const canAdvance =
|
||||
step === ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS ||
|
||||
prematurelyCompleted;
|
||||
step === ClaimWorkflowStep.USER_SUBMISSION_COMPLETE ||
|
||||
claimCase.status === ClaimCaseStatus.WAITING_FOR_FILE_REVIEWER;
|
||||
|
||||
if (!canAdvance) {
|
||||
throw new BadRequestException(
|
||||
|
||||
Reference in New Issue
Block a user