Merge pull request #918 from Safelite/bug/SSR-2004
New bailout for errors in vehicle lookup on vehicle-selection page
This commit is contained in:
commit
dd6ba9b00a
5 changed files with 21 additions and 8 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ export default {
|
|||
return this.navigateForward();
|
||||
}
|
||||
|
||||
this.mainStore.setBailout(bailoutMessage.vehicleLookupError(
|
||||
this.mainStore.setBailout(bailoutMessage.vehicleVinLookupError(
|
||||
vehicle.vin,
|
||||
vehicleLookupResponse.data
|
||||
));
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue