diff --git a/src/constants/application-config.js b/src/constants/application-config.js index 244882509..b8a59a129 100644 --- a/src/constants/application-config.js +++ b/src/constants/application-config.js @@ -11,6 +11,7 @@ const applicationConfig = { PAGE_QUERYSTRING: "fmgPage", SITE_ENTRY_TRIGGER_VALUE: "FixMyGlass", CASH_PARENT_ACCOUNT_NUMBER: 167132, + CASH_DEFAULT_BILL_TO_ACCOUNT_NUMBER: "87291", MY_ACCOUNT: process.env.VUE_APP_MY_ACCOUNT, PIA_RESPONSE_URL: location.protocol + diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 9b6fdb865..d77237170 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -80,6 +80,7 @@ const storeActions = { SAVE_PAYMENT_TYPE: "savePaymentType", SAVE_PAYMENT_METHOD_CHOICE: "savePaymentMethodChoice", SAVE_PARENT_ACCOUNT_NUMBER: "saveParentAccountNumber", + SAVE_BILL_TO_ACCOUNT_NUMBER: "saveBillToAccountNumber", SAVE_SUPPORTING_ITEMS: "saveSupportingItems", SAVE_SUPPORTING_ITEMS_SUPPRESSING_STATE_RESETTING: "saveSupportingItemsSuppressingStateResetting", diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index 5b0b66509..0b0338fef 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -46,6 +46,7 @@ const storeMutations = { UPDATE_REFERRAL_DATE: "updateReferralDate", UPDATE_REFERRAL_CORRELATION_ID: "updateReferralCorrelationId", UPDATE_PARENT_ACCT_NUMBER: "updateParentAcctNumber", + UPDATE_BILL_TO_ACCT_NUMBER: "updateBillToAcctNumber", UPDATE_EON: "updateEON", UPDATE_IS_INSURANCE: "updateIsInsurance", UPDATE_SAVED_SESSION_ID: "updateSavedSessionId", diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 3bde800bf..75a8ffa0c 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -244,7 +244,7 @@ export default { const taxedLineItems = await baseMixin.methods.dispatchStoreActionWithLogging( storeActions.TAX_ORDER_ITEMS_AND_SAVE_SERVER_DATA, { - billToAccountNumber: "87291", + billToAccountNumber: store.getters.payment.billToAccountNumber, providerNumber: store.getters.order.serviceLocation.provider.providerNumber, appointmentType: store.getters.order.serviceLocation.appointmentType, serviceLocationCity: store.getters.order.serviceLocation.city, @@ -405,7 +405,7 @@ export default { await baseMixin.methods.dispatchStoreActionWithLogging( storeActions.TAX_ORDER_ITEMS_AND_SAVE_SERVER_DATA, { - billToAccountNumber: "87291", + billToAccountNumber: store.getters.payment.billToAccountNumber, providerNumber: this.$store.getters.order.serviceLocation.provider.providerNumber, appointmentType: this.$store.getters.order.serviceLocation.appointmentType, diff --git a/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue index b4b02b3ed..adb9bee3d 100644 --- a/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue +++ b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue @@ -255,14 +255,13 @@ export default { this.availableVaps, "payment-method" ); - if (promoCodeData.isValid) { const pricedLineItemsToTax = []; pricedLineItemsToTax.push(...promoCodeData.promoCode); const taxedLineItems = await baseMixin.methods.dispatchStoreActionWithLogging( storeActions.TAX_ORDER_ITEMS_AND_SAVE_SERVER_DATA, { - billToAccountNumber: "87291", + billToAccountNumber: store.getters.payment.billToAccountNumber, providerNumber: store.getters.order.serviceLocation.provider.providerNumber, appointmentType: store.getters.order.serviceLocation.appointmentType, diff --git a/src/layouts/payment/payment.vue b/src/layouts/payment/payment.vue index 365dccf01..a0f888b04 100644 --- a/src/layouts/payment/payment.vue +++ b/src/layouts/payment/payment.vue @@ -356,7 +356,7 @@ export default { const taxedLineItems = await baseMixin.methods.dispatchStoreActionWithLogging( storeActions.TAX_ORDER_ITEMS_AND_SAVE_SERVER_DATA, { - billToAccountNumber: "87291", + billToAccountNumber: store.getters.payment.billToAccountNumber, providerNumber: store.getters.order.serviceLocation.provider.providerNumber, appointmentType: store.getters.order.serviceLocation.appointmentType, serviceLocationCity: store.getters.order.serviceLocation.city, diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 5c6b2d744..12ee04c8d 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -276,6 +276,11 @@ export default { applicationConfig.CASH_PARENT_ACCOUNT_NUMBER, false ); + this.dispatchStoreAction( + this.storeActions.SAVE_BILL_TO_ACCOUNT_NUMBER, + applicationConfig.CASH_DEFAULT_BILL_TO_ACCOUNT_NUMBER, + false + ); } if ( diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index a12e9ff78..3d0d5f588 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -153,11 +153,11 @@ const MOBILE_FEE_PART_TYPE = "MOBILE FEE"; // DEFINE VALIDATION RULES defineRule("mobile-location-required", (value) => { if ( - value.addressQuestions.streetAddress == "" || - value.addressQuestions.city == "" || - value.addressQuestions.state == "" || - value.addressQuestions.zipCode == "" || - value.isVehicleProtected == null + !value.addressQuestions.streetAddress || + !value.addressQuestions.city || + !value.addressQuestions.state || + !value.addressQuestions.zipCode || + !value.isVehicleProtected ) { return errorMessages.MOBILE_LOCATION_REQUIRED; } diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index e0d865c35..d394190ff 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -155,10 +155,9 @@ export default { ...(lineItems.vaps ?? []), ...(lineItems.promos ?? []), ]; - const subtotal = baseMixin.methods.getTotalPriceOfAllLineItemsAndChildParts( - combinedLineItems, - false - ); + const subtotal = baseMixin.methods + .getTotalPriceOfAllLineItemsAndChildParts(combinedLineItems, false) + .toFixed(2); // // get correct zip code const providerZip = order.serviceLocation.provider.address.zipCode; @@ -168,26 +167,25 @@ export default { : providerZip; // // calculate total - const total = baseMixin.methods.getTotalPriceOfAllLineItemsAndChildParts( - combinedLineItems, - true - ); + const total = baseMixin.methods + .getTotalPriceOfAllLineItemsAndChildParts(combinedLineItems, true) + .toFixed(2); const payload = { serviceZipCode: serviceZip, damageType: order.damage.isRepair ? "repair" : "replace", accountType: order.payment.isInsurance ? "insurance" : "cash", promoCodes: promoString, - vehicleYear: order.vehicle.year, + vehicleYear: `${order.vehicle.year}`, vehicleMake: order.vehicle.make, vehicleModel: order.vehicle.model, vehicleStyle: order.vehicle.style, glassToReplace: glassString, - workOrderId: order.workOrderId, - providerCtu: order.serviceLocation.zipCodeCtu, + workOrderId: parseInt(order.workOrderId), + providerCtu: parseInt(order.serviceLocation.zipCodeCtu), orderNumber: order.workOrderNumber, - priceTotal: total, - priceSubTotal: subtotal, + priceTotal: parseFloat(total), + priceSubTotal: parseFloat(subtotal), isRecalibrationOnOrder: store.getters.isRecalibrationOnSubmittedOrder, appointmentType: order.serviceLocation.appointmentType, }; diff --git a/src/store/index.js b/src/store/index.js index 86aa1a669..eeb70ec0a 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -249,6 +249,9 @@ export const mutations = { updateParentAcctNumber(state, parentAcctNumber) { state.order.payment.parentAccountNumber = parentAcctNumber; }, + updateBillToAcctNumber(state, billToAcctNumber) { + state.order.payment.billToAccountNumber = billToAcctNumber; + }, updateEON(state, eon) { state.order.eon = eon; }, @@ -518,7 +521,7 @@ export const mutations = { state.order.lineItems.glassParts = sessionInformation.order.lineItems.glassParts; state.order.lineItems.supportingItems = sessionInformation.order.lineItems.supportingItems; - state.order.lineItems.vaps = sessionInformation.order.lineItems.vaps; + state.order.lineItems.vaps = sessionInformation.order.lineItems.vaps ?? []; state.order.lineItems.promos = sessionInformation.order.lineItems.promos; state.order.lineItems.serverData = sessionInformation.order.lineItems.serverData; @@ -1489,6 +1492,7 @@ export const actions = { lineItems: lineItems, glassPieces: glassPieces, eon: order.eon, + billToAccountNumber: context.getters.payment.billToAccountNumber, coverage: { status: payment.insuranceCoverage.coverageStatus, deductible: order.policy.currentDeductible, @@ -1554,6 +1558,7 @@ export const actions = { lineItems: lineItems, glassPieces: glassPieces, eon: order.eon, + billToAccountNumber: context.getters.payment.billToAccountNumber, coverage: { status: payment.insuranceCoverage.coverageStatus, deductible: order.policy.currentDeductible, @@ -2128,6 +2133,9 @@ export const actions = { saveParentAccountNumber(context, parentAccountNumber) { context.commit(storeMutations.UPDATE_PARENT_ACCT_NUMBER, parentAccountNumber); }, + saveBillToAccountNumber(context, billToAccountNumber) { + context.commit(storeMutations.UPDATE_BILL_TO_ACCT_NUMBER, billToAccountNumber); + }, saveSupportingItems(context, supportingItems) { if (!deepEqual(supportingItems, context.state.order.lineItems.supportingItems)) {