From 91e2726aa3ce19f1f0f5cae51dcf7eda0ac2ba49 Mon Sep 17 00:00:00 2001 From: Alex Humphries Date: Thu, 19 Dec 2024 10:58:29 -0500 Subject: [PATCH 1/3] New bailout for errors in vehicle lookup on vehicle-selection page --- src/constants/bailoutCode.js | 5 +++-- src/constants/bailoutMessage.js | 10 +++++++--- src/layouts/vehicle-selection/vehicle-selection.vue | 8 ++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/constants/bailoutCode.js b/src/constants/bailoutCode.js index bd0a4b49..fb1ac071 100644 --- a/src/constants/bailoutCode.js +++ b/src/constants/bailoutCode.js @@ -2,7 +2,7 @@ const bailoutCode = Object.freeze({ Unknown: 0, SaveSessionError: 1, VehicleNotFound: 2, - VehicleLookupError: 3, + VehicleVinLookupError: 3, CoverageStatementInvalidState: 4, DoNotSeeMyShop: 5, PricingResponseError: 6, @@ -11,7 +11,8 @@ const bailoutCode = Object.freeze({ HeavyTruckVehicle: 9, NoPartsAvailable: 10, PartsServiceError: 11, - SafeliteNotTheProvider: 12 + SafeliteNotTheProvider: 12, + VehicleYMMSLookupError: 13 }); export default bailoutCode; diff --git a/src/constants/bailoutMessage.js b/src/constants/bailoutMessage.js index e4fa6b84..e26ec247 100644 --- a/src/constants/bailoutMessage.js +++ b/src/constants/bailoutMessage.js @@ -25,8 +25,8 @@ const bailoutMessage = Object.freeze({ code: bailoutCode.VehicleNotFound, message: `Failed to find vehicle in system with vin: ${vin}` }), - vehicleLookupError: (vin, error) => ({ - code: bailoutCode.VehicleLookupError, + vehicleVinLookupError: (vin, error) => ({ + code: bailoutCode.VehicleVinLookupError, message: `An error occurred looking up Vin: ${vin}. Error: ${getItemData(error)}` }), coverageStatementInvalidState: () => ({ @@ -64,7 +64,11 @@ const bailoutMessage = Object.freeze({ SafeliteNotTheProvider: () => ({ code: bailoutCode.SafeliteNotTheProvider, message: 'User selected to continue a referral where a TPA shop was previously selected.' - }) + }), + vehicleYMMSLookupError: (year, make, model, style, error) => ({ + code: bailoutCode.VehicleYMMSLookupError, + message: `An error occurred looking up Year: ${year}, Make: ${make}, Model: ${model}, Style: ${style}. Error: ${getItemData(error)}` + }), }); export default bailoutMessage; diff --git a/src/layouts/vehicle-selection/vehicle-selection.vue b/src/layouts/vehicle-selection/vehicle-selection.vue index bbb4607e..4f4f5ffa 100644 --- a/src/layouts/vehicle-selection/vehicle-selection.vue +++ b/src/layouts/vehicle-selection/vehicle-selection.vue @@ -88,6 +88,7 @@ import settleAllPromises from '@/helpers/layout-helper'; import { Form, defineRule } from 'vee-validate'; import { required } from '@/helpers/validation-rules'; import errorMessages from '@/constants/error-messages'; +import bailoutMessage from '@/constants/bailoutMessage'; // define validation rules defineRule('year-required', required(errorMessages.YEAR_REQUIRED)); @@ -207,6 +208,13 @@ export default { this.navigationScenarios.CLICKED_FORWARD, this.$route ); + }, + (error) => { + this.mainStore.setBailout(bailoutMessage.vehicleYMMSLookupError(this.mainStore.vehicle.year, this.mainStore.vehicle.make, this.mainStore.vehicle.model, this.mainStore.vehicle.style, error)); + this.$router.navigate( + this.navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT, + this.$route + ); }); }, async updateYearValues() { From 4077b2dfefa4ad056c5f5f439982115c887ba2d9 Mon Sep 17 00:00:00 2001 From: Alex Humphries Date: Thu, 19 Dec 2024 11:25:45 -0500 Subject: [PATCH 2/3] Update bailout on policy-vehicles to properly use tweaked message --- src/layouts/policy-vehicles/policy-vehicles.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/policy-vehicles/policy-vehicles.vue b/src/layouts/policy-vehicles/policy-vehicles.vue index cc35fd73..65cc7ea6 100644 --- a/src/layouts/policy-vehicles/policy-vehicles.vue +++ b/src/layouts/policy-vehicles/policy-vehicles.vue @@ -200,7 +200,7 @@ export default { return this.navigateForward(); } - this.mainStore.setBailout(bailoutMessage.vehicleLookupError( + this.mainStore.setBailout(bailoutMessage.vehicleVinLookupError( vehicle.vin, vehicleLookupResponse.data )); From 5655494e4039021fac46eb436f62faf8699a2076 Mon Sep 17 00:00:00 2001 From: Alex Humphries Date: Thu, 19 Dec 2024 11:38:33 -0500 Subject: [PATCH 3/3] Update test to use tweaked bailout code/message --- src/layouts/policy-vehicles/policy-vehicles.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/layouts/policy-vehicles/policy-vehicles.spec.js b/src/layouts/policy-vehicles/policy-vehicles.spec.js index 8b727434..e9df4583 100644 --- a/src/layouts/policy-vehicles/policy-vehicles.spec.js +++ b/src/layouts/policy-vehicles/policy-vehicles.spec.js @@ -279,14 +279,14 @@ describe('policy-vehicles.vue', () => { // Act wrapper.vm.mainStore.applicationUser.pageData[issPageValues.BAILOUT_PAGE] = { 'bailout-page': { - bailoutCode: bailoutCode.VehicleLookupError + bailoutCode: bailoutCode.VehicleVinLookupError } }; await wrapper.vm.forwardButtonAction(); // Assert // eslint-disable-next-line max-len - expect(wrapper.vm.mainStore.setBailout).toHaveBeenCalledWith(bailoutMessage.vehicleLookupError(vin, lookupReturnValue.data)); + expect(wrapper.vm.mainStore.setBailout).toHaveBeenCalledWith(bailoutMessage.vehicleVinLookupError(vin, lookupReturnValue.data)); expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith( navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT, undefined,