CASH-2855: Bailout when required VIN is not found
This commit is contained in:
parent
2b0e07948e
commit
9e08617582
6 changed files with 131 additions and 10 deletions
|
|
@ -355,7 +355,15 @@ export default {
|
|||
}
|
||||
} else {
|
||||
// No VINS found.
|
||||
this.displayVinNotFoundAlert = true;
|
||||
const isVinLookupRequired = this.$store.getters.vehicle.vinRequired;
|
||||
if (isVinLookupRequired) {
|
||||
this.continueWithFailedLookup(
|
||||
this.customerQuestions,
|
||||
resultMap.serviceZipValidationResponse
|
||||
);
|
||||
} else {
|
||||
this.displayVinNotFoundAlert = true;
|
||||
}
|
||||
return this.$refs.navbar.removeLoader();
|
||||
}
|
||||
|
||||
|
|
@ -462,6 +470,28 @@ export default {
|
|||
this.displayVinLookupByHomeAddressNotAllowedAlert = false;
|
||||
this.displayNoServiceAlert = false;
|
||||
},
|
||||
async continueWithFailedLookup(customerQuestions, zipCodeValidationResponse) {
|
||||
// Save the entered customer questions and service zip code (if applicable) so that it can be used in the next page if needed
|
||||
await this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_CUSTOMER_DETAILS,
|
||||
{
|
||||
firstName: customerQuestions.firstName,
|
||||
lastName: customerQuestions.lastName,
|
||||
},
|
||||
false
|
||||
);
|
||||
await this.dispatchStoreAction(
|
||||
storeActions.SAVE_SERVICE_ZIP_CODE_INFO,
|
||||
{
|
||||
state: zipCodeValidationResponse.state,
|
||||
zipCode: this.serviceZipCode || this.customerQuestions.addressQuestions.zipCode,
|
||||
zipCodeCtu: zipCodeValidationResponse.zipCodeCtu,
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
this.navigateForwardWithSingleCarMatch();
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.attachCustomEvents();
|
||||
|
|
|
|||
|
|
@ -254,7 +254,12 @@ export default {
|
|||
resultMap.registrationZipValidationResponse.state
|
||||
).catch(() => {
|
||||
// No VIN found.
|
||||
this.displayVinNotFoundAlert = true;
|
||||
const isVinLookupRequired = this.$store.getters.vehicle.vinRequired;
|
||||
if (isVinLookupRequired) {
|
||||
this.continueWithFailedLookup(resultMap.serviceZipValidationResponse);
|
||||
} else {
|
||||
this.displayVinNotFoundAlert = true;
|
||||
}
|
||||
return this.$refs.navbar.removeLoader();
|
||||
});
|
||||
// If no VIN was found, stop processing after displaying alert
|
||||
|
|
@ -393,6 +398,18 @@ export default {
|
|||
this.displayInvalidZipAlert = false;
|
||||
this.displayNoServiceAlert = false;
|
||||
},
|
||||
async continueWithFailedLookup(zipCodeData) {
|
||||
await this.dispatchStoreAction(
|
||||
storeActions.SAVE_SERVICE_ZIP_CODE_INFO,
|
||||
{
|
||||
state: zipCodeData.state,
|
||||
zipCode: this.serviceZipCode || this.registrationZipCode,
|
||||
zipCodeCtu: zipCodeData.zipCodeCtu,
|
||||
},
|
||||
false
|
||||
);
|
||||
this.navigateForwardWithSingleCarMatch();
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.attachCustomEvents();
|
||||
|
|
|
|||
|
|
@ -11,9 +11,20 @@ jest.mock("@/store", () => ({
|
|||
commit: jest.fn(),
|
||||
dispatch: jest.fn(),
|
||||
getters: {
|
||||
applicationUser: {
|
||||
bailoutCode: null,
|
||||
},
|
||||
externalParameterState: {
|
||||
isExternalParameter: false,
|
||||
},
|
||||
emailOrSms: "email",
|
||||
vehicle: {
|
||||
year: 2019,
|
||||
carId: "C00000",
|
||||
vin: null,
|
||||
vinRequired: false,
|
||||
isBigTruck: false,
|
||||
canSafeliteService: true,
|
||||
},
|
||||
order: {
|
||||
serviceLocation: {
|
||||
|
|
@ -23,6 +34,11 @@ jest.mock("@/store", () => ({
|
|||
emailAddress: "builddigitaltest@safelite.com",
|
||||
},
|
||||
referralNumber: "666666",
|
||||
vehicle: {
|
||||
make: null,
|
||||
model: null,
|
||||
year: null,
|
||||
},
|
||||
},
|
||||
payment: {
|
||||
insuranceCoverage: {
|
||||
|
|
|
|||
|
|
@ -93,7 +93,8 @@
|
|||
vinPopulatedOnPageLoad &&
|
||||
!isInsuranceVerified &&
|
||||
!displayInvalidZipAlert &&
|
||||
!displayNonServiceableZipAlert
|
||||
!displayNonServiceableZipAlert &&
|
||||
!requiredVinNotFound
|
||||
"
|
||||
alertClass="alert-success" />
|
||||
|
||||
|
|
@ -144,6 +145,7 @@ import baseMixin from "@/mixins/base-mixin.js";
|
|||
import store from "@/store";
|
||||
import vinPagesMixin from "@/mixins/vin-pages-mixin";
|
||||
import { routeData } from "@/router/constants/routes";
|
||||
import { bailoutCodes } from "@/constants/bailout-codes";
|
||||
|
||||
// DEFINE VALIDATION RULES
|
||||
defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED));
|
||||
|
|
@ -202,6 +204,7 @@ export default {
|
|||
displayMatchedDifferentVehicleAlert: false,
|
||||
displayVinScanFailedAlert: false,
|
||||
displayNoServiceAlert: false,
|
||||
requiredVinNotFound: this.getRequiredVinNotFound(),
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -289,7 +292,13 @@ export default {
|
|||
if (!resultMap.vehicleLookupResponse || !resultMap.zipCodeData.isServiceable) {
|
||||
// If the vehicle result is undefined, the vin entered was invalid.
|
||||
if (!resultMap.vehicleLookupResponse) {
|
||||
this.displayVinNotFoundAlert = true;
|
||||
const isVinLookupRequired = this.$store.getters.vehicle.vinRequired;
|
||||
if (isVinLookupRequired) {
|
||||
this.requiredVinNotFound = true;
|
||||
this.continueWithFailedVin(this.vin, resultMap.zipCodeData);
|
||||
} else {
|
||||
this.displayVinNotFoundAlert = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if Service Zip entered is serviceable, if not display an alert
|
||||
|
|
@ -303,18 +312,18 @@ export default {
|
|||
|
||||
// Check if the CarId is different from the lookup vs what is in state currently.
|
||||
this.isCarIdDifferent =
|
||||
resultMap.vehicleLookupResponse.carId !== this.$store.getters.vehicle.carId;
|
||||
resultMap.vehicleLookupResponse?.carId !== this.$store.getters.vehicle.carId;
|
||||
|
||||
if (
|
||||
this.isCarIdDifferent &&
|
||||
resultMap.vehicleLookupResponse.carId !== this.previouslyEnteredCarId
|
||||
resultMap.vehicleLookupResponse?.carId !== this.previouslyEnteredCarId
|
||||
) {
|
||||
this.previouslyEnteredCarId = resultMap.vehicleLookupResponse.carId;
|
||||
this.previouslyEnteredCarId = resultMap.vehicleLookupResponse?.carId;
|
||||
this.customAlertData.vehicleInfo = resultMap.vehicleLookupResponse;
|
||||
this.displayMatchedDifferentVehicleAlert = true;
|
||||
|
||||
this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId(
|
||||
resultMap.vehicleLookupResponse.carId,
|
||||
resultMap.vehicleLookupResponse?.carId,
|
||||
"vin-lookup"
|
||||
);
|
||||
|
||||
|
|
@ -486,10 +495,52 @@ export default {
|
|||
this.displayVinNotFoundAlert = false;
|
||||
this.displayVinScanFailedAlert = false;
|
||||
this.displayNoServiceAlert = false;
|
||||
this.requiredVinNotFound = false;
|
||||
},
|
||||
async continueWithFailedVin(vin, zipCodeData) {
|
||||
var selectedVehicle = {
|
||||
vin: vin,
|
||||
vehicle: {
|
||||
carId: this.carId,
|
||||
make: this.$store.getters.order.vehicle.make || null,
|
||||
model: this.$store.getters.order.vehicle.model || null,
|
||||
year: this.$store.getters.order.vehicle.year || null,
|
||||
},
|
||||
};
|
||||
await this.dispatchStoreAction(
|
||||
storeActions.SAVE_VIN,
|
||||
{
|
||||
vehicleInfo: Object.assign(selectedVehicle.vehicle, {
|
||||
vin: vin,
|
||||
}),
|
||||
isSelectedGlassAvailableForVehicle: this.isSelectedGlassAvailableForVehicle,
|
||||
},
|
||||
false
|
||||
);
|
||||
await this.dispatchStoreAction(
|
||||
storeActions.SAVE_SERVICE_ZIP_CODE_INFO,
|
||||
{
|
||||
state: zipCodeData.state,
|
||||
zipCode: this.serviceZipCode,
|
||||
zipCodeCtu: zipCodeData.zipCodeCtu,
|
||||
},
|
||||
false
|
||||
);
|
||||
this.navigateForwardWithSingleCarMatch();
|
||||
},
|
||||
getRequiredVinNotFound() {
|
||||
// Prevents success alert from showing
|
||||
var bailoutCode = this.$store.getters.applicationUser.bailoutCode;
|
||||
var vinRequired = this.$store.getters.vehicle.vinRequired;
|
||||
if (vinRequired && this.vin && bailoutCode == bailoutCodes.PART_NOT_FOUND) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
async mounted() {
|
||||
this.attachCustomEvents();
|
||||
this.requiredVinNotFound = this.getRequiredVinNotFound();
|
||||
},
|
||||
computed: {
|
||||
AlertMatchedDifferentVehicleHeader() {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,10 @@ export default {
|
|||
});
|
||||
|
||||
if (result.PartNotFound) {
|
||||
bailoutMixin.methods.navigateToBailoutPage(this, bailoutCodes.PART_NOT_FOUND);
|
||||
return bailoutMixin.methods.navigateToBailoutPage(
|
||||
this,
|
||||
bailoutCodes.PART_NOT_FOUND
|
||||
);
|
||||
}
|
||||
|
||||
const partsOrQuestions = result.data.partsOrQuestions;
|
||||
|
|
|
|||
|
|
@ -181,6 +181,10 @@ const routingTable = function () {
|
|||
scenario: navigationScenarios.CLICKED_VIN_RETRY,
|
||||
destinationPageData: routeData.ESTIMATE,
|
||||
},
|
||||
{
|
||||
scenario: navigationScenarios.BAILOUT,
|
||||
destinationPageData: routeData.BAILOUT,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue