SSR-1341 Bill to API update

This commit is contained in:
Josh Dassinger 2024-06-03 11:00:22 -05:00
parent a723bfa60c
commit bf5c84891b
3 changed files with 16 additions and 63 deletions

View file

@ -25,8 +25,8 @@ const endpoints = Object.freeze({
method: 'GET' method: 'GET'
}, },
GetBillToInfo: { GetBillToInfo: {
url: `${ACCOUNT_BASE_URL}/bill-to-info`, url: `${ACCOUNT_BASE_URL}/bill-to-account-number`,
method: 'POST' method: 'GET'
}, },
GetAlertReasons: { GetAlertReasons: {
url: `${LOCATION_BASE_URL}/alert-reasons`, url: `${LOCATION_BASE_URL}/alert-reasons`,

View file

@ -233,8 +233,6 @@ export const getDefaultState = () => ({
styleSheet: '', // Stylesheet used by the client. styleSheet: '', // Stylesheet used by the client.
parentAccountNumber: 0, // Parent account number used by the client. parentAccountNumber: 0, // Parent account number used by the client.
billToAccountNumber: null, billToAccountNumber: null,
itacCashBillToNumber: null,
itacFnrBillToNumber: null,
isCoverageEnabled: false, // Indicates if we should be calling coverage on this flow. isCoverageEnabled: false, // Indicates if we should be calling coverage on this flow.
isClaimRegistrationRequired: false, // Indicates if the claim registration call needs to be made for a client to complete coverage verification. isClaimRegistrationRequired: false, // Indicates if the claim registration call needs to be made for a client to complete coverage verification.
isAuthenticated: false, // Indicates if user is authenticated or not. isAuthenticated: false, // Indicates if user is authenticated or not.
@ -257,17 +255,7 @@ export const useMainStore = defineStore({
id: storeId, id: storeId,
state: () => state, state: () => state,
getters: { getters: {
billToNumberToUse(storeState) { billToAccountNumber: (storeState) => storeState.issConfig.billToAccountNumber,
if (this.isITAC) {
return storeState.issConfig.itacCashBillToNumber;
}
if (this.isNoComp) {
return storeState.issConfig.itacFnrBillToNumber;
}
return storeState.issConfig.billToAccountNumber;
},
hasRecalibrationPart: (storeState) => getHasRecalibrationPart(storeState), hasRecalibrationPart: (storeState) => getHasRecalibrationPart(storeState),
vehicle: (storeState) => storeState.order.vehicle, vehicle: (storeState) => storeState.order.vehicle,
damage: (storeState) => storeState.order.damage, damage: (storeState) => storeState.order.damage,
@ -871,7 +859,7 @@ export const useMainStore = defineStore({
startDate, startDate,
endDate, endDate,
applicationName: applicationConfig.APPLICATION_NAME, applicationName: applicationConfig.APPLICATION_NAME,
billToAccountNumber: this.billToNumberToUse, billToAccountNumber: this.billToAccountNumber,
parentAccountNumber: this.issConfig.parentAccountNumber, // this.payment.parentAccountNumber, parentAccountNumber: this.issConfig.parentAccountNumber, // this.payment.parentAccountNumber,
carId: vehicle.carId, carId: vehicle.carId,
lineItems, lineItems,
@ -935,7 +923,7 @@ export const useMainStore = defineStore({
endDate, endDate,
shopAppointmentType, shopAppointmentType,
applicationName: applicationConfig.APPLICATION_NAME, applicationName: applicationConfig.APPLICATION_NAME,
billToAccountNumber: this.billToNumberToUse, billToAccountNumber: this.billToAccountNumber,
parentAccountNumber: this.issConfig.parentAccountNumber, // this.payment.parentAccountNumber, parentAccountNumber: this.issConfig.parentAccountNumber, // this.payment.parentAccountNumber,
carId: vehicle.carId, carId: vehicle.carId,
lineItems, lineItems,
@ -1061,7 +1049,7 @@ export const useMainStore = defineStore({
let queryString = let queryString =
`ParentAccountNumber=${this.order.parentAccountNumber}` `ParentAccountNumber=${this.order.parentAccountNumber}`
+ `&BillToAccountNumber=${this.billToNumberToUse}` + `&BillToAccountNumber=${this.billToAccountNumber}`
+ `&CTU=${ctuToUse}` + `&CTU=${ctuToUse}`
+ `&Deductible=${deductibleToUse}` + `&Deductible=${deductibleToUse}`
+ `&ZipCode=${zipCodeToUse}` + `&ZipCode=${zipCodeToUse}`
@ -1098,7 +1086,7 @@ export const useMainStore = defineStore({
return globalMethods.callHttpClient({ return globalMethods.callHttpClient({
method: endpoints.GetMobileFeePart.method, method: endpoints.GetMobileFeePart.method,
endpoint: `${endpoints.GetMobileFeePart.url}/${damageType}/${this.order.parentAccountNumber}/${this.billToNumberToUse}` endpoint: `${endpoints.GetMobileFeePart.url}/${damageType}/${this.order.parentAccountNumber}/${this.billToAccountNumber}`
}); });
}, },
@ -1843,8 +1831,6 @@ export const useMainStore = defineStore({
this.issConfig.siteType = null; this.issConfig.siteType = null;
this.issConfig.enableNoCompQuote = false; this.issConfig.enableNoCompQuote = false;
this.issConfig.billToAccountNumber = null; this.issConfig.billToAccountNumber = null;
this.issConfig.itacCashBillToNumber = null;
this.issConfig.itacFnrBillToNumber = null;
}, },
disableKeyFields() { disableKeyFields() {
@ -2045,7 +2031,7 @@ export const useMainStore = defineStore({
|| appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP) { || appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP) {
queryString = queryString =
`ParentAccountNumber=${this.order.parentAccountNumber}` `ParentAccountNumber=${this.order.parentAccountNumber}`
+ `&BillToAccountNumber=${this.billToNumberToUse}` + `&BillToAccountNumber=${this.billToAccountNumber}`
+ `&ProviderNumber=${providerNumber}` + `&ProviderNumber=${providerNumber}`
+ `&AppointmentType=${appointmentType}` + `&AppointmentType=${appointmentType}`
+ `&ServiceLocation.City=${serviceLocationCity}` + `&ServiceLocation.City=${serviceLocationCity}`
@ -2055,7 +2041,7 @@ export const useMainStore = defineStore({
} else { } else {
queryString = queryString =
`ParentAccountNumber=${this.order.parentAccountNumber}` `ParentAccountNumber=${this.order.parentAccountNumber}`
+ `&BillToAccountNumber=${this.billToNumberToUse}` + `&BillToAccountNumber=${this.billToAccountNumber}`
+ `&ProviderNumber=${providerNumber}` + `&ProviderNumber=${providerNumber}`
+ `&AppointmentType=${appointmentType}` + `&AppointmentType=${appointmentType}`
+ `${lineItemsQueryString}`; + `${lineItemsQueryString}`;
@ -2304,26 +2290,22 @@ export const useMainStore = defineStore({
async getBillToInfo() { async getBillToInfo() {
const { order, issConfig } = this; const { order, issConfig } = this;
try { try {
const payload = { const params = new URLSearchParams({
parentAccountNumber: issConfig.parentAccountNumber.toString(), parentAccountNumber: issConfig.parentAccountNumber.toString(),
providerNumber: order.serviceLocation.zipCodeCtu.toString(), providerNumber: order.serviceLocation.zipCodeCtu.toString(),
billToSelectionCriteria: {
typeOfClaim: 'GLASS ONLY', typeOfClaim: 'GLASS ONLY',
lineOfBusiness: 'PERSONAL' lineOfBusiness: 'PERSONAL',
} isItac: false
}; });
const response = await globalMethods.callHttpClient({ const response = await globalMethods.callHttpClient({
method: endpoints.GetBillToInfo.method, method: endpoints.GetBillToInfo.method,
endpoint: endpoints.GetBillToInfo.url, endpoint: `${endpoints.GetBillToInfo.url}?${params.toString()}`
payload
}); });
const billToInfo = response.data; const billToInfo = response.data;
if (billToInfo != null) { if (billToInfo != null) {
issConfig.billToAccountNumber = billToInfo.billToAccountNumber; issConfig.billToAccountNumber = billToInfo.toString();
issConfig.itacCashBillToNumber = billToInfo.itacCashBillToNumber;
issConfig.itacFnrBillToNumber = billToInfo.itacFnrBillToNumber;
return Promise.resolve(); return Promise.resolve();
} }

View file

@ -2096,33 +2096,4 @@ describe('Store', () => {
expect(store.order.payment.paypalToken).toEqual(paypalToken); expect(store.order.payment.paypalToken).toEqual(paypalToken);
}); });
}); });
describe('billToNumberToUse getter', () => {
it('returns itacCashBillToNumber when coverageType is ITAC', () => {
// Arrange
store.order.insuranceCoverage.coverageType = coverageType.ITAC;
store.issConfig.itacCashBillToNumber = '12345';
// Assert
expect(store.billToNumberToUse).toEqual(store.issConfig.itacCashBillToNumber);
});
it('returns itacFnrBillToNumber when coverageType is No Comp', () => {
// Arrange
store.order.insuranceCoverage.coverageType = coverageType.NO_COMP;
store.issConfig.itacFnrBillToNumber = '12345';
// Assert
expect(store.billToNumberToUse).toEqual(store.issConfig.itacFnrBillToNumber);
});
it('returns billToAccountNumber when coverageType is Deductible', () => {
// Arrange
store.order.insuranceCoverage.coverageType = coverageType.Deductible;
store.issConfig.billToAccountNumber = '12345';
// Assert
expect(store.billToNumberToUse).toEqual(store.issConfig.billToAccountNumber);
});
});
}); });