CSR-1804 | Utilize billToAccountNumber endpoint

Only fires when zip changes on service-location
This commit is contained in:
Scott Kiener 2024-09-18 10:23:15 -04:00
parent 49fc0b7373
commit 534337b48b
7 changed files with 85 additions and 10 deletions

View file

@ -172,6 +172,10 @@ const endpoints = {
url: "/account/api/v1/account/insurance-companies", url: "/account/api/v1/account/insurance-companies",
method: "GET", method: "GET",
}, },
GetBillToAccountNumber: {
url: "/account/api/v1/account/bill-to-account-number",
method: "GET",
},
}; };
export { endpoints }; export { endpoints };

View file

@ -53,6 +53,7 @@ const storeActions = {
VALIDATE_ORDER_PROMO_AND_SAVE_SERVER_DATA: "validateOrderPromoAndSaveServerData", VALIDATE_ORDER_PROMO_AND_SAVE_SERVER_DATA: "validateOrderPromoAndSaveServerData",
REVALIDATE_ORDER_PROMOS_AND_SAVE_SERVER_DATA: "revalidateOrderPromosAndSaveServerData", REVALIDATE_ORDER_PROMOS_AND_SAVE_SERVER_DATA: "revalidateOrderPromosAndSaveServerData",
GET_INSURANCE_COMPANY_LIST: "getInsuranceCompanyList", GET_INSURANCE_COMPANY_LIST: "getInsuranceCompanyList",
GET_BILL_TO_ACCOUNT_NUMBER: "getBillToAccountNumber",
// DEPENDENCY MUTATIONS // DEPENDENCY MUTATIONS
RESET_DAMAGE_STATE_AND_DEPENDENCIES: "resetDamageAndDependencies", RESET_DAMAGE_STATE_AND_DEPENDENCIES: "resetDamageAndDependencies",

View file

@ -3,7 +3,7 @@ import baseMixin from "@/mixins/base-mixin.js";
export async function getPricedMobileFeePart(serviceZipCode, pageNameToLog) { export async function getPricedMobileFeePart(serviceZipCode, pageNameToLog) {
if (!serviceZipCode) { if (!serviceZipCode) {
return Promise.resolve(null); return null;
} }
const zipCodeData = await baseMixin.methods.getZipCodeData(serviceZipCode, pageNameToLog); const zipCodeData = await baseMixin.methods.getZipCodeData(serviceZipCode, pageNameToLog);
@ -36,12 +36,12 @@ export async function getPricedMobileFeePart(serviceZipCode, pageNameToLog) {
false false
); );
return Promise.resolve(pricingResults[0]); return pricingResults[0];
} }
export async function getServiceabilityDetails(serviceZipCode, lineItems, pageNameToLog) { export async function getServiceabilityDetails(serviceZipCode, lineItems, pageNameToLog) {
// Get the Mobile Fee Part // Get the Mobile Fee Part
const serviceabilityDetails = await baseMixin.methods.dispatchStoreActionWithLogging( return await baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.GET_SERVICEABILITY_DETAILS, storeActions.GET_SERVICEABILITY_DETAILS,
{ {
serviceZipCode: serviceZipCode, serviceZipCode: serviceZipCode,
@ -50,20 +50,26 @@ export async function getServiceabilityDetails(serviceZipCode, lineItems, pageNa
pageNameToLog, pageNameToLog,
false false
); );
}
return Promise.resolve(serviceabilityDetails); export async function getBillToAccountNumber(providerNumber) {
// Get the BillTo Account Number
return await baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.GET_BILL_TO_ACCOUNT_NUMBER,
{ providerNumber: providerNumber },
"service-location",
false
);
} }
export async function getShopProviderData(serviceZipCode) { export async function getShopProviderData(serviceZipCode) {
const shopProviderData = await baseMixin.methods.dispatchStoreActionWithLogging( return await baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.GET_PROVIDERS, storeActions.GET_PROVIDERS,
{ {
serviceZipCode: serviceZipCode, serviceZipCode: serviceZipCode,
}, },
"service-location" "service-location"
); );
return Promise.resolve(shopProviderData);
} }
export async function getAvailabilityRating( export async function getAvailabilityRating(
@ -92,5 +98,5 @@ export async function getAvailabilityRating(
const shopStatus = isGoodAvailability ? "high" : "low"; const shopStatus = isGoodAvailability ? "high" : "low";
return Promise.resolve(shopStatus); return shopStatus;
} }

View file

@ -83,6 +83,7 @@ import { deepClone } from "@/helpers/object-helper";
import { import {
getPricedMobileFeePart, getPricedMobileFeePart,
getServiceabilityDetails, getServiceabilityDetails,
getBillToAccountNumber,
} from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper";
// Validation // Validation
@ -91,7 +92,7 @@ import { v4 as uuidv4 } from "uuid";
export default { export default {
name: "mobile-location-modal-questions", name: "mobile-location-modal-questions",
emits: ["update:modelValue", "updated-mobile-fee-part", "updated-contains-military-base"], emits: ["update:modelValue", "updated-mobile-fee-part", "updated-contains-military-base", "updated-bill-to-account-number"],
data() { data() {
return { return {
internalModel: deepClone(this.modelValue), internalModel: deepClone(this.modelValue),
@ -266,11 +267,16 @@ export default {
"service-location" "service-location"
); );
const billToAccountNumber = await getBillToAccountNumber(
this.internalModel.zipCodeCtu
);
// update content related to service zip code // update content related to service zip code
this.$emit("updated-mobile-fee-part", mobileFeePart); this.$emit("updated-mobile-fee-part", mobileFeePart);
this.$emit("updated-serviceability", serviceabilityDetails.data); this.$emit("updated-serviceability", serviceabilityDetails.data);
this.$emit("updated-contains-military-base", zipCodeData.containsMilitaryBase); this.$emit("updated-contains-military-base", zipCodeData.containsMilitaryBase);
this.$emit("updated-mobile-ctu", zipCodeData.zipCodeCtu); this.$emit("updated-mobile-ctu", zipCodeData.zipCodeCtu);
this.$emit("updated-bill-to-account-number", billToAccountNumber);
// update the page level model // update the page level model
this.$emit("update:modelValue", this.internalModel); this.$emit("update:modelValue", this.internalModel);

View file

@ -19,6 +19,7 @@
@updated-mobile-fee-part="setMobileFeePart" @updated-mobile-fee-part="setMobileFeePart"
@updated-serviceability="setServiceabilityDetails" @updated-serviceability="setServiceabilityDetails"
@updated-contains-military-base="setContainsMilitaryBase" @updated-contains-military-base="setContainsMilitaryBase"
@updated-bill-to-account-number="setBillToAccountNumber"
linkWidgetName="ServiceZipLinkWidget" linkWidgetName="ServiceZipLinkWidget"
modalWidgetName="ServiceZipModalWidget" /> modalWidgetName="ServiceZipModalWidget" />
@ -191,6 +192,7 @@ export default {
mobileFeePart: null, mobileFeePart: null,
zipContainsMilitaryBase: false, zipContainsMilitaryBase: false,
zipCodeCtu: null, zipCodeCtu: null,
billToAccountNumber: null,
shopProviderData: null, shopProviderData: null,
navigatingForward: false, navigatingForward: false,
}; };
@ -437,6 +439,9 @@ export default {
this.zipContainsMilitaryBase = val; this.zipContainsMilitaryBase = val;
} }
}, },
setBillToAccountNumber(val) {
this.billToAccountNumber = val;
},
setCtuForMobile(val) { setCtuForMobile(val) {
this.zipCodeCtu = val; this.zipCodeCtu = val;
}, },
@ -601,6 +606,14 @@ export default {
}, },
false false
); );
console.log(this.billToAccountNumber);
if (this.billToAccountNumber) {
this.dispatchStoreAction(
this.storeActions.SAVE_BILL_TO_ACCOUNT_NUMBER,
this.billToAccountNumber,
false
);
}
this.updateAndSaveSupportingItems(); this.updateAndSaveSupportingItems();
this.$router.navigateWithSaving(this.navigationScenarios.CLICKED_FORWARD, this.$route); this.$router.navigateWithSaving(this.navigationScenarios.CLICKED_FORWARD, this.$route);

