Merge pull request #2007 from Safelite/feature/CSR-2237

Feature/csr 2237
This commit is contained in:
AdamCaouetteSafelite 2024-09-30 10:26:25 -04:00 committed by GitHub
commit 899fdc9cc2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 40 additions and 17 deletions

View file

@ -628,13 +628,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()

View file

@ -145,18 +145,30 @@ export default {
includeTax
);
}
if (lineItems.supportingItems) {
amountDue += this.getTotalPriceOfAllLineItemsAndChildParts(
lineItems.supportingItems,
includeTax
);
}
const order = this.hasSubmittedOrder() ? this.getSubmittedOrder() : store.getters.order;
if (
store.getters.coverageIsVerified &&
!order.policy.isNoComp &&
!order.policy.isItac
) {
amountDue = order.policy.currentDeductible;
}
if (lineItems.vaps) {
amountDue += this.getTotalPriceOfAllLineItemsAndChildParts(
lineItems.vaps,
includeTax
);
}
if (lineItems.promos) {
amountDue += this.getTotalPriceOfAllLineItemsAndChildParts(
lineItems.promos,
@ -164,16 +176,6 @@ export default {
);
}
const order = this.hasSubmittedOrder() ? this.getSubmittedOrder() : store.getters.order;
if (
order.payment.insuranceCoverage.isVerified &&
!order.policy.isNoComp &&
!order.policy.isItac
) {
amountDue = order.policy.currentDeductible;
}
return ((amountDue * 100) / 100).toFixed(2);
},
getSubTotal(lineItems) {

View file

@ -775,6 +775,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;
},
@ -900,13 +918,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) => {