forked from Yara724/api
feat: complete in-person claims without final sign
This commit is contained in:
37
src/helpers/claim-v2-expert-reply-workflow.spec.ts
Normal file
37
src/helpers/claim-v2-expert-reply-workflow.spec.ts
Normal 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);
|
||||
});
|
||||
});
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user