Add pia to store
This commit is contained in:
parent
8ee5a11ec9
commit
6dec3371c2
4 changed files with 32 additions and 8 deletions
|
|
@ -77,7 +77,7 @@ const storeActions = {
|
|||
SAVE_MOLDING_QUESTION_ANSWERS: "saveMoldingQuestionAnswers",
|
||||
SAVE_CAPABILITY_QUESTION_ANSWERS: "saveCapabilityQuestionAnswers",
|
||||
SAVE_PAYMENT_TYPE: "savePaymentType",
|
||||
SAVE_PAY_NOW_TYPE: "savePayNowType",
|
||||
SAVE_PAYMENT_METHOD_CHOICE: "savePaymentMethodChoice",
|
||||
SAVE_PARENT_ACCOUNT_NUMBER: "saveParentAccountNumber",
|
||||
SAVE_SUPPORTING_ITEMS: "saveSupportingItems",
|
||||
SAVE_SUPPORTING_ITEMS_SUPPRESSING_STATE_RESETTING:
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ const storeMutations = {
|
|||
UPDATE_IS_INSURANCE: "updateIsInsurance",
|
||||
UPDATE_SAVED_SESSION_ID: "updateSavedSessionId",
|
||||
UPDATE_CRM_CUSTOMER_ID: "updateCrmCustomerId",
|
||||
UPDATE_PAY_NOW_TYPE: "updatePayNowType",
|
||||
UPDATE_IS_PIA: "updateIsPia",
|
||||
UPDATE_PIA_TYPE: "updatePiaType",
|
||||
WORK_ORDER_NUMBER: "updateWorkOrderNumber",
|
||||
|
||||
// EVENT BUS MUTATIONS
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ export default {
|
|||
supportingItems: null,
|
||||
pricedGlassParts: null,
|
||||
displayPaypalAlert: this.getPaypalAlert(),
|
||||
paymentMethodInternalModel: null,
|
||||
paymentMethodInternalModel: this.getPaymentMethodFromStore(),
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -220,6 +220,15 @@ export default {
|
|||
getPaypalAlert() {
|
||||
return store.getters.order.payment.piaErrorCode ? true : false;
|
||||
},
|
||||
getPaymentMethodFromStore() {
|
||||
const isPia = store.getters.order.payment.isPia;
|
||||
|
||||
if (isPia) {
|
||||
return store.getters.order.payment.piaType;
|
||||
} else {
|
||||
return paymentMethods.LATER;
|
||||
}
|
||||
},
|
||||
vapsItemsSelectedAction(vapsItemsSelected) {
|
||||
this.cartItems = vapsItemsSelected;
|
||||
},
|
||||
|
|
@ -246,6 +255,11 @@ export default {
|
|||
async forwardButtonAction() {
|
||||
this.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false);
|
||||
this.dispatchStoreAction(this.storeActions.SAVE_WORK_ORDER_FLAG, true, false);
|
||||
this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_PAYMENT_METHODS_CHOICE,
|
||||
this.paymentMethod,
|
||||
false
|
||||
);
|
||||
await submitWorkOrder({ pageNameToLog: "payment-method" });
|
||||
this.$router.navigateWithoutSaving(
|
||||
this.navigationScenarios.CLICKED_FORWARD,
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import {
|
|||
militaryToTwelveHourTime,
|
||||
getDisplayTextForDurationLength,
|
||||
} from "@/layouts/schedule/helpers/schedule-helper";
|
||||
import { paymentMethods } from "@/constants/payment-method-constants";
|
||||
|
||||
import { getDateDifferenceInDays } from "@/helpers/date-helper";
|
||||
// Export State
|
||||
|
|
@ -92,7 +93,8 @@ const getDefaultState = () => {
|
|||
coverageStatus: null,
|
||||
},
|
||||
parentAccountNumber: 0,
|
||||
payNowType: "cc",
|
||||
isPia: null,
|
||||
piaType: null,
|
||||
piaErrorCode: null,
|
||||
},
|
||||
schedule: {
|
||||
|
|
@ -218,8 +220,11 @@ export const mutations = {
|
|||
updateIsInsurance(state, isInsurance) {
|
||||
state.order.payment.isInsurance = isInsurance;
|
||||
},
|
||||
updatePayNowType(state, payNowType) {
|
||||
state.order.payment.payNowType = payNowType;
|
||||
updateIsPia(state, isPia) {
|
||||
state.order.payment.isPia = isPia;
|
||||
},
|
||||
updatePiaType(state, piaType) {
|
||||
state.order.payment.piaType = piaType;
|
||||
},
|
||||
updatePiaErrorCode(state, piaErrorCode) {
|
||||
state.order.payment.piaErrorCode = piaErrorCode;
|
||||
|
|
@ -1994,8 +1999,12 @@ export const actions = {
|
|||
context.commit(storeMutations.UPDATE_IS_INSURANCE, isInsurance);
|
||||
},
|
||||
|
||||
savePayNowType(context, payNowType) {
|
||||
context.commit(storeMutations.UPDATE_PAY_NOW_TYPE, payNowType);
|
||||
savePaymentMethodChoice(context, paymentMethod) {
|
||||
const isPia = paymentMethod !== paymentMethods.LATER;
|
||||
|
||||
context.commit(storeMutations.UPDATE_IS_PIA, isPia);
|
||||
|
||||
context.commit(storeMutations.UPDATE_PIA_TYPE, isPia ? paymentMethod : null);
|
||||
},
|
||||
|
||||
saveParentAccountNumber(context, parentAccountNumber) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue