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,
|
Unknown: 0,
|
||||||
SaveSessionError: 1,
|
SaveSessionError: 1,
|
||||||
VehicleNotFound: 2,
|
VehicleNotFound: 2,
|
||||||
VehicleLookupError: 3,
|
VehicleVinLookupError: 3,
|
||||||
CoverageStatementInvalidState: 4,
|
CoverageStatementInvalidState: 4,
|
||||||
DoNotSeeMyShop: 5,
|
DoNotSeeMyShop: 5,
|
||||||
PricingResponseError: 6,
|
PricingResponseError: 6,
|
||||||
|
|
@ -11,7 +11,8 @@ const bailoutCode = Object.freeze({
|
||||||
HeavyTruckVehicle: 9,
|
HeavyTruckVehicle: 9,
|
||||||
NoPartsAvailable: 10,
|
NoPartsAvailable: 10,
|
||||||
PartsServiceError: 11,
|
PartsServiceError: 11,
|
||||||
SafeliteNotTheProvider: 12
|
SafeliteNotTheProvider: 12,
|
||||||
|
VehicleYMMSLookupError: 13
|
||||||
});
|
});
|
||||||
|
|
||||||
export default bailoutCode;
|
export default bailoutCode;
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,8 @@ const bailoutMessage = Object.freeze({
|
||||||
code: bailoutCode.VehicleNotFound,
|
code: bailoutCode.VehicleNotFound,
|
||||||
message: `Failed to find vehicle in system with vin: ${vin}`
|
message: `Failed to find vehicle in system with vin: ${vin}`
|
||||||
}),
|
}),
|
||||||
vehicleLookupError: (vin, error) => ({
|
vehicleVinLookupError: (vin, error) => ({
|
||||||
code: bailoutCode.VehicleLookupError,
|
code: bailoutCode.VehicleVinLookupError,
|
||||||
message: `An error occurred looking up Vin: ${vin}. Error: ${getItemData(error)}`
|
message: `An error occurred looking up Vin: ${vin}. Error: ${getItemData(error)}`
|
||||||
}),
|
}),
|
||||||
coverageStatementInvalidState: () => ({
|
coverageStatementInvalidState: () => ({
|
||||||
|
|
@ -64,7 +64,11 @@ const bailoutMessage = Object.freeze({
|
||||||
SafeliteNotTheProvider: () => ({
|
SafeliteNotTheProvider: () => ({
|
||||||
code: bailoutCode.SafeliteNotTheProvider,
|
code: bailoutCode.SafeliteNotTheProvider,
|
||||||
message: 'User selected to continue a referral where a TPA shop was previously selected.'
|
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;
|
export default bailoutMessage;
|
||||||
|
|
|
||||||
|
|
@ -279,14 +279,14 @@ describe('policy-vehicles.vue', () => {
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.mainStore.applicationUser.pageData[issPageValues.BAILOUT_PAGE] = {
|
wrapper.vm.mainStore.applicationUser.pageData[issPageValues.BAILOUT_PAGE] = {
|
||||||
'bailout-page': {
|
'bailout-page': {
|
||||||
bailoutCode: bailoutCode.VehicleLookupError
|
bailoutCode: bailoutCode.VehicleVinLookupError
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
await wrapper.vm.forwardButtonAction();
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
// eslint-disable-next-line max-len
|
// 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(
|
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
|
||||||
navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT,
|
navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT,
|
||||||
undefined,
|
undefined,
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ export default {
|
||||||
return this.navigateForward();
|
return this.navigateForward();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mainStore.setBailout(bailoutMessage.vehicleLookupError(
|
this.mainStore.setBailout(bailoutMessage.vehicleVinLookupError(
|
||||||
vehicle.vin,
|
vehicle.vin,
|
||||||
vehicleLookupResponse.data
|
vehicleLookupResponse.data
|
||||||
));
|
));
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ import settleAllPromises from '@/helpers/layout-helper';
|
||||||
import { Form, defineRule } from 'vee-validate';
|
import { Form, defineRule } from 'vee-validate';
|
||||||
import { required } from '@/helpers/validation-rules';
|
import { required } from '@/helpers/validation-rules';
|
||||||
import errorMessages from '@/constants/error-messages';
|
import errorMessages from '@/constants/error-messages';
|
||||||
|
import bailoutMessage from '@/constants/bailoutMessage';
|
||||||
|
|
||||||
// define validation rules
|
// define validation rules
|
||||||
defineRule('year-required', required(errorMessages.YEAR_REQUIRED));
|
defineRule('year-required', required(errorMessages.YEAR_REQUIRED));
|
||||||
|
|
@ -207,6 +208,13 @@ export default {
|
||||||
this.navigationScenarios.CLICKED_FORWARD,
|
this.navigationScenarios.CLICKED_FORWARD,
|
||||||
this.$route
|
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() {
|
async updateYearValues() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue