diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index 495973144..9e5a43bd6 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -140,7 +140,7 @@
Promo code {{ promoCode }} applied @@ -184,6 +184,7 @@ export default { allowItemRemoval: Boolean, recyclingModalCmsWidgetName: String, showAsPaid: Boolean, + isInsurance: Boolean, insuranceDeductible: Number, insuranceCompanyName: String, showInsuranceCoverageAs: String, @@ -283,6 +284,7 @@ export default { (lineItemsToKeep) => lineItemsToKeep.cartItemType != cartItemType ); }, + getPromoCodeList() { if (this.$refs["promoModalQuestion"]) { return this.$refs["promoModalQuestion"].getPromoCodeList(); @@ -299,6 +301,14 @@ export default { this.$emit("update:modelValue", newValue); }, }, + lineItemsWithoutRecal() { + if (!this.lineItems || this.lineItems.length < 1) return; + const lineItemsCopy = deepClone(this.lineItems); + lineItemsCopy.supportingItems = baseMixin.methods.filterOutRecalibration( + lineItemsCopy.supportingItems + ); + return lineItemsCopy; + }, showCoverageAsPending() { return this.showInsuranceCoverageAs === coverageStatus.PENDING; }, @@ -427,7 +437,14 @@ export default { packagePrice() { let packagePrice = 0; - if (!this.showCoverageAsVerified && !this.showCoverageAsPending) { + if (!this.isInsurance) { + // CASH ONLY + packagePrice = baseMixin.methods.getTierOnePackagePrice( + baseMixin.methods.filterOutFees( + baseMixin.methods.filterOutRecalibration(this.availableLineItems) + ) + ); + } else if (!this.showCoverageAsVerified && !this.showCoverageAsPending) { packagePrice = baseMixin.methods.getTierOnePackagePrice( baseMixin.methods.filterOutFees(this.availableLineItems) ); @@ -916,8 +933,6 @@ export default { promoCartItems() { const promoCartItems = []; - // clone the promos array - const promosClone = deepClone(this.promo); // get unique promo codes const uniquePromoCodes = [ ...new Set( @@ -983,16 +998,23 @@ export default { return this.getCmsContent("SubtotalTextWidget", "Text"); }, subTotal() { - return baseMixin.methods.getSubTotal(this.lineItems); + if (!this.lineItems || this.lineItems.length < 1) return; + return this.isInsurance + ? baseMixin.methods.getSubTotal(this.lineItems) + : baseMixin.methods.getSubTotal(this.lineItemsWithoutRecal); }, salesTax() { - return baseMixin.methods.getSalesTax(this.lineItems); + if (!this.lineItems || this.lineItems.length < 1) return; + return this.isInsurance + ? baseMixin.methods.getSalesTax(this.lineItems) + : baseMixin.methods.getSalesTax(this.lineItemsWithoutRecal); }, amountDue() { - if (this.showAsPaid) { - return 0; - } - return baseMixin.methods.getAmountDue(this.lineItems); + if (!this.lineItems || this.lineItems.length < 1) return; + if (this.showAsPaid) return 0; + return this.isInsurance + ? baseMixin.methods.getAmountDue(this.lineItems) + : baseMixin.methods.getAmountDue(this.lineItemsWithoutRecal); }, amountPaid() { if (!this.showAsPaid) { diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 332936ba6..8723ab85a 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -30,6 +30,7 @@ pageName="payment-method" servicePackageOptionsCmsName="ServicePackageTitle" recyclingModalCmsWidgetName="RecycleModal" + :isInsurance="isInsurance" :insuranceDeductible="currentDeductible" :insuranceCompanyName="insuranceCompanyName" :showInsuranceCoverageAs="showInsuranceCoverageAs" /> diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index 109f90d04..c86cdacb5 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -102,6 +102,12 @@ export default { }); return filteredLineItems; }, + filterOutRecalibration(lineItems) { + const filteredLineItems = lineItems.filter((item) => { + return item.partType != partTypeStrings.RECALIBRATION; + }); + return filteredLineItems; + }, getTotalPriceOfAllLineItemsAndChildParts(lineItems, includeTax) { let totalPrice = 0; lineItems.forEach((lineItem) => {