From 4e1caf85595712861454eee21684dcff2d04c4d1 Mon Sep 17 00:00:00 2001 From: CarlNation <32103961+CarlNation@users.noreply.github.com> Date: Mon, 19 Feb 2024 07:40:07 -0500 Subject: [PATCH] CSR-1072 CSR-1072 insurance orders will remove line items depending on the company. mobile fee, recycle fee, etc. So we can return from heritage with nothing in supporting items causing exceptions when lineItems is no longer required. --- src/layouts/payment-method/payment-method.vue | 5 +---- src/layouts/payment/payment.vue | 4 ---- src/layouts/schedule/schedule.vue | 13 ++++++++++--- src/layouts/service-location/service-location.vue | 4 ++-- src/router/index.js | 3 +++ 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 75a8ffa0c..bad1ae713 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -314,9 +314,6 @@ export default { }, methods: { arePagePrerequisitesValid() { - // Line Items - const packageReqs = !!store.getters.order.lineItems.supportingItems; - // Service Location const serviceLocation = store.getters.order.serviceLocation; const mobileReqs = !!( @@ -362,7 +359,7 @@ export default { ); return ( - packageReqs && serviceLocationReqs && isInsuranceSet && scheduleReqs && customerReqs + serviceLocationReqs && isInsuranceSet && scheduleReqs && customerReqs ); }, getPaymentMethodFromStore() { diff --git a/src/layouts/payment/payment.vue b/src/layouts/payment/payment.vue index a0f888b04..e61e54753 100644 --- a/src/layouts/payment/payment.vue +++ b/src/layouts/payment/payment.vue @@ -440,9 +440,6 @@ export default { }, methods: { arePagePrerequisitesValid() { - // Line Items - const packageReqs = !!store.getters.order.lineItems.supportingItems; - // Service Location const serviceLocation = store.getters.order.serviceLocation; const mobileReqs = !!( @@ -492,7 +489,6 @@ export default { (store.getters.order.payment.isPia || !!store.getters.order.payment.piaType); return ( - packageReqs && serviceLocationReqs && isInsuranceSet && scheduleReqs && diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index c2fee87ee..77e009a2a 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -314,14 +314,13 @@ export default { serviceLocation.provider.providerNumber); const paymentInfo = store.getters.payment.isInsurance !== null; - const supportingItems = store.getters.lineItems.supportingItems !== null; const damageInfo = store.getters.order.damage.isRepair || (store.getters.order.lineItems?.glassParts != null && store.getters.order.lineItems.glassParts.length > 0); - return serviceLocationPreReqs && paymentInfo && supportingItems && damageInfo; + return serviceLocationPreReqs && paymentInfo && damageInfo; }, async getAvailableDatesMethod(startDate, endDate) { const newShopTimeSlots = await getAvailableDates( @@ -348,9 +347,13 @@ export default { }, getSelectedTimeSlotInfo() { const supportingItems = this.getSupportingItems(); - const isPremiumAppointment = + + var isPremiumAppointment = false; + if (supportingItems) { + isPremiumAppointment = !!supportingItems.filter((lineItem) => lineItem.partType === PREMIUM_FEE_PART_TYPE) .length > 0; + } const selectedTimeSlotInfo = { timeSlot: store.getters.order.schedule, @@ -461,6 +464,10 @@ export default { false ); } else { + if (!supportingItems) { + return; + } + // if it's not a mobile and/or premium early bird, then make sure we remove any that may have been added const removePremiumFeeIndex = supportingItems.findIndex( (item) => item.partType == PREMIUM_FEE_PART_TYPE diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index 38f46424f..0007cb112 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -204,7 +204,7 @@ export default { ); const mobileFeePartPromise = getPricedMobileFeePart(serviceZipCode, "service-location"); - + const shopProviderDataPromise = getShopProviderData(serviceZipCode); // shopQuestion.methods.loadInitialData(serviceZipCode); // Settle promises and get results @@ -479,7 +479,7 @@ export default { ); } else { // if it's not a mobile, then make sure we remove any that may have been added - const removeMobileFeeIndex = supportingItems.findIndex( + const removeMobileFeeIndex = supportingItems?.findIndex( (item) => item.partType == MOBILE_FEE_PART_TYPE ); diff --git a/src/router/index.js b/src/router/index.js index 4a13a8fc7..18621cbdc 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -103,6 +103,7 @@ const routes = [ } if (!arePagePrerequisitesValid(component)) { + console.log("Page prereq error: " + component.default.name); GoToFunnelStartOn404(next); } @@ -110,6 +111,7 @@ const routes = [ } if (!isExistingFmgPageName(to.query.fmgPage)) { + console.log("Not an existing fmg page name:" + to.query.fmgPage); GoToFunnelStartOn404(next); } @@ -131,6 +133,7 @@ const routes = [ .components.default(); if (!arePagePrerequisitesValid(nextComponent)) { + console.log("Page Prereqs not valid for next component: " + nextComponent.default.name); GoToFunnelStartOn404(next); }