From 469818c022cce32fcd4b63a0dc6a01457e8afb8e Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 10 Oct 2023 12:29:04 -0400 Subject: [PATCH 1/3] Add prerequisite method --- src/layouts/payment-method/payment-method.vue | 54 ++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index cc688ca27..5bb749726 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -105,6 +105,7 @@ import { storeActions } from "@/constants/store-actions"; import store from "@/store"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { Form } from "vee-validate"; +import { AppointmentTypeStrings } from "@/constants/schedule-constants"; export default { name: "paymentMethod", @@ -193,7 +194,58 @@ export default { }, methods: { arePagePrerequisitesValid() { - return true; + // Line Items + const lineItems = store.getters.order.lineItems; + // damageReqs handles checking for damage, even though it is also required for this section. + const packageReqs = !!(lineItems.supportingItems && lineItems.vaps); + + // Service Location + const serviceLocation = store.getters.order.serviceLocation; + const mobileReqs = !!( + serviceLocation.address && + serviceLocation.city && + serviceLocation.state && + serviceLocation.zipCode + ); + + const providerLocation = serviceLocation.provider.address; + const dropOffInshopReqs = !!( + providerLocation.streetAddress && + providerLocation.city && + providerLocation.state && + providerLocation.zipCode + ); + + const isMobile = serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE; + + const serviceLocationReqs = + (isMobile && mobileReqs) || (!isMobile && dropOffInshopReqs); + + // Insurance + const isInsuranceSet = store.getters.order.payment.isInsurance !== null; + + // Schedule + const schedule = store.getters.order.schedule; + const scheduleReqs = !!( + schedule.date && + schedule.startTime && + schedule.endTime && + schedule.jobMaxMinutes && + schedule.jobMinMinutes + ); + + // Customer + const customer = store.getters.order.customer; + const customerReqs = !!( + customer.firstName && + customer.lastName && + customer.phoneNumber && + customer.emailAddress + ); + + return ( + packageReqs && serviceLocationReqs && isInsuranceSet && scheduleReqs && customerReqs + ); }, getPaypalAlert() { return store.getters.order.payment.piaErrorCode ? true : false; From 0a9df36a8d359e10d2b5ca78fd735f213868bd9a Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 10 Oct 2023 15:54:52 -0400 Subject: [PATCH 2/3] Update prereq expectations --- src/layouts/payment-method/payment-method.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 5bb749726..37c2d668b 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -195,9 +195,7 @@ export default { methods: { arePagePrerequisitesValid() { // Line Items - const lineItems = store.getters.order.lineItems; - // damageReqs handles checking for damage, even though it is also required for this section. - const packageReqs = !!(lineItems.supportingItems && lineItems.vaps); + const packageReqs = !!store.getters.order.lineItems.supportingItems; // Service Location const serviceLocation = store.getters.order.serviceLocation; From 2e78f18691a56843d3d5e475f318ea664591a8a8 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 10 Oct 2023 15:55:05 -0400 Subject: [PATCH 3/3] Also update review prereqs --- src/layouts/review/review.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/layouts/review/review.vue b/src/layouts/review/review.vue index 20daf921f..29711fcef 100644 --- a/src/layouts/review/review.vue +++ b/src/layouts/review/review.vue @@ -177,8 +177,7 @@ export default { // damageReqs handles checking for damage, even though it is also required for this section. const packageReqs = !!( (damage.isRepair || lineItems.glassParts) && - lineItems.supportingItems && - lineItems.vaps + lineItems.supportingItems ); // Service Location