Added call to get mobile fee part in each component

This commit is contained in:
Leah Schumann 2023-03-14 13:28:16 -04:00
parent 1613e192e3
commit 8c82e8f9f9
3 changed files with 15 additions and 31 deletions

View file

@ -1,14 +1,8 @@
import { storeActions } from "@/constants/store-actions";
import store from "@/store";
import baseMixin from "@/mixins/base-mixin.js";
export async function getPricedMobileFeePart(
serviceZipCode,
serviceType,
parentAccountNumber,
billToAccountNumber
) {
if (!serviceZipCode || !serviceType || !parentAccountNumber || !billToAccountNumber) {
export async function getPricedMobileFeePart(serviceZipCode) {
if (!serviceZipCode) {
return Promise.resolve(null);
}
@ -17,11 +11,7 @@ export async function getPricedMobileFeePart(
// Get the Mobile Fee Part
const mobileFeePart = await baseMixin.methods.dispatchStoreAction(
storeActions.GET_MOBILE_FEE_PART,
{
serviceType: serviceType,
parentAccountNumber: parentAccountNumber,
billToAccountNumber: billToAccountNumber,
},
null,
false
);
@ -38,4 +28,3 @@ export async function getPricedMobileFeePart(
return Promise.resolve(pricingResults[0]);
}

View file

@ -161,6 +161,7 @@ export default {
values: {
state: updatedServiceZipCodeInfo.state,
zipCode: updatedServiceZipCodeInfo.zipCode,
isVehicleProtected: updatedServiceZipCodeInfo.isVehicleProtected
},
});
},
@ -177,14 +178,11 @@ export default {
this.displayInvalidZipAlert = true;
this.resetModalButtonStyle();
} else {
// retrieve mobile fee part
const serviceType = store.getters.damage.isRepair ? "Repair" : "Replace";
const parentAccountNumber = store.getters.payment.parentAccountNumber;
const billToAccountNumber = 1;
const serviceZipCode = this.internalModel.addressQuestions.zipCode;
const mobileFeePart = await getPricedMobileFeePart(serviceZipCode);
const mobileFeePart = await getPricedMobileFeePart(this.internalModel.addressQuestions.zipCode, serviceType, parentAccountNumber, billToAccountNumber);
// emit it to parent
this.$emit("set-mobile-fee-part", mobileFeePart);
@ -200,8 +198,9 @@ export default {
this.internalModel = deepClone(newValue);
this.resetComponent({
state: newValue.state,
zipCode: newValue.zipCode,
state: newValue.addressQuestions.state,
zipCode: newValue.addressQuestions.zipCode,
isVehicleProtected: newValue.isVehicleProtected
});
},
deep: true,

View file

@ -61,7 +61,7 @@ export default {
mobileFeePart: {
type: Object,
default: () => ({}),
},
},
linkWidgetName: String,
modalWidgetName: String,
},
@ -142,27 +142,23 @@ export default {
this.resetAlerts();
const zipCodeData = await this.getZipCodeData(this.internalModel.zipCode);
this.resetModalButtonStyle();
if (!zipCodeData.isValid) {
this.displayInvalidZipAlert = true;
this.focusOnZipInput();
this.resetModalButtonStyle();
} else {
this.internalModel.state = zipCodeData.state;
// retrieve mobile fee part
const serviceType = store.getters.damage.isRepair ? "Repair" : "Replace";
const parentAccountNumber = store.getters.payment.parentAccountNumber;
const billToAccountNumber = 1;
const serviceZipCode = this.internalModel.zipCode;
const mobileFeePart = await getPricedMobileFeePart(serviceZipCode);
const mobileFeePart = await getPricedMobileFeePart(this.internalModel.zipCode, serviceType, parentAccountNumber, billToAccountNumber);
// emit it to parent
this.$emit("set-mobile-fee-part", mobileFeePart);
// Update the page level model
this.$emit("update:modelValue", this.internalModel);
this.closeModal();
}
},