SSR-1341 Bill to API update
This commit is contained in:
parent
a723bfa60c
commit
bf5c84891b
3 changed files with 16 additions and 63 deletions
|
|
@ -25,8 +25,8 @@ const endpoints = Object.freeze({
|
|||
method: 'GET'
|
||||
},
|
||||
GetBillToInfo: {
|
||||
url: `${ACCOUNT_BASE_URL}/bill-to-info`,
|
||||
method: 'POST'
|
||||
url: `${ACCOUNT_BASE_URL}/bill-to-account-number`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetAlertReasons: {
|
||||
url: `${LOCATION_BASE_URL}/alert-reasons`,
|
||||
|
|
|
|||
|
|
@ -233,8 +233,6 @@ export const getDefaultState = () => ({
|
|||
styleSheet: '', // Stylesheet used by the client.
|
||||
parentAccountNumber: 0, // Parent account number used by the client.
|
||||
billToAccountNumber: null,
|
||||
itacCashBillToNumber: null,
|
||||
itacFnrBillToNumber: null,
|
||||
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.
|
||||
isAuthenticated: false, // Indicates if user is authenticated or not.
|
||||
|
|
@ -257,17 +255,7 @@ export const useMainStore = defineStore({
|
|||
id: storeId,
|
||||
state: () => state,
|
||||
getters: {
|
||||
billToNumberToUse(storeState) {
|
||||
if (this.isITAC) {
|
||||
return storeState.issConfig.itacCashBillToNumber;
|
||||
}
|
||||
|
||||
if (this.isNoComp) {
|
||||
return storeState.issConfig.itacFnrBillToNumber;
|
||||
}
|
||||
|
||||
return storeState.issConfig.billToAccountNumber;
|
||||
},
|
||||
billToAccountNumber: (storeState) => storeState.issConfig.billToAccountNumber,
|
||||
hasRecalibrationPart: (storeState) => getHasRecalibrationPart(storeState),
|
||||
vehicle: (storeState) => storeState.order.vehicle,
|
||||
damage: (storeState) => storeState.order.damage,
|
||||
|
|
@ -871,7 +859,7 @@ export const useMainStore = defineStore({
|
|||
startDate,
|
||||
endDate,
|
||||
applicationName: applicationConfig.APPLICATION_NAME,
|
||||
billToAccountNumber: this.billToNumberToUse,
|
||||
billToAccountNumber: this.billToAccountNumber,
|
||||
parentAccountNumber: this.issConfig.parentAccountNumber, // this.payment.parentAccountNumber,
|
||||
carId: vehicle.carId,
|
||||
lineItems,
|
||||
|
|
@ -935,7 +923,7 @@ export const useMainStore = defineStore({
|
|||
endDate,
|
||||
shopAppointmentType,
|
||||
applicationName: applicationConfig.APPLICATION_NAME,
|
||||
billToAccountNumber: this.billToNumberToUse,
|
||||
billToAccountNumber: this.billToAccountNumber,
|
||||
parentAccountNumber: this.issConfig.parentAccountNumber, // this.payment.parentAccountNumber,
|
||||
carId: vehicle.carId,
|
||||
lineItems,
|
||||
|
|
@ -1061,7 +1049,7 @@ export const useMainStore = defineStore({
|
|||
|
||||
let queryString =
|
||||
`ParentAccountNumber=${this.order.parentAccountNumber}`
|
||||
+ `&BillToAccountNumber=${this.billToNumberToUse}`
|
||||
+ `&BillToAccountNumber=${this.billToAccountNumber}`
|
||||
+ `&CTU=${ctuToUse}`
|
||||
+ `&Deductible=${deductibleToUse}`
|
||||
+ `&ZipCode=${zipCodeToUse}`
|
||||
|
|
@ -1098,7 +1086,7 @@ export const useMainStore = defineStore({
|
|||
|
||||
return globalMethods.callHttpClient({
|
||||
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.enableNoCompQuote = false;
|
||||
this.issConfig.billToAccountNumber = null;
|
||||
this.issConfig.itacCashBillToNumber = null;
|
||||
this.issConfig.itacFnrBillToNumber = null;
|
||||
},
|
||||
|
||||
disableKeyFields() {
|
||||
|
|
@ -2045,7 +2031,7 @@ export const useMainStore = defineStore({
|
|||
|| appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP) {
|
||||
queryString =
|
||||
`ParentAccountNumber=${this.order.parentAccountNumber}`
|
||||
+ `&BillToAccountNumber=${this.billToNumberToUse}`
|
||||
+ `&BillToAccountNumber=${this.billToAccountNumber}`
|
||||
+ `&ProviderNumber=${providerNumber}`
|
||||
+ `&AppointmentType=${appointmentType}`
|
||||
+ `&ServiceLocation.City=${serviceLocationCity}`
|
||||
|
|
@ -2055,7 +2041,7 @@ export const useMainStore = defineStore({
|
|||
} else {
|
||||
queryString =
|
||||
`ParentAccountNumber=${this.order.parentAccountNumber}`
|
||||
+ `&BillToAccountNumber=${this.billToNumberToUse}`
|
||||
+ `&BillToAccountNumber=${this.billToAccountNumber}`
|
||||
+ `&ProviderNumber=${providerNumber}`
|
||||
+ `&AppointmentType=${appointmentType}`
|
||||
+ `${lineItemsQueryString}`;
|
||||
|
|
@ -2304,26 +2290,22 @@ export const useMainStore = defineStore({
|
|||
async getBillToInfo() {
|
||||
const { order, issConfig } = this;
|
||||
try {
|
||||
const payload = {
|
||||
const params = new URLSearchParams({
|
||||
parentAccountNumber: issConfig.parentAccountNumber.toString(),
|
||||
providerNumber: order.serviceLocation.zipCodeCtu.toString(),
|
||||
billToSelectionCriteria: {
|
||||
typeOfClaim: 'GLASS ONLY',
|
||||
lineOfBusiness: 'PERSONAL'
|
||||
}
|
||||
};
|
||||
typeOfClaim: 'GLASS ONLY',
|
||||
lineOfBusiness: 'PERSONAL',
|
||||
isItac: false
|
||||
});
|
||||
|
||||
const response = await globalMethods.callHttpClient({
|
||||
method: endpoints.GetBillToInfo.method,
|
||||
endpoint: endpoints.GetBillToInfo.url,
|
||||
payload
|
||||
endpoint: `${endpoints.GetBillToInfo.url}?${params.toString()}`
|
||||
});
|
||||
|
||||
const billToInfo = response.data;
|
||||
if (billToInfo != null) {
|
||||
issConfig.billToAccountNumber = billToInfo.billToAccountNumber;
|
||||
issConfig.itacCashBillToNumber = billToInfo.itacCashBillToNumber;
|
||||
issConfig.itacFnrBillToNumber = billToInfo.itacFnrBillToNumber;
|
||||
issConfig.billToAccountNumber = billToInfo.toString();
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2096,33 +2096,4 @@ describe('Store', () => {
|
|||
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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue