diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index cf763fdff..ec49c3f0f 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -152,6 +152,15 @@ export default { if (lineItems.promos) { amountDue += this.getTotalPriceOfAllLineItemsAndChildParts(lineItems.promos, true); } + + if ( + store.getters.payment.insuranceCoverage.isVerified && + !store.getters.policy.isNoComp && + !store.getters.policy.isItac + ) { + amountDue += store.getters.policy.currentDeductible; + } + return ((amountDue * 100) / 100).toFixed(2); }, scrollToPageTop() { diff --git a/src/mixins/base-mixin.spec.js b/src/mixins/base-mixin.spec.js index 2ef76315e..1b0f919ba 100644 --- a/src/mixins/base-mixin.spec.js +++ b/src/mixins/base-mixin.spec.js @@ -120,6 +120,46 @@ describe("baseMixin.js", () => { expect(mixIn.methods.dispatchStoreActionWithLogging).toBeCalled(); }); + + test("getAmountDue for verified deductible should be deductible plus any lineitems", () => { + 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: [], + }; + + store.getters = { + payment: { insuranceCoverage: { isVerified: true } }, + policy: { isNoComp: false, isItac: false, currentDeductible: 250 }, + }; + + var amtDue = mixIn.methods.getAmountDue(lineItems); + + expect(amtDue).toEqual("303.00"); + }); }); function getMixInInstance({ isDispatchSuccess = true }) {