View file

@ -46,11 +46,12 @@ import alert from "@/ux-components/alert/alert";
import { import {
getPricedMobileFeePart, getPricedMobileFeePart,
getServiceabilityDetails, getServiceabilityDetails,
getBillToAccountNumber
} from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper";
export default { export default {
name: "service-zip-modal-question", name: "service-zip-modal-question",
emits: ["update:modelValue", "updated-mobile-fee-part", "updated-contains-military-base"], emits: ["update:modelValue", "updated-mobile-fee-part", "updated-contains-military-base", "updated-bill-to-account-number"],
data() { data() {
return { return {
internalModel: this.copyModel(this.modelValue), internalModel: this.copyModel(this.modelValue),
@ -165,10 +166,15 @@ export default {
"service-location" "service-location"
); );
const billToAccountNumber = await getBillToAccountNumber(
this.internalModel.zipCodeCtu
);
// update content related to service zip code // update content related to service zip code
this.$emit("updated-mobile-fee-part", mobileFeePart); this.$emit("updated-mobile-fee-part", mobileFeePart);
this.$emit("updated-serviceability", serviceabilityDetails.data); this.$emit("updated-serviceability", serviceabilityDetails.data);
this.$emit("updated-contains-military-base", zipCodeData.containsMilitaryBase); this.$emit("updated-contains-military-base", zipCodeData.containsMilitaryBase);
this.$emit("updated-bill-to-account-number", billToAccountNumber);
// update the page level model // update the page level model
this.$emit("update:modelValue", this.internalModel); this.$emit("update:modelValue", this.internalModel);

View file

@ -1881,6 +1881,7 @@ export const actions = {
}, },
isInsurance: order.payment.isInsurance, isInsurance: order.payment.isInsurance,
parentAccountNumber: order.payment.parentAccountNumber, parentAccountNumber: order.payment.parentAccountNumber,
billToAccountNumber: order.payment.billToAccountNumber,
inactivePromos: order.payment.inactivePromos, inactivePromos: order.payment.inactivePromos,
isCreditCard: isCreditCard:
order.payment.piaType == paymentMethods.CREDIT_CARD ? true : false, order.payment.piaType == paymentMethods.CREDIT_CARD ? true : false,
@ -2669,6 +2670,10 @@ export const actions = {
return revalidateResponse?.data; return revalidateResponse?.data;
}, },
///////////////////////////
// Account Service Calls //
///////////////////////////
// List all insurance companies // List all insurance companies
async getInsuranceCompanyList(context, { pageNameToLog }) { async getInsuranceCompanyList(context, { pageNameToLog }) {
const insuranceCompanyList = await globalMethods.callHttpClient({ const insuranceCompanyList = await globalMethods.callHttpClient({
@ -2691,6 +2696,40 @@ export const actions = {
return 0; return 0;
}); });
}, },
// Get BillToAccountNumber
async getBillToAccountNumber(
context,
{
payload: {
parentAccountNumber = context.getters.order.payment.parentAccountNumber,
providerNumber = context.getters.order.serviceLocation.zipCodeCtu,
isItac = context.getters.order.policy.isItac,
},
pageNameToLog,
}
) {
// Cash orders default to 87291 - update if/when more detailed
// billToAccountNumbers are needed for cash
if (parentAccountNumber == applicationConfig.CASH_PARENT_ACCOUNT_NUMBER) {
return applicationConfig.CASH_DEFAULT_BILL_TO_ACCOUNT_NUMBER;
}
const queryString =
`ParentAccountNumber=${parentAccountNumber}` +
`&ProviderNumber=${providerNumber}` +
`&IsItac=${isItac}`;
const billToAccountNumberResponse = await globalMethods.callHttpClient({
method: endpoints.GetBillToAccountNumber.method,
endpoint: `${endpoints.GetBillToAccountNumber.url}?${queryString}`,
logApiCall: true,
pageNameToLog: pageNameToLog,
});
return billToAccountNumberResponse.data.toString();
},
//////////////////////////////////
// END OF Account Service Calls //
//////////////////////////////////
// Misc order actions // Misc order actions
saveSchedule(context, scheduleInfo) { saveSchedule(context, scheduleInfo) {