diff --git a/src/common-components/funnel-footer/funnel-footer.vue b/src/common-components/funnel-footer/funnel-footer.vue index 43b471e81..2a6119681 100644 --- a/src/common-components/funnel-footer/funnel-footer.vue +++ b/src/common-components/funnel-footer/funnel-footer.vue @@ -15,10 +15,6 @@ data-bs-target="#footerModal" data-bs-dismiss="modal" /> - -
- -
@@ -189,10 +188,8 @@ export default { false ); - // TODO KO delete after quote MVP - this.navigateForward(matchedParts, null, this.shouldGoToHeritageQuote); // Navigate to the next page - // this.navigateForward(matchedParts); + this.navigateForward(matchedParts); }, LoadInitialPartsData() { diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index dbe7a9115..bba6cbcf3 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -100,7 +100,6 @@ cmsWidgetName="FunnelFooterWidget" ref="funnelFooter" :isForwardActionDisabled="!meta.valid" - @tempButtonClicked="() => handleTempButtonClicked(this)" @back-clicked="backButtonAction" @ForwardClicked="forwardButtonAction" /> @@ -315,6 +314,7 @@ export default { { zipCode: this.serviceZipCode, state: resultMap.zipCodeData.state, + zipCodeCtu: resultMap.zipCodeData.zipCodeCtu, }, false ); @@ -347,6 +347,7 @@ export default { { zipCode: this.serviceZipCode, state: zipCodeData.state, + zipCodeCtu: zipCodeData.zipCodeCtu, }, false ); diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index a72bc0186..ef9c2e54e 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -60,6 +60,7 @@ export default { isValid: serviceZipValidationResponse.data.isValid, isServiceable: serviceZipValidationResponse.data.isServiceable, state: serviceZipValidationResponse.data.state, + zipCodeCtu: serviceZipValidationResponse.data.zipCodeCtu, }; }, getTierOnePackagePrice(lineItems) { diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js index 75f042ff4..bef4f6545 100644 --- a/src/mixins/vehicle-questions-mixin.js +++ b/src/mixins/vehicle-questions-mixin.js @@ -7,12 +7,6 @@ import baseMixin from "@/mixins/base-mixin.js"; import store from "@/store"; export default { - data() { - // TODO KO DELETE AFTER QUOTE MVP - return { - shouldGoToHeritageQuote: false, - }; - }, methods: { hasPartQuestions(partsOrQuestions) { return partsOrQuestions?.some((pq) => pq.partQuestions?.length > 0); @@ -353,9 +347,8 @@ export default { } } }, - // TODO KO Delete `shouldGoToHeritageQuote` // Can't use `this` because navigateForward is also called from vin-pages-mixin - async navigateForward(partsOrQuestions, vm, shouldGoToHeritageQuote) { + async navigateForward(partsOrQuestions, vm) { const self = vm ?? this; const currentPage = self.$route.query.fmgPage; @@ -450,13 +443,15 @@ export default { self.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts); const payment = store.getters.payment; - shouldGoToHeritageQuote || - (payment.isInsurance && payment.insuranceCoverage.isVerified) - ? navigateToHeritageFunnel({ loadingModal: self.$refs.loadingModal }) - : self.$router.navigateWithSaving( - self.navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, - self.$route - ); + + if (payment.isInsurance && payment.insuranceCoverage.isVerified) { + navigateToHeritageFunnel({ loadingModal: self.$refs.loadingModal }); + } else { + self.$router.navigateWithSaving( + self.navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, + self.$route + ); + } } }, // Can't use `this` because navigateForward is also called from quote @@ -530,9 +525,5 @@ export default { self.$router.navigateWithoutSaving(backNavigationScenario, self.$route); }, - // TODO KO delete this after quote mvp - async handleTempButtonClicked(vm) { - this.shouldGoToHeritageQuote = true; - }, }, }; diff --git a/src/mixins/vin-pages-mixin.js b/src/mixins/vin-pages-mixin.js index ca8c66369..e6e41aad5 100644 --- a/src/mixins/vin-pages-mixin.js +++ b/src/mixins/vin-pages-mixin.js @@ -4,12 +4,6 @@ import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin"; import { saveSession } from "@/helpers/heritage-integration/order-helper.js"; export default { - data() { - // TODO KO DELETE AFTER QUOTE MVP - return { - shouldGoToHeritageQuote: false, - }; - }, methods: { async navigateForwardWithSingleCarMatch() { // If we have not already saved a session, we need to save one now before the lengthy call to getPartsOrQuestions @@ -20,17 +14,7 @@ export default { const result = await this.dispatchStoreAction(storeActions.GET_PARTS_OR_QUESTIONS); const partsOrQuestions = result.data.partsOrQuestions; - // TODO KO delete `this.shouldGoToHeritageQuote` - vehicleQuestionsMixin.methods.navigateForward( - partsOrQuestions, - this, - this.shouldGoToHeritageQuote - ); - }, - // TODO KO delete this after quote mvp - async handleTempButtonClicked(vm) { - this.shouldGoToHeritageQuote = true; - await vm.forwardButtonAction(); + vehicleQuestionsMixin.methods.navigateForward(partsOrQuestions, this); }, }, }; diff --git a/src/store/index.js b/src/store/index.js index c6bf967ed..8684f513a 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -41,6 +41,7 @@ const getDefaultState = () => { city: null, state: null, zipCode: null, + zipCodeCtu: null, }, customer: { emailAddress: null, @@ -187,12 +188,6 @@ export const mutations = { updateRegistrationZipCode(state, registrationZipCode) { state.order.vehicle.registration.zipCode = registrationZipCode; }, - updateServiceLocationZipCode(state, serviceLocationZip) { - state.order.serviceLocation.zipCode = serviceLocationZip; - }, - updateServiceLocationState(state, serviceLocationState) { - state.order.serviceLocation.state = serviceLocationState; - }, updateRegistrationFirstName(state, firstName) { state.order.vehicle.registration.firstName = firstName; }, @@ -229,6 +224,7 @@ export const mutations = { state.order.serviceLocation.city = serviceLocationInfo.city; state.order.serviceLocation.state = serviceLocationInfo.state; state.order.serviceLocation.zipCode = serviceLocationInfo.zipCode; + state.order.serviceLocation.zipCodeCtu = serviceLocationInfo.zipCodeCtu; }, // applicationUser MUTATIONS @@ -355,7 +351,9 @@ export const mutations = { (state.order.serviceLocation.city = sessionInformation.order.serviceLocation.city), (state.order.serviceLocation.state = sessionInformation.order.serviceLocation.state), (state.order.serviceLocation.zipCode = - sessionInformation.order.serviceLocation.zipCode); + sessionInformation.order.serviceLocation.zipCode), + (state.order.serviceLocation.zipCodeCtu = + sessionInformation.order.serviceLocation.zipCodeCtu); state.order.payment.isInsurance = sessionInformation.order.payment.isInsurance; state.order.payment.insuranceCoverage.isVerified = @@ -906,14 +904,14 @@ export const actions = { const carId = context.getters.vehicle.carId; const isRepair = context.getters.damage.isRepair; const numberOfChips = context.getters.damage.numberOfChips; - const parentAccountNumber = context.getters.order.accountNumber.toString(); + return globalMethods.callHttpClient({ method: endpoints.GetSupportingItems.method, endpoint: endpoints.GetSupportingItems.url, payload: { carId: carId, serviceType: isRepair ? "Repair" : "Replace", - parentAccountNumber: parentAccountNumber, + parentAccountNumber: applicationConfig.CASH_ACCOUNT_NUMBER, parts: glassPartsArray, numberOfRepairChips: isRepair ? numberOfChips : 0, }, @@ -1010,13 +1008,14 @@ export const actions = { }, isInsurance: order.payment.isInsurance ?? false, }, - accountNumber: order.accountNumber?.toString(), + accountNumber: order.accountNumber, providerNumber: "", serviceLocation: { streetAddress: order.serviceLocation.address, city: order.serviceLocation.city, state: order.serviceLocation.state, zipCode: order.serviceLocation.zipCode, + zipCodeCtu: order.serviceLocation.zipCodeCtu, }, existingPromoCode: null, referralCorrelationId: order.referralCorrelationId, diff --git a/src/store/store.spec.js b/src/store/store.spec.js index 0a7c97c29..06f0cb746 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -312,6 +312,28 @@ describe("Mutations", () => { // Assert expect(storeState.applicationUser.triggeredSiteEntry).toEqual(true); }); + + it("updateServiceLocation, should set serviceLocation in state", () => { + // Arrange + const storeState = state; + const serviceLocation = { + address: "123 Test Lane", + city: "Columbus", + zipCode: "43212", + state: "OH", + zipCodeCtu: "01820", + }; + + // Act + mutations.updateServiceLocation(storeState, serviceLocation); + + // Assert + expect(storeState.order.serviceLocation.address).toEqual("123 Test Lane"); + expect(storeState.order.serviceLocation.city).toEqual("Columbus"); + expect(storeState.order.serviceLocation.zipCode).toEqual("43212"); + expect(storeState.order.serviceLocation.state).toEqual("OH"); + expect(storeState.order.serviceLocation.zipCodeCtu).toEqual("01820"); + }); }); describe("Actions", () => { @@ -357,13 +379,13 @@ describe("Actions", () => { // Act globalMethods.callHttpClient.mockImplementation(() => { - return Promise.resolve({ data: { carId: "C00000001" } }); + return Promise.resolve({ data: { carId: "C0000001" } }); }); // Assert const response = await actions.lookupVehicleByVin(context, "12345678901234567"); - expect(response.data).toEqual({ carId: "C00000001" }); + expect(response.data).toEqual({ carId: "C0000001" }); }); it("lookupVinByPlate action, should return car data", async () => { @@ -467,13 +489,25 @@ describe("Actions", () => { // Act globalMethods.callHttpClient.mockImplementation(() => { - return Promise.resolve({ data: "43201" }); + return Promise.resolve({ + data: { + isValid: true, + isServiceable: true, + state: "OH", + zipCodeCtu: "01820", + }, + }); }); - const response = await actions.validateZip(context, "C00000000"); + const response = await actions.validateZip(context, "43212"); // Assert - expect(response.data).toEqual("43201"); + expect(response.data).toEqual({ + isValid: true, + isServiceable: true, + state: "OH", + zipCodeCtu: "01820", + }); }); it("resetDamageAndDependencies action", async () => { @@ -866,18 +900,30 @@ describe("Actions", () => { ); }); - it("saveServiceLocation, should call mutation", () => { + it("saveServiceLocation, should call mutation and save service address to state", () => { // Arrange const context = state; const commit = jest.fn(); - context.commit = commit; + const serviceLocation = { + address: "123 Test Lane", + city: "Columbus", + zipCode: "43212", + state: "OH", + zipCodeCtu: "01820", + }; + // Act - actions.saveServiceLocation(context, { zipCode: "80020" }); + actions.saveServiceLocation(context, serviceLocation); // Assert - expect(commit).toBeCalledWith(storeMutations.UPDATE_SERVICE_LOCATION, { zipCode: "80020" }); + expect(commit).toBeCalledWith(storeMutations.UPDATE_SERVICE_LOCATION, serviceLocation); + expect(state.order.serviceLocation.address).toEqual("123 Test Lane"); + expect(state.order.serviceLocation.city).toEqual("Columbus"); + expect(state.order.serviceLocation.zipCode).toEqual("43212"); + expect(state.order.serviceLocation.state).toEqual("OH"); + expect(state.order.serviceLocation.zipCodeCtu).toEqual("01820"); }); it("saveGlassParts, should call mutation", () => {