@zeniai/client-epic-state 4.11.44 → 4.11.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
- package/lib/entity/company/companyPayload.d.ts +12 -0
- package/lib/entity/company/companyPayload.js +21 -0
- package/lib/entity/company/companyReducer.d.ts +7 -0
- package/lib/entity/company/companyReducer.js +22 -2
- package/lib/entity/company/companyStateTypes.d.ts +12 -0
- package/lib/entity/depositAccountTransaction/depositAccountTransaction.d.ts +1 -1
- package/lib/entity/paymentAccount/paymentAccountPayload.d.ts +2 -0
- package/lib/entity/paymentAccount/paymentAccountPayload.js +2 -0
- package/lib/entity/paymentAccount/paymentAccountState.d.ts +2 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/toastNotification/epic/pushToastNotificationEpic.d.ts +1 -1
- package/lib/view/cardPayment/epic/addCardPaymentSourceEpic.d.ts +1 -1
- package/lib/view/cardPayment/epic/confirmCardSetupIntentEpic.d.ts +1 -1
- package/lib/view/cardPayment/epic/createCardSetupIntentEpic.d.ts +1 -1
- package/lib/view/cardPayment/epic/fetchPaymentSourcesEpic.d.ts +1 -1
- package/lib/view/companyView/types/cockpitTypes.d.ts +2 -2
- package/lib/view/onboardingView/customerView/epic/plaidConnection/establishOnboardingPlaidConnectionEpic.js +2 -0
- package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
- package/lib/view/people/deletePersonEpic.d.ts +1 -1
- package/lib/view/people/invitePeopleEpic.d.ts +1 -1
- package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
- package/lib/view/people/resendInviteEpic.d.ts +1 -1
- package/lib/view/referralView/referralState.d.ts +1 -1
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +2 -3
- package/lib/view/spendManagement/billPay/billPaySetupView/billPaySetupViewSelector.js +1 -1
- package/lib/view/spendManagement/billPay/billPaySetupView/epic/billPaySetup/fetchBillPaySetupViewEpic.d.ts +4 -1
- package/lib/view/spendManagement/billPay/billPaySetupView/epic/billPaySetup/fetchBillPaySetupViewEpic.js +16 -4
- package/lib/view/spendManagement/billPay/billsBulkActionView/epics/approveOrRejectBillsBulkActionEpic.js +25 -23
- package/lib/view/spendManagement/billPay/billsBulkActionView/epics/cancelOrDeleteBillsBulkActionEpic.js +21 -19
- package/lib/view/spendManagement/billPay/billsBulkActionView/epics/submitDraftBillsBulkActionEpic.js +25 -23
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +2 -3
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewSelector.js +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/epic/fetchChargeCardSetupViewEpic.d.ts +4 -1
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/epic/fetchChargeCardSetupViewEpic.js +16 -4
- package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +4 -0
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +42 -32
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/getPaymentAccountsEpic.js +1 -2
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updateMappedCashAccountEpic.js +4 -5
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountEpic.js +1 -2
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountStatusEpic.js +1 -2
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePrimaryFundingAccountEpic.js +34 -12
- package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.d.ts +2 -1
- package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js +52 -16
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +22 -29
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +49 -78
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +2 -8
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.js +5 -3
- package/lib/view/spendManagement/reimbursement/remiSetupView/epic/remiSetup/fetchRemiSetupViewEpic.js +6 -19
- package/lib/view/spendManagement/zeniAccounts/zeniAccountList/zeniAccountListSelector.js +2 -2
- package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/epic/fetchZeniAccountSetupViewEpic.d.ts +4 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/epic/fetchZeniAccountSetupViewEpic.js +20 -9
- package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewSelector.js +1 -1
- package/lib/view/tagView/epics/createTagEpic.d.ts +6 -6
- package/lib/view/tagView/epics/deleteTagEpic.d.ts +6 -6
- package/package.json +1 -1
package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountEpic.js
CHANGED
|
@@ -15,11 +15,10 @@ const updatePaymentAccountEpic = (actions$, _state$, zeniAPI) => actions$.pipe((
|
|
|
15
15
|
})
|
|
16
16
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
17
17
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
18
|
-
const paymentAccountIds = response.data.payment_accounts.map((paymentAccount) => paymentAccount.payment_account_id);
|
|
19
18
|
const actions = [
|
|
20
19
|
(0, accountReducer_1.updateAccounts)(response.data.accounts, setupViewType),
|
|
21
20
|
(0, paymentAccountReducer_1.updatePaymentAccounts)(response.data.payment_accounts),
|
|
22
|
-
(0, plaidAccountViewReducer_1.updatePaymentAccountSuccess)(
|
|
21
|
+
(0, plaidAccountViewReducer_1.updatePaymentAccountSuccess)(plaidAccountKeyType),
|
|
23
22
|
];
|
|
24
23
|
return (0, rxjs_1.from)(actions);
|
|
25
24
|
}
|
package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountStatusEpic.js
CHANGED
|
@@ -16,11 +16,10 @@ const updatePaymentAccountStatusEpic = (actions$, _state$, zeniAPI) => actions$.
|
|
|
16
16
|
})
|
|
17
17
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
18
18
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
19
|
-
const paymentAccountIds = response.data.payment_accounts.map((paymentAccount) => paymentAccount.payment_account_id);
|
|
20
19
|
const actions = [
|
|
21
20
|
(0, accountReducer_1.updateAccounts)(response.data.accounts, setupViewType),
|
|
22
21
|
(0, paymentAccountReducer_1.updatePaymentAccounts)(response.data.payment_accounts),
|
|
23
|
-
(0, plaidAccountViewReducer_1.updatePaymentAccountStatusSuccess)(
|
|
22
|
+
(0, plaidAccountViewReducer_1.updatePaymentAccountStatusSuccess)(linkTokenType, plaidAccountKeyType),
|
|
24
23
|
];
|
|
25
24
|
return (0, rxjs_1.from)(actions);
|
|
26
25
|
}
|
|
@@ -8,32 +8,54 @@ const plaidAccountViewReducer_1 = require("../../plaidAccountViewReducer");
|
|
|
8
8
|
const companyReducer_1 = require("../../../../../entity/company/companyReducer");
|
|
9
9
|
const helpers_1 = require("../../../helpers");
|
|
10
10
|
const billPayConfigState_1 = require("../../../billPay/billPayConfig/billPayConfigState");
|
|
11
|
-
const billPayConfigPayload_1 = require("../../../billPay/billPayConfig/billPayConfigPayload");
|
|
12
11
|
const updatePrimaryFundingAccountEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(plaidAccountViewReducer_1.updatePrimaryFundingAccount.match), (0, operators_1.mergeMap)((action) => {
|
|
13
|
-
const { companyId, accountId, accountType } = action.payload;
|
|
12
|
+
const { companyId, plaidAccountKeyType, accountId, accountType } = action.payload;
|
|
14
13
|
return zeniAPI
|
|
15
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`,
|
|
16
|
-
reimbursement_primary_funding_account_id: accountId,
|
|
17
|
-
reimbursement_primary_funding_account_type: (0, helpers_1.accountTypeSubConfigCodeToAccType)(accountType),
|
|
18
|
-
})
|
|
14
|
+
.putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, toPayload(plaidAccountKeyType, accountId, accountType))
|
|
19
15
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
20
|
-
var _a
|
|
16
|
+
var _a;
|
|
21
17
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
22
18
|
const actions = [
|
|
23
19
|
(0, companyReducer_1.updateCompanies)({
|
|
24
20
|
payload: (_a = response.data.companies) !== null && _a !== void 0 ? _a : [],
|
|
25
21
|
schema: {},
|
|
26
22
|
}),
|
|
27
|
-
(0, plaidAccountViewReducer_1.updatePrimaryFundingAccountSuccess)(
|
|
28
|
-
.primary_funding_account.account_id) !== null && _b !== void 0 ? _b : '', (0, billPayConfigPayload_1.getAccountTypeSubConfigCodeKey)((0, billPayConfigState_1.toAccType)((_c = response.data.companies[0].reimbursement_info
|
|
29
|
-
.primary_funding_account.account_type) !== null && _c !== void 0 ? _c : ''))),
|
|
23
|
+
(0, plaidAccountViewReducer_1.updatePrimaryFundingAccountSuccess)(plaidAccountKeyType),
|
|
30
24
|
];
|
|
31
25
|
return (0, rxjs_1.from)(actions);
|
|
32
26
|
}
|
|
33
27
|
else {
|
|
34
|
-
return (0, rxjs_1.of)((0, plaidAccountViewReducer_1.updatePrimaryFundingAccountFailure)(response.status));
|
|
28
|
+
return (0, rxjs_1.of)((0, plaidAccountViewReducer_1.updatePrimaryFundingAccountFailure)(plaidAccountKeyType, response.status));
|
|
35
29
|
}
|
|
36
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, plaidAccountViewReducer_1.updatePrimaryFundingAccountFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Update Primary Funding Account errored out' +
|
|
30
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, plaidAccountViewReducer_1.updatePrimaryFundingAccountFailure)(plaidAccountKeyType, (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Update Primary Funding Account errored out' +
|
|
37
31
|
JSON.stringify(error))))));
|
|
38
32
|
}));
|
|
39
33
|
exports.updatePrimaryFundingAccountEpic = updatePrimaryFundingAccountEpic;
|
|
34
|
+
function toPayload(plaidAccountKeyType, accountId, accountType) {
|
|
35
|
+
switch (plaidAccountKeyType) {
|
|
36
|
+
case 'bill_pay_setup': {
|
|
37
|
+
return {
|
|
38
|
+
bill_pay_primary_funding_account_id: accountId,
|
|
39
|
+
bill_pay_primary_funding_account_type: (0, helpers_1.accountTypeSubConfigCodeToAccType)((0, billPayConfigState_1.toAccountTypeSubConfigCodeKeyType)(accountType)),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
case 'reimbursement_setup': {
|
|
43
|
+
return {
|
|
44
|
+
reimbursement_primary_funding_account_id: accountId,
|
|
45
|
+
reimbursement_primary_funding_account_type: (0, helpers_1.accountTypeSubConfigCodeToAccType)((0, billPayConfigState_1.toAccountTypeSubConfigCodeKeyType)(accountType)),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
case 'charge_card_setup': {
|
|
49
|
+
return {
|
|
50
|
+
charge_cards_primary_funding_account_id: accountId,
|
|
51
|
+
charge_cards_primary_funding_account_type: (0, helpers_1.accountTypeSubConfigCodeToAccType)((0, billPayConfigState_1.toAccountTypeSubConfigCodeKeyType)(accountType)),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
default: {
|
|
55
|
+
return {
|
|
56
|
+
deposit_accounts_primary_funding_account_id: accountId,
|
|
57
|
+
deposit_accounts_primary_funding_account_type: (0, helpers_1.accountTypeSubConfigCodeToAccType)((0, billPayConfigState_1.toAccountTypeSubConfigCodeKeyType)(accountType)),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.d.ts
CHANGED
|
@@ -9,5 +9,6 @@ import { establishPlaidConnection, establishPlaidConnectionSuccess, establishPla
|
|
|
9
9
|
import { updateBankAccounts } from '../../../../../entity/bankAccount/bankAccountReducer';
|
|
10
10
|
import { updateUserBankAccount } from '../../../../userFinancialAccount/userFinancialAccountReducer';
|
|
11
11
|
import { updatePaymentAccountList } from '../../../zeniAccounts/paymentAccountList/paymentAccountListReducer';
|
|
12
|
-
|
|
12
|
+
import { updateCompanyPrimaryAccount } from '../../../../../entity/company/companyReducer';
|
|
13
|
+
export declare type ActionType = ReturnType<typeof establishPlaidConnection> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateBankAccounts> | ReturnType<typeof updateUserBankAccount> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof openSnackbar> | ReturnType<typeof updatePaymentAccountList> | ReturnType<typeof establishPlaidConnectionSuccess> | ReturnType<typeof establishPlaidConnectionFailure> | ReturnType<typeof updateCompanyPrimaryAccount>;
|
|
13
14
|
export declare const establishPlaidConnectionEpic: (actions$: ActionsObservable<ActionType>, state: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js
CHANGED
|
@@ -11,9 +11,10 @@ const plaidAccountViewReducer_1 = require("../../plaidAccountViewReducer");
|
|
|
11
11
|
const bankAccountReducer_1 = require("../../../../../entity/bankAccount/bankAccountReducer");
|
|
12
12
|
const userFinancialAccountReducer_1 = require("../../../../userFinancialAccount/userFinancialAccountReducer");
|
|
13
13
|
const paymentAccountListReducer_1 = require("../../../zeniAccounts/paymentAccountList/paymentAccountListReducer");
|
|
14
|
+
const companyReducer_1 = require("../../../../../entity/company/companyReducer");
|
|
14
15
|
const establishPlaidConnectionEpic = (actions$, state, zeniAPI) => actions$.pipe((0, operators_1.filter)(plaidAccountViewReducer_1.establishPlaidConnection.match), (0, operators_1.mergeMap)((action) => {
|
|
15
16
|
var _a, _b;
|
|
16
|
-
const { publicToken, setupViewType, linkTokenType, plaidAccountKeyType } = action.payload;
|
|
17
|
+
const { publicToken, companyId, setupViewType, linkTokenType, plaidAccountKeyType, } = action.payload;
|
|
17
18
|
const requestPayload = {
|
|
18
19
|
public_token: publicToken,
|
|
19
20
|
};
|
|
@@ -23,39 +24,74 @@ const establishPlaidConnectionEpic = (actions$, state, zeniAPI) => actions$.pipe
|
|
|
23
24
|
if (setupViewType == null) {
|
|
24
25
|
requestPayload.is_user_account = true;
|
|
25
26
|
}
|
|
27
|
+
else if (plaidAccountKeyType === 'bill_pay_setup') {
|
|
28
|
+
requestPayload.is_primary_for_bill_pay = true;
|
|
29
|
+
}
|
|
26
30
|
else if (plaidAccountKeyType === 'reimbursement_setup') {
|
|
27
31
|
requestPayload.is_primary_for_reimbursements = true;
|
|
28
32
|
}
|
|
33
|
+
else if (plaidAccountKeyType === 'charge_card_setup') {
|
|
34
|
+
requestPayload.is_primary_for_charge_cards = true;
|
|
35
|
+
}
|
|
36
|
+
else if (plaidAccountKeyType === 'account_setup') {
|
|
37
|
+
requestPayload.is_primary_for_deposit_accounts = true;
|
|
38
|
+
}
|
|
29
39
|
else if (plaidAccountKeyType === 'billing_setup') {
|
|
30
40
|
requestPayload.is_primary_for_onboarding = true;
|
|
31
41
|
}
|
|
32
|
-
else {
|
|
33
|
-
requestPayload.is_primary_for_bill_pay = true;
|
|
34
|
-
}
|
|
35
42
|
}
|
|
36
43
|
return zeniAPI
|
|
37
44
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/plaid/public-token`, requestPayload)
|
|
38
45
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
39
46
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
40
|
-
const
|
|
41
|
-
// the payment account received in the response is the new primary funding account
|
|
42
|
-
const primaryFundingAccountId = paymentAccountIds[0];
|
|
43
|
-
const existingPaymentAccountIds = state.value.plaidAccountViewState['reimbursement_setup']
|
|
44
|
-
.accountDetails.paymentAccountIds;
|
|
47
|
+
const paymentAccount = response.data.payment_accounts[0];
|
|
45
48
|
const actions = [
|
|
46
49
|
(0, paymentAccountReducer_1.updatePaymentAccounts)(response.data.payment_accounts),
|
|
47
50
|
(0, paymentAccountListReducer_1.updatePaymentAccountList)({
|
|
48
51
|
data: response.data.payment_accounts,
|
|
49
52
|
updateType: 'merge',
|
|
50
53
|
}),
|
|
51
|
-
(0, plaidAccountViewReducer_1.establishPlaidConnectionSuccess)(
|
|
54
|
+
(0, plaidAccountViewReducer_1.establishPlaidConnectionSuccess)(linkTokenType, plaidAccountKeyType),
|
|
52
55
|
];
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
if (setupViewType != null) {
|
|
57
|
+
const primaryAccountForProducts = [];
|
|
58
|
+
// if the account added is primary for any product, it should be reflected on that setup page without refresh also
|
|
59
|
+
// this happens when the first external account is added - it becomes primary for rest of the products also
|
|
60
|
+
if (paymentAccount.is_primary_for_bill_pay === true) {
|
|
61
|
+
primaryAccountForProducts.push('bill_pay');
|
|
62
|
+
}
|
|
63
|
+
if (paymentAccount.is_primary_for_bill_pay === true) {
|
|
64
|
+
actions.push((0, companyReducer_1.updateCompanyPrimaryAccount)({
|
|
65
|
+
companyId: companyId,
|
|
66
|
+
primaryFundingAccountId: paymentAccount.payment_account_id,
|
|
67
|
+
accountType: 'paymentAccount',
|
|
68
|
+
productType: 'bill_pay',
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
if (paymentAccount.is_primary_for_reimbursements === true) {
|
|
72
|
+
actions.push((0, companyReducer_1.updateCompanyPrimaryAccount)({
|
|
73
|
+
companyId: companyId,
|
|
74
|
+
primaryFundingAccountId: paymentAccount.payment_account_id,
|
|
75
|
+
accountType: 'paymentAccount',
|
|
76
|
+
productType: 'reimbursement',
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
if (paymentAccount.is_primary_for_charge_cards === true) {
|
|
80
|
+
actions.push((0, companyReducer_1.updateCompanyPrimaryAccount)({
|
|
81
|
+
companyId: companyId,
|
|
82
|
+
primaryFundingAccountId: paymentAccount.payment_account_id,
|
|
83
|
+
accountType: 'paymentAccount',
|
|
84
|
+
productType: 'charge_cards',
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
if (paymentAccount.is_primary_for_deposit_accounts === true) {
|
|
88
|
+
actions.push((0, companyReducer_1.updateCompanyPrimaryAccount)({
|
|
89
|
+
companyId: companyId,
|
|
90
|
+
primaryFundingAccountId: paymentAccount.payment_account_id,
|
|
91
|
+
accountType: 'paymentAccount',
|
|
92
|
+
productType: 'zeni_accounts',
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
59
95
|
}
|
|
60
96
|
if (response.data.bank_accounts != null) {
|
|
61
97
|
const bankAccountIds = response.data.bank_accounts.map((bank_account) => bank_account.bank_account_id);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ID } from '../../../commonStateTypes/common';
|
|
2
1
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
3
2
|
import { PlaidAccountKeyType, PlaidAccountViewState, PlaidLinkTokenType } from './plaidAccountViewState';
|
|
4
3
|
export declare const initialState: PlaidAccountViewState;
|
|
@@ -6,8 +5,7 @@ export declare const getPaymentAccounts: import("@reduxjs/toolkit").ActionCreato
|
|
|
6
5
|
setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing";
|
|
7
6
|
includeBalances: boolean;
|
|
8
7
|
plaidAccountKeyType: PlaidAccountKeyType;
|
|
9
|
-
}, string, never, never>, getPaymentAccountsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[
|
|
10
|
-
paymentAccountIds: string[];
|
|
8
|
+
}, string, never, never>, getPaymentAccountsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[plaidAccountKeyType: PlaidAccountKeyType], {
|
|
11
9
|
plaidAccountKeyType: PlaidAccountKeyType;
|
|
12
10
|
}, string, never, never>, getPaymentAccountsFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>, plaidAccountKeyType: PlaidAccountKeyType], {
|
|
13
11
|
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
@@ -17,8 +15,7 @@ export declare const getPaymentAccounts: import("@reduxjs/toolkit").ActionCreato
|
|
|
17
15
|
paymentAccountId: string;
|
|
18
16
|
setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing";
|
|
19
17
|
plaidAccountKeyType: PlaidAccountKeyType;
|
|
20
|
-
}, string, never, never>, updatePaymentAccountSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[
|
|
21
|
-
paymentAccountIds: string[];
|
|
18
|
+
}, string, never, never>, updatePaymentAccountSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[plaidAccountKeyType: PlaidAccountKeyType], {
|
|
22
19
|
plaidAccountKeyType: PlaidAccountKeyType;
|
|
23
20
|
}, string, never, never>, updatePaymentAccountFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>, plaidAccountKeyType: PlaidAccountKeyType], {
|
|
24
21
|
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
@@ -29,8 +26,7 @@ export declare const getPaymentAccounts: import("@reduxjs/toolkit").ActionCreato
|
|
|
29
26
|
setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing";
|
|
30
27
|
plaidAccountKeyType: PlaidAccountKeyType;
|
|
31
28
|
linkTokenType: PlaidLinkTokenType;
|
|
32
|
-
}, string, never, never>, updatePaymentAccountStatusSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[
|
|
33
|
-
paymentAccountIds: string[];
|
|
29
|
+
}, string, never, never>, updatePaymentAccountStatusSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[linkTokenType: PlaidLinkTokenType, plaidAccountKeyType: PlaidAccountKeyType], {
|
|
34
30
|
linkTokenType: PlaidLinkTokenType;
|
|
35
31
|
plaidAccountKeyType: PlaidAccountKeyType;
|
|
36
32
|
}, string, never, never>, updatePaymentAccountStatusFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>, linkTokenType: PlaidLinkTokenType, plaidAccountKeyType: PlaidAccountKeyType], {
|
|
@@ -64,44 +60,41 @@ export declare const getPaymentAccounts: import("@reduxjs/toolkit").ActionCreato
|
|
|
64
60
|
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
65
61
|
linkTokenType: PlaidLinkTokenType;
|
|
66
62
|
plaidAccountKeyType: PlaidAccountKeyType;
|
|
67
|
-
}, string, never, never>, establishPlaidConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[publicToken: string, plaidAccountKeyType: PlaidAccountKeyType, setupViewType?: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing" | undefined, linkTokenType?: PlaidLinkTokenType | undefined], {
|
|
63
|
+
}, string, never, never>, establishPlaidConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[publicToken: string, companyId: string, plaidAccountKeyType: PlaidAccountKeyType, setupViewType?: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing" | undefined, linkTokenType?: PlaidLinkTokenType | undefined], {
|
|
68
64
|
publicToken: string;
|
|
65
|
+
companyId: string;
|
|
69
66
|
setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing" | undefined;
|
|
70
67
|
linkTokenType: PlaidLinkTokenType;
|
|
71
68
|
plaidAccountKeyType: PlaidAccountKeyType;
|
|
72
|
-
}, string, never, never>, establishPlaidConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[
|
|
73
|
-
primaryFundingAccountId: string;
|
|
74
|
-
paymentAccountIds: string[];
|
|
69
|
+
}, string, never, never>, establishPlaidConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[linkTokenType: PlaidLinkTokenType, plaidAccountKeyType: PlaidAccountKeyType], {
|
|
75
70
|
linkTokenType: PlaidLinkTokenType;
|
|
76
71
|
plaidAccountKeyType: PlaidAccountKeyType;
|
|
77
72
|
}, string, never, never>, establishPlaidConnectionFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>, linkTokenType: PlaidLinkTokenType, plaidAccountKeyType: PlaidAccountKeyType], {
|
|
78
73
|
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
79
74
|
linkTokenType: PlaidLinkTokenType;
|
|
80
75
|
plaidAccountKeyType: PlaidAccountKeyType;
|
|
81
|
-
}, string, never, never>, updatePlaidAccountViewAccountDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[allBankAccountIds: string[],
|
|
82
|
-
accountId: ID;
|
|
83
|
-
accountType: string;
|
|
84
|
-
} | undefined], {
|
|
76
|
+
}, string, never, never>, updatePlaidAccountViewAccountDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[allBankAccountIds: string[], plaidAccountKeyType: PlaidAccountKeyType], {
|
|
85
77
|
allBankAccountIds: string[];
|
|
86
|
-
paymentAccountIds: string[];
|
|
87
78
|
plaidAccountKeyType: PlaidAccountKeyType;
|
|
88
|
-
|
|
89
|
-
primaryFundingAccount: {
|
|
90
|
-
accountId: ID;
|
|
91
|
-
accountType: string;
|
|
92
|
-
} | undefined;
|
|
93
|
-
}, string, never, never>, updatePrimaryFundingAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, accountId: string, accountType: string], {
|
|
79
|
+
}, string, never, never>, updatePrimaryFundingAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, plaidAccountKeyType: PlaidAccountKeyType, accountId: string, accountType: string], {
|
|
94
80
|
companyId: string;
|
|
81
|
+
plaidAccountKeyType: PlaidAccountKeyType;
|
|
95
82
|
accountId: string;
|
|
96
83
|
accountType: string;
|
|
97
|
-
}, string, never, never>, updatePrimaryFundingAccountSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
84
|
+
}, string, never, never>, updatePrimaryFundingAccountSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[plaidAccountKeyType: PlaidAccountKeyType], {
|
|
85
|
+
plaidAccountKeyType: PlaidAccountKeyType;
|
|
86
|
+
}, string, never, never>, updatePrimaryFundingAccountFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[plaidAccountKeyType: PlaidAccountKeyType, error: ZeniAPIStatus<Record<string, unknown>>], {
|
|
87
|
+
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
88
|
+
plaidAccountKeyType: PlaidAccountKeyType;
|
|
89
|
+
}, string, never, never>, updateMappedCashAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[plaidAccountKeyType: PlaidAccountKeyType, accountId: string, depositAccountId: string], {
|
|
90
|
+
plaidAccountKeyType: PlaidAccountKeyType;
|
|
101
91
|
accountId: string;
|
|
102
92
|
depositAccountId: string;
|
|
103
|
-
}, string, never, never>, updateMappedCashAccountSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[
|
|
104
|
-
|
|
105
|
-
}, string, never, never>, updateMappedCashAccountFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>],
|
|
93
|
+
}, string, never, never>, updateMappedCashAccountSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[plaidAccountKeyType: PlaidAccountKeyType], {
|
|
94
|
+
plaidAccountKeyType: PlaidAccountKeyType;
|
|
95
|
+
}, string, never, never>, updateMappedCashAccountFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[plaidAccountKeyType: PlaidAccountKeyType, error: ZeniAPIStatus<Record<string, unknown>>], {
|
|
96
|
+
plaidAccountKeyType: PlaidAccountKeyType;
|
|
97
|
+
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
98
|
+
}, string, never, never>, clearPlaidAccountView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
106
99
|
declare const _default: import("@reduxjs/toolkit").Reducer<PlaidAccountViewState, import("@reduxjs/toolkit").AnyAction>;
|
|
107
100
|
export default _default;
|
|
@@ -7,9 +7,12 @@ const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
|
7
7
|
const plaidAccountViewState_1 = require("./plaidAccountViewState");
|
|
8
8
|
exports.initialState = {
|
|
9
9
|
spend_management_setup: plaidAccountViewState_1.initialPlaidAccountState,
|
|
10
|
+
bill_pay_setup: plaidAccountViewState_1.initialPlaidAccountState,
|
|
11
|
+
reimbursement_setup: plaidAccountViewState_1.initialPlaidAccountState,
|
|
12
|
+
account_setup: plaidAccountViewState_1.initialPlaidAccountState,
|
|
13
|
+
charge_card_setup: plaidAccountViewState_1.initialPlaidAccountState,
|
|
10
14
|
user_reimbursement_account: plaidAccountViewState_1.initialPlaidAccountState,
|
|
11
15
|
external_account: plaidAccountViewState_1.initialPlaidAccountState,
|
|
12
|
-
reimbursement_setup: plaidAccountViewState_1.initialPlaidAccountState,
|
|
13
16
|
billing_setup: plaidAccountViewState_1.initialPlaidAccountState,
|
|
14
17
|
};
|
|
15
18
|
const plaidAccountView = (0, toolkit_1.createSlice)({
|
|
@@ -36,17 +39,15 @@ const plaidAccountView = (0, toolkit_1.createSlice)({
|
|
|
36
39
|
},
|
|
37
40
|
getPaymentAccountsSuccess: {
|
|
38
41
|
reducer(draft, action) {
|
|
39
|
-
const {
|
|
42
|
+
const { plaidAccountKeyType } = action.payload;
|
|
40
43
|
draft[plaidAccountKeyType].accountDetails.fetchStatus = {
|
|
41
44
|
fetchState: 'Completed',
|
|
42
45
|
error: undefined,
|
|
43
46
|
};
|
|
44
|
-
draft[plaidAccountKeyType].accountDetails.paymentAccountIds =
|
|
45
|
-
paymentAccountIds;
|
|
46
47
|
},
|
|
47
|
-
prepare(
|
|
48
|
+
prepare(plaidAccountKeyType) {
|
|
48
49
|
return {
|
|
49
|
-
payload: {
|
|
50
|
+
payload: { plaidAccountKeyType },
|
|
50
51
|
};
|
|
51
52
|
},
|
|
52
53
|
},
|
|
@@ -67,7 +68,7 @@ const plaidAccountView = (0, toolkit_1.createSlice)({
|
|
|
67
68
|
updatePaymentAccount: {
|
|
68
69
|
reducer(draft, action) {
|
|
69
70
|
const { plaidAccountKeyType } = action.payload;
|
|
70
|
-
draft[plaidAccountKeyType].accountDetails.
|
|
71
|
+
draft[plaidAccountKeyType].accountDetails.cashAccountUpdateStatus = {
|
|
71
72
|
fetchState: 'In-Progress',
|
|
72
73
|
error: undefined,
|
|
73
74
|
};
|
|
@@ -86,21 +87,21 @@ const plaidAccountView = (0, toolkit_1.createSlice)({
|
|
|
86
87
|
updatePaymentAccountSuccess: {
|
|
87
88
|
reducer(draft, action) {
|
|
88
89
|
const { plaidAccountKeyType } = action.payload;
|
|
89
|
-
draft[plaidAccountKeyType].accountDetails.
|
|
90
|
+
draft[plaidAccountKeyType].accountDetails.cashAccountUpdateStatus = {
|
|
90
91
|
fetchState: 'Completed',
|
|
91
92
|
error: undefined,
|
|
92
93
|
};
|
|
93
94
|
},
|
|
94
|
-
prepare(
|
|
95
|
+
prepare(plaidAccountKeyType) {
|
|
95
96
|
return {
|
|
96
|
-
payload: {
|
|
97
|
+
payload: { plaidAccountKeyType },
|
|
97
98
|
};
|
|
98
99
|
},
|
|
99
100
|
},
|
|
100
101
|
updatePaymentAccountFailure: {
|
|
101
102
|
reducer(draft, action) {
|
|
102
103
|
const { error, plaidAccountKeyType } = action.payload;
|
|
103
|
-
draft[plaidAccountKeyType].accountDetails.
|
|
104
|
+
draft[plaidAccountKeyType].accountDetails.cashAccountUpdateStatus = {
|
|
104
105
|
fetchState: 'Error',
|
|
105
106
|
error,
|
|
106
107
|
};
|
|
@@ -133,19 +134,15 @@ const plaidAccountView = (0, toolkit_1.createSlice)({
|
|
|
133
134
|
},
|
|
134
135
|
updatePaymentAccountStatusSuccess: {
|
|
135
136
|
reducer(draft, action) {
|
|
136
|
-
const {
|
|
137
|
+
const { linkTokenType, plaidAccountKeyType } = action.payload;
|
|
137
138
|
draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType] = Object.assign(Object.assign({}, draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType]), { updateStatus: {
|
|
138
139
|
fetchState: 'Completed',
|
|
139
140
|
error: undefined,
|
|
140
141
|
} });
|
|
141
|
-
if (plaidAccountKeyType !== 'reimbursement_setup') {
|
|
142
|
-
draft[plaidAccountKeyType].accountDetails.paymentAccountIds =
|
|
143
|
-
paymentAccountIds;
|
|
144
|
-
}
|
|
145
142
|
},
|
|
146
|
-
prepare(
|
|
143
|
+
prepare(linkTokenType, plaidAccountKeyType) {
|
|
147
144
|
return {
|
|
148
|
-
payload: {
|
|
145
|
+
payload: { linkTokenType, plaidAccountKeyType },
|
|
149
146
|
};
|
|
150
147
|
},
|
|
151
148
|
},
|
|
@@ -185,13 +182,11 @@ const plaidAccountView = (0, toolkit_1.createSlice)({
|
|
|
185
182
|
},
|
|
186
183
|
updatePaymentAccountLoginStatusSuccess: {
|
|
187
184
|
reducer(draft, action) {
|
|
188
|
-
const {
|
|
185
|
+
const { linkTokenType, plaidAccountKeyType } = action.payload;
|
|
189
186
|
draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType] = Object.assign(Object.assign({}, draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType]), { updateStatus: {
|
|
190
187
|
fetchState: 'Completed',
|
|
191
188
|
error: undefined,
|
|
192
189
|
} });
|
|
193
|
-
draft[plaidAccountKeyType].accountDetails.paymentAccountIds =
|
|
194
|
-
paymentAccountIds;
|
|
195
190
|
},
|
|
196
191
|
prepare(paymentAccountIds, linkTokenType, plaidAccountKeyType) {
|
|
197
192
|
return {
|
|
@@ -215,17 +210,11 @@ const plaidAccountView = (0, toolkit_1.createSlice)({
|
|
|
215
210
|
},
|
|
216
211
|
getPlaidLinkToken: {
|
|
217
212
|
reducer(draft, action) {
|
|
218
|
-
const { linkTokenType,
|
|
213
|
+
const { linkTokenType, plaidAccountKeyType } = action.payload;
|
|
219
214
|
draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType] = Object.assign(Object.assign({}, draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType]), { fetchStatus: {
|
|
220
215
|
fetchState: 'In-Progress',
|
|
221
216
|
error: undefined,
|
|
222
217
|
} });
|
|
223
|
-
if (paymentAccountId != null &&
|
|
224
|
-
plaidAccountKeyType !== 'reimbursement_setup') {
|
|
225
|
-
draft[plaidAccountKeyType].accountDetails.paymentAccountIds = [
|
|
226
|
-
paymentAccountId,
|
|
227
|
-
];
|
|
228
|
-
}
|
|
229
218
|
},
|
|
230
219
|
prepare(plaidAccountKeyType, linkTokenType, paymentAccountId) {
|
|
231
220
|
return {
|
|
@@ -273,10 +262,11 @@ const plaidAccountView = (0, toolkit_1.createSlice)({
|
|
|
273
262
|
error: undefined,
|
|
274
263
|
} });
|
|
275
264
|
},
|
|
276
|
-
prepare(publicToken, plaidAccountKeyType, setupViewType, linkTokenType) {
|
|
265
|
+
prepare(publicToken, companyId, plaidAccountKeyType, setupViewType, linkTokenType) {
|
|
277
266
|
return {
|
|
278
267
|
payload: {
|
|
279
268
|
publicToken,
|
|
269
|
+
companyId,
|
|
280
270
|
setupViewType,
|
|
281
271
|
linkTokenType: linkTokenType !== null && linkTokenType !== void 0 ? linkTokenType : 'link_account',
|
|
282
272
|
plaidAccountKeyType,
|
|
@@ -286,23 +276,15 @@ const plaidAccountView = (0, toolkit_1.createSlice)({
|
|
|
286
276
|
},
|
|
287
277
|
establishPlaidConnectionSuccess: {
|
|
288
278
|
reducer(draft, action) {
|
|
289
|
-
const {
|
|
279
|
+
const { linkTokenType, plaidAccountKeyType } = action.payload;
|
|
290
280
|
draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType] = Object.assign(Object.assign({}, draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType]), { updateStatus: {
|
|
291
281
|
fetchState: 'Completed',
|
|
292
282
|
error: undefined,
|
|
293
283
|
} });
|
|
294
|
-
draft[plaidAccountKeyType].accountDetails.primaryFundingAccount = {
|
|
295
|
-
accountId: primaryFundingAccountId,
|
|
296
|
-
accountType: 'paymentAccount',
|
|
297
|
-
};
|
|
298
|
-
draft[plaidAccountKeyType].accountDetails.paymentAccountIds =
|
|
299
|
-
paymentAccountIds;
|
|
300
284
|
},
|
|
301
|
-
prepare(
|
|
285
|
+
prepare(linkTokenType, plaidAccountKeyType) {
|
|
302
286
|
return {
|
|
303
287
|
payload: {
|
|
304
|
-
primaryFundingAccountId,
|
|
305
|
-
paymentAccountIds,
|
|
306
288
|
linkTokenType,
|
|
307
289
|
plaidAccountKeyType,
|
|
308
290
|
},
|
|
@@ -324,27 +306,18 @@ const plaidAccountView = (0, toolkit_1.createSlice)({
|
|
|
324
306
|
},
|
|
325
307
|
},
|
|
326
308
|
updatePlaidAccountViewAccountDetails: {
|
|
327
|
-
prepare(allBankAccountIds,
|
|
309
|
+
prepare(allBankAccountIds, plaidAccountKeyType) {
|
|
328
310
|
return {
|
|
329
311
|
payload: {
|
|
330
312
|
allBankAccountIds,
|
|
331
|
-
paymentAccountIds,
|
|
332
313
|
plaidAccountKeyType,
|
|
333
|
-
depositAccountIds,
|
|
334
|
-
primaryFundingAccount,
|
|
335
314
|
},
|
|
336
315
|
};
|
|
337
316
|
},
|
|
338
317
|
reducer(draft, action) {
|
|
339
|
-
const { allBankAccountIds,
|
|
318
|
+
const { allBankAccountIds, plaidAccountKeyType } = action.payload;
|
|
340
319
|
draft[plaidAccountKeyType].accountDetails.allBankAccountIds =
|
|
341
320
|
allBankAccountIds;
|
|
342
|
-
draft[plaidAccountKeyType].accountDetails.paymentAccountIds =
|
|
343
|
-
paymentAccountIds;
|
|
344
|
-
draft[plaidAccountKeyType].accountDetails.depositAccountIds =
|
|
345
|
-
depositAccountIds !== null && depositAccountIds !== void 0 ? depositAccountIds : [];
|
|
346
|
-
draft[plaidAccountKeyType].accountDetails.primaryFundingAccount =
|
|
347
|
-
primaryFundingAccount;
|
|
348
321
|
draft[plaidAccountKeyType].accountDetails.fetchStatus = {
|
|
349
322
|
fetchState: 'Completed',
|
|
350
323
|
error: undefined,
|
|
@@ -352,81 +325,79 @@ const plaidAccountView = (0, toolkit_1.createSlice)({
|
|
|
352
325
|
},
|
|
353
326
|
},
|
|
354
327
|
updatePrimaryFundingAccount: {
|
|
355
|
-
reducer(draft) {
|
|
356
|
-
draft[
|
|
328
|
+
reducer(draft, action) {
|
|
329
|
+
draft[action.payload.plaidAccountKeyType].accountDetails.primaryFundingAccountUpdateStatus = {
|
|
357
330
|
fetchState: 'In-Progress',
|
|
358
331
|
error: undefined,
|
|
359
332
|
};
|
|
360
333
|
},
|
|
361
|
-
prepare(companyId, accountId, accountType) {
|
|
362
|
-
return {
|
|
334
|
+
prepare(companyId, plaidAccountKeyType, accountId, accountType) {
|
|
335
|
+
return {
|
|
336
|
+
payload: { companyId, plaidAccountKeyType, accountId, accountType },
|
|
337
|
+
};
|
|
363
338
|
},
|
|
364
339
|
},
|
|
365
340
|
updatePrimaryFundingAccountSuccess: {
|
|
366
341
|
reducer(draft, action) {
|
|
367
|
-
const {
|
|
368
|
-
draft[
|
|
342
|
+
const { plaidAccountKeyType } = action.payload;
|
|
343
|
+
draft[plaidAccountKeyType].accountDetails.primaryFundingAccountUpdateStatus = {
|
|
369
344
|
fetchState: 'Completed',
|
|
370
345
|
error: undefined,
|
|
371
346
|
};
|
|
372
|
-
draft['reimbursement_setup'].accountDetails.primaryFundingAccount = {
|
|
373
|
-
accountId: accountId,
|
|
374
|
-
accountType: accountType,
|
|
375
|
-
};
|
|
376
347
|
},
|
|
377
|
-
prepare(
|
|
348
|
+
prepare(plaidAccountKeyType) {
|
|
378
349
|
return {
|
|
379
|
-
payload: {
|
|
350
|
+
payload: { plaidAccountKeyType },
|
|
380
351
|
};
|
|
381
352
|
},
|
|
382
353
|
},
|
|
383
354
|
updatePrimaryFundingAccountFailure: {
|
|
384
355
|
reducer(draft, action) {
|
|
385
|
-
draft[
|
|
356
|
+
draft[action.payload.plaidAccountKeyType].accountDetails.primaryFundingAccountUpdateStatus = {
|
|
386
357
|
fetchState: 'Error',
|
|
387
|
-
error: action.payload,
|
|
358
|
+
error: action.payload.error,
|
|
388
359
|
};
|
|
389
360
|
},
|
|
390
|
-
prepare(error) {
|
|
361
|
+
prepare(plaidAccountKeyType, error) {
|
|
391
362
|
return {
|
|
392
|
-
payload: error,
|
|
363
|
+
payload: { error, plaidAccountKeyType },
|
|
393
364
|
};
|
|
394
365
|
},
|
|
395
366
|
},
|
|
396
367
|
updateMappedCashAccount: {
|
|
397
|
-
reducer(draft) {
|
|
398
|
-
draft[
|
|
368
|
+
reducer(draft, action) {
|
|
369
|
+
draft[action.payload.plaidAccountKeyType].accountDetails.cashAccountUpdateStatus = {
|
|
399
370
|
fetchState: 'In-Progress',
|
|
400
371
|
error: undefined,
|
|
401
372
|
};
|
|
402
373
|
},
|
|
403
|
-
prepare(accountId, depositAccountId) {
|
|
404
|
-
return { payload: { accountId, depositAccountId } };
|
|
374
|
+
prepare(plaidAccountKeyType, accountId, depositAccountId) {
|
|
375
|
+
return { payload: { plaidAccountKeyType, accountId, depositAccountId } };
|
|
405
376
|
},
|
|
406
377
|
},
|
|
407
378
|
updateMappedCashAccountSuccess: {
|
|
408
|
-
reducer(draft) {
|
|
409
|
-
draft[
|
|
379
|
+
reducer(draft, action) {
|
|
380
|
+
draft[action.payload.plaidAccountKeyType].accountDetails.cashAccountUpdateStatus = {
|
|
410
381
|
fetchState: 'Completed',
|
|
411
382
|
error: undefined,
|
|
412
383
|
};
|
|
413
384
|
},
|
|
414
|
-
prepare(
|
|
385
|
+
prepare(plaidAccountKeyType) {
|
|
415
386
|
return {
|
|
416
|
-
payload: {
|
|
387
|
+
payload: { plaidAccountKeyType },
|
|
417
388
|
};
|
|
418
389
|
},
|
|
419
390
|
},
|
|
420
391
|
updateMappedCashAccountFailure: {
|
|
421
392
|
reducer(draft, action) {
|
|
422
|
-
draft[
|
|
393
|
+
draft[action.payload.plaidAccountKeyType].accountDetails.cashAccountUpdateStatus = {
|
|
423
394
|
fetchState: 'Error',
|
|
424
|
-
error: action.payload,
|
|
395
|
+
error: action.payload.error,
|
|
425
396
|
};
|
|
426
397
|
},
|
|
427
|
-
prepare(error) {
|
|
398
|
+
prepare(plaidAccountKeyType, error) {
|
|
428
399
|
return {
|
|
429
|
-
payload: error,
|
|
400
|
+
payload: { plaidAccountKeyType, error },
|
|
430
401
|
};
|
|
431
402
|
},
|
|
432
403
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
3
3
|
export declare type PlaidLinkTokenType = 'link_account' | 'update_account' | 'link_account_no_microdeposit' | 'link_external_account';
|
|
4
|
-
export declare type PlaidAccountKeyType = 'spend_management_setup' | 'reimbursement_setup' | 'user_reimbursement_account' | 'external_account' | 'billing_setup';
|
|
4
|
+
export declare type PlaidAccountKeyType = 'spend_management_setup' | 'bill_pay_setup' | 'reimbursement_setup' | 'account_setup' | 'charge_card_setup' | 'user_reimbursement_account' | 'external_account' | 'billing_setup';
|
|
5
5
|
export declare type PlaidConnectionDetails = Record<PlaidLinkTokenType, {
|
|
6
6
|
linkToken?: string;
|
|
7
7
|
expiration?: ZeniDate;
|
|
@@ -12,14 +12,8 @@ export declare const initialPlaidAccountState: PlaidAccountState;
|
|
|
12
12
|
export interface PlaidAccountState {
|
|
13
13
|
accountDetails: {
|
|
14
14
|
fetchStatus: FetchStateAndError;
|
|
15
|
-
|
|
15
|
+
cashAccountUpdateStatus: FetchStateAndError;
|
|
16
16
|
primaryFundingAccountUpdateStatus?: FetchStateAndError;
|
|
17
|
-
primaryFundingAccount?: {
|
|
18
|
-
accountId: ID;
|
|
19
|
-
accountType: string;
|
|
20
|
-
};
|
|
21
|
-
paymentAccountIds: ID[];
|
|
22
|
-
depositAccountIds: ID[];
|
|
23
17
|
allBankAccountIds: ID[];
|
|
24
18
|
};
|
|
25
19
|
plaidConnectionDetails: PlaidConnectionDetails;
|