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/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, 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 )); 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() {