Merge pull request #1674 from Safelite/feature/CSR-1886

CSR-1886
This commit is contained in:
CarlNation 2024-01-05 08:16:06 -05:00 committed by GitHub
commit 2252610d37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 15 deletions

View file

@ -480,19 +480,6 @@ export default {
async forwardButtonAction() { async forwardButtonAction() {
this.navigatingForward = true; this.navigatingForward = true;
// clear items not needed for appointmentType
if (this.selectedAppointmentType == AppointmentTypeStrings.IN_SHOP) {
// if we have a provider.zipCodeCtu that's different than the servicelocation.zipCodeCtu then they
// may have selected a shop in a different ctu. change the servicelocation zip/ctu if different
if (this.zipCodeCtu != this.selectedProvider.address.zipCodeCtu) {
this.zipCodeCtu = this.selectedProvider.address.zipCodeCtu;
this.zipCode = this.selectedProvider.address.zipCode;
}
this.city = null;
this.streetAddress = null;
}
if ( if (
this.selectedAppointmentType == AppointmentTypeStrings.MOBILE && this.selectedAppointmentType == AppointmentTypeStrings.MOBILE &&
this.selectedProvider && this.selectedProvider &&
@ -505,6 +492,18 @@ export default {
this.selectedProvider.address.zipCodeCtu = null; this.selectedProvider.address.zipCodeCtu = null;
} }
var ctu = this.zipCodeCtu;
if (this.selectedAppointmentType == AppointmentTypeStrings.IN_SHOP) {
// if we have a provider.zipCodeCtu that's different than the servicelocation.zipCodeCtu then they
// may have selected a shop in a different ctu. change the servicelocation zip/ctu if different
if (this.zipCodeCtu != this.selectedProvider.address.zipCodeCtu) {
ctu = this.selectedProvider.address.zipCodeCtu;
}
this.city = null;
this.streetAddress = null;
}
await this.dispatchStoreAction( await this.dispatchStoreAction(
this.storeActions.SAVE_SERVICE_LOCATION, this.storeActions.SAVE_SERVICE_LOCATION,
{ {
@ -513,7 +512,7 @@ export default {
city: this.city, city: this.city,
state: this.state, state: this.state,
zipCode: this.zipCode, zipCode: this.zipCode,
zipCodeCtu: this.zipCodeCtu, zipCodeCtu: ctu,
appointmentType: this.selectedAppointmentType, appointmentType: this.selectedAppointmentType,
isVehicleProtected: this.isVehicleProtected, isVehicleProtected: this.isVehicleProtected,
provider: { provider: {

View file

@ -911,9 +911,10 @@ export const actions = {
}, },
validateZip(context, { payload: { zip }, pageNameToLog }) { validateZip(context, { payload: { zip }, pageNameToLog }) {
const damageType = context.getters.damage.isRepair ? "Repair" : "Replace";
return globalMethods.callHttpClient({ return globalMethods.callHttpClient({
methods: endpoints.ValidateZip.method, methods: endpoints.ValidateZip.method,
endpoint: `${endpoints.ValidateZip.url}/${zip}`, endpoint: `${endpoints.ValidateZip.url}/${zip}/${damageType}`,
logApiCall: true, logApiCall: true,
pageNameToLog: pageNameToLog, pageNameToLog: pageNameToLog,
}); });

View file

@ -571,6 +571,11 @@ describe("Actions", () => {
it("validateZip action", async () => { it("validateZip action", async () => {
// Arrange // Arrange
const context = state; const context = state;
context.getters = {
damage: {
isRepair: "false",
},
};
// Act // Act
globalMethods.callHttpClient.mockImplementation(() => { globalMethods.callHttpClient.mockImplementation(() => {