@zeniai/client-epic-state 4.10.66 → 4.10.68
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/company/companyPayload.d.ts +4 -0
- package/lib/entity/company/companyPayload.js +10 -1
- package/lib/entity/company/companyStateTypes.d.ts +5 -0
- package/lib/entity/depositAccount/depositAccount.d.ts +1 -0
- package/lib/entity/depositAccount/depositAccountPayload.d.ts +1 -0
- package/lib/entity/depositAccount/depositAccountPayload.js +1 -0
- package/lib/entity/paymentAccount/paymentAccountPayload.d.ts +1 -0
- package/lib/entity/paymentAccount/paymentAccountPayload.js +1 -0
- package/lib/entity/paymentAccount/paymentAccountState.d.ts +1 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/tenant/tenantSelector.js +4 -2
- package/lib/epic.d.ts +4 -1
- package/lib/epic.js +4 -1
- package/lib/index.d.ts +12 -11
- package/lib/index.js +15 -10
- package/lib/reducer.d.ts +3 -0
- package/lib/reducer.js +3 -0
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewPayload.d.ts +1 -0
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.d.ts +2 -1
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +14 -1
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewSelector.d.ts +8 -2
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewSelector.js +41 -3
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.d.ts +7 -0
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.js +2 -1
- package/lib/view/onboardingView/customerView/epic/plaidConnection/establishOnboardingPlaidConnectionEpic.js +1 -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/reviewCompanyView/fetchReviewCompanyViewEpic.d.ts +2 -1
- package/lib/view/reviewCompanyView/fetchReviewCompanyViewEpic.js +9 -1
- package/lib/view/reviewCompanyView/reviewCompanyViewReducer.d.ts +2 -1
- package/lib/view/reviewCompanyView/reviewCompanyViewReducer.js +2 -2
- package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.d.ts +2 -2
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +2 -2
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +2 -2
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +5 -5
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +4 -4
- package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +2 -2
- package/lib/view/spendManagement/commonSetup/setupViewPayload.d.ts +2 -0
- package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +28 -3
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +79 -5
- package/lib/view/spendManagement/helpers.d.ts +1 -0
- package/lib/view/spendManagement/helpers.js +5 -1
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updateMappedCashAccountEpic.d.ts +9 -0
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updateMappedCashAccountEpic.js +31 -0
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePrimaryFundingAccountEpic.d.ts +8 -0
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePrimaryFundingAccountEpic.js +39 -0
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +23 -2
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +96 -8
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewSelector.d.ts +1 -1
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewSelector.js +3 -3
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +7 -1
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.js +1 -0
- package/lib/view/spendManagement/reimbursement/remiSetupView/epic/remiSetup/fetchRemiSetupViewEpic.d.ts +2 -1
- package/lib/view/spendManagement/reimbursement/remiSetupView/epic/remiSetup/fetchRemiSetupViewEpic.js +18 -3
- package/lib/view/spendManagement/reimbursement/remiSetupView/remiSetupViewSelector.js +1 -1
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailReducer.js +1 -0
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.d.ts +3 -6
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.js +3 -44
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailState.d.ts +4 -14
- package/lib/view/tagView/epics/createTagEpic.d.ts +1 -1
- package/lib/view/tagView/epics/deleteTagEpic.d.ts +1 -1
- package/lib/view/vendorTabView/fetchVendorTabViewEpic.d.ts +9 -0
- package/lib/view/vendorTabView/fetchVendorTabViewEpic.js +53 -0
- package/lib/view/vendorTabView/vendorTabViewReducer.d.ts +15 -0
- package/lib/view/vendorTabView/vendorTabViewReducer.js +37 -0
- package/lib/view/vendorTabView/vendorTabViewState.d.ts +2 -0
- package/lib/view/vendorTabView/vendorTabViewState.js +2 -0
- package/package.json +2 -2
|
@@ -18,7 +18,7 @@ export declare const saveNotificationSettingsEpic: (actions$: ActionsObservable<
|
|
|
18
18
|
type: string;
|
|
19
19
|
} | {
|
|
20
20
|
payload: {
|
|
21
|
-
messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "
|
|
21
|
+
messageSection: "reimbursement_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "zeni_account_accept_term" | "update_vendor" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "charge_card_setup" | "charge_card_accept_term" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "settings_accounting_accounts_updated";
|
|
22
22
|
messageText: "failed" | "success";
|
|
23
23
|
type: import("../../..").SnackbarMessageType;
|
|
24
24
|
showStatusIcon?: boolean | undefined;
|
|
@@ -18,13 +18,13 @@ import { UserAndRole } from '../../../companyView/types/userAndRole';
|
|
|
18
18
|
import { Class } from '../../../../entity/class/classState';
|
|
19
19
|
import { PaymentInstrument } from '../../../../entity/paymentInstrument/paymentInstrument';
|
|
20
20
|
import { RecurringBillConfig, RecurringBillData } from '../../../../entity/billPay/recurringBills/recurringBillsState';
|
|
21
|
-
import {
|
|
21
|
+
import { FundingAccount } from '../../commonSetup/setupViewSelector';
|
|
22
22
|
export interface BillDetailViewSelector extends SelectorView {
|
|
23
23
|
transactionDetails?: BillTransaction;
|
|
24
24
|
createdBy?: User;
|
|
25
25
|
bankAccount?: BankAccount;
|
|
26
26
|
paymentInstrument?: PaymentInstrument;
|
|
27
|
-
withdrawFrom?:
|
|
27
|
+
withdrawFrom?: FundingAccount;
|
|
28
28
|
previousBills: PreviousBillsSelectorView;
|
|
29
29
|
deleteStatus: FetchStateAndError;
|
|
30
30
|
cancelAndDeleteStatus: FetchStateAndError;
|
|
@@ -25,7 +25,7 @@ const helpers_1 = require("../../helpers");
|
|
|
25
25
|
const paymentInstrumentSelector_1 = require("../../../../entity/paymentInstrument/paymentInstrumentSelector");
|
|
26
26
|
const billPayConfigPayload_1 = require("../billPayConfig/billPayConfigPayload");
|
|
27
27
|
const depositAccountSelector_1 = require("../../../../entity/depositAccount/depositAccountSelector");
|
|
28
|
-
const
|
|
28
|
+
const setupViewSelector_1 = require("../../commonSetup/setupViewSelector");
|
|
29
29
|
const getBillActivities = (state, billId, billStageCode) => {
|
|
30
30
|
const { billDetailViewState, approvalRuleState, entityApprovalStatusState, userState, } = state;
|
|
31
31
|
const key = (0, billDetailViewState_1.getBillTransactionDetailKey)(billId);
|
|
@@ -98,7 +98,7 @@ const getBillDetailView = (state, billId) => {
|
|
|
98
98
|
const paymentInstrument = (0, paymentInstrumentSelector_1.getPaymentInstrumentById)(paymentInstrumentState, (_c = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.toAccount.billAccountId) !== null && _c !== void 0 ? _c : '');
|
|
99
99
|
const paymentAccount = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, (_d = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountId) !== null && _d !== void 0 ? _d : '');
|
|
100
100
|
const depositAccount = (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, (_e = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountId) !== null && _e !== void 0 ? _e : '');
|
|
101
|
-
const withdrawFrom = (0,
|
|
101
|
+
const withdrawFrom = (0, setupViewSelector_1.getAllFundingAccounts)((_f = (depositAccount && [depositAccount])) !== null && _f !== void 0 ? _f : [], (_g = (paymentAccount && [paymentAccount])) !== null && _g !== void 0 ? _g : [])[0];
|
|
102
102
|
let previousBills = {
|
|
103
103
|
bills: [],
|
|
104
104
|
fetchState: 'Not-Started',
|
|
@@ -13,7 +13,7 @@ const contactSelector_1 = require("../../../../entity/billPay/contact/contactSel
|
|
|
13
13
|
const editBillViewSelector_1 = require("../editBillView/editBillViewSelector");
|
|
14
14
|
const paymentAccountSelector_1 = require("../../../../entity/paymentAccount/paymentAccountSelector");
|
|
15
15
|
const depositAccountListSelector_1 = require("../../zeniAccounts/depositAccountList/depositAccountListSelector");
|
|
16
|
-
const
|
|
16
|
+
const setupViewSelector_1 = require("../../commonSetup/setupViewSelector");
|
|
17
17
|
const getDuplicateBills = (state, billId) => {
|
|
18
18
|
var _a, _b;
|
|
19
19
|
const { billTransactionState, billPayReviewState } = state;
|
|
@@ -50,7 +50,7 @@ const getReviewPageBillDetail = (state, billId) => {
|
|
|
50
50
|
const primaryPaymentAccount = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, plaidAccountViewState['spend_management_setup'].accountDetails
|
|
51
51
|
.paymentAccountIds);
|
|
52
52
|
const allDepositAccounts = (0, depositAccountListSelector_1.getAllDepostAccounts)(depositAccountState, depositAccountListState).depositAccounts;
|
|
53
|
-
const withdrawFromList = (0,
|
|
53
|
+
const withdrawFromList = (0, setupViewSelector_1.getAllFundingAccounts)(allDepositAccounts, primaryPaymentAccount);
|
|
54
54
|
let fetchState = 'Not-Started';
|
|
55
55
|
let sourceBillDetailFetchState = 'Not-Started';
|
|
56
56
|
const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'billPayAccountList');
|
|
@@ -26,8 +26,8 @@ import { VendorDetailLocalData } from '../../../commonVendorView/vendorView/vend
|
|
|
26
26
|
import { AccountBase, RecommendedAccountBase } from '../../../../entity/account/accountState';
|
|
27
27
|
import { ClassBase, RecommendedClassBase } from '../../../../entity/class/classState';
|
|
28
28
|
import { RecurringBillState } from '../../../../entity/billPay/recurringBills/recurringBillsState';
|
|
29
|
-
import { TransferMoneyParty } from '../../zeniAccounts/transferDetail/transferDetailState';
|
|
30
29
|
import { DepositAccountState } from '../../../../entity/depositAccount/depositAccount';
|
|
30
|
+
import { FundingAccount } from '../../commonSetup/setupViewSelector';
|
|
31
31
|
export declare type PaymentToOption = {
|
|
32
32
|
id: ID;
|
|
33
33
|
type: PaymentModeType;
|
|
@@ -106,7 +106,7 @@ export interface EditBillDetailSelectorView extends SelectorView {
|
|
|
106
106
|
isRecurring: boolean;
|
|
107
107
|
recurringConfig?: RecurringBillConfigLocalData;
|
|
108
108
|
recurringBillInstances?: RecurringBillInstance[];
|
|
109
|
-
withdrawFromList:
|
|
109
|
+
withdrawFromList: FundingAccount[];
|
|
110
110
|
}
|
|
111
111
|
export interface EditBillInitialDetails {
|
|
112
112
|
vendor?: Vendor;
|
|
@@ -120,14 +120,14 @@ export declare const getEditBillDetail: (state: RootState, isVendorRecommendatio
|
|
|
120
120
|
export declare const getBillPayConfigList: (billPayConfigState: BillPayConfigState) => BillPayConfig[];
|
|
121
121
|
export declare const getPaymentMethodType: (billPayConfigState: BillPayConfigState, accType: AccountTypeSubConfigCodeKeyType, paymentMethod?: BillPaymentMethod | undefined, internationalTransferFeeBearerPaymentMethod?: "swift_our" | "swift_sha" | undefined) => BillPayConfig | undefined;
|
|
122
122
|
export declare function getWhatForSection(updatedWhatForSection: WhatForSection | undefined): WhatForSection;
|
|
123
|
-
export declare function getPaymentSection(state: RootState, withdrawFromList:
|
|
123
|
+
export declare function getPaymentSection(state: RootState, withdrawFromList: FundingAccount[], updatedPaymentSection: PaymentDetailsSection): PaymentDetailsSectionView;
|
|
124
124
|
export declare const getActualPaymentTypeBasedOnAccType: (availablePaymentOptions: BillPayConfig[], withdrawFromAccType: AccountTypeSubConfigCodeKeyType, currentPaymentType?: BillPayConfig | undefined) => BillPayConfig | undefined;
|
|
125
125
|
export declare function toPaymentToOption(paymentMode: PaymentMode): PaymentToOption;
|
|
126
126
|
export declare function getCurrentPaymentToOption(state: RootState, id: ID): PaymentToOption | undefined;
|
|
127
127
|
export interface PaymentDetailsSectionView {
|
|
128
128
|
paymentType?: BillPayConfig;
|
|
129
129
|
paymentDate?: ZeniDate;
|
|
130
|
-
withdrawFrom?:
|
|
130
|
+
withdrawFrom?: FundingAccount;
|
|
131
131
|
withdrawFromAccountingName?: string;
|
|
132
132
|
paymentTo?: PaymentToOption;
|
|
133
133
|
internationalTransferFeeBearerPaymentMethod?: InternationalTransferFeeBearerPaymentMethod;
|
|
@@ -139,4 +139,4 @@ export declare const getRecurringBillLocalData: (recurringBillState: RecurringBi
|
|
|
139
139
|
};
|
|
140
140
|
export declare const getInvoiceDate: (billStageCode: BillStageCodeType, invoiceDate: ZeniDate, bookCloseDate?: import("dayjs").Dayjs | undefined) => import("dayjs").Dayjs;
|
|
141
141
|
export declare const getDueDate: (billStageCode: BillStageCodeType, dueDate: ZeniDate, invoiceDate?: import("dayjs").Dayjs | undefined, bookCloseDate?: import("dayjs").Dayjs | undefined) => import("dayjs").Dayjs;
|
|
142
|
-
export declare const getWithdrawFrom: (paymentAccountState: PaymentAccountState, depositAccountState: DepositAccountState, fromAccountId: ID, fromAccountType: string) =>
|
|
142
|
+
export declare const getWithdrawFrom: (paymentAccountState: PaymentAccountState, depositAccountState: DepositAccountState, fromAccountId: ID, fromAccountType: string) => FundingAccount | undefined;
|
|
@@ -27,9 +27,9 @@ const helpers_1 = require("../../helpers");
|
|
|
27
27
|
const billPayReviewSelector_1 = require("../billPayReview/billPayReviewSelector");
|
|
28
28
|
const paymentInstrumentSelector_1 = require("../../../../entity/paymentInstrument/paymentInstrumentSelector");
|
|
29
29
|
const billPayConfigPayload_1 = require("../billPayConfig/billPayConfigPayload");
|
|
30
|
-
const transferDetailSelector_1 = require("../../zeniAccounts/transferDetail/transferDetailSelector");
|
|
31
30
|
const depositAccountListSelector_1 = require("../../zeniAccounts/depositAccountList/depositAccountListSelector");
|
|
32
31
|
const depositAccountSelector_1 = require("../../../../entity/depositAccount/depositAccountSelector");
|
|
32
|
+
const setupViewSelector_1 = require("../../commonSetup/setupViewSelector");
|
|
33
33
|
const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAccountsEnabled, billId) => {
|
|
34
34
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
|
|
35
35
|
const { accountListState, accountState, bankAccountState, billDetailViewState, plaidAccountViewState, billTransactionState, billPayConfigState, classListState, classState, editBillDetailViewState, paymentAccountState, vendorState, tenantState, companyState, userState, commonHistoryState, contactState, paymentInstrumentState, recurringBillState, depositAccountListState, depositAccountState, } = state;
|
|
@@ -84,7 +84,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
84
84
|
if (allDepositAccounts.length === 0 && fromDepositAccount != null) {
|
|
85
85
|
allDepositAccounts.push(fromDepositAccount);
|
|
86
86
|
}
|
|
87
|
-
const withdrawFromList = (0,
|
|
87
|
+
const withdrawFromList = (0, setupViewSelector_1.getAllFundingAccounts)(allDepositAccounts, primaryPaymentAccount);
|
|
88
88
|
let previousBills = {
|
|
89
89
|
bills: [],
|
|
90
90
|
fetchState: 'Not-Started',
|
|
@@ -593,11 +593,11 @@ const getWithdrawFrom = (paymentAccountState, depositAccountState, fromAccountId
|
|
|
593
593
|
const withdrawFromAsPaymentAcc = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, fromAccountId);
|
|
594
594
|
if (fromAccountType === 'depositAccount' &&
|
|
595
595
|
withdrawFromAsDepositAcc != null) {
|
|
596
|
-
return (0,
|
|
596
|
+
return (0, setupViewSelector_1.mapDepositAccToFundingAccount)(withdrawFromAsDepositAcc);
|
|
597
597
|
}
|
|
598
598
|
if (fromAccountType === 'paymentAccount' &&
|
|
599
599
|
withdrawFromAsPaymentAcc != null) {
|
|
600
|
-
return (0,
|
|
600
|
+
return (0, setupViewSelector_1.mapPaymentAccToFundingAccount)(withdrawFromAsPaymentAcc);
|
|
601
601
|
}
|
|
602
602
|
return undefined;
|
|
603
603
|
};
|
|
@@ -12,8 +12,8 @@ import { PaymentInstrument } from '../../../../entity/paymentInstrument/paymentI
|
|
|
12
12
|
import { BankAccount } from '../../../../entity/bankAccount/bankAccount';
|
|
13
13
|
import { Contact } from '../../../../entity/billPay/contact/contact';
|
|
14
14
|
import { RecurringBillFrequency, RecurringBillPaymentStatus, RecurringBillStatus } from '../../../../entity/billPay/recurringBills/recurringBillsState';
|
|
15
|
-
import { TransferMoneyParty } from '../../zeniAccounts/transferDetail/transferDetailState';
|
|
16
15
|
import { RecurringDatePickerOptions } from '../../../common/recurringViewHelper';
|
|
16
|
+
import { FundingAccount } from '../../commonSetup/setupViewSelector';
|
|
17
17
|
export interface EditBillDetail {
|
|
18
18
|
fetchStatus: FetchStateAndError;
|
|
19
19
|
saveStatus: FetchStateAndError;
|
|
@@ -79,7 +79,7 @@ export interface PaymentDetailsSection {
|
|
|
79
79
|
internationalTransferFeeBearerPaymentMethod?: InternationalTransferFeeBearerPaymentMethod;
|
|
80
80
|
paymentType?: BillPayConfig;
|
|
81
81
|
paymentDate?: ZeniDate;
|
|
82
|
-
withdrawFrom?:
|
|
82
|
+
withdrawFrom?: FundingAccount;
|
|
83
83
|
paymentTo?: ID;
|
|
84
84
|
conversionRate?: number;
|
|
85
85
|
}
|
|
@@ -5,6 +5,7 @@ import { UserRolePayload } from '../../../entity/userRole/userRolePayload';
|
|
|
5
5
|
import { FilePayload } from '../../../entity/file/filePayload';
|
|
6
6
|
import { AddressPayload } from '../../../entity/address/addressPayload';
|
|
7
7
|
import { PaymentAccountsPayload } from '../plaidAccount/types/paymentAccount';
|
|
8
|
+
import { DepositAccountPayload } from '../../../entity/depositAccount/depositAccountPayload';
|
|
8
9
|
/**
|
|
9
10
|
* Setup View Payload
|
|
10
11
|
*/
|
|
@@ -16,6 +17,7 @@ export interface EnableSetupViewPayload {
|
|
|
16
17
|
export interface SetupViewPayload extends EnableSetupViewPayload, PaymentAccountsPayload {
|
|
17
18
|
files: FilePayload[];
|
|
18
19
|
addresses: AddressPayload[];
|
|
20
|
+
deposit_accounts?: DepositAccountPayload[];
|
|
19
21
|
}
|
|
20
22
|
export declare type SetupViewResponse = ZeniAPIResponse<SetupViewPayload>;
|
|
21
23
|
export declare type EnableSetupViewResponse = ZeniAPIResponse<EnableSetupViewPayload>;
|
|
@@ -4,21 +4,43 @@ import { ZeniDate } from '../../../zeniDayJS';
|
|
|
4
4
|
import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
5
5
|
import { File } from '../../../entity/file/fileState';
|
|
6
6
|
import { CompanyBillPayInfo } from '../../../entity/company/companyStateTypes';
|
|
7
|
-
import { PaymentAccount } from '../../../entity/paymentAccount/paymentAccountState';
|
|
7
|
+
import { InstitutionDetails, Logo, PaymentAccount } from '../../../entity/paymentAccount/paymentAccountState';
|
|
8
8
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
9
9
|
import { CompanyOfficerType } from '../../companyView/types/companyPassport/companyUsersLocalData';
|
|
10
10
|
import { CompanyView } from '../../companyView/types/companyView';
|
|
11
11
|
import { NewAddressData } from '../../addressView/addressViewState';
|
|
12
12
|
import { CompanyAndIdentityDetails, CompanyOfficerLocalData, PrimaryContactLocalData, SetupViewType } from './setupViewState';
|
|
13
13
|
import { PlaidAccountKeyType, PlaidConnectionDetails } from '../plaidAccount/plaidAccountViewState';
|
|
14
|
+
import { AccountTypeSubConfigCodeKeyType } from '../billPay/billPayConfig/billPayConfigState';
|
|
15
|
+
import { Balance } from '../../../commonStateTypes/balance';
|
|
16
|
+
import { DepositAccount } from '../../../entity/depositAccount/depositAccount';
|
|
17
|
+
import { AllowedValueWithCode } from '../../../commonStateTypes/allowedValue';
|
|
14
18
|
export interface SetupView {
|
|
15
|
-
|
|
16
|
-
paymentAccount?: PaymentAccount;
|
|
19
|
+
allFundingAccounts: FundingAccount[];
|
|
17
20
|
allBankAccounts: AccountBase[];
|
|
18
21
|
plaidConnectionDetails: PlaidConnectionDetails;
|
|
19
22
|
accountUpdateStatus: FetchStateAndError;
|
|
20
23
|
accountFetchStatus: FetchStateAndError;
|
|
21
24
|
updateStatus: FetchStateAndError;
|
|
25
|
+
companyBillPayInfo?: CompanyBillPayInfo;
|
|
26
|
+
paymentAccount?: PaymentAccount;
|
|
27
|
+
primaryFundingAccount?: FundingAccount;
|
|
28
|
+
}
|
|
29
|
+
export interface FundingAccount {
|
|
30
|
+
id: ID;
|
|
31
|
+
accType: AccountTypeSubConfigCodeKeyType;
|
|
32
|
+
label: string;
|
|
33
|
+
maskedAccountNumber: string;
|
|
34
|
+
zeniAccountId?: ID;
|
|
35
|
+
accountBalance?: Balance;
|
|
36
|
+
logo?: Logo;
|
|
37
|
+
providerAccountId?: ID;
|
|
38
|
+
institutionDetails?: InstitutionDetails;
|
|
39
|
+
accountSubType?: AllowedValueWithCode;
|
|
40
|
+
verificationStatus?: AllowedValueWithCode;
|
|
41
|
+
providerVerificationStatus?: AllowedValueWithCode;
|
|
42
|
+
isVerified?: boolean;
|
|
43
|
+
isLoginRequired?: boolean;
|
|
22
44
|
}
|
|
23
45
|
export interface CompanyOfficersDetails extends CompanyOfficerLocalData {
|
|
24
46
|
userFiles: File[];
|
|
@@ -57,3 +79,6 @@ export interface BusinessVerificationDetails extends CompanyAndOfficerLocalData
|
|
|
57
79
|
export declare function getCommonSetupViewDetails(state: RootState, companyId: ID, setupViewType: SetupViewType, plaidAccountKeyType: PlaidAccountKeyType): SetupView;
|
|
58
80
|
export declare function getBusinessVerificationDetails(state: RootState, companyId: ID): BusinessVerificationDetails;
|
|
59
81
|
export declare const getCompanyAndIdentityDetails: (state: RootState, companyId: ID, companyAndIdentityDetails: CompanyAndIdentityDetails) => CompanyAndOfficerLocalData;
|
|
82
|
+
export declare const getAllFundingAccounts: (depositAccounts: DepositAccount[], paymentAccounts: PaymentAccount[]) => FundingAccount[];
|
|
83
|
+
export declare const mapDepositAccToFundingAccount: (depositAcc: DepositAccount) => FundingAccount;
|
|
84
|
+
export declare const mapPaymentAccToFundingAccount: (paymentAcc: PaymentAccount) => FundingAccount;
|
|
@@ -1,29 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCompanyAndIdentityDetails = exports.getBusinessVerificationDetails = exports.getCommonSetupViewDetails = void 0;
|
|
3
|
+
exports.mapPaymentAccToFundingAccount = exports.mapDepositAccToFundingAccount = exports.getAllFundingAccounts = exports.getCompanyAndIdentityDetails = exports.getBusinessVerificationDetails = exports.getCommonSetupViewDetails = void 0;
|
|
4
4
|
const accountSelector_1 = require("../../../entity/account/accountSelector");
|
|
5
5
|
const fileSelector_1 = require("../../../entity/file/fileSelector");
|
|
6
6
|
const fileViewSelector_1 = require("../../fileView/fileViewSelector");
|
|
7
7
|
const getCompanyView_1 = require("../../companyView/selectorHelpers/getCompanyView");
|
|
8
8
|
const plaidAccountViewSelector_1 = require("../plaidAccount/plaidAccountViewSelector");
|
|
9
9
|
const paymentAccountSelector_1 = require("../../../entity/paymentAccount/paymentAccountSelector");
|
|
10
|
+
const depositAccountSelector_1 = require("../../../entity/depositAccount/depositAccountSelector");
|
|
11
|
+
const depositAccountPayload_1 = require("../../../entity/depositAccount/depositAccountPayload");
|
|
10
12
|
function getCommonSetupViewDetails(state, companyId, setupViewType, plaidAccountKeyType) {
|
|
11
|
-
var _a;
|
|
12
|
-
const { accountState, setupViewState, paymentAccountState, plaidAccountViewState, } = state;
|
|
13
|
+
var _a, _b, _c;
|
|
14
|
+
const { accountState, setupViewState, paymentAccountState, depositAccountState, plaidAccountViewState, } = state;
|
|
13
15
|
const { updateStatus } = setupViewState;
|
|
14
|
-
const { accountDetails, plaidConnectionDetails } = (0, plaidAccountViewSelector_1.
|
|
15
|
-
const { allBankAccountIds, paymentAccountIds } = accountDetails;
|
|
16
|
+
const { accountDetails, plaidConnectionDetails } = (0, plaidAccountViewSelector_1.getPlaidAccountDetails)(plaidAccountViewState, plaidAccountKeyType);
|
|
17
|
+
const { allBankAccountIds, paymentAccountIds, depositAccountIds, primaryFundingAccount, } = accountDetails;
|
|
16
18
|
const allBankAccounts = (_a = allBankAccountIds === null || allBankAccountIds === void 0 ? void 0 : allBankAccountIds.map((accountId) => (0, accountSelector_1.getAccountBase)(accountState, accountId, setupViewType)).filter((account) => account != null)) !== null && _a !== void 0 ? _a : [];
|
|
19
|
+
const paymentAccounts = (_b = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, paymentAccountIds).filter((account) => account != null)) !== null && _b !== void 0 ? _b : [];
|
|
20
|
+
const depositAccounts = (_c = (0, depositAccountSelector_1.getDepositAccountsByDepositAccountIds)(depositAccountState, depositAccountIds).filter((account) => account != null)) !== null && _c !== void 0 ? _c : [];
|
|
21
|
+
const allFundingAccounts = (0, exports.getAllFundingAccounts)(depositAccounts, paymentAccounts);
|
|
17
22
|
const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
|
|
18
23
|
const companyBillPayInfo = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyBillPayInfo;
|
|
19
24
|
let paymentAccount;
|
|
25
|
+
let primaryAccount = undefined;
|
|
20
26
|
if ((paymentAccountIds === null || paymentAccountIds === void 0 ? void 0 : paymentAccountIds.length) > 0) {
|
|
21
27
|
const paymentAccountId = paymentAccountIds[0];
|
|
22
28
|
paymentAccount = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, paymentAccountId);
|
|
23
29
|
}
|
|
30
|
+
// For reimbursement setup, use primaryFundingAccount as the payment account.
|
|
31
|
+
// For other setup pages, continue using first payment account
|
|
32
|
+
if (plaidAccountKeyType === 'reimbursement_setup') {
|
|
33
|
+
if ((primaryFundingAccount === null || primaryFundingAccount === void 0 ? void 0 : primaryFundingAccount.accountType) === 'depositAccount') {
|
|
34
|
+
const depositAccount = (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, primaryFundingAccount.accountId);
|
|
35
|
+
if (depositAccount != null) {
|
|
36
|
+
primaryAccount = (0, exports.mapDepositAccToFundingAccount)(depositAccount);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else if ((primaryFundingAccount === null || primaryFundingAccount === void 0 ? void 0 : primaryFundingAccount.accountType) === 'paymentAccount') {
|
|
40
|
+
const paymentAccount = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, primaryFundingAccount.accountId);
|
|
41
|
+
if (paymentAccount != null) {
|
|
42
|
+
primaryAccount = (0, exports.mapPaymentAccToFundingAccount)(paymentAccount);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else if ((paymentAccountIds === null || paymentAccountIds === void 0 ? void 0 : paymentAccountIds.length) > 0) {
|
|
47
|
+
const paymentAccountId = paymentAccountIds[0];
|
|
48
|
+
const paymentAccount = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, paymentAccountId);
|
|
49
|
+
if (paymentAccount != null) {
|
|
50
|
+
primaryAccount = (0, exports.mapPaymentAccToFundingAccount)(paymentAccount);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
24
53
|
return {
|
|
25
54
|
companyBillPayInfo,
|
|
26
55
|
paymentAccount,
|
|
56
|
+
primaryFundingAccount: primaryAccount,
|
|
57
|
+
allFundingAccounts,
|
|
27
58
|
allBankAccounts,
|
|
28
59
|
plaidConnectionDetails,
|
|
29
60
|
accountUpdateStatus: accountDetails.updateStatus,
|
|
@@ -132,3 +163,46 @@ const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentityDetail
|
|
|
132
163
|
};
|
|
133
164
|
};
|
|
134
165
|
exports.getCompanyAndIdentityDetails = getCompanyAndIdentityDetails;
|
|
166
|
+
/* This helper function takes deposit accounts and payment accounts
|
|
167
|
+
and give back FundingAccount type array
|
|
168
|
+
to support single dropdown with both lists */
|
|
169
|
+
const getAllFundingAccounts = (depositAccounts, paymentAccounts) => {
|
|
170
|
+
return [
|
|
171
|
+
...depositAccounts.map((depositAcc) => (0, exports.mapDepositAccToFundingAccount)(depositAcc)),
|
|
172
|
+
...paymentAccounts
|
|
173
|
+
.filter((paymentAccount) => {
|
|
174
|
+
var _a, _b, _c;
|
|
175
|
+
return ((_a = paymentAccount.providerVerificationStatus) === null || _a === void 0 ? void 0 : _a.code) === 'verified' ||
|
|
176
|
+
((_b = paymentAccount.providerVerificationStatus) === null || _b === void 0 ? void 0 : _b.code) ===
|
|
177
|
+
'manually_verified' ||
|
|
178
|
+
((_c = paymentAccount.providerVerificationStatus) === null || _c === void 0 ? void 0 : _c.code) ===
|
|
179
|
+
'automatically_verified';
|
|
180
|
+
})
|
|
181
|
+
.map((paymentAcc) => (0, exports.mapPaymentAccToFundingAccount)(paymentAcc)),
|
|
182
|
+
];
|
|
183
|
+
};
|
|
184
|
+
exports.getAllFundingAccounts = getAllFundingAccounts;
|
|
185
|
+
const mapDepositAccToFundingAccount = (depositAcc) => ({
|
|
186
|
+
id: depositAcc.id,
|
|
187
|
+
accType: 'depositAccount',
|
|
188
|
+
label: depositAcc.accountName,
|
|
189
|
+
maskedAccountNumber: depositAcc.maskedAccountNumber,
|
|
190
|
+
accountBalance: depositAcc.accountBalance,
|
|
191
|
+
logo: undefined,
|
|
192
|
+
zeniAccountId: depositAcc.zeniAccountId,
|
|
193
|
+
});
|
|
194
|
+
exports.mapDepositAccToFundingAccount = mapDepositAccToFundingAccount;
|
|
195
|
+
const mapPaymentAccToFundingAccount = (paymentAcc) => {
|
|
196
|
+
var _a;
|
|
197
|
+
return ({
|
|
198
|
+
id: paymentAcc.paymentAccountId,
|
|
199
|
+
accType: 'paymentAccount',
|
|
200
|
+
maskedAccountNumber: paymentAcc.maskedAccountNumber,
|
|
201
|
+
zeniAccountId: paymentAcc.zeniAccountId,
|
|
202
|
+
label: Boolean(paymentAcc.institutionDetails.institutionName) === true
|
|
203
|
+
? paymentAcc.institutionDetails.institutionName
|
|
204
|
+
: (0, depositAccountPayload_1.getZeniAccountFallbackName)(paymentAcc.maskedAccountNumber, (_a = paymentAcc.accountSubType) === null || _a === void 0 ? void 0 : _a.name),
|
|
205
|
+
logo: paymentAcc.institutionDetails.logo,
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
exports.mapPaymentAccToFundingAccount = mapPaymentAccToFundingAccount;
|
|
@@ -23,3 +23,4 @@ export declare const accountTypeSubConfigCodeToAccType: (code?: "depositAccount"
|
|
|
23
23
|
export declare function showReimbursementPromoPage(currentTenant: CurrentTenant, userRoleMap: RoleMap): boolean;
|
|
24
24
|
export declare function showBillPayPromoPage(currentTenant: CurrentTenant, userRoleMap: RoleMap): boolean;
|
|
25
25
|
export declare const getActualPaymentDate: (billPayInfo: BillPayInfo) => ZeniDate | undefined;
|
|
26
|
+
export declare function isVerifiedStatusCode(statusCode: string): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getActualPaymentDate = exports.showBillPayPromoPage = exports.showReimbursementPromoPage = exports.accountTypeSubConfigCodeToAccType = exports.getEndDate = exports.getTotalPayments = exports.isRecurringConfigChanged = exports.updateRecurringBillDetails = exports.getPaymentDateFromVendorReceiveDate = exports.getSelectedCompanyOfficer = exports.getSpendManagementEffectiveListPeriod = exports.getLatestApprovalDate = void 0;
|
|
3
|
+
exports.isVerifiedStatusCode = exports.getActualPaymentDate = exports.showBillPayPromoPage = exports.showReimbursementPromoPage = exports.accountTypeSubConfigCodeToAccType = exports.getEndDate = exports.getTotalPayments = exports.isRecurringConfigChanged = exports.updateRecurringBillDetails = exports.getPaymentDateFromVendorReceiveDate = exports.getSelectedCompanyOfficer = exports.getSpendManagementEffectiveListPeriod = exports.getLatestApprovalDate = void 0;
|
|
4
4
|
const timeframeTick_1 = require("../../commonStateTypes/timeframeTick");
|
|
5
5
|
const workingDayHelper_1 = require("../../commonStateTypes/workingDayHelper");
|
|
6
6
|
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
@@ -261,3 +261,7 @@ const getActualPaymentDate = (billPayInfo) => {
|
|
|
261
261
|
: billPaymentDate;
|
|
262
262
|
};
|
|
263
263
|
exports.getActualPaymentDate = getActualPaymentDate;
|
|
264
|
+
function isVerifiedStatusCode(statusCode) {
|
|
265
|
+
return ['verified', 'pending_verification'].includes(statusCode);
|
|
266
|
+
}
|
|
267
|
+
exports.isVerifiedStatusCode = isVerifiedStatusCode;
|
package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updateMappedCashAccountEpic.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
5
|
+
import { updateAccounts } from '../../../../../entity/account/accountReducer';
|
|
6
|
+
import { updateMappedCashAccount, updateMappedCashAccountSuccess, updateMappedCashAccountFailure } from '../../plaidAccountViewReducer';
|
|
7
|
+
import { updateDepositAccounts } from '../../../../../entity/depositAccount/depositAccountReducer';
|
|
8
|
+
export declare type ActionType = ReturnType<typeof updateMappedCashAccount> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateDepositAccounts> | ReturnType<typeof updateMappedCashAccountSuccess> | ReturnType<typeof updateMappedCashAccountFailure>;
|
|
9
|
+
export declare const updateMappedCashAccountEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updateMappedCashAccountEpic.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateMappedCashAccountEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../../../responsePayload");
|
|
7
|
+
const plaidAccountViewReducer_1 = require("../../plaidAccountViewReducer");
|
|
8
|
+
const depositAccountReducer_1 = require("../../../../../entity/depositAccount/depositAccountReducer");
|
|
9
|
+
const updateMappedCashAccountEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(plaidAccountViewReducer_1.updateMappedCashAccount.match), (0, operators_1.mergeMap)((action) => {
|
|
10
|
+
const { accountId, depositAccountId } = action.payload;
|
|
11
|
+
return zeniAPI
|
|
12
|
+
.putAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/deposit-accounts/${depositAccountId}`, {
|
|
13
|
+
zeni_mapped_account_id: accountId,
|
|
14
|
+
})
|
|
15
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
16
|
+
var _a, _b;
|
|
17
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
18
|
+
const depositAccountIds = response.data.deposit_accounts.map((depositAccount) => depositAccount.deposit_account_id);
|
|
19
|
+
const actions = [
|
|
20
|
+
(0, depositAccountReducer_1.updateDepositAccounts)((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.deposit_accounts) !== null && _b !== void 0 ? _b : []),
|
|
21
|
+
(0, plaidAccountViewReducer_1.updateMappedCashAccountSuccess)(depositAccountIds),
|
|
22
|
+
];
|
|
23
|
+
return (0, rxjs_1.from)(actions);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return (0, rxjs_1.of)((0, plaidAccountViewReducer_1.updateMappedCashAccountFailure)(response.status));
|
|
27
|
+
}
|
|
28
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, plaidAccountViewReducer_1.updateMappedCashAccountFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Update Mapped Cash Account errored out' +
|
|
29
|
+
JSON.stringify(error))))));
|
|
30
|
+
}));
|
|
31
|
+
exports.updateMappedCashAccountEpic = updateMappedCashAccountEpic;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
5
|
+
import { updatePrimaryFundingAccount, updatePrimaryFundingAccountSuccess, updatePrimaryFundingAccountFailure } from '../../plaidAccountViewReducer';
|
|
6
|
+
import { updateCompanies } from '../../../../../entity/company/companyReducer';
|
|
7
|
+
export declare type ActionType = ReturnType<typeof updatePrimaryFundingAccount> | ReturnType<typeof updatePrimaryFundingAccountSuccess> | ReturnType<typeof updatePrimaryFundingAccountFailure> | ReturnType<typeof updateCompanies>;
|
|
8
|
+
export declare const updatePrimaryFundingAccountEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updatePrimaryFundingAccountEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../../../responsePayload");
|
|
7
|
+
const plaidAccountViewReducer_1 = require("../../plaidAccountViewReducer");
|
|
8
|
+
const companyReducer_1 = require("../../../../../entity/company/companyReducer");
|
|
9
|
+
const helpers_1 = require("../../../helpers");
|
|
10
|
+
const billPayConfigState_1 = require("../../../billPay/billPayConfig/billPayConfigState");
|
|
11
|
+
const billPayConfigPayload_1 = require("../../../billPay/billPayConfig/billPayConfigPayload");
|
|
12
|
+
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;
|
|
14
|
+
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
|
+
})
|
|
19
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
20
|
+
var _a, _b, _c;
|
|
21
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
22
|
+
const actions = [
|
|
23
|
+
(0, companyReducer_1.updateCompanies)({
|
|
24
|
+
payload: (_a = response.data.companies) !== null && _a !== void 0 ? _a : [],
|
|
25
|
+
schema: {},
|
|
26
|
+
}),
|
|
27
|
+
(0, plaidAccountViewReducer_1.updatePrimaryFundingAccountSuccess)((_b = response.data.companies[0].reimbursement_info
|
|
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 : ''))),
|
|
30
|
+
];
|
|
31
|
+
return (0, rxjs_1.from)(actions);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return (0, rxjs_1.of)((0, plaidAccountViewReducer_1.updatePrimaryFundingAccountFailure)(response.status));
|
|
35
|
+
}
|
|
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' +
|
|
37
|
+
JSON.stringify(error))))));
|
|
38
|
+
}));
|
|
39
|
+
exports.updatePrimaryFundingAccountEpic = updatePrimaryFundingAccountEpic;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ID } from '../../../commonStateTypes/common';
|
|
1
2
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
2
3
|
import { PlaidAccountKeyType, PlaidAccountViewState, PlaidLinkTokenType } from './plaidAccountViewState';
|
|
3
4
|
export declare const initialState: PlaidAccountViewState;
|
|
@@ -76,10 +77,30 @@ export declare const getPaymentAccounts: import("@reduxjs/toolkit").ActionCreato
|
|
|
76
77
|
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
77
78
|
linkTokenType: PlaidLinkTokenType;
|
|
78
79
|
plaidAccountKeyType: PlaidAccountKeyType;
|
|
79
|
-
}, string, never, never>, updatePlaidAccountViewAccountDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[allBankAccountIds: string[], paymentAccountIds: string[], plaidAccountKeyType: PlaidAccountKeyType], {
|
|
80
|
+
}, string, never, never>, updatePlaidAccountViewAccountDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[allBankAccountIds: string[], paymentAccountIds: string[], plaidAccountKeyType: PlaidAccountKeyType, depositAccountIds?: string[] | undefined, primaryFundingAccount?: {
|
|
81
|
+
accountId: ID;
|
|
82
|
+
accountType: string;
|
|
83
|
+
} | undefined], {
|
|
80
84
|
allBankAccountIds: string[];
|
|
81
85
|
paymentAccountIds: string[];
|
|
82
86
|
plaidAccountKeyType: PlaidAccountKeyType;
|
|
83
|
-
|
|
87
|
+
depositAccountIds: string[] | undefined;
|
|
88
|
+
primaryFundingAccount: {
|
|
89
|
+
accountId: ID;
|
|
90
|
+
accountType: string;
|
|
91
|
+
} | undefined;
|
|
92
|
+
}, string, never, never>, updatePrimaryFundingAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, accountId: string, accountType: string], {
|
|
93
|
+
companyId: string;
|
|
94
|
+
accountId: string;
|
|
95
|
+
accountType: string;
|
|
96
|
+
}, string, never, never>, updatePrimaryFundingAccountSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountId: string, accountType: string], {
|
|
97
|
+
accountId: string;
|
|
98
|
+
accountType: string;
|
|
99
|
+
}, string, never, never>, updatePrimaryFundingAccountFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, string, never, never>, updateMappedCashAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountId: string, depositAccountId: string], {
|
|
100
|
+
accountId: string;
|
|
101
|
+
depositAccountId: string;
|
|
102
|
+
}, string, never, never>, updateMappedCashAccountSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[depositAccountIds: string[]], {
|
|
103
|
+
depositAccountIds: string[];
|
|
104
|
+
}, string, never, never>, updateMappedCashAccountFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, string, never, never>, clearPlaidAccountView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
84
105
|
declare const _default: import("@reduxjs/toolkit").Reducer<PlaidAccountViewState, import("@reduxjs/toolkit").AnyAction>;
|
|
85
106
|
export default _default;
|