feat: complete in-person claims without final sign

This commit is contained in:
SepehrYahyaee
2026-09-01 15:03:08 +03:30
parent 6880de5960
commit ae49031c55
16 changed files with 249 additions and 162 deletions

View File

@@ -0,0 +1,37 @@
import { ClaimCaseStatus } from "src/Types&Enums/claim-request-management/claim-case-status.enum";
import { claimCaseStatusAfterExpertReplyV2 } from "./claim-v2-expert-reply-workflow";
describe("claimCaseStatusAfterExpertReplyV2", () => {
it("keeps V1 priced-only claims in their final owner-signature state", () => {
expect(
claimCaseStatusAfterExpertReplyV2([
{ factorNeeded: false },
{ factorNeeded: false },
]),
).toBe(ClaimCaseStatus.INSURER_REVIEW_AWAITING_OWNER_SIGN);
});
it("completes a V2–V5 priced-only claim without a final owner signature", () => {
expect(
claimCaseStatusAfterExpertReplyV2(
[{ factorNeeded: false }, { factorNeeded: false }],
true,
),
).toBe(ClaimCaseStatus.COMPLETED);
});
it("keeps factor-required claims in their factor collection workflow", () => {
expect(
claimCaseStatusAfterExpertReplyV2([{ factorNeeded: true }]),
).toBe(ClaimCaseStatus.OWNER_REPAIR_FACTOR_UPLOAD_PENDING);
});
it("keeps the priced-line acceptance gate for mixed factor claims", () => {
expect(
claimCaseStatusAfterExpertReplyV2([
{ factorNeeded: false },
{ factorNeeded: true },
]),
).toBe(ClaimCaseStatus.INSURER_REVIEW_MIXED_FACTORS_PENDING);
});
});

View File

@@ -95,11 +95,16 @@ export function claimIsAwaitingExpertFactorValidationV2(claim: {
);
}
export function claimCaseStatusAfterExpertReplyV2(parts: ClaimPricingPartLite[]): ClaimCaseStatus {
export function claimCaseStatusAfterExpertReplyV2(
parts: ClaimPricingPartLite[],
completeWithoutFinalOwnerSignature = false,
): ClaimCaseStatus {
const { mixedFactorAndPrice } = classifyV2ExpertPricingParts(parts);
const needsFactorUpload = parts.some((p) => p.factorNeeded === true);
if (!needsFactorUpload) {
return ClaimCaseStatus.INSURER_REVIEW_AWAITING_OWNER_SIGN;
return completeWithoutFinalOwnerSignature
? ClaimCaseStatus.COMPLETED
: ClaimCaseStatus.INSURER_REVIEW_AWAITING_OWNER_SIGN;
}
if (mixedFactorAndPrice) {
return ClaimCaseStatus.INSURER_REVIEW_MIXED_FACTORS_PENDING;