diff --git a/src/layouts/welcome-page/welcome-page.vue b/src/layouts/welcome-page/welcome-page.vue index 64173a91..b06949f5 100644 --- a/src/layouts/welcome-page/welcome-page.vue +++ b/src/layouts/welcome-page/welcome-page.vue @@ -304,26 +304,29 @@ export default { }, methods: { async forwardButtonAction() { - await this.mainStore - .validateZip({ zip: this.welcomePageModel.policyZipCode }) + await this.mainStore.validateZip({ zip: this.welcomePageModel.policyZipCode }) .then(async (zipInfo) => { if (zipInfo?.data?.isValid === true) { this.mainStore.updatePolicyData(this.welcomePageModel); - await this.mainStore - .getDuplicateReferrals() - .then( - () => {}, - () => {} - ) + + this.mainStore.order.serviceLocation.zipCodeCtu = zipInfo.data.zipCodeCtu?.toString(); + + const billToInfo = await this.getBillToInfo( + this.mainStore.issConfig.parentAccountNumber, + this.mainStore.order.serviceLocation.zipCodeCtu + ); + + if (billToInfo !== null) { + this.mainStore.issConfig.billToAccountNumber = billToInfo.billToAccountNumber; + this.mainStore.issConfig.itacCashBillToNumber = billToInfo.itacCashBillToNumber; + this.mainStore.issConfig.itacFnrBillToNumber = billToInfo.itacFnrBillToNumber; + } + + await this.mainStore.getDuplicateReferrals() + .then(() => {}, () => {}) .finally(async () => { - if ( - this.isCoverageEnabled - && !this.maxCoverageLookupAttemptsReached - ) { - await this.mainStore.getCoveragePolicyInfo()?.then( - () => {}, - () => {} - ); + if (this.isCoverageEnabled && !this.maxCoverageLookupAttemptsReached) { + await this.mainStore.getCoveragePolicyInfo()?.then(() => {}, () => {}); } else { this.mainStore.order.policy.policyLookupSuccessful = false; } @@ -335,6 +338,29 @@ export default { } }); }, + async getBillToInfo(parentAccountNumber, providerNumber) { + try { + const payload = { + parentAccountNumber: parentAccountNumber.toString(), + providerNumber: providerNumber.toString(), + billToSelectionCriteria: { + typeOfClaim: 'GLASS ONLY', + lineOfBusiness: 'PERSONAL' + } + }; + + const response = await globalMethods.callHttpClient({ + method: endpoints.GetBillToInfo.method, + endpoint: endpoints.GetBillToInfo.url, + payload + }); + + return response.data; + } catch (err) { + console.error(`Error Status Code: ${err.data?.status}: ${err.data?.title}`); + return null; + } + }, navigateForward() { if (this.mainStore.applicationUser.duplicateOrders?.length > 0 ?? false) { this.$router.navigate(