Merge pull request #3219 from Safelite/feature/CASH-2855
Feature/CASH 2855
This commit is contained in:
commit
4798191489
6 changed files with 131 additions and 10 deletions
|
|
@ -355,7 +355,15 @@ export default {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// No VINS found.
|
// 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();
|
return this.$refs.navbar.removeLoader();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -462,6 +470,28 @@ export default {
|
||||||
this.displayVinLookupByHomeAddressNotAllowedAlert = false;
|
this.displayVinLookupByHomeAddressNotAllowedAlert = false;
|
||||||
this.displayNoServiceAlert = 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() {
|
mounted() {
|
||||||
this.attachCustomEvents();
|
this.attachCustomEvents();
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,12 @@ export default {
|
||||||
resultMap.registrationZipValidationResponse.state
|
resultMap.registrationZipValidationResponse.state
|
||||||
).catch(() => {
|
).catch(() => {
|
||||||
// No VIN found.
|
// 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();
|
return this.$refs.navbar.removeLoader();
|
||||||
});
|
});
|
||||||
// If no VIN was found, stop processing after displaying alert
|
// If no VIN was found, stop processing after displaying alert
|
||||||
|
|
@ -393,6 +398,18 @@ export default {
|
||||||
this.displayInvalidZipAlert = false;
|
this.displayInvalidZipAlert = false;
|
||||||
this.displayNoServiceAlert = 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() {
|
mounted() {
|
||||||
this.attachCustomEvents();
|
this.attachCustomEvents();
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,20 @@ jest.mock("@/store", () => ({
|
||||||
commit: jest.fn(),
|
commit: jest.fn(),
|
||||||
dispatch: jest.fn(),
|
dispatch: jest.fn(),
|
||||||
getters: {
|
getters: {
|
||||||
|
applicationUser: {
|
||||||
|
bailoutCode: null,
|
||||||
|
},
|
||||||
|
externalParameterState: {
|
||||||
|
isExternalParameter: false,
|
||||||
|
},
|
||||||
|
emailOrSms: "email",
|
||||||
vehicle: {
|
vehicle: {
|
||||||
year: 2019,
|
year: 2019,
|
||||||
carId: "C00000",
|
carId: "C00000",
|
||||||
|
vin: null,
|
||||||
|
vinRequired: false,
|
||||||
|
isBigTruck: false,
|
||||||
|
canSafeliteService: true,
|
||||||
},
|
},
|
||||||
order: {
|
order: {
|
||||||
serviceLocation: {
|
serviceLocation: {
|
||||||
|
|
@ -23,6 +34,11 @@ jest.mock("@/store", () => ({
|
||||||
emailAddress: "builddigitaltest@safelite.com",
|
emailAddress: "builddigitaltest@safelite.com",
|
||||||
},
|
},
|
||||||
referralNumber: "666666",
|
referralNumber: "666666",
|
||||||
|
vehicle: {
|
||||||
|
make: null,
|
||||||
|
model: null,
|
||||||
|
year: null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
payment: {
|
payment: {
|
||||||
insuranceCoverage: {
|
insuranceCoverage: {
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,8 @@
|
||||||
vinPopulatedOnPageLoad &&
|
vinPopulatedOnPageLoad &&
|
||||||
!isInsuranceVerified &&
|
!isInsuranceVerified &&
|
||||||
!displayInvalidZipAlert &&
|
!displayInvalidZipAlert &&
|
||||||
!displayNonServiceableZipAlert
|
!displayNonServiceableZipAlert &&
|
||||||
|
!requiredVinNotFound
|
||||||
"
|
"
|
||||||
alertClass="alert-success" />
|
alertClass="alert-success" />
|
||||||
|
|
||||||
|
|
@ -144,6 +145,7 @@ import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import vinPagesMixin from "@/mixins/vin-pages-mixin";
|
import vinPagesMixin from "@/mixins/vin-pages-mixin";
|
||||||
import { routeData } from "@/router/constants/routes";
|
import { routeData } from "@/router/constants/routes";
|
||||||
|
import { bailoutCodes } from "@/constants/bailout-codes";
|
||||||
|
|
||||||
// DEFINE VALIDATION RULES
|
// DEFINE VALIDATION RULES
|
||||||
defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED));
|
defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED));
|
||||||
|
|
@ -202,6 +204,7 @@ export default {
|
||||||
displayMatchedDifferentVehicleAlert: false,
|
displayMatchedDifferentVehicleAlert: false,
|
||||||
displayVinScanFailedAlert: false,
|
displayVinScanFailedAlert: false,
|
||||||
displayNoServiceAlert: false,
|
displayNoServiceAlert: false,
|
||||||
|
requiredVinNotFound: this.getRequiredVinNotFound(),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -289,7 +292,13 @@ export default {
|
||||||
if (!resultMap.vehicleLookupResponse || !resultMap.zipCodeData.isServiceable) {
|
if (!resultMap.vehicleLookupResponse || !resultMap.zipCodeData.isServiceable) {
|
||||||
// If the vehicle result is undefined, the vin entered was invalid.
|
// If the vehicle result is undefined, the vin entered was invalid.
|
||||||
if (!resultMap.vehicleLookupResponse) {
|
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
|
// 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.
|
// Check if the CarId is different from the lookup vs what is in state currently.
|
||||||
this.isCarIdDifferent =
|
this.isCarIdDifferent =
|
||||||
resultMap.vehicleLookupResponse.carId !== this.$store.getters.vehicle.carId;
|
resultMap.vehicleLookupResponse?.carId !== this.$store.getters.vehicle.carId;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.isCarIdDifferent &&
|
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.customAlertData.vehicleInfo = resultMap.vehicleLookupResponse;
|
||||||
this.displayMatchedDifferentVehicleAlert = true;
|
this.displayMatchedDifferentVehicleAlert = true;
|
||||||
|
|
||||||
this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId(
|
this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId(
|
||||||
resultMap.vehicleLookupResponse.carId,
|
resultMap.vehicleLookupResponse?.carId,
|
||||||
"vin-lookup"
|
"vin-lookup"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -486,10 +495,52 @@ export default {
|
||||||
this.displayVinNotFoundAlert = false;
|
this.displayVinNotFoundAlert = false;
|
||||||
this.displayVinScanFailedAlert = false;
|
this.displayVinScanFailedAlert = false;
|
||||||
this.displayNoServiceAlert = 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.attachCustomEvents();
|
||||||
|
this.requiredVinNotFound = this.getRequiredVinNotFound();
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
AlertMatchedDifferentVehicleHeader() {
|
AlertMatchedDifferentVehicleHeader() {
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,10 @@ export default {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.PartNotFound) {
|
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;
|
const partsOrQuestions = result.data.partsOrQuestions;
|
||||||
|
|
|
||||||
|
|
@ -181,6 +181,10 @@ const routingTable = function () {
|
||||||
scenario: navigationScenarios.CLICKED_VIN_RETRY,
|
scenario: navigationScenarios.CLICKED_VIN_RETRY,
|
||||||
destinationPageData: routeData.ESTIMATE,
|
destinationPageData: routeData.ESTIMATE,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.BAILOUT,
|
||||||
|
destinationPageData: routeData.BAILOUT,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue