From e03dfd65ccfd04096d25d2ab38437c18be603302 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Mon, 20 May 2024 09:39:37 -0400 Subject: [PATCH 1/4] CSR-2098 CSR-2098 handle case where verified insurance with deductible --- src/mixins/base-mixin.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index cf763fdff..ff2ea93d6 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -152,6 +152,11 @@ 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() { From 67610544e00a8e73cd5e3afe75a621b18db8fd1d Mon Sep 17 00:00:00 2001 From: CarlNation Date: Mon, 20 May 2024 09:43:11 -0400 Subject: [PATCH 2/4] CSR-2098 prettier --- src/mixins/base-mixin.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index ff2ea93d6..ec49c3f0f 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -152,8 +152,12 @@ 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) { + + if ( + store.getters.payment.insuranceCoverage.isVerified && + !store.getters.policy.isNoComp && + !store.getters.policy.isItac + ) { amountDue += store.getters.policy.currentDeductible; } From 91b4036cd5308d93b1d76f0ce116bf21d6f00543 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Mon, 20 May 2024 10:26:26 -0400 Subject: [PATCH 3/4] CSR-2098 CSR-2098 unit test for verified deductible --- src/mixins/base-mixin.spec.js | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/mixins/base-mixin.spec.js b/src/mixins/base-mixin.spec.js index 2ef76315e..cd18ecd7d 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.00, + sellingPrice: 30.00, + }, + { + cartItemType: "FRONT WIPERS", + description: 'WIPER BLADE STANDARD 26"', + kitPrice: 0, + laborAmount: 0, + partNumber: "WB26", + partType: "FRONT WIPER", + salesTax: 1.00, + sellingPrice: 20.00, + }, + ], + 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 }) { From 831685aa5f85b3442c9470136cd66005079c0ae7 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Mon, 20 May 2024 10:29:28 -0400 Subject: [PATCH 4/4] CSR-2098 prettier --- src/mixins/base-mixin.spec.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mixins/base-mixin.spec.js b/src/mixins/base-mixin.spec.js index cd18ecd7d..1b0f919ba 100644 --- a/src/mixins/base-mixin.spec.js +++ b/src/mixins/base-mixin.spec.js @@ -134,8 +134,8 @@ describe("baseMixin.js", () => { laborAmount: 0, partNumber: "WB18", partType: "FRONT WIPER", - salesTax: 2.00, - sellingPrice: 30.00, + salesTax: 2.0, + sellingPrice: 30.0, }, { cartItemType: "FRONT WIPERS", @@ -144,15 +144,15 @@ describe("baseMixin.js", () => { laborAmount: 0, partNumber: "WB26", partType: "FRONT WIPER", - salesTax: 1.00, - sellingPrice: 20.00, + salesTax: 1.0, + sellingPrice: 20.0, }, ], promos: [], }; store.getters = { - payment: {insuranceCoverage: { isVerified: true } }, + payment: { insuranceCoverage: { isVerified: true } }, policy: { isNoComp: false, isItac: false, currentDeductible: 250 }, };