From 8ebd0cd3060f61eaa93ad5da5ac778613470b4e6 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Sun, 29 Sep 2024 09:31:26 -0400 Subject: [PATCH 1/2] CSR-2237 CSR-2237 Added new getter that checks the 7777 and 9999 deductibles when determining if coverage is verified. Added the amount of vaps due to the amount due when using deductible/verified pricing. --- src/layouts/payment-method/payment-method.vue | 11 +++++---- src/mixins/base-mixin.js | 9 +++++-- src/store/index.js | 24 ++++++++++++++++--- 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 3c8d23502..60eabcb02 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -626,13 +626,16 @@ export default { }, showInsuranceCoverageAs() { if (!this.isInsurance) return null; + if (this.isNoComp || this.isItac) { return coverageStatus.NOCOMP; - } else { - return this.hasSubmittedOrder() - ? this.getSubmittedOrder()?.payment.insuranceCoverage.coverageStatus - : this.$store.getters.payment.insuranceCoverage.coverageStatus; } + + if (this.$store.getters.coverageIsVerified) { + return coverageStatus.VERIFIED; + } + + return coverageStatus.PENDING; }, currentDeductible() { return this.hasSubmittedOrder() diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index 15095746b..b740cc5ac 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -167,13 +167,18 @@ export default { } const order = this.hasSubmittedOrder() ? this.getSubmittedOrder() : store.getters.order; - if ( - order.payment.insuranceCoverage.isVerified && + store.getters.coverageIsVerified && !order.policy.isNoComp && !order.policy.isItac ) { amountDue = order.policy.currentDeductible; + if (lineItems.vaps) { + amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( + lineItems.vaps, + includeTax + ); + } } return ((amountDue * 100) / 100).toFixed(2); diff --git a/src/store/index.js b/src/store/index.js index 00bdd486f..4ec245ff3 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -774,6 +774,24 @@ export const getters = { ); return !!nonWindshieldItems?.length; }, + coverageIsVerified: (state) => { + let order; + if (window.sessionStorage.getItem("submittedOrder") !== null) { + order = JSON.parse(window.sessionStorage.getItem("submittedOrder")); + } else { + order = state.order; + } + + if ( + order.payment?.insuranceCoverage?.isVerified && + order.policy?.currentDeductible != 9999 && + order.policy?.currentDeductible != 7777 + ) { + return true; + } + + return false; + }, isMobileAppointment: (state) => { return state.order.serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE; }, @@ -899,13 +917,13 @@ export const getters = { isVerifiedAndDeductibleZeroConfirmed: (state) => { // used as a CMS variable on /payment-method, needed for FunnelSubHeaderWidget on cart pages if ( - (state.order.policy.currentDeductible === 0 || - state.order.policy.currentDeductible > 0) && - state.order.payment.insuranceCoverage.coverageStatus === coverageStatus.VERIFIED && + state.order.policy.currentDeductible === 0 && + getters.coverageIsVerified(state) && !state.order.policy.isNoComp ) { return true; } + return false; }, requiresVerifiedRedirecting: (state) => { From 92e0e6e60d63bdce3aa49f399e92993454fa31d8 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Mon, 30 Sep 2024 06:22:52 -0400 Subject: [PATCH 2/2] CSR-2237 CSR-2237 move vaps and promos below deductible pricing to make sure it is added into the amount due and also avoid code duplication --- src/mixins/base-mixin.js | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index fdf1261e0..e30663fea 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -145,24 +145,13 @@ export default { includeTax ); } + if (lineItems.supportingItems) { amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( lineItems.supportingItems, includeTax ); } - if (lineItems.vaps) { - amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( - lineItems.vaps, - includeTax - ); - } - if (lineItems.promos) { - amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( - lineItems.promos, - includeTax - ); - } const order = this.hasSubmittedOrder() ? this.getSubmittedOrder() : store.getters.order; if ( @@ -171,12 +160,20 @@ export default { !order.policy.isItac ) { amountDue = order.policy.currentDeductible; - if (lineItems.vaps) { - amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( - lineItems.vaps, - includeTax - ); - } + } + + if (lineItems.vaps) { + amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( + lineItems.vaps, + includeTax + ); + } + + if (lineItems.promos) { + amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( + lineItems.promos, + includeTax + ); } return ((amountDue * 100) / 100).toFixed(2);