@@ -171,39 +199,32 @@ export default {
{
resultKey: "serviceZipValidationResponse",
promise: this.serviceZipCode ?
- this.dispatchStoreAction(storeActions.VALIDATE_ZIP, {zip: this.serviceZipCode}) :
- this.dispatchStoreAction(storeActions.VALIDATE_ZIP, {zip: this.customerQuestions.addressQuestions.zipCode})
+ this.dispatchStoreAction(storeActions.VALIDATE_ZIP, { zip: this.serviceZipCode }) :
+ this.dispatchStoreAction(storeActions.VALIDATE_ZIP, { zip: this.customerQuestions.addressQuestions.zipCode })
}
];
const resultMap = await settleAllPromises(promiseResultMap);
- // Verify if the service zip code or registration zip code provided is serviceable
+ // If VIN Lookup by address is forbidden by State Restrictions then show an alert
if (!resultMap.vinLookupResponse.isStatePermissible) {
// State Restrictions forbid lookup by address
this.displayVinLookupByHomeAddressNotAllowedAlert = true;
return this.$refs.funnelFooter.removeLoader();
}
- // If the neither the registration zip code or service zip code are not serviceable
- this.isZipServiceable = resultMap.serviceZipValidationResponse.isServiceable;
- if (!this.isZipServiceable) {
- this.displayNonServiceableZipAlert = true;
- this.showServiceZipField = true;
- return this.$refs.funnelFooter.removeLoader();
- }
-
- // If the registration zip code is serviceable and nothing was entered for the service zip code
- // then set the service zip code to the registration zip code
- if (!this.serviceZipCode) {
- this.serviceZipCode = this.customerQuestions.addressQuestions.zipCode;
- }
+ // If a Service Zip is entered and it is an invalid zip code (ex. 11111) then show an alert
+ const isZipValid = resultMap.serviceZipValidationResponse.isValid;
+ if (this.serviceZipCode && !isZipValid) {
+ this.displayInvalidZipAlert = true;
+ return this.$refs.funnelFooter.removeLoader();
+ }
+ this.displayInvalidZipAlert = false;
const carsFound = resultMap.vinLookupResponse.vinVehicles;
// Handle cases for different amounts of VINS found for the address.
if (carsFound.length == 1) {
-
// Single VIN found
const carFound = carsFound[0].vehicle;
@@ -222,19 +243,10 @@ export default {
return this.$refs.funnelFooter.removeLoader();
}
- if (!this.isZipServiceable) {
- return;
- }
-
// update data if the zip or service zip is serviceable
vehicleInfoToCommit = Object.assign(carFound, { vin: carsFound[0].vin });
+
} else if (carsFound.length > 1) {
-
- // Multiple VINS found
- if (!this.isZipServiceable) {
- return;
- }
-
// If multiple cars were found and one and only one of them matches the carId entered, save the vehicle info
// so we can go to the Heritage Funnel directly
const matchingCars = carsFound.filter(vin => vin.vehicle.carId === this.$store.getters.vehicle.carId);
@@ -242,11 +254,26 @@ export default {
if (matchingCars.length === 1) {
vehicleInfoToCommit = Object.assign(matchingCars[0].vehicle, {vin: matchingCars[0].vin});
}
- } else {
+ } else {
// No VINS found.
this.displayVinNotFoundAlert = true;
return this.$refs.funnelFooter.removeLoader();
+
+ }
+
+ // If the neither the registration zip code or service zip code are not serviceable
+ this.isZipServiceable = resultMap.serviceZipValidationResponse.isServiceable;
+ if (!this.isZipServiceable) {
+ this.displayNonServiceableZipAlert = true;
+ this.showServiceZipField = true;
+ return this.$refs.funnelFooter.removeLoader();
+ }
+
+ // If the registration zip code is serviceable and nothing was entered for the service zip code
+ // then set the service zip code to the registration zip code
+ if (!this.serviceZipCode) {
+ this.serviceZipCode = this.customerQuestions.addressQuestions.zipCode;
}
// Save vehicle, customer, service and registration information
diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue
index 3e9240719..eb8c6172b 100644
--- a/src/layouts/license-plate-lookup/license-plate-lookup.vue
+++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue
@@ -46,6 +46,7 @@
/>
+