CSR-1804 | Utilize billToAccountNumber endpoint
Only fires when zip changes on service-location
This commit is contained in:
parent
49fc0b7373
commit
534337b48b
7 changed files with 85 additions and 10 deletions
|
|
@ -172,6 +172,10 @@ const endpoints = {
|
|||
url: "/account/api/v1/account/insurance-companies",
|
||||
method: "GET",
|
||||
},
|
||||
GetBillToAccountNumber: {
|
||||
url: "/account/api/v1/account/bill-to-account-number",
|
||||
method: "GET",
|
||||
},
|
||||
};
|
||||
|
||||
export { endpoints };
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ const storeActions = {
|
|||
VALIDATE_ORDER_PROMO_AND_SAVE_SERVER_DATA: "validateOrderPromoAndSaveServerData",
|
||||
REVALIDATE_ORDER_PROMOS_AND_SAVE_SERVER_DATA: "revalidateOrderPromosAndSaveServerData",
|
||||
GET_INSURANCE_COMPANY_LIST: "getInsuranceCompanyList",
|
||||
GET_BILL_TO_ACCOUNT_NUMBER: "getBillToAccountNumber",
|
||||
|
||||
// DEPENDENCY MUTATIONS
|
||||
RESET_DAMAGE_STATE_AND_DEPENDENCIES: "resetDamageAndDependencies",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import baseMixin from "@/mixins/base-mixin.js";
|
|||
|
||||
export async function getPricedMobileFeePart(serviceZipCode, pageNameToLog) {
|
||||
if (!serviceZipCode) {
|
||||
return Promise.resolve(null);
|
||||
return null;
|
||||
}
|
||||
|
||||
const zipCodeData = await baseMixin.methods.getZipCodeData(serviceZipCode, pageNameToLog);
|
||||
|
|
@ -36,12 +36,12 @@ export async function getPricedMobileFeePart(serviceZipCode, pageNameToLog) {
|
|||
false
|
||||
);
|
||||
|
||||
return Promise.resolve(pricingResults[0]);
|
||||
return pricingResults[0];
|
||||
}
|
||||
|
||||
export async function getServiceabilityDetails(serviceZipCode, lineItems, pageNameToLog) {
|
||||
// Get the Mobile Fee Part
|
||||
const serviceabilityDetails = await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
return await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
storeActions.GET_SERVICEABILITY_DETAILS,
|
||||
{
|
||||
serviceZipCode: serviceZipCode,
|
||||
|
|
@ -50,20 +50,26 @@ export async function getServiceabilityDetails(serviceZipCode, lineItems, pageNa
|
|||
pageNameToLog,
|
||||
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) {
|
||||
const shopProviderData = await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
return await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
storeActions.GET_PROVIDERS,
|
||||
{
|
||||
serviceZipCode: serviceZipCode,
|
||||
},
|
||||
"service-location"
|
||||
);
|
||||
|
||||
return Promise.resolve(shopProviderData);
|
||||
}
|
||||
|
||||
export async function getAvailabilityRating(
|
||||
|
|
@ -92,5 +98,5 @@ export async function getAvailabilityRating(
|
|||
|
||||
const shopStatus = isGoodAvailability ? "high" : "low";
|
||||
|
||||
return Promise.resolve(shopStatus);
|
||||
return shopStatus;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ import { deepClone } from "@/helpers/object-helper";
|
|||
import {
|
||||
getPricedMobileFeePart,
|
||||
getServiceabilityDetails,
|
||||
getBillToAccountNumber,
|
||||
} from "@/layouts/service-location/helpers/service-location-helper/service-location-helper";
|
||||
|
||||
// Validation
|
||||
|
|
@ -91,7 +92,7 @@ import { v4 as uuidv4 } from "uuid";
|
|||
|
||||
export default {
|
||||
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() {
|
||||
return {
|
||||
internalModel: deepClone(this.modelValue),
|
||||
|
|
@ -266,11 +267,16 @@ export default {
|
|||
"service-location"
|
||||
);
|
||||
|
||||
const billToAccountNumber = await getBillToAccountNumber(
|
||||
this.internalModel.zipCodeCtu
|
||||
);
|
||||
|
||||
// update content related to service zip code
|
||||
this.$emit("updated-mobile-fee-part", mobileFeePart);
|
||||
this.$emit("updated-serviceability", serviceabilityDetails.data);
|
||||
this.$emit("updated-contains-military-base", zipCodeData.containsMilitaryBase);
|
||||
this.$emit("updated-mobile-ctu", zipCodeData.zipCodeCtu);
|
||||
this.$emit("updated-bill-to-account-number", billToAccountNumber);
|
||||
|
||||
// update the page level model
|
||||
this.$emit("update:modelValue", this.internalModel);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
@updated-mobile-fee-part="setMobileFeePart"
|
||||
@updated-serviceability="setServiceabilityDetails"
|
||||
@updated-contains-military-base="setContainsMilitaryBase"
|
||||
@updated-bill-to-account-number="setBillToAccountNumber"
|
||||
linkWidgetName="ServiceZipLinkWidget"
|
||||
modalWidgetName="ServiceZipModalWidget" />
|
||||
|
||||
|
|
@ -191,6 +192,7 @@ export default {
|
|||
mobileFeePart: null,
|
||||
zipContainsMilitaryBase: false,
|
||||
zipCodeCtu: null,
|
||||
billToAccountNumber: null,
|
||||
shopProviderData: null,
|
||||
navigatingForward: false,
|
||||
};
|
||||
|
|
@ -437,6 +439,9 @@ export default {
|
|||
this.zipContainsMilitaryBase = val;
|
||||
}
|
||||
},
|
||||
setBillToAccountNumber(val) {
|
||||
this.billToAccountNumber = val;
|
||||
},
|
||||
setCtuForMobile(val) {
|
||||
this.zipCodeCtu = val;
|
||||
},
|
||||
|
|
@ -601,6 +606,14 @@ export default {
|
|||
},
|
||||
false
|
||||
);
|
||||
console.log(this.billToAccountNumber);
|
||||
if (this.billToAccountNumber) {
|
||||
this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_BILL_TO_ACCOUNT_NUMBER,
|
||||
this.billToAccountNumber,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
this.updateAndSaveSupportingItems();
|
||||
this.$router.navigateWithSaving(this.navigationScenarios.CLICKED_FORWARD, this.$route);
|
||||
|
|
|
|||
|
|
@ -46,11 +46,12 @@ import alert from "@/ux-components/alert/alert";
|
|||
import {
|
||||
getPricedMobileFeePart,
|
||||
getServiceabilityDetails,
|
||||
getBillToAccountNumber
|
||||
} from "@/layouts/service-location/helpers/service-location-helper/service-location-helper";
|
||||
|
||||
export default {
|
||||
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() {
|
||||
return {
|
||||
internalModel: this.copyModel(this.modelValue),
|
||||
|
|
@ -165,10 +166,15 @@ export default {
|
|||
"service-location"
|
||||
);
|
||||
|
||||
const billToAccountNumber = await getBillToAccountNumber(
|
||||
this.internalModel.zipCodeCtu
|
||||
);
|
||||
|
||||
// update content related to service zip code
|
||||
this.$emit("updated-mobile-fee-part", mobileFeePart);
|
||||
this.$emit("updated-serviceability", serviceabilityDetails.data);
|
||||
this.$emit("updated-contains-military-base", zipCodeData.containsMilitaryBase);
|
||||
this.$emit("updated-bill-to-account-number", billToAccountNumber);
|
||||
|
||||
// update the page level model
|
||||
this.$emit("update:modelValue", this.internalModel);
|
||||
|
|
|
|||
|
|
@ -1881,6 +1881,7 @@ export const actions = {
|
|||
},
|
||||
isInsurance: order.payment.isInsurance,
|
||||
parentAccountNumber: order.payment.parentAccountNumber,
|
||||
billToAccountNumber: order.payment.billToAccountNumber,
|
||||
inactivePromos: order.payment.inactivePromos,
|
||||
isCreditCard:
|
||||
order.payment.piaType == paymentMethods.CREDIT_CARD ? true : false,
|
||||
|
|
@ -2669,6 +2670,10 @@ export const actions = {
|
|||
|
||||
return revalidateResponse?.data;
|
||||
},
|
||||
///////////////////////////
|
||||
// Account Service Calls //
|
||||
///////////////////////////
|
||||
|
||||
// List all insurance companies
|
||||
async getInsuranceCompanyList(context, { pageNameToLog }) {
|
||||
const insuranceCompanyList = await globalMethods.callHttpClient({
|
||||
|
|
@ -2691,6 +2696,40 @@ export const actions = {
|
|||
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
|
||||
saveSchedule(context, scheduleInfo) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue