forked from Yara724/api
YARA-1119
This commit is contained in:
@@ -161,6 +161,7 @@ import {
|
||||
getClaimCaptureProgress,
|
||||
isCapturePhaseDamagedPartyDocKey,
|
||||
isClaimCaptureStepComplete,
|
||||
OPTIONAL_CAPTURE_PHASE_DOC_KEYS_V4V5,
|
||||
} from "src/helpers/claim-capture-phase";
|
||||
import { HttpService } from "@nestjs/axios";
|
||||
import { firstValueFrom } from "rxjs";
|
||||
@@ -8138,7 +8139,7 @@ export class ClaimRequestManagementService {
|
||||
file: Express.Multer.File,
|
||||
currentUserId: string,
|
||||
actor?: { sub: string; role?: string },
|
||||
options?: { v3InPersonFlow?: boolean },
|
||||
options?: { v3InPersonFlow?: boolean; skipMetalPlate?: boolean },
|
||||
): Promise<UploadRequiredDocumentV2ResponseDto> {
|
||||
try {
|
||||
const claimCase = await this.claimCaseDbService.findById(claimRequestId);
|
||||
@@ -8315,12 +8316,16 @@ export class ClaimRequestManagementService {
|
||||
k === body.documentKey ||
|
||||
this.isRequiredDocumentUploadedOnClaim(claimCase, k);
|
||||
remaining = CAPTURE_PHASE_DAMAGED_PARTY_DOC_KEYS.filter(
|
||||
(k) => !afterThis(k),
|
||||
(k) => {
|
||||
if (options?.skipMetalPlate && OPTIONAL_CAPTURE_PHASE_DOC_KEYS_V4V5.includes(k as any)) return false;
|
||||
return !afterThis(k);
|
||||
},
|
||||
).length;
|
||||
|
||||
if (remaining === 0) {
|
||||
const progressAfterDoc = getClaimCaptureProgress(claimCase, {
|
||||
assumeCapturePhaseDocKey: body.documentKey,
|
||||
skipMetalPlate: options?.skipMetalPlate,
|
||||
});
|
||||
|
||||
if (
|
||||
@@ -10196,9 +10201,10 @@ export class ClaimRequestManagementService {
|
||||
|
||||
private shapeCaptureRequirementsForV3(
|
||||
claimCase: any,
|
||||
_blame: any,
|
||||
blame: any,
|
||||
base: GetCaptureRequirementsV2ResponseDto,
|
||||
): GetCaptureRequirementsV2ResponseDto {
|
||||
const skipMetalPlate = !!(blame as any)?.isMadeByFileMaker;
|
||||
const step = claimCase.workflow?.currentStep;
|
||||
const capturePartDone = this.claimV3StepCompleted(
|
||||
claimCase,
|
||||
@@ -10258,7 +10264,9 @@ export class ClaimRequestManagementService {
|
||||
|
||||
if (step === ClaimWorkflowStep.CAPTURE_PART_DAMAGES) {
|
||||
const capturePhaseDocs = base.requiredDocuments.filter(
|
||||
(d) => d.preferUploadDuringCapture,
|
||||
(d) =>
|
||||
d.preferUploadDuringCapture &&
|
||||
!(skipMetalPlate && OPTIONAL_CAPTURE_PHASE_DOC_KEYS_V4V5.includes(d.key as any)),
|
||||
);
|
||||
return {
|
||||
...base,
|
||||
@@ -10298,6 +10306,7 @@ export class ClaimRequestManagementService {
|
||||
);
|
||||
}
|
||||
const blame = await this.assertV3InPersonClaim(claimCase);
|
||||
const skipMetalPlate = !!(blame as any).isMadeByFileMaker;
|
||||
|
||||
const isCaptureDoc = isCapturePhaseDamagedPartyDocKey(body.documentKey);
|
||||
|
||||
@@ -10306,7 +10315,7 @@ export class ClaimRequestManagementService {
|
||||
this.assertV3ClaimWorkflowStep(
|
||||
claimCase,
|
||||
ClaimWorkflowStep.CAPTURE_PART_DAMAGES,
|
||||
"Upload chassis, engine, and metal plate photos during capture after damaged-part photos and car angles.",
|
||||
"Upload chassis and engine photos during capture after damaged-part photos and car angles.",
|
||||
);
|
||||
if (
|
||||
!this.claimV3StepCompleted(
|
||||
@@ -10318,15 +10327,15 @@ export class ClaimRequestManagementService {
|
||||
"Complete outer and other part selection before capture-phase vehicle documents.",
|
||||
);
|
||||
}
|
||||
const captureProgress = getClaimCaptureProgress(claimCase);
|
||||
const captureProgress = getClaimCaptureProgress(claimCase, { skipMetalPlate });
|
||||
if (!captureProgress.partsComplete) {
|
||||
throw new BadRequestException(
|
||||
"Upload photos for all selected damaged parts before chassis, engine, or metal plate photos.",
|
||||
"Upload photos for all selected damaged parts before chassis or engine photos.",
|
||||
);
|
||||
}
|
||||
if (!captureProgress.anglesComplete) {
|
||||
throw new BadRequestException(
|
||||
"Capture all four car angles before chassis, engine, or metal plate photos.",
|
||||
"Capture all four car angles before chassis or engine photos.",
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@@ -10346,7 +10355,7 @@ export class ClaimRequestManagementService {
|
||||
file,
|
||||
currentUserId,
|
||||
actor,
|
||||
{ v3InPersonFlow: true },
|
||||
{ v3InPersonFlow: true, skipMetalPlate },
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user