From 9142f027621560d90f36b5c3b2fe730129194447 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Thu, 12 Sep 2024 11:36:52 -0400 Subject: [PATCH 1/6] CSR-2130 CSR-2130 send to pia-return for cc & apple pay decline --- src/constants/application-config.js | 5 +++++ src/layouts/payment/payment.vue | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/constants/application-config.js b/src/constants/application-config.js index 6a747617f..e49426afb 100644 --- a/src/constants/application-config.js +++ b/src/constants/application-config.js @@ -24,6 +24,11 @@ const applicationConfig = { "//" + location.host + "/fmg/?fmgPage=payment-method&src=concept-funnel", + PIA_ERROR_URL: + location.protocol + + "//" + + location.host + + "/fmg/?fmgPage=payment-pia-return&src=concept-funnel", CONFIRMATION_URL: location.protocol + "//" + location.host + "/fmg/?fmgPage=confirmation", GOOGLE_CALENDAR: "https://www.google.com/calendar/render?action=TEMPLATE", YAHOO_CALENDAR: "https://calendar.yahoo.com/?v=60", diff --git a/src/layouts/payment/payment.vue b/src/layouts/payment/payment.vue index 5dc103c68..64989ec66 100644 --- a/src/layouts/payment/payment.vue +++ b/src/layouts/payment/payment.vue @@ -171,7 +171,7 @@ - + @@ -235,6 +235,7 @@ export default { checkoutUrl: externalUrls.SAFELITE_HOP, piaResponseUrl: applicationConfig.PIA_RESPONSE_URL, piaCancelUrl: applicationConfig.PIA_CANCEL_URL, + piaErrorUrl: applicationConfig.PIA_ERROR_URL, paymentType: this.getPaymentType(), authToken: "", authSignature: "", From a4a25ad547e73b66b3098aea6295f21797ba24f8 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Thu, 12 Sep 2024 15:44:15 -0400 Subject: [PATCH 2/6] CSR-2179: remove unnecessary experiment logging from quote --- src/layouts/quote/quote.vue | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 3d539e630..d6288735e 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -138,9 +138,6 @@ export default { async beforeRouteEnter(to, from, next) { // Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); - const experimentForLogging = store.getters.applicationUser.experiments.find( - (e) => e.universeName === experimentUniverses.RECAL_PRICE_REMOVAL - ); const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging( storeActions.GET_WIPERS, { @@ -208,33 +205,6 @@ export default { ...servicePackageDiscountPart, ]; - // If the recal experiment is found then log the experiment exposure. - const isRecalibrationOnOrder = containsLineItemWithPartType( - partTypeStrings.RECALIBRATION, - availableLineItems - ); - const canSafeliteRecalibrate = nullSafeGlassParts.some((glassPart) => { - return glassPart.partType === "WINDSHIELD" && glassPart.canSafeliteRecalibrate; - }); - if ( - experimentForLogging !== undefined && - isRecalibrationOnOrder && - canSafeliteRecalibrate - ) { - // Log experiment exposure - baseMixin.methods.dispatchStoreActionWithLogging( - storeActions.LOG_EXPERIMENT_EXPOSURE, - { - userId: getUserIdValue(), - sessionKey: getSessionKeyValue(), - pageName: to.query.fmgPage, - experiment: experimentForLogging, - }, - "quote", - false - ); - } - // When calling pricing from the quote page, always use the cash parent account baseMixin.methods.dispatchStoreAction( storeActions.SAVE_PARENT_ACCOUNT_NUMBER, From 7cfcf07dd675f7c955a095ef46016b2157e17bf0 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Thu, 12 Sep 2024 15:46:49 -0400 Subject: [PATCH 3/6] CSR-2179: pass experiment boolean via prop from /quote & refactor --- src/layouts/quote/quote.vue | 9 +++++++-- .../service-package-question.vue | 11 ++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index d6288735e..660681da1 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -31,6 +31,8 @@ groupName="ServicePackageQuestion" :availableLineItems="availableLineItems" :isInsuranceSelected="isInsuranceSelected" + :isRecalibrationOnOrder="isRecalibrationOnOrder" + :shouldHideRecalibration="shouldHideRecalibration" @vapsItemsSelected="vapsItemsSelectedAction" @servicePackageDiscountSelected="servicePackageDiscountSelectedAction" :servicePackage="servicePackage" @@ -336,10 +338,13 @@ export default { return recalSettingValue; }, showAfterpayBanner() { - return !this.isInsuranceSelected && (!this.isRecalibrationOnOrder || !this.shouldHideRecalibration) + return ( + !this.isInsuranceSelected && + (!this.isRecalibrationOnOrder || !this.shouldHideRecalibration) + ); }, showRecalDisclaimer() { - return this.isRecalibrationOnOrder && this.shouldHideRecalibration + return this.isRecalibrationOnOrder && this.shouldHideRecalibration; }, }, methods: { diff --git a/src/layouts/quote/service-package-question/service-package-question.vue b/src/layouts/quote/service-package-question/service-package-question.vue index 93d8ff79b..4ef027ad5 100644 --- a/src/layouts/quote/service-package-question/service-package-question.vue +++ b/src/layouts/quote/service-package-question/service-package-question.vue @@ -49,6 +49,8 @@ export default { availableLineItems: null, activePromos: null, servicePackage: null, + isRecalibrationOnOrder: Boolean, + shouldHideRecalibration: Boolean, }, data() { return { @@ -141,12 +143,6 @@ export default { })); return modifiedAnswers; }, - isRecalibrationOnOrder() { - return containsLineItemWithPartType( - partTypeStrings.RECALIBRATION, - this.nullSafeAvailableLineItems - ); - }, isServicePackageDiscountOnOrder() { return containsLineItemWithPartType( partTypeStrings.SERVICE_PACKAGE_DISCOUNT, @@ -242,7 +238,8 @@ export default { }, getPackagePrice(packageName, { discountedPrice = false, servicePackageDiscount = false }) { var lineItemsToPrice = [...this.nullSafeAvailableLineItems]; - if (this.isRecalibrationOnOrder) { + + if (this.isRecalibrationOnOrder && this.shouldHideRecalibration) { lineItemsToPrice = lineItemsToPrice.filter((item) => { return item.partType != partTypeStrings.RECALIBRATION; }); From 81586b0e4f0b339a36b64bdbf29560cd55f445d7 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Thu, 12 Sep 2024 15:48:39 -0400 Subject: [PATCH 4/6] CSR-2179: prettier and reformat fixes --- src/fmg-components/cart/cart.vue | 14 ++++++++------ src/layouts/confirmation/confirmation.vue | 4 +--- src/layouts/payment-method/payment-method.vue | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index d0f4d6ed4..e841d8849 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -305,9 +305,9 @@ export default { if (!this.lineItems || this.lineItems.length < 1) return; const lineItemsCopy = deepClone(this.lineItems); - lineItemsCopy.supportingItems = lineItemsCopy.supportingItems ? baseMixin.methods.filterOutRecalibration( - lineItemsCopy?.supportingItems - ) : []; + lineItemsCopy.supportingItems = lineItemsCopy.supportingItems + ? baseMixin.methods.filterOutRecalibration(lineItemsCopy?.supportingItems) + : []; return lineItemsCopy; }, showCoverageAsPending() { @@ -438,13 +438,15 @@ export default { packagePrice() { let packagePrice = 0; - if (!this.isInsurance && this.shouldHideRecalibration) { // Update packagePrice if Cash only && is part of RemoveRecal experiment + if (!this.isInsurance && this.shouldHideRecalibration) { + // Update packagePrice if Cash only && is part of RemoveRecal experiment packagePrice = baseMixin.methods.getTierOnePackagePrice( baseMixin.methods.filterOutFees( baseMixin.methods.filterOutRecalibration(this.availableLineItems) // Strip out recal before filtering out fees ) ); - } else if (!this.showCoverageAsVerified && !this.showCoverageAsPending) { // Update packagePrice if is verified insurance OR if Cash && not part of RemoveRecal experiment + } else if (!this.showCoverageAsVerified && !this.showCoverageAsPending) { + // Update packagePrice if is verified insurance OR if Cash && not part of RemoveRecal experiment packagePrice = baseMixin.methods.getTierOnePackagePrice( baseMixin.methods.filterOutFees(this.availableLineItems) ); @@ -1001,7 +1003,7 @@ export default { if (!this.lineItems || this.lineItems.length < 1) return; return this.isInsurance || !this.shouldHideRecalibration ? baseMixin.methods.getSubTotal(this.lineItems) // calculate with recal (if on order) - : baseMixin.methods.getSubTotal(this.lineItemsWithoutRecal); // calculated without recal + : baseMixin.methods.getSubTotal(this.lineItemsWithoutRecal); // calculate without recal }, salesTax() { if (!this.lineItems || this.lineItems.length < 1) return; diff --git a/src/layouts/confirmation/confirmation.vue b/src/layouts/confirmation/confirmation.vue index df3a3dfe7..acb97cba2 100644 --- a/src/layouts/confirmation/confirmation.vue +++ b/src/layouts/confirmation/confirmation.vue @@ -170,9 +170,7 @@ export default { }, computed: { shouldHideRecalibration() { - return this.getSettingValue( - experimentSettings.RECAL_PRICE_REMOVE - ); + return this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE); }, ShowCart() { if (this.isPia && this.submittedOrder?.settledTenderAmount == 0) { diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index ccf4e1524..85fb84a63 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -55,7 +55,9 @@ class="service-questions" />
-
+
Date: Mon, 16 Sep 2024 06:06:38 -0400 Subject: [PATCH 5/6] CSR-2179: update unit tests --- src/layouts/quote/quote.spec.js | 3 +++ .../service-package-question/service-package-question.spec.js | 1 + 2 files changed, 4 insertions(+) diff --git a/src/layouts/quote/quote.spec.js b/src/layouts/quote/quote.spec.js index 4f2ac213e..ca2bfd78e 100644 --- a/src/layouts/quote/quote.spec.js +++ b/src/layouts/quote/quote.spec.js @@ -750,7 +750,10 @@ function setupMocks({ customMountOptions }) { baseMixin.methods.ResetExternalParamsAndHideModal = jest.fn(); baseMixin.methods.isFormValid = jest.fn().mockReturnValue(true); mountOptions.global.mocks["$store"] = store; + store.getters.experimentSettings = "test value"; + mountOptions["attachTo"] = document.body; + const wrapper = shallowMount(quote, mountOptions); wrapper.vm.setCmsContent = jest.fn(); return { wrapper }; diff --git a/src/layouts/quote/service-package-question/service-package-question.spec.js b/src/layouts/quote/service-package-question/service-package-question.spec.js index 07d37ed19..a23d1ead6 100644 --- a/src/layouts/quote/service-package-question/service-package-question.spec.js +++ b/src/layouts/quote/service-package-question/service-package-question.spec.js @@ -475,6 +475,7 @@ describe("service-package-question.vue, matching business rules for package disp mockProps.availableLineItems.push(recalLineItem); mockProps.availableLineItems.push(driverFrontWiperLineItem); mockProps.availableLineItems.push(passengerFrontWiperLineItem); + mockProps.isRecalibrationOnOrder = true; Object.assign(processedCmsContent, mockProcessedCmsContent[packageNameKey]); const wrapper = setupMocks({ mountOptionsMockData: { From 8d73880b3fb6fbae6778f8dc08ec51c9691f05d1 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Mon, 16 Sep 2024 13:50:08 -0400 Subject: [PATCH 6/6] CSR-2102 CSR-2102 change order-items to a post. order-items now can price cash or insurance orders --- src/constants/endpoints.js | 2 +- src/store/index.js | 61 ++++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index 43abf149c..0c75258e9 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -130,7 +130,7 @@ const endpoints = { }, PriceOrderItems: { url: "/price/api/v1/price/order-items", - method: "GET", + method: "POST", }, ValidatePromo: { url: "/price/api/v1/price/order-promo", diff --git a/src/store/index.js b/src/store/index.js index 5c04398ac..9aac79a53 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -2413,14 +2413,6 @@ export const actions = { context, { payload: { availableLineItems, serviceZipCode, serviceZipCodeCtu }, pageNameToLog } ) { - const zipCodeToUse = serviceZipCode - ? serviceZipCode - : context.getters.order.serviceLocation.zipCode; - - const ctuToUse = serviceZipCodeCtu - ? serviceZipCodeCtu - : context.getters.order.serviceLocation.zipCodeCtu; - const flattenedLineItemsWithChildParts = getFlattenedArrayOfLineItemsWithChildParts(availableLineItems); @@ -2428,34 +2420,39 @@ export const actions = { partNumber: lineItem.partNumber, })); - const availableLineItemsFormattedForRequest = - buildQueryStringParameterFromArrayOfComplexObjects( - lineItemsWithOnlyPartNumbers, - "lineItems" - ); - - const vehicle = context.getters.order.vehicle; - - // TODO: Insurance pricing...`ParentAccountNumber=${context.getters.order.payment.parentAccountNumber}` - let queryString = - `ParentAccountNumber=${context.getters.order.payment.parentAccountNumber}` + - `&CTU=${ctuToUse}` + - `&CarId=${vehicle.carId}` + - `&Make=${vehicle.make}` + - `&Model=${vehicle.model}` + - `&Year=${vehicle.year}` + - `&EON=${context.getters.order.eon}` + - `&ZipCode=${zipCodeToUse}` + - `&${availableLineItemsFormattedForRequest}`; - - const lineItemServerData = context.getters.order.lineItems.serverData; - if (lineItemServerData) { - queryString += `&ServerData=${encodeURIComponent(lineItemServerData)}`; + const order = context.getters.order; + + var providerNumber = order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; + if (providerNumber.startsWith("00")) { + providerNumber = providerNumber.substring(1); } const response = await globalMethods.callHttpClient({ method: endpoints.PriceOrderItems.method, - endpoint: `${endpoints.PriceOrderItems.url}?${queryString}`, + endpoint: endpoints.PriceOrderItems.url, + payload: { + parentAccountNumber: order.payment?.parentAccountNumber, + billToAccountNumber: + order.payment?.billToAccountNumber ?? + applicationConfig.CASH_DEFAULT_BILL_TO_ACCOUNT_NUMBER, + providerNumber: providerNumber, + carId: order.vehicle.carId, + year: order.vehicle.year, + make: order.vehicle.make, + model: order.vehicle.model, + eon: order.eon, + state: order.serviceLocation?.state, + referralNumber: order.referralNumber, + referralSequenceNumber: order.referralSequenceNumber, + zipCode: order.serviceLocation?.zipCode, + serviceZipCode: serviceZipCode ?? order.serviceLocation?.zipCode, + referralDate: order.referralDate, + isReplacement: !order.damage.isRepair, + deductible: order.policy?.currentDeductible, + coverageStatus: order.payment?.insuranceCoverage?.coverageStatus, + lineItems: lineItemsWithOnlyPartNumbers, + serverData: order.lineItems.serverData ? order.lineItems.serverData : "", + }, logApiCall: true, pageNameToLog: pageNameToLog, });