forked from Yara724/api
status modfied
This commit is contained in:
@@ -85,6 +85,8 @@ import {
|
||||
partKeyAllowedForExpertResend,
|
||||
} from "src/helpers/claim-expert-resend";
|
||||
import {
|
||||
claimCaseStatusAllowsOwnerFactorUploadDuringRevision,
|
||||
claimCaseStatusAllowsOwnerInsurerSignStep,
|
||||
classifyV2ExpertPricingParts,
|
||||
getActiveV2ExpertReply,
|
||||
objectionDisallowedDueToOutstandingFactorWorkflow,
|
||||
@@ -2369,9 +2371,9 @@ export class ClaimRequestManagementService {
|
||||
);
|
||||
}
|
||||
|
||||
if (claim.status !== ClaimCaseStatus.WAITING_FOR_INSURER_APPROVAL) {
|
||||
if (!claimCaseStatusAllowsOwnerFactorUploadDuringRevision(claim.status)) {
|
||||
throw new BadRequestException(
|
||||
"Factors can only be uploaded while the insurer-approval phase is pending.",
|
||||
"Factors can only be uploaded while the claim is in a repair-factor upload phase (see ClaimCaseStatus).",
|
||||
);
|
||||
}
|
||||
if (claim.claimStatus !== ClaimStatus.NEEDS_REVISION) {
|
||||
@@ -2487,6 +2489,7 @@ export class ClaimRequestManagementService {
|
||||
|
||||
await this.claimCaseDbService.findByIdAndUpdate(claimRequestId, {
|
||||
$set: {
|
||||
status: ClaimCaseStatus.EXPERT_VALIDATING_REPAIR_FACTORS,
|
||||
claimStatus: ClaimStatus.UNDER_REVIEW,
|
||||
"workflow.currentStep": ClaimWorkflowStep.EXPERT_COST_EVALUATION,
|
||||
"workflow.nextStep": ClaimWorkflowStep.INSURER_REVIEW,
|
||||
@@ -5064,7 +5067,7 @@ export class ClaimRequestManagementService {
|
||||
/**
|
||||
* V2 API: User objection (ClaimCase + evaluation.objection payload).
|
||||
*
|
||||
* Priced-flow: WAITING_FOR_INSURER_APPROVAL @ INSURER_REVIEW — either NEEDS_REVISION (mixed-priced gate before factor upload)
|
||||
* Priced-flow: insurer-review post-expert statuses (`INSURER_REVIEW_AWAITING_OWNER_SIGN`, `INSURER_REVIEW_MIXED_FACTORS_PENDING`, or legacy `WAITING_FOR_INSURER_APPROVAL`) @ `INSURER_REVIEW` — either NEEDS_REVISION (mixed-priced gate before factor upload)
|
||||
* or APPROVED (final totals after pricing / factor validation); never while uploading factors or while expert validates.
|
||||
* Legacy: objection during unpaid expert resend (`WAITING_FOR_USER_RESEND` @ `USER_EXPERT_RESEND`).
|
||||
* Post: resets owner signatures when applicable and returns claim to WAITING_FOR_DAMAGE_EXPERT.
|
||||
@@ -5121,7 +5124,7 @@ export class ClaimRequestManagementService {
|
||||
|
||||
let pricingObjectionEligible = false;
|
||||
if (
|
||||
claimCase.status === ClaimCaseStatus.WAITING_FOR_INSURER_APPROVAL &&
|
||||
claimCaseStatusAllowsOwnerInsurerSignStep(claimCase.status) &&
|
||||
claimCase.workflow?.currentStep === ClaimWorkflowStep.INSURER_REVIEW &&
|
||||
!claimCase.evaluation?.ownerInsurerApproval?.signedAt
|
||||
) {
|
||||
@@ -5321,11 +5324,11 @@ export class ClaimRequestManagementService {
|
||||
/**
|
||||
* V2: Claim owner signature on expert pricing.
|
||||
*
|
||||
* Phase 1 (mixed priced + factor-needed lines): WAITING_FOR_INSURER_APPROVAL, NEEDS_REVISION, INSURER_REVIEW,
|
||||
* Phase 1 (mixed priced + factor-needed lines): `INSURER_REVIEW_MIXED_FACTORS_PENDING` (or legacy `WAITING_FOR_INSURER_APPROVAL`), NEEDS_REVISION, INSURER_REVIEW,
|
||||
* owner has not yet accepted priced lines — agreeing records `evaluation.ownerPricedPartsApproval` and moves the
|
||||
* workflow to OWNER_UPLOAD_FACTOR_DOCUMENTS. Rejecting rejects the whole case.
|
||||
*
|
||||
* Phase 2 (final): WAITING_FOR_INSURER_APPROVAL, APPROVED, INSURER_REVIEW — full accept/reject completes the case.
|
||||
* Phase 2 (final): INSURER_REVIEW_AWAITING_OWNER_SIGN (or legacy WAITING_FOR_INSURER_APPROVAL), APPROVED, INSURER_REVIEW — full accept/reject completes the case.
|
||||
*/
|
||||
async submitOwnerInsurerApprovalSignV2(
|
||||
claimRequestId: string,
|
||||
@@ -5366,7 +5369,7 @@ export class ClaimRequestManagementService {
|
||||
);
|
||||
}
|
||||
|
||||
if (claimCase.status !== ClaimCaseStatus.WAITING_FOR_INSURER_APPROVAL) {
|
||||
if (!claimCaseStatusAllowsOwnerInsurerSignStep(claimCase.status)) {
|
||||
throw new BadRequestException(
|
||||
`Claim is not waiting for your insurer-approval signature. Current status: ${String(claimCase.status)}`,
|
||||
);
|
||||
@@ -5515,7 +5518,7 @@ export class ClaimRequestManagementService {
|
||||
message:
|
||||
"Priced repair lines accepted. Upload repair factor files for each factor-needed part; the claim will return to the damage expert for cost validation.",
|
||||
claimRequestId,
|
||||
status: ClaimCaseStatus.WAITING_FOR_INSURER_APPROVAL,
|
||||
status: claimCase.status,
|
||||
claimStatus: ClaimStatus.NEEDS_REVISION,
|
||||
currentStep: ClaimWorkflowStep.OWNER_UPLOAD_FACTOR_DOCUMENTS,
|
||||
accepted: true,
|
||||
|
||||
Reference in New Issue
Block a user