CASH-2844 more non C&C cleanup
CASH-2844 more non C&C cleanup. load session to handle any part changes(fees) changed by safelite api. dynamic damage types form managed vs unmanaged accounts
This commit is contained in:
parent
450eb1cc6c
commit
c21ff3c249
8 changed files with 115 additions and 16 deletions
|
|
@ -208,6 +208,10 @@ const endpoints = {
|
|||
url: "/account/api/v1/account/bill-to-account-number",
|
||||
method: "GET",
|
||||
},
|
||||
GetAccountDetails: {
|
||||
url: "/account/api/v1/account/account-details",
|
||||
method: "GET",
|
||||
},
|
||||
ClosestApplicableShops: {
|
||||
url: "/location/api/v1/location/closest-applicable-shops",
|
||||
method: "GET",
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ const storeActions = {
|
|||
REVALIDATE_ORDER_PROMOS_AND_SAVE_SERVER_DATA: "revalidateOrderPromosAndSaveServerData",
|
||||
GET_INSURANCE_COMPANY_LIST: "getInsuranceCompanyList",
|
||||
GET_BILL_TO_ACCOUNT_NUMBER: "getBillToAccountNumber",
|
||||
GET_ACCOUNT_DETAILS: "getAccountDetails",
|
||||
GET_RECAL_PARTS_AND_SAVE_TO_LINE_ITEMS: "getRecalPartsAndSaveToLineItems",
|
||||
GET_CLOSEST_APPLICABLE_SHOPS: "getClosestApplicableShops",
|
||||
|
||||
|
|
@ -100,8 +101,7 @@ const storeActions = {
|
|||
SAVE_PAYMENT_METHOD_CHOICE: "savePaymentMethodChoice",
|
||||
SAVE_PARENT_ACCOUNT_NUMBER: "saveParentAccountNumber",
|
||||
SAVE_ACCOUNT_NAME: "saveAccountName",
|
||||
SAVE_IS_CLAIM_AND_COVERAGE: "saveIsClaimAndCoverage",
|
||||
SAVE_CAN_SCHEDULE_ONLINE: "saveCanScheduleOnline",
|
||||
SAVE_INSURANCE_ACCOUNT_DETAILS: "saveInsuranceAccountDetails",
|
||||
SAVE_BILL_TO_ACCOUNT_NUMBER: "saveBillToAccountNumber",
|
||||
SAVE_SUPPORTING_ITEMS: "saveSupportingItems",
|
||||
SAVE_SUPPORTING_ITEMS_SUPPRESSING_STATE_RESETTING:
|
||||
|
|
@ -120,6 +120,7 @@ const storeActions = {
|
|||
SAVE_IS_OEM_GLASS_SELECTED: "saveIsOemGlassSelected",
|
||||
SAVE_IS_MSR_FEE_APPLICABLE: "saveIsMSRFeeApplicable",
|
||||
SAVE_IS_MSR_FEE_COVERED_BY_INSURANCE: "saveIsMSRFeeCoveredByInsurance",
|
||||
SAVE_IS_NEW_INSURANCE_FLOW: "saveIsNewInsuranceFlow",
|
||||
|
||||
CREATE_SUBMITTED_STATE: "createSubmittedState",
|
||||
RESET_SUBMITTED_STATE: "resetSubmittedState",
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ const storeMutations = {
|
|||
UPDATE_ACCOUNT_NAME: "updateAccountName",
|
||||
UPDATE_IS_CLAIM_AND_COVERAGE: "updateIsClaimAndCoverage",
|
||||
UPDATE_CAN_SCHEDULE_ONLINE: "updateCanScheduleOnline",
|
||||
UPDATE_IS_MANAGED_ACCOUNT: "updateIsManagedAccount",
|
||||
UPDATE_BILL_TO_ACCT_NUMBER: "updateBillToAcctNumber",
|
||||
UPDATE_EON: "updateEON",
|
||||
UPDATE_IS_INSURANCE: "updateIsInsurance",
|
||||
|
|
@ -83,6 +84,7 @@ const storeMutations = {
|
|||
UPDATE_IS_OEM_GLASS_SELECTED: "updateIsOemGlassSelected",
|
||||
UPDATE_IS_MSR_FEE_APPLICABLE: "updateIsMSRFeeApplicable",
|
||||
UPDATE_IS_MSR_FEE_COVERED_BY_INSURANCE: "updateIsMSRFeeCoveredByInsurance",
|
||||
UPDATE_IS_NEW_INSURANCE_FLOW: "updateIsNewInsuranceFlow",
|
||||
UPDATE_CASH_PRICE_SUBTOTAL: "updateCashPriceSubTotal",
|
||||
|
||||
// EVENT BUS MUTATIONS
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ import modal from "@/digital-components/modal/modal";
|
|||
import contentGroupModal from "@/fmg-components/content-group-modal/content-group-modal.vue";
|
||||
import textBlock from "@/digital-components/text-block/text-block.vue";
|
||||
import { debugLog } from "@/helpers/debug-log-helper";
|
||||
import { loadSessionIfPresent } from "@/helpers/heritage-integration/order-helper";
|
||||
export default {
|
||||
name: "coverage-statement",
|
||||
mixins: [],
|
||||
|
|
@ -186,6 +187,13 @@ export default {
|
|||
);
|
||||
},
|
||||
async forwardButtonAction() {
|
||||
// The safelite api will often remove fees when switching cash to insurance. Heritage does the same.
|
||||
// The heritage flow triggers a load session when returning to pick up new parts to make sure we're in-sync.
|
||||
// The new insurance flow needs to trigger a load session to pick up these same type of part changes.
|
||||
if (store.getters.order.isNewInsuranceFlow) {
|
||||
await loadSessionIfPresent(false, this.pageName);
|
||||
}
|
||||
|
||||
this.$router.navigateWithSaving(
|
||||
this.navigationScenarios.CLICKED_FORWARD,
|
||||
this.pageName
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ export default {
|
|||
accountName: this.accountNameFromStore(),
|
||||
isClaimAndCoverage: this.isClaimAndCoverageFromStore(),
|
||||
canScheduleOnline: this.canScheduleOnlineFromStore(),
|
||||
isManagedAccount: this.isManagedAccountFromStore(),
|
||||
},
|
||||
originalList: [],
|
||||
};
|
||||
|
|
@ -156,6 +157,9 @@ export default {
|
|||
canScheduleOnlineFromStore() {
|
||||
return store.getters.order?.payment?.canScheduleOnline;
|
||||
},
|
||||
isManagedAccountFromStore() {
|
||||
return store.getters.order?.payment?.isManagedAccount;
|
||||
},
|
||||
arePagePrerequisitesValid() {
|
||||
return store.getters.order.payment.isInsurance === true;
|
||||
},
|
||||
|
|
@ -192,15 +196,24 @@ export default {
|
|||
false
|
||||
);
|
||||
|
||||
await this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_IS_CLAIM_AND_COVERAGE,
|
||||
this.selectedAccount.isClaimAndCoverage,
|
||||
// Fetch the latest account details for the selected parent account so that
|
||||
// routing and the saved values below reflect the current source of truth.
|
||||
const accountDetails = await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
storeActions.GET_ACCOUNT_DETAILS,
|
||||
{ parentAccountNumber: this.selectedAccount.parentAccountNumber },
|
||||
"insurance-company",
|
||||
false
|
||||
);
|
||||
|
||||
this.selectedAccount.isManagedAccount = accountDetails.isManagedAccount;
|
||||
|
||||
await this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_CAN_SCHEDULE_ONLINE,
|
||||
this.selectedAccount.canScheduleOnline,
|
||||
this.storeActions.SAVE_INSURANCE_ACCOUNT_DETAILS,
|
||||
{
|
||||
isClaimAndCoverage: this.selectedAccount.isClaimAndCoverage,
|
||||
canScheduleOnline: this.selectedAccount.canScheduleOnline,
|
||||
isManagedAccount: this.selectedAccount.isManagedAccount,
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
|
|
@ -236,6 +249,11 @@ export default {
|
|||
debugLog(
|
||||
`--- ${this.selectedAccount.parentAccountNumber} C&C experiment active for this parent account number, sending to vue app Policy Info page ---`
|
||||
);
|
||||
baseMixin.methods.dispatchStoreAction(
|
||||
storeActions.SAVE_IS_NEW_INSURANCE_FLOW,
|
||||
true,
|
||||
false
|
||||
);
|
||||
this.$router.navigateWithSaving(
|
||||
this.navigationScenarios.CLICKED_FORWARD_POLICY_INFO,
|
||||
this.pageName
|
||||
|
|
@ -248,6 +266,11 @@ export default {
|
|||
debugLog(
|
||||
`--- ${this.selectedAccount.parentAccountNumber} C&C experiment setting is false, but is a C&C client, sending to heritage ---`
|
||||
);
|
||||
baseMixin.methods.dispatchStoreAction(
|
||||
storeActions.SAVE_IS_NEW_INSURANCE_FLOW,
|
||||
false,
|
||||
false
|
||||
);
|
||||
navigateToHeritageFunnel({
|
||||
shouldSaveSession: true,
|
||||
pageNameToLog: this.pageName,
|
||||
|
|
@ -265,6 +288,11 @@ export default {
|
|||
debugLog(
|
||||
`--- ${this.selectedAccount.parentAccountNumber} Non integrated experiment setting is true, sending to vue app Insurance Details page ---`
|
||||
);
|
||||
baseMixin.methods.dispatchStoreAction(
|
||||
storeActions.SAVE_IS_NEW_INSURANCE_FLOW,
|
||||
true,
|
||||
false
|
||||
);
|
||||
this.$router.navigateWithSaving(
|
||||
this.navigationScenarios.CLICKED_FORWARD_NON_CLAIM_AND_COVERAGE,
|
||||
this.pageName
|
||||
|
|
@ -290,6 +318,11 @@ export default {
|
|||
debugLog(
|
||||
`--- ${this.selectedAccount.parentAccountNumber} Non integrated experiment setting is false, but a parent account is NON_CLAIM_AND_COVERAGE_TEST_PARENT_ACCOUNT experiment contains a specific parent account number, sending to vue app Insurance Details page ---`
|
||||
);
|
||||
baseMixin.methods.dispatchStoreAction(
|
||||
storeActions.SAVE_IS_NEW_INSURANCE_FLOW,
|
||||
true,
|
||||
false
|
||||
);
|
||||
this.$router.navigateWithSaving(
|
||||
this.navigationScenarios.CLICKED_FORWARD_NON_CLAIM_AND_COVERAGE,
|
||||
this.pageName
|
||||
|
|
@ -297,6 +330,11 @@ export default {
|
|||
return;
|
||||
}
|
||||
|
||||
baseMixin.methods.dispatchStoreAction(
|
||||
storeActions.SAVE_IS_NEW_INSURANCE_FLOW,
|
||||
false,
|
||||
false
|
||||
);
|
||||
navigateToHeritageFunnel({
|
||||
shouldSaveSession: true,
|
||||
pageNameToLog: "insurance-company",
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
:questionText="damageTypesQuestionText"
|
||||
class="mb-4"
|
||||
v-model="damageCause"
|
||||
cmsWidgetName="DamageTypesWidget"
|
||||
:cmsWidgetName="damageTypesWidgetName"
|
||||
customDropdownId="damageTypes"
|
||||
:options="damageTypesOptions"
|
||||
:valueAsKey="true"
|
||||
|
|
@ -183,6 +183,7 @@ export default {
|
|||
policyZip: this.getPolicyZipFromStore(),
|
||||
claimNumber: this.getClaimNumberFromStore(),
|
||||
showSaveProgressModal: null,
|
||||
isManagedAccount: this.getIsManagedAccountFromStore(),
|
||||
};
|
||||
},
|
||||
components: {
|
||||
|
|
@ -249,13 +250,22 @@ export default {
|
|||
stateOptions() {
|
||||
return stateOptionsInternational;
|
||||
},
|
||||
damageTypesWidgetName() {
|
||||
return this.isManagedAccount ? "DamageTypesWidget" : "UnmanagedDamageTypesWidget";
|
||||
},
|
||||
damageCauseQuestionText() {
|
||||
return this.getCmsContent("DamageTypesWidget", "QuestionText");
|
||||
if (this.isManagedAccount) {
|
||||
return this.getCmsContent("DamageTypesWidget", "QuestionText");
|
||||
} else {
|
||||
return this.getCmsContent("UnmanagedDamageTypesWidget", "QuestionText");
|
||||
}
|
||||
},
|
||||
damageTypesOptions() {
|
||||
const options = {};
|
||||
|
||||
const answers = this.getCmsContent("DamageTypesWidget", "Answers");
|
||||
const answers = this.isManagedAccount
|
||||
? this.getCmsContent("DamageTypesWidget", "Answers")
|
||||
: this.getCmsContent("UnmanagedDamageTypesWidget", "Answers");
|
||||
if (!Array.isArray(answers)) {
|
||||
return options;
|
||||
}
|
||||
|
|
@ -267,6 +277,9 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
getIsManagedAccountFromStore() {
|
||||
return store.getters.order?.payment?.isManagedAccount ?? false;
|
||||
},
|
||||
getInsuranceCompanyNameFromStore() {
|
||||
return store.getters.order.policy.insuranceCompanyName;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -777,6 +777,12 @@ export default {
|
|||
}
|
||||
},
|
||||
async forwardButtonAction() {
|
||||
baseMixin.methods.dispatchStoreAction(
|
||||
storeActions.SAVE_IS_NEW_INSURANCE_FLOW,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_PAYMENT_TYPE,
|
||||
this.isInsuranceSelected,
|
||||
|
|
@ -795,12 +801,15 @@ export default {
|
|||
false
|
||||
);
|
||||
this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_IS_CLAIM_AND_COVERAGE,
|
||||
false,
|
||||
this.storeActions.SAVE_INSURANCE_ACCOUNT_DETAILS,
|
||||
{
|
||||
isClaimAndCoverage: false,
|
||||
canScheduleOnline: false,
|
||||
isManagedAccount: false,
|
||||
},
|
||||
false
|
||||
);
|
||||
this.dispatchStoreAction(this.storeActions.RESET_INSURANCE_DETAILS, false, false);
|
||||
this.dispatchStoreAction(this.storeActions.SAVE_CAN_SCHEDULE_ONLINE, false, false);
|
||||
this.dispatchStoreAction(this.storeActions.SAVE_ACCOUNT_NAME, null, false);
|
||||
} else {
|
||||
baseMixin.methods.dispatchStoreAction(
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@ const getDefaultState = () => {
|
|||
accountName: null,
|
||||
isClaimAndCoverage: false,
|
||||
canScheduleOnline: false,
|
||||
isManagedAccount: false,
|
||||
billToAccountNumber: null,
|
||||
isPia: null,
|
||||
piaType: null,
|
||||
|
|
@ -213,6 +214,7 @@ const getDefaultState = () => {
|
|||
isRecalAcknowledgedForScheduling: "",
|
||||
isMSRFeeApplicable: false,
|
||||
isMSRFeeCoveredByInsurance: false,
|
||||
isNewInsuranceFlow: false,
|
||||
},
|
||||
applicationUser: {
|
||||
eventBus: [],
|
||||
|
|
@ -386,6 +388,9 @@ export const mutations = {
|
|||
updateCanScheduleOnline(state, canScheduleOnline) {
|
||||
state.order.payment.canScheduleOnline = canScheduleOnline;
|
||||
},
|
||||
updateIsManagedAccount(state, isManagedAccount) {
|
||||
state.order.payment.isManagedAccount = isManagedAccount;
|
||||
},
|
||||
updateBillToAcctNumber(state, billToAcctNumber) {
|
||||
state.order.payment.billToAccountNumber = billToAcctNumber;
|
||||
},
|
||||
|
|
@ -451,6 +456,9 @@ export const mutations = {
|
|||
updateIsMSRFeeCoveredByInsurance(state, isMSRFeeCoveredByInsurance) {
|
||||
state.order.isMSRFeeCoveredByInsurance = isMSRFeeCoveredByInsurance;
|
||||
},
|
||||
updateIsNewInsuranceFlow(state, isNewInsuranceFlow) {
|
||||
state.order.isNewInsuranceFlow = isNewInsuranceFlow;
|
||||
},
|
||||
updateCashPriceSubTotal(state, cashPriceSubTotal) {
|
||||
state.order.cashPriceSubTotal =
|
||||
cashPriceSubTotal === "" ? null : cashPriceSubTotal.toString();
|
||||
|
|
@ -2709,6 +2717,7 @@ export const actions = {
|
|||
billToAccountNumber: order.payment.billToAccountNumber,
|
||||
isClaimAndCoverage: order.payment.isClaimAndCoverage,
|
||||
canScheduleOnline: order.payment.canScheduleOnline,
|
||||
isManagedAccount: order.payment.isManagedAccount,
|
||||
inactivePromos: order.payment.inactivePromos,
|
||||
isCreditCard:
|
||||
order.payment.piaType == paymentMethods.CREDIT_CARD ? true : false,
|
||||
|
|
@ -3225,17 +3234,23 @@ export const actions = {
|
|||
);
|
||||
},
|
||||
|
||||
saveIsNewInsuranceFlow(context, isNewInsuranceFlow) {
|
||||
context.commit(storeMutations.UPDATE_IS_NEW_INSURANCE_FLOW, isNewInsuranceFlow);
|
||||
},
|
||||
|
||||
saveParentAccountNumber(context, parentAccountNumber) {
|
||||
context.commit(storeMutations.UPDATE_PARENT_ACCT_NUMBER, parentAccountNumber);
|
||||
},
|
||||
saveAccountName(context, accountName) {
|
||||
context.commit(storeMutations.UPDATE_ACCOUNT_NAME, accountName);
|
||||
},
|
||||
saveIsClaimAndCoverage(context, isClaimAndCoverage) {
|
||||
saveInsuranceAccountDetails(
|
||||
context,
|
||||
{ isClaimAndCoverage, canScheduleOnline, isManagedAccount }
|
||||
) {
|
||||
context.commit(storeMutations.UPDATE_IS_CLAIM_AND_COVERAGE, isClaimAndCoverage);
|
||||
},
|
||||
saveCanScheduleOnline(context, canScheduleOnline) {
|
||||
context.commit(storeMutations.UPDATE_CAN_SCHEDULE_ONLINE, canScheduleOnline);
|
||||
context.commit(storeMutations.UPDATE_IS_MANAGED_ACCOUNT, isManagedAccount);
|
||||
},
|
||||
saveBillToAccountNumber(context, billToAccountNumber) {
|
||||
context.commit(storeMutations.UPDATE_BILL_TO_ACCT_NUMBER, billToAccountNumber);
|
||||
|
|
@ -3626,6 +3641,15 @@ export const actions = {
|
|||
|
||||
return billToAccountNumberResponse.data.toString();
|
||||
},
|
||||
// Get Account Details
|
||||
async getAccountDetails(context, { payload: { parentAccountNumber }, pageNameToLog }) {
|
||||
const accountDetailsResponse = await globalMethods.callHttpClient({
|
||||
method: endpoints.GetAccountDetails.method,
|
||||
endpoint: `${endpoints.GetAccountDetails.url}/${parentAccountNumber}`,
|
||||
});
|
||||
|
||||
return accountDetailsResponse.data;
|
||||
},
|
||||
//////////////////////////////////
|
||||
// END OF Account Service Calls //
|
||||
//////////////////////////////////
|
||||
|
|
|
|||
Loading…
Reference in a new issue