diff --git a/src/store/index.js b/src/store/index.js index 1bd88bd7..40863522 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1269,7 +1269,9 @@ export const useMainStore = defineStore({ policyZipCode: policy.policyZipCode, originalDeductible: this.order.originalDeductible, currentDeductible: this.order.currentDeductible, - OemEndorsement: policy.endorsements?.indexOf('OEM Approved') !== -1 ?? false + OemEndorsement: policy.endorsements?.indexOf('OEM Approved') !== -1 ?? false, + noCoverage: this.isNoComp, + isItac: this.isITAC }, customer: { address: { @@ -1304,7 +1306,12 @@ export const useMainStore = defineStore({ isPaypal: payment.payInAdvanceType === paymentMethods.PAYPAL, isCreditCard: payment.payInAdvanceType === paymentMethods.CREDIT_CARD, isAfterpay: payment.payInAdvanceType === paymentMethods.AFTERPAY, - CCToken: payment.creditCardToken + CCToken: payment.creditCardToken, + insuranceCoverage: { + isVerified: this.isVerified, + coverageStatus: this.isNoComp ? coverageStatuses.NO_COVERAGE : this.isVerified ? coverageStatuses.VERIFIED : coverageStatuses.PENDING, + claimNumber: insuranceCoverage.claimNumber + } }, serviceLocation: { address: { @@ -1403,9 +1410,16 @@ export const useMainStore = defineStore({ order.contactInfo.alternativePhone = data?.customer?.alternativePhone; order.contactInfo.requestTextUpdates = data?.customer?.isSmsOptIn; - order.insuranceCoverage.coverageType = data?.insuranceCoverage?.coverageType; - order.insuranceCoverage.coverageStatus = data?.insuranceCoverage?.coverageStatus; - order.insuranceCoverage.claimNumber = data?.insuranceCoverage?.claimNumber; + if (data.insuranceCoverage) { + order.insuranceCoverage.coverageType = data?.insuranceCoverage?.coverageType; + order.insuranceCoverage.coverageStatus = data?.insuranceCoverage?.coverageStatus; + order.insuranceCoverage.claimNumber = data?.insuranceCoverage?.claimNumber; + } else if (data?.payment?.insuranceCoverage) { + if (data?.payment?.insuranceCoverage?.isVerified) { + order.insuranceCoverage.coverageStatus = coverageStatuses.VERIFIED; + } + order.insuranceCoverage.claimNumber = data?.payment?.insuranceCoverage?.claimNumber; + } if (order.policy.vehicles.length !== 0 && data.vehicle?.carId) { order.vehicle.registration.licensePlate = data?.vehicle?.licensePlateNumber;