diff --git a/src/constants/application-config.js b/src/constants/application-config.js index 91a56ae10..b5233d170 100644 --- a/src/constants/application-config.js +++ b/src/constants/application-config.js @@ -21,6 +21,10 @@ const applicationConfig = { "//" + location.host + "/fmg/?fmgPage=payment-method&src=concept-funnel", + GOOGLE_CALENDAR: "https://www.google.com/calendar/render?action=TEMPLATE", + YAHOO_CALENDAR: "https://calendar.yahoo.com/?v=60", + OUTLOOK_CALENDAR: + "https://outlook.office.com/calendar/deeplink/compose?path=/calendar/action/compose&rru=addevent", }; export { applicationConfig }; diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 9801ef22e..64e6df3aa 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -93,6 +93,7 @@ const storeActions = { SAVE_PIA_ERROR_CODE: "savePiaErrorCode", SAVE_PIA_WORK_ORDER: "savePiaWorkOrder", SAVE_CCTOKEN: "saveCCToken", + SAVE_PAYPAL_TOKEN: "savePaypalToken", }; export { storeActions }; diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index 2b2efae64..9e2e30a14 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -4,6 +4,7 @@ const storeMutations = { UPDATE_PIA_ERROR_CODE: "updatePiaErrorCode", UPDATE_PIA_WORK_ORDER: "updatePiaWorkOrder", UPDATE_CCTOKEN: "updateCCToken", + UPDATE_PAYPAL_TOKEN: "updatePaypalToken", // VEHICLE MUTATIONS UPDATE_YEAR: "updateYear", diff --git a/src/fmg-components/content-group-modal/content-group-modal.vue b/src/fmg-components/content-group-modal/content-group-modal.vue index d9d9da937..a64d10fa3 100644 --- a/src/fmg-components/content-group-modal/content-group-modal.vue +++ b/src/fmg-components/content-group-modal/content-group-modal.vue @@ -12,6 +12,7 @@ class="my-4 caption modal-sub-body" v-if="ModalSubBodyText" v-html="ModalSubBodyText">

+ @@ -22,6 +23,10 @@ export default { name: "content-group-modal", props: { cmsWidgetName: String, + footerButtonActionName: { + type: String, + default: null, + }, }, computed: { ModalName() { @@ -50,10 +55,16 @@ export default { openModal() { this.$refs[this.ModalName].openModal(); }, - - footerButtonClick() { + closeModal() { this.$refs[this.ModalName].closeModal(); }, + footerButtonClick() { + if (this.footerButtonActionName) { + this.$emit(this.footerButtonActionName, this.ModalName); + } else { + this.closeModal(); + } + }, }, components: { modal, diff --git a/src/fmg-components/layouts/questions-page-layout/questions-page-layout.vue b/src/fmg-components/layouts/questions-page-layout/questions-page-layout.vue index 8fc382bf0..0bacf3f01 100644 --- a/src/fmg-components/layouts/questions-page-layout/questions-page-layout.vue +++ b/src/fmg-components/layouts/questions-page-layout/questions-page-layout.vue @@ -8,7 +8,7 @@
-
+
diff --git a/src/layouts/add-to-calendar/add-to-calendar.vue b/src/layouts/add-to-calendar/add-to-calendar.vue deleted file mode 100644 index afd9942ea..000000000 --- a/src/layouts/add-to-calendar/add-to-calendar.vue +++ /dev/null @@ -1,167 +0,0 @@ - - - diff --git a/src/layouts/add-to-calendar/add-to-calendar.spec.js b/src/layouts/confirmation/add-to-calendar/add-to-calendar.spec.js similarity index 94% rename from src/layouts/add-to-calendar/add-to-calendar.spec.js rename to src/layouts/confirmation/add-to-calendar/add-to-calendar.spec.js index 14b6d978b..c55b170cd 100644 --- a/src/layouts/add-to-calendar/add-to-calendar.spec.js +++ b/src/layouts/confirmation/add-to-calendar/add-to-calendar.spec.js @@ -1,5 +1,5 @@ // Components -import addToCalendar from "@/layouts/add-to-calendar/add-to-calendar.vue"; +import addToCalendar from "@/layouts/confirmation/add-to-calendar/add-to-calendar.vue"; import { calendarOptions } from "@/constants/calendar-options"; import { AppointmentTypeStrings, RouteCodeFlags } from "@/constants/schedule-constants"; @@ -176,11 +176,20 @@ describe("Add-to-calendar methods...", () => { }); }); +var appointmentText = "Appointment content"; function setupMocks({ customMountOptions }) { const mountOptions = getMountOptions({ ...customMountOptions, }); - + mountOptions.mixins = [ + { + methods: { + getCmsContent: jest.fn().mockImplementation(() => { + return appointmentText; + }), + }, + }, + ]; const wrapper = shallowMount(addToCalendar, mountOptions); wrapper.vm.$refs.calendarModalQuestion.openModal = jest.fn(); return { wrapper }; diff --git a/src/layouts/confirmation/add-to-calendar/add-to-calendar.vue b/src/layouts/confirmation/add-to-calendar/add-to-calendar.vue new file mode 100644 index 000000000..24427b2d5 --- /dev/null +++ b/src/layouts/confirmation/add-to-calendar/add-to-calendar.vue @@ -0,0 +1,314 @@ + + + diff --git a/src/layouts/add-to-calendar/calendar-modal-question/calendar-modal-list-button/calendar-modal-list-button.vue b/src/layouts/confirmation/add-to-calendar/calendar-modal-question/calendar-modal-list-button/calendar-modal-list-button.vue similarity index 100% rename from src/layouts/add-to-calendar/calendar-modal-question/calendar-modal-list-button/calendar-modal-list-button.vue rename to src/layouts/confirmation/add-to-calendar/calendar-modal-question/calendar-modal-list-button/calendar-modal-list-button.vue diff --git a/src/layouts/add-to-calendar/calendar-modal-question/calendar-modal-question.spec.js b/src/layouts/confirmation/add-to-calendar/calendar-modal-question/calendar-modal-question.spec.js similarity index 92% rename from src/layouts/add-to-calendar/calendar-modal-question/calendar-modal-question.spec.js rename to src/layouts/confirmation/add-to-calendar/calendar-modal-question/calendar-modal-question.spec.js index d28c2442f..2f0a51a33 100644 --- a/src/layouts/add-to-calendar/calendar-modal-question/calendar-modal-question.spec.js +++ b/src/layouts/confirmation/add-to-calendar/calendar-modal-question/calendar-modal-question.spec.js @@ -1,6 +1,6 @@ import { shallowMount } from "@vue/test-utils"; import { getMountOptions } from "@/helpers/unit-test-helper.js"; -import calendarModalQuestion from "@/layouts/add-to-calendar/calendar-modal-question/calendar-modal-question.vue"; +import calendarModalQuestion from "@/layouts/confirmation/add-to-calendar/calendar-modal-question/calendar-modal-question.vue"; describe("calendar-modal-question.vue", () => { test("When selected calendar option is changed, a correctly selectedCalendarOption should be emitted", async () => { diff --git a/src/layouts/add-to-calendar/calendar-modal-question/calendar-modal-question.vue b/src/layouts/confirmation/add-to-calendar/calendar-modal-question/calendar-modal-question.vue similarity index 100% rename from src/layouts/add-to-calendar/calendar-modal-question/calendar-modal-question.vue rename to src/layouts/confirmation/add-to-calendar/calendar-modal-question/calendar-modal-question.vue diff --git a/src/layouts/confirmation/confirmation.vue b/src/layouts/confirmation/confirmation.vue index 1ced1c495..5adcc5613 100644 --- a/src/layouts/confirmation/confirmation.vue +++ b/src/layouts/confirmation/confirmation.vue @@ -20,7 +20,19 @@

{{ ScheduleDateFormatted }}

{{ ScheduleTimeFormatted }}

- +
@@ -43,22 +55,17 @@ import funnelHeader from "@/fmg-components/funnel-header/funnel-header"; import vehicleBanner from "@/fmg-components/vehicle-banner/vehicle-banner"; import navbar from "@/fmg-components/nav-bar/nav-bar"; -import addToCalendar from "@/layouts/add-to-calendar/add-to-calendar"; +import addToCalendar from "@/layouts/confirmation/add-to-calendar/add-to-calendar"; //Supporting files import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; -import { AppointmentTypeStrings, RouteCodeFlags } from "@/constants/schedule-constants"; +import { AppointmentTypeStrings } from "@/constants/schedule-constants"; import { settleAllPromises } from "@/helpers/layout-helper"; import { applicationConfig } from "@/constants/application-config.js"; import { convertDateStringToDate } from "@/layouts/schedule/helpers/schedule-helper"; -import { - calculateDuration, - combineDateAndTime, - shortTimeString, - addMinutes, -} from "@/helpers/date-helper"; + import { Form } from "vee-validate"; import store from "@/store"; -import { serviceType } from "@/constants/service-type"; + import { get12HourTimeFormat, get12HourTimeMobileFormat } from "@/helpers/date-helper"; export default { name: "confirmation", @@ -190,138 +197,6 @@ export default { return `at ${get12HourTimeFormat(this.ScheduleStartTime)}`; } }, - IsSameDayDropOff() { - const todaysDate = new Date().toISOString().split("T")[0]; - return this.ScheduleDate === todaysDate; - }, - Mobile_Appointment_Subject() { - return this.getCmsContent("Mobile_Appointment_Widget", "HeaderText"); - }, - Mobile_Appointment_Body() { - return this.getCmsContent("Mobile_Appointment_Widget", "BodyText"); - }, - InShop_Appointment_Subject() { - return this.getCmsContent("InShop_Appointment_Widget", "HeaderText"); - }, - InShop_Appointment_Body() { - return this.getCmsContent("InShop_Appointment_Widget", "BodyText"); - }, - Drop_Off_Appointment_Subject() { - return this.getCmsContent("Drop_Off_Appointment_Widget", "HeaderText"); - }, - Drop_Off_Appointment_Body() { - return this.getCmsContent("Drop_Off_Appointment_Widget", "BodyText"); - }, - Overnight_Drop_Off_Appointment_Subject() { - return this.getCmsContent("Drop_Off_Appointment_Widget", "HeaderText"); - }, - Overnight_Drop_Off_Appointment_Body() { - return this.getCmsContent("Drop_Off_Appointment_Widget", "BodyText"); - }, - All_Day_Drop_Off_Appointment_Subject() { - return this.getCmsContent("All_Day_Drop_Off_Appointment_Widget", "HeaderText"); - }, - All_Day_Drop_Off_Appointment_Body() { - return this.getCmsContent("All_Day_Drop_Off_Appointment_Widget", "BodyText"); - }, - Same_Day_Drop_Off_Appointment_Subject() { - return this.getCmsContent("Same_Day_Drop_Off_Appointment_Widget", "HeaderText"); - }, - Same_Day_Drop_Off_Appointment_Body() { - return this.getCmsContent("Same_Day_Drop_Off_Appointment_Widget", "BodyText"); - }, - UniqueId() { - return store.getters.order.referralNumber?.toString(); - }, - ServiceType() { - const isRepair = store.getters.order.damage.isRepair; - const funnelHasRecalibrationPart = store.getters.funnelHasRecalibrationPart; - if (!isRepair) { - if (funnelHasRecalibrationPart) { - return serviceType.REPLACEMENT_AND_RECALIBRATION; - } else { - return serviceType.REPLACEMENT; - } - } - return serviceType.REPAIR; - }, - RouteCode() { - return store.getters.order.schedule.routeCode; - }, - AppointmentData() { - var subject = ""; - var location = ""; - var startDateTime = combineDateAndTime(this.ScheduleDate, this.ScheduleStartTime); - var endDateTime = combineDateAndTime(this.ScheduleDate, this.ScheduleEndTime); - var body = ""; - var isHTML = false; - var duration = ""; - - if (this.AppointmentType === AppointmentTypeStrings.MOBILE) { - location = this.ServiceLocationFullAddress?.replace("
", ""); - subject = this.Mobile_Appointment_Subject?.replace( - "{custom:SERVICETYPE}", - this.ServiceType - ); - body = this.Mobile_Appointment_Body; - } else { - location = this.ProviderFullAddress?.replace("
", ""); - if (this.AppointmentType === AppointmentTypeStrings.DROP_OFF) { - if (this.RouteCode.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) { - subject = this.Overnight_Drop_Off_Appointment_Subject; - body = this.Overnight_Drop_Off_Appointment_Body; - } else if (this.RouteCode.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) { - if (this.IsSameDayDropOff) { - subject = this.Same_Day_Drop_Off_Appointment_Subject; - endDateTime = addMinutes(startDateTime, 120); - body = this.Same_Day_Drop_Off_Appointment_Body; - } else { - endDateTime = addMinutes(startDateTime, 120); - subject = this.All_Day_Drop_Off_Appointment_Subject?.replace( - "{custom:STARTDATETIME}", - shortTimeString(startDateTime) - ).replace("{custom:ENDDATETIME}", shortTimeString(endDateTime)); - body = this.All_Day_Drop_Off_Appointment_Body?.replace( - "{custom:ENDDATETIME}", - shortTimeString(endDateTime) - ); - } - } //normal time slot - else { - subject = this.Drop_Off_Appointment_Subject?.replace( - "{custom:SERVICETYPE}", - this.ServiceType - ); - body = this.Drop_Off_Appointment_Body?.replace( - "{custom:ADDRESS}", - location - ); - } - } else { - subject = this.InShop_Appointment_Subject?.replace( - "{custom:SERVICETYPE}", - this.ServiceType - ); - body = this.InShop_Appointment_Body?.replace("{custom:ADDRESS}", location); - } - duration = calculateDuration(startDateTime, endDateTime); - } - return { - Subject: subject, - Location: location, - StartDate: startDateTime, - EndDate: endDateTime, - RefrrlSeqNum: this.UniqueId, - Body: body, - IsHTML: isHTML, - Duration: duration, - }; - }, - }, - data() { - return { - workOrderNumber: store.getters.order.workOrderNumber, - }; }, methods: { arePagePrerequisitesValid() { diff --git a/src/fmg-components/add-vaps-modal-buttons/add-vaps-button/add-vaps-button.vue b/src/layouts/payment-method/add-vaps-modal-buttons/add-vaps-button/add-vaps-button.vue similarity index 100% rename from src/fmg-components/add-vaps-modal-buttons/add-vaps-button/add-vaps-button.vue rename to src/layouts/payment-method/add-vaps-modal-buttons/add-vaps-button/add-vaps-button.vue diff --git a/src/layouts/payment-method/add-vaps-modal-buttons/add-vaps-modal-buttons.vue b/src/layouts/payment-method/add-vaps-modal-buttons/add-vaps-modal-buttons.vue new file mode 100644 index 000000000..3fc426d63 --- /dev/null +++ b/src/layouts/payment-method/add-vaps-modal-buttons/add-vaps-modal-buttons.vue @@ -0,0 +1,164 @@ + + + diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 15f066bc7..08ee3565e 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -42,12 +42,10 @@
+ vapsTilesCmsName="VapsProductTiles" /> - { @@ -397,7 +385,6 @@ export default { cart, alert, addVapsModalButtons, - contentGroupModal, paymentMethodQuestion, }, }; diff --git a/src/layouts/payment-pia-return/payment-pia-return.vue b/src/layouts/payment-pia-return/payment-pia-return.vue index ec2ecd1c0..e3e2a84fc 100644 --- a/src/layouts/payment-pia-return/payment-pia-return.vue +++ b/src/layouts/payment-pia-return/payment-pia-return.vue @@ -18,13 +18,7 @@ export default { name: "payment-pia-return", async mounted() { this.$refs.loadingModal.showModal(); - // from paypal const piaError = getQuerystringParameter(queryStrings.ERROR); - const token = getQuerystringParameter(queryStrings.TOKEN); - const payerId = getQuerystringParameter(queryStrings.PAYERID); - - // from credit card - const subscriptionID = getQuerystringParameter(queryStrings.SUBSCRIPTIONID); if (piaError) { console.log("Error during payment: " + piaError); @@ -35,15 +29,16 @@ export default { ); this.$router.navigateWithoutSaving(this.navigationScenarios.PIA_ERROR, this.$route); } else { - if (token && payerId) { - await this.processPaypalResponse(); - } else { - if (subscriptionID) { - await this.processCreditCardResponse(subscriptionID); - } else { - console.log( - "Error during payment: " + token + " : " + payerId + " : " + subscriptionID - ); + switch (store.getters.order.payment.piaType) { + case "cc": + case "ap": + await this.processCreditCardResponse(); + break; + case "pp": + await this.processPaypalResponse(); + break; + default: + console.log("Unknown Pia type: " + store.getters.order.payment.piaType); baseMixin.methods.dispatchStoreAction( storeActions.SAVE_PIA_ERROR_CODE, piaError, @@ -53,7 +48,6 @@ export default { this.navigationScenarios.PIA_ERROR, this.$route ); - } } } }, @@ -62,12 +56,16 @@ export default { return true; }, async processPaypalResponse() { + const token = getQuerystringParameter(queryStrings.TOKEN); + const payerId = getQuerystringParameter(queryStrings.PAYERID); baseMixin.methods.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false); baseMixin.methods.dispatchStoreAction(storeActions.SAVE_WORK_ORDER_FLAG, true, false); + baseMixin.methods.dispatchStoreAction(storeActions.SAVE_PAYPAL_TOKEN, token, false); await this.saveAndSubmitWorkOrder(); }, - async processCreditCardResponse(subscriptionID) { + async processCreditCardResponse() { + const subscriptionID = getQuerystringParameter(queryStrings.SUBSCRIPTIONID); baseMixin.methods.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false); baseMixin.methods.dispatchStoreAction(storeActions.SAVE_WORK_ORDER_FLAG, true, false); diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index 704ad007d..ff1961465 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -9,7 +9,7 @@
- +