Merge pull request #1876 from Safelite/feature/csr-2108

Feature/csr 2108
This commit is contained in:
chloeherdsafelite 2024-06-05 09:49:50 -04:00 committed by GitHub
commit a4da02f6cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 78 additions and 8 deletions

View file

@ -158,12 +158,17 @@ export default {
includeTax
);
}
const order = store.getters.hasSubmittedOrder
? store.getters.submittedOrder
: store.getters.order;
if (
store.getters.payment.insuranceCoverage.isVerified &&
!store.getters.policy.isNoComp &&
!store.getters.policy.isItac
order.payment.insuranceCoverage.isVerified &&
!order.policy.isNoComp &&
!order.policy.isItac
) {
amountDue += store.getters.policy.currentDeductible;
amountDue += order.policy.currentDeductible;
}
return ((amountDue * 100) / 100).toFixed(2);

View file

@ -175,9 +175,66 @@ describe("baseMixin.js", () => {
promos: [],
};
const payment = { insuranceCoverage: { isVerified: true } };
const policy = { isNoComp: false, isItac: false, currentDeductible: 250 };
store.getters = {
payment: { insuranceCoverage: { isVerified: true } },
policy: { isNoComp: false, isItac: false, currentDeductible: 250 },
payment: payment,
policy: policy,
order: {
payment: payment,
policy: policy,
},
hasSubmittedOrder: false,
};
var amtDue = mixIn.methods.getAmountDue(lineItems);
expect(amtDue).toEqual("303.00");
});
test("getAmountDue should function with a submitted order", () => {
const mixIn = getMixInInstance({});
const lineItems = {
glassParts: [],
supportingItems: [],
vaps: [
{
cartItemType: "FRONT WIPERS",
description: 'WIPER BLADE STANDARD 18"',
kitPrice: 0,
laborAmount: 0,
partNumber: "WB18",
partType: "FRONT WIPER",
salesTax: 2.0,
sellingPrice: 30.0,
},
{
cartItemType: "FRONT WIPERS",
description: 'WIPER BLADE STANDARD 26"',
kitPrice: 0,
laborAmount: 0,
partNumber: "WB26",
partType: "FRONT WIPER",
salesTax: 1.0,
sellingPrice: 20.0,
},
],
promos: [],
};
const payment = { insuranceCoverage: { isVerified: true } };
const policy = { isNoComp: false, isItac: false, currentDeductible: 250 };
store.getters = {
payment: {},
policy: {},
order: {},
submittedOrder: {
payment: payment,
policy: policy,
},
hasSubmittedOrder: true,
};
var amtDue = mixIn.methods.getAmountDue(lineItems);
@ -241,9 +298,17 @@ describe("baseMixin.js", () => {
promos: [],
};
const payment = { isInsurance: null, insuranceCoverage: { isVerified: null } };
const policy = { isNoComp: false, isItac: false, currentDeductible: 0 };
store.getters = {
payment: { isInsurance: null, insuranceCoverage: { isVerified: null } },
policy: { isNoComp: false, isItac: false, currentDeductible: 0 },
payment: payment,
policy: policy,
order: {
payment: payment,
policy: policy,
},
hasSubmittedOrder: false,
};
var amtDue = mixIn.methods.getAmountDue(lineItems);