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