From d7e2f1e0cb37710d4f7c51705a35468d4b255be6 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Fri, 8 Jul 2022 10:06:32 -0400 Subject: [PATCH] Redo of address-lookup invalid zip alert changes --- src/layouts/address-lookup/address-lookup.vue | 101 +++++++++++------- .../license-plate-lookup.vue | 31 ++++-- src/layouts/vin-lookup/vin-lookup.vue | 1 - 3 files changed, 87 insertions(+), 46 deletions(-) diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 849e5772f..c24d3501d 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -7,15 +7,43 @@
- - - - - - - - - + + + + +
@@ -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 @@ />
+ { this.isVinValid = false; diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index e854f034e..9193bb0ee 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -313,7 +313,6 @@ export default { return this.$refs.funnelFooter.removeLoader(); } - // 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;