@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
|
@@ -46,7 +46,7 @@ export declare const REFERRAL_LIST_VIEW_SORT_KEYS: readonly ["invitee_email", "a
|
|
|
46
46
|
export declare const toReferralListViewSortKeyType: (v: string) => "status" | "amount" | "invitee_email" | "referral_date";
|
|
47
47
|
export declare type ReferralListViewSortKey = ReturnType<typeof toReferralListViewSortKeyType>;
|
|
48
48
|
export declare const ALL_REFERRAL_STATUSES: readonly ["invite_processing", "invite_sent", "onboarding", "active", "declined", "resend_invite", "reward_sent"];
|
|
49
|
-
export declare const toReferralStatusType: (v: string) => "active" | "onboarding" | "
|
|
49
|
+
export declare const toReferralStatusType: (v: string) => "active" | "onboarding" | "invite_processing" | "invite_sent" | "declined" | "resend_invite" | "reward_sent";
|
|
50
50
|
export declare type ReferralStatus = ReturnType<typeof toReferralStatusType>;
|
|
51
51
|
export declare const StatusTypes: Record<ReferralStatus, string>;
|
|
52
52
|
export declare const ALL_REFERRAL_AMOUNT_STATUSES: readonly ["received", "to_be_received"];
|
|
@@ -10,7 +10,7 @@ export declare const ALL_SCHEDULES_SUB_TABS: readonly ["all", "new", "ongoing",
|
|
|
10
10
|
export declare const toScheduleSubTabType: (v: string) => "all" | "new" | "completed" | "ongoing";
|
|
11
11
|
export declare type ScheduleSubTabType = ReturnType<typeof toScheduleSubTabType>;
|
|
12
12
|
export declare const ALL_SCHEDULES_PAY_SORT_KEYS: readonly ["transactionDate", "vendor", "scheduleCategory", "expenseCategory", "accumulatedDepreciationCategory", "class", "amount", "balanceAsOfToday", "memo", "startMonth", "endMonth", "months", "transactionType", "status", "assetId", "user"];
|
|
13
|
-
export declare const toScheduleSortKeyType: (v: string) => "status" | "user" | "months" | "amount" | "vendor" | "class" | "memo" | "transactionDate" | "
|
|
13
|
+
export declare const toScheduleSortKeyType: (v: string) => "status" | "user" | "months" | "amount" | "vendor" | "class" | "memo" | "transactionDate" | "transactionType" | "balanceAsOfToday" | "scheduleCategory" | "expenseCategory" | "accumulatedDepreciationCategory" | "startMonth" | "endMonth" | "assetId";
|
|
14
14
|
export declare type ScheduleListSortKey = ReturnType<typeof toScheduleSortKeyType>;
|
|
15
15
|
export interface DownloadJEScheduleTabOptions {
|
|
16
16
|
timezone: string;
|
|
@@ -18,7 +18,7 @@ export declare const saveNotificationSettingsEpic: (actions$: ActionsObservable<
|
|
|
18
18
|
type: string;
|
|
19
19
|
} | {
|
|
20
20
|
payload: {
|
|
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" | "
|
|
21
|
+
messageSection: "bill_pay_setup" | "reimbursement_setup" | "charge_card_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" | "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" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "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" | "save_vendor_marked_as_local_contractor" | "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" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success";
|
|
22
22
|
messageText: "failed" | "success" | "notification";
|
|
23
23
|
type: import("../../..").SnackbarMessageType;
|
|
24
24
|
showStatusIcon?: boolean | undefined;
|
|
@@ -37,7 +37,7 @@ const getDuplicateBills = (state, billId) => {
|
|
|
37
37
|
exports.getDuplicateBills = getDuplicateBills;
|
|
38
38
|
const getReviewPageBillDetail = (state, billId) => {
|
|
39
39
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
40
|
-
const { accountListState, accountState,
|
|
40
|
+
const { accountListState, accountState, billTransactionState, classListState, editBillDetailViewState, paymentAccountState, vendorState, contactState, billPayConfigState, recurringBillState, depositAccountState, depositAccountListState, paymentAccountListState, } = state;
|
|
41
41
|
const key = (0, billDetailViewState_1.getBillTransactionDetailKey)(billId !== null && billId !== void 0 ? billId : '');
|
|
42
42
|
const sourceBillDetail = billId != null
|
|
43
43
|
? (_a = editBillDetailViewState.editBillStateById) === null || _a === void 0 ? void 0 : _a[key]
|
|
@@ -47,8 +47,7 @@ const getReviewPageBillDetail = (state, billId) => {
|
|
|
47
47
|
let paymentDetailsSection;
|
|
48
48
|
let file;
|
|
49
49
|
let contactDetails = [];
|
|
50
|
-
const primaryPaymentAccount = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState,
|
|
51
|
-
.paymentAccountIds);
|
|
50
|
+
const primaryPaymentAccount = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, paymentAccountListState.paymentAccountIds);
|
|
52
51
|
const allDepositAccounts = (0, depositAccountListSelector_1.getAllDepostAccounts)(depositAccountState, depositAccountListState).depositAccounts;
|
|
53
52
|
const withdrawFromList = (0, setupViewSelector_1.getAllFundingAccounts)(allDepositAccounts, primaryPaymentAccount);
|
|
54
53
|
let fetchState = 'Not-Started';
|
|
@@ -4,7 +4,7 @@ exports.getBillPayBusinessVerificationDetails = exports.getBillPaySetupViewDetai
|
|
|
4
4
|
const setupViewSelector_1 = require("../../commonSetup/setupViewSelector");
|
|
5
5
|
const helpers_1 = require("../../helpers");
|
|
6
6
|
function getBillPaySetupViewDetails(state, companyId) {
|
|
7
|
-
const billPaySetupViewDetails = (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'bill_pay', '
|
|
7
|
+
const billPaySetupViewDetails = (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'bill_pay', 'bill_pay_setup');
|
|
8
8
|
const businessVerificationDetails = getBillPayBusinessVerificationDetails(state, companyId);
|
|
9
9
|
const selectedCompanyOfficer = (0, helpers_1.getSelectedCompanyOfficer)(businessVerificationDetails);
|
|
10
10
|
const { billPaySetupViewState, setupViewState } = state;
|
|
@@ -13,5 +13,8 @@ import { openSnackbar } from '../../../../../../entity/snackbar/snackbarReducer'
|
|
|
13
13
|
import { updateSetupViewLocalStoreData } from '../../../../commonSetup/setupViewReducer';
|
|
14
14
|
import { fetchBillPaySetupView, fetchBillPaySetupViewSuccess, fetchBillPaySetupViewFailure } from '../../billPaySetupViewReducer';
|
|
15
15
|
import { updatePlaidAccountViewAccountDetails } from '../../../../plaidAccount/plaidAccountViewReducer';
|
|
16
|
-
|
|
16
|
+
import { updatePaymentAccountList } from '../../../../zeniAccounts/paymentAccountList/paymentAccountListReducer';
|
|
17
|
+
import { updateDepositAccounts } from '../../../../../../entity/depositAccount/depositAccountReducer';
|
|
18
|
+
import { updateDepositAccountList } from '../../../../zeniAccounts/depositAccountList/depositAccountListReducer';
|
|
19
|
+
export declare type ActionType = ReturnType<typeof fetchBillPaySetupView> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateFiles> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAddresses> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof updatePaymentAccountList> | ReturnType<typeof updateDepositAccounts> | ReturnType<typeof updateDepositAccountList> | ReturnType<typeof updatePlaidAccountViewAccountDetails> | ReturnType<typeof updateSetupViewLocalStoreData> | ReturnType<typeof openSnackbar> | ReturnType<typeof fetchBillPaySetupViewSuccess> | ReturnType<typeof fetchBillPaySetupViewFailure>;
|
|
17
20
|
export declare const fetchBillPaySetupViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -16,6 +16,9 @@ const snackbarReducer_1 = require("../../../../../../entity/snackbar/snackbarRed
|
|
|
16
16
|
const setupViewReducer_1 = require("../../../../commonSetup/setupViewReducer");
|
|
17
17
|
const billPaySetupViewReducer_1 = require("../../billPaySetupViewReducer");
|
|
18
18
|
const plaidAccountViewReducer_1 = require("../../../../plaidAccount/plaidAccountViewReducer");
|
|
19
|
+
const paymentAccountListReducer_1 = require("../../../../zeniAccounts/paymentAccountList/paymentAccountListReducer");
|
|
20
|
+
const depositAccountReducer_1 = require("../../../../../../entity/depositAccount/depositAccountReducer");
|
|
21
|
+
const depositAccountListReducer_1 = require("../../../../zeniAccounts/depositAccountList/depositAccountListReducer");
|
|
19
22
|
const fetchBillPaySetupViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(billPaySetupViewReducer_1.fetchBillPaySetupView.match), (0, operators_1.switchMap)((action) => {
|
|
20
23
|
var _a;
|
|
21
24
|
const { companyId, cacheOverride, refreshViewInBackground } = action.payload;
|
|
@@ -29,9 +32,9 @@ const fetchBillPaySetupViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
29
32
|
return zeniAPI
|
|
30
33
|
.getJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}?query={"view":"bill_pay_setup"}`)
|
|
31
34
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
35
|
+
var _a, _b, _c;
|
|
32
36
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
33
37
|
const allBankAccountIds = response.data.accounts.map((account) => account.account_id);
|
|
34
|
-
const paymentAccountIds = response.data.payment_accounts.map((paymentAccount) => paymentAccount.payment_account_id);
|
|
35
38
|
const actions = [
|
|
36
39
|
(0, userReducer_1.updateAllUsers)({ users: response.data.users }),
|
|
37
40
|
(0, userRoleReducer_1.updateUserRoles)(response.data.user_roles),
|
|
@@ -43,10 +46,19 @@ const fetchBillPaySetupViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
43
46
|
(0, fileReducer_1.updateFiles)({ files: response.data.files }),
|
|
44
47
|
(0, accountReducer_1.updateAccounts)(response.data.accounts, 'bill_pay'),
|
|
45
48
|
(0, paymentAccountReducer_1.updatePaymentAccounts)(response.data.payment_accounts),
|
|
49
|
+
(0, paymentAccountListReducer_1.updatePaymentAccountList)({
|
|
50
|
+
data: response.data.payment_accounts,
|
|
51
|
+
updateType: 'replace',
|
|
52
|
+
}),
|
|
53
|
+
(0, depositAccountReducer_1.updateDepositAccounts)((_a = response.data.deposit_accounts) !== null && _a !== void 0 ? _a : []),
|
|
54
|
+
(0, depositAccountListReducer_1.updateDepositAccountList)({
|
|
55
|
+
data: (_c = (_b = response.data) === null || _b === void 0 ? void 0 : _b.deposit_accounts) !== null && _c !== void 0 ? _c : [],
|
|
56
|
+
updateType: 'replace',
|
|
57
|
+
}),
|
|
46
58
|
(0, setupViewReducer_1.updateSetupViewLocalStoreData)({
|
|
47
59
|
companyId: response.data.companies[0].company_id,
|
|
48
60
|
}),
|
|
49
|
-
(0, plaidAccountViewReducer_1.updatePlaidAccountViewAccountDetails)(allBankAccountIds,
|
|
61
|
+
(0, plaidAccountViewReducer_1.updatePlaidAccountViewAccountDetails)(allBankAccountIds, 'bill_pay_setup'),
|
|
50
62
|
(0, billPaySetupViewReducer_1.fetchBillPaySetupViewSuccess)(),
|
|
51
63
|
];
|
|
52
64
|
return (0, rxjs_1.from)(actions);
|
|
@@ -62,10 +74,10 @@ const fetchBillPaySetupViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
62
74
|
JSON.stringify(error))))));
|
|
63
75
|
}
|
|
64
76
|
else {
|
|
65
|
-
const { allBankAccountIds
|
|
77
|
+
const { allBankAccountIds } = plaidAccountViewState['spend_management_setup'].accountDetails;
|
|
66
78
|
return (0, rxjs_1.of)((0, setupViewReducer_1.updateSetupViewLocalStoreData)({
|
|
67
79
|
companyId,
|
|
68
|
-
}), (0, plaidAccountViewReducer_1.updatePlaidAccountViewAccountDetails)(allBankAccountIds,
|
|
80
|
+
}), (0, plaidAccountViewReducer_1.updatePlaidAccountViewAccountDetails)(allBankAccountIds, 'bill_pay_setup'), (0, billPaySetupViewReducer_1.fetchBillPaySetupViewSuccess)());
|
|
69
81
|
}
|
|
70
82
|
}));
|
|
71
83
|
exports.fetchBillPaySetupViewEpic = fetchBillPaySetupViewEpic;
|
|
@@ -15,34 +15,36 @@ const approveOrRejectBillsBulkActionEpic = (actions$, state$, zeniAPI) => action
|
|
|
15
15
|
return zeniAPI
|
|
16
16
|
.putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/bulk/bills/transactions`, payload)
|
|
17
17
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
18
|
-
var _a, _b, _c, _d, _e, _f
|
|
18
|
+
var _a, _b, _c, _d, _e, _f;
|
|
19
19
|
if ((0, responsePayload_1.isSuccessStatus)(response)) {
|
|
20
20
|
const actions = [];
|
|
21
21
|
const processingBillsCount = (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.total_operations_processing) !== null && _b !== void 0 ? _b : 0;
|
|
22
22
|
actions.push((0, billsBulkActionViewReducer_1.billsBulkActionSuccess)({
|
|
23
|
-
billsProcessing:
|
|
24
|
-
refreshTime: (
|
|
25
|
-
}));
|
|
26
|
-
actions.push((0, billTransactionReducer_1.updateBillTransactionsWithBulkActionStatus)((_h = (_g = response.data) === null || _g === void 0 ? void 0 : _g.operations) !== null && _h !== void 0 ? _h : []));
|
|
27
|
-
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
28
|
-
messageSection: 'bill_pay_bulk_submit',
|
|
29
|
-
messageText: 'success',
|
|
30
|
-
type: 'success',
|
|
31
|
-
variables: [
|
|
32
|
-
{
|
|
33
|
-
variableName: '_count_',
|
|
34
|
-
variableValue: processingBillsCount.toString(),
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
variableName: '_bill_',
|
|
38
|
-
variableValue: processingBillsCount > 1 ? 'bills' : 'bill',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
variableName: '_action_',
|
|
42
|
-
variableValue: approvalType,
|
|
43
|
-
},
|
|
44
|
-
],
|
|
23
|
+
billsProcessing: processingBillsCount,
|
|
24
|
+
refreshTime: (_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.hard_refresh_after_sec) !== null && _d !== void 0 ? _d : 0,
|
|
45
25
|
}));
|
|
26
|
+
actions.push((0, billTransactionReducer_1.updateBillTransactionsWithBulkActionStatus)((_f = (_e = response.data) === null || _e === void 0 ? void 0 : _e.operations) !== null && _f !== void 0 ? _f : []));
|
|
27
|
+
if (processingBillsCount > 0) {
|
|
28
|
+
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
29
|
+
messageSection: 'bill_pay_bulk_submit',
|
|
30
|
+
messageText: 'success',
|
|
31
|
+
type: 'success',
|
|
32
|
+
variables: [
|
|
33
|
+
{
|
|
34
|
+
variableName: '_count_',
|
|
35
|
+
variableValue: processingBillsCount.toString(),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
variableName: '_bill_',
|
|
39
|
+
variableValue: processingBillsCount > 1 ? 'bills' : 'bill',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
variableName: '_action_',
|
|
43
|
+
variableValue: approvalType,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
46
48
|
return (0, rxjs_1.from)(actions);
|
|
47
49
|
}
|
|
48
50
|
else {
|
|
@@ -26,25 +26,27 @@ const cancelOrDeleteBillsBulkActionEpic = (actions$, state$, zeniAPI) => actions
|
|
|
26
26
|
refreshTime: (_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.hard_refresh_after_sec) !== null && _d !== void 0 ? _d : 0,
|
|
27
27
|
}));
|
|
28
28
|
actions.push((0, billTransactionReducer_1.updateBillTransactionsWithBulkActionStatus)((_f = (_e = response.data) === null || _e === void 0 ? void 0 : _e.operations) !== null && _f !== void 0 ? _f : []));
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
29
|
+
if (processingBillsCount > 0) {
|
|
30
|
+
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
31
|
+
messageSection: 'bill_pay_bulk_submit',
|
|
32
|
+
messageText: 'success',
|
|
33
|
+
type: 'success',
|
|
34
|
+
variables: [
|
|
35
|
+
{
|
|
36
|
+
variableName: '_count_',
|
|
37
|
+
variableValue: processingBillsCount.toString(),
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
variableName: '_bill_',
|
|
41
|
+
variableValue: processingBillsCount > 1 ? 'bills' : 'bill',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
variableName: '_action_',
|
|
45
|
+
variableValue: operationType === 'cancel' ? 'canceled' : 'deleted',
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
48
50
|
return (0, rxjs_1.from)(actions);
|
|
49
51
|
}
|
|
50
52
|
else {
|
package/lib/view/spendManagement/billPay/billsBulkActionView/epics/submitDraftBillsBulkActionEpic.js
CHANGED
|
@@ -18,34 +18,36 @@ const submitDraftBillsBulkActionEpic = (actions$, state$, zeniAPI) => actions$.p
|
|
|
18
18
|
return zeniAPI
|
|
19
19
|
.putAndGetJSON(bulkApiUrl, payload)
|
|
20
20
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
21
|
-
var _a, _b, _c, _d, _e, _f
|
|
21
|
+
var _a, _b, _c, _d, _e, _f;
|
|
22
22
|
if ((0, responsePayload_1.isSuccessStatus)(response)) {
|
|
23
23
|
const actions = [];
|
|
24
24
|
const processingBillsCount = (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.total_operations_processing) !== null && _b !== void 0 ? _b : 0;
|
|
25
25
|
actions.push((0, billsBulkActionViewReducer_1.billsBulkActionSuccess)({
|
|
26
|
-
billsProcessing:
|
|
27
|
-
refreshTime: (
|
|
28
|
-
}));
|
|
29
|
-
actions.push((0, billTransactionReducer_1.updateBillTransactionsWithBulkActionStatus)((_h = (_g = response.data) === null || _g === void 0 ? void 0 : _g.operations) !== null && _h !== void 0 ? _h : []));
|
|
30
|
-
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
31
|
-
messageSection: 'bill_pay_bulk_submit',
|
|
32
|
-
messageText: 'success',
|
|
33
|
-
type: 'success',
|
|
34
|
-
variables: [
|
|
35
|
-
{
|
|
36
|
-
variableName: '_count_',
|
|
37
|
-
variableValue: processingBillsCount.toString(),
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
variableName: '_bill_',
|
|
41
|
-
variableValue: processingBillsCount > 1 ? 'bills' : 'bill',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
variableName: '_action_',
|
|
45
|
-
variableValue: 'sent for approval',
|
|
46
|
-
},
|
|
47
|
-
],
|
|
26
|
+
billsProcessing: processingBillsCount,
|
|
27
|
+
refreshTime: (_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.hard_refresh_after_sec) !== null && _d !== void 0 ? _d : 0,
|
|
48
28
|
}));
|
|
29
|
+
actions.push((0, billTransactionReducer_1.updateBillTransactionsWithBulkActionStatus)((_f = (_e = response.data) === null || _e === void 0 ? void 0 : _e.operations) !== null && _f !== void 0 ? _f : []));
|
|
30
|
+
if (processingBillsCount > 0) {
|
|
31
|
+
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
32
|
+
messageSection: 'bill_pay_bulk_submit',
|
|
33
|
+
messageText: 'success',
|
|
34
|
+
type: 'success',
|
|
35
|
+
variables: [
|
|
36
|
+
{
|
|
37
|
+
variableName: '_count_',
|
|
38
|
+
variableValue: processingBillsCount.toString(),
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
variableName: '_bill_',
|
|
42
|
+
variableValue: processingBillsCount > 1 ? 'bills' : 'bill',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
variableName: '_action_',
|
|
46
|
+
variableValue: 'sent for approval',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
49
51
|
return (0, rxjs_1.from)(actions);
|
|
50
52
|
}
|
|
51
53
|
else {
|
|
@@ -32,7 +32,7 @@ const depositAccountSelector_1 = require("../../../../entity/depositAccount/depo
|
|
|
32
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, _7;
|
|
35
|
-
const { accountListState, accountState, bankAccountState, billDetailViewState,
|
|
35
|
+
const { accountListState, accountState, bankAccountState, billDetailViewState, paymentAccountListState, billTransactionState, billPayConfigState, classListState, classState, editBillDetailViewState, paymentAccountState, vendorState, tenantState, companyState, userState, commonHistoryState, contactState, paymentInstrumentState, recurringBillState, depositAccountListState, depositAccountState, } = state;
|
|
36
36
|
const transaction = (0, get_1.default)(billTransactionState.transactionById, billId !== null && billId !== void 0 ? billId : '', undefined);
|
|
37
37
|
let recommendations = {};
|
|
38
38
|
if (billId != null) {
|
|
@@ -70,8 +70,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
70
70
|
we need to pick payment ids from billPayInfo object
|
|
71
71
|
*/
|
|
72
72
|
[transaction.billPayInfo.fromAccount.billAccountId]
|
|
73
|
-
:
|
|
74
|
-
.paymentAccountIds);
|
|
73
|
+
: paymentAccountListState.paymentAccountIds);
|
|
75
74
|
const fromDepositAccount = (transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountType) === 'depositAccount' &&
|
|
76
75
|
(transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountId) != null
|
|
77
76
|
? (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountId)
|
|
@@ -5,7 +5,7 @@ const getCompanyView_1 = require("../../../companyView/selectorHelpers/getCompan
|
|
|
5
5
|
const setupViewSelector_1 = require("../../commonSetup/setupViewSelector");
|
|
6
6
|
const helpers_1 = require("../../helpers");
|
|
7
7
|
function getChargeCardSetupViewDetails(state, companyId) {
|
|
8
|
-
const chargeCardSetupViewDetails = (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'charge_cards', '
|
|
8
|
+
const chargeCardSetupViewDetails = (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'charge_cards', 'charge_card_setup');
|
|
9
9
|
const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
|
|
10
10
|
const companyChargeCardInfo = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyChargeCardInfo;
|
|
11
11
|
const { chargeCardSetupViewState, setupViewState } = state;
|
package/lib/view/spendManagement/chargeCards/chargeCardSetUp/epic/fetchChargeCardSetupViewEpic.d.ts
CHANGED
|
@@ -13,5 +13,8 @@ import { ZeniAPI } from '../../../../../zeniAPI';
|
|
|
13
13
|
import { updateSetupViewLocalStoreData } from '../../../commonSetup/setupViewReducer';
|
|
14
14
|
import { fetchChargeCardSetupView, fetchChargeCardSetupViewFailure, fetchChargeCardSetupViewSuccess } from '../chargeCardSetUpViewReducer';
|
|
15
15
|
import { updatePlaidAccountViewAccountDetails } from '../../../plaidAccount/plaidAccountViewReducer';
|
|
16
|
-
|
|
16
|
+
import { updatePaymentAccountList } from '../../../zeniAccounts/paymentAccountList/paymentAccountListReducer';
|
|
17
|
+
import { updateDepositAccounts } from '../../../../../entity/depositAccount/depositAccountReducer';
|
|
18
|
+
import { updateDepositAccountList } from '../../../zeniAccounts/depositAccountList/depositAccountListReducer';
|
|
19
|
+
export declare type ActionType = ReturnType<typeof fetchChargeCardSetupView> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateFiles> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAddresses> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof updatePaymentAccountList> | ReturnType<typeof updateDepositAccounts> | ReturnType<typeof updateDepositAccountList> | ReturnType<typeof updatePlaidAccountViewAccountDetails> | ReturnType<typeof updateSetupViewLocalStoreData> | ReturnType<typeof openSnackbar> | ReturnType<typeof fetchChargeCardSetupViewSuccess> | ReturnType<typeof fetchChargeCardSetupViewFailure>;
|
|
17
20
|
export declare const fetchChargeCardSetupViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
package/lib/view/spendManagement/chargeCards/chargeCardSetUp/epic/fetchChargeCardSetupViewEpic.js
CHANGED
|
@@ -16,6 +16,9 @@ const responsePayload_1 = require("../../../../../responsePayload");
|
|
|
16
16
|
const setupViewReducer_1 = require("../../../commonSetup/setupViewReducer");
|
|
17
17
|
const chargeCardSetUpViewReducer_1 = require("../chargeCardSetUpViewReducer");
|
|
18
18
|
const plaidAccountViewReducer_1 = require("../../../plaidAccount/plaidAccountViewReducer");
|
|
19
|
+
const paymentAccountListReducer_1 = require("../../../zeniAccounts/paymentAccountList/paymentAccountListReducer");
|
|
20
|
+
const depositAccountReducer_1 = require("../../../../../entity/depositAccount/depositAccountReducer");
|
|
21
|
+
const depositAccountListReducer_1 = require("../../../zeniAccounts/depositAccountList/depositAccountListReducer");
|
|
19
22
|
const fetchChargeCardSetupViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardSetUpViewReducer_1.fetchChargeCardSetupView.match), (0, operators_1.switchMap)((action) => {
|
|
20
23
|
var _a;
|
|
21
24
|
const { companyId, cacheOverride, refreshViewInBackground } = action.payload;
|
|
@@ -29,9 +32,9 @@ const fetchChargeCardSetupViewEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
29
32
|
return zeniAPI
|
|
30
33
|
.getJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}?query={"view":"charge_cards_setup"}`)
|
|
31
34
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
35
|
+
var _a, _b, _c;
|
|
32
36
|
if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
|
|
33
37
|
const allBankAccountIds = response.data.accounts.map((account) => account.account_id);
|
|
34
|
-
const paymentAccountIds = response.data.payment_accounts.map((paymentAccount) => paymentAccount.payment_account_id);
|
|
35
38
|
const actions = [
|
|
36
39
|
(0, userReducer_1.updateAllUsers)({ users: response.data.users }),
|
|
37
40
|
(0, userRoleReducer_1.updateUserRoles)(response.data.user_roles),
|
|
@@ -43,10 +46,19 @@ const fetchChargeCardSetupViewEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
43
46
|
(0, fileReducer_1.updateFiles)({ files: response.data.files }),
|
|
44
47
|
(0, accountReducer_1.updateAccounts)(response.data.accounts, 'charge_cards'),
|
|
45
48
|
(0, paymentAccountReducer_1.updatePaymentAccounts)(response.data.payment_accounts),
|
|
49
|
+
(0, paymentAccountListReducer_1.updatePaymentAccountList)({
|
|
50
|
+
data: response.data.payment_accounts,
|
|
51
|
+
updateType: 'replace',
|
|
52
|
+
}),
|
|
53
|
+
(0, depositAccountReducer_1.updateDepositAccounts)((_a = response.data.deposit_accounts) !== null && _a !== void 0 ? _a : []),
|
|
54
|
+
(0, depositAccountListReducer_1.updateDepositAccountList)({
|
|
55
|
+
data: (_c = (_b = response.data) === null || _b === void 0 ? void 0 : _b.deposit_accounts) !== null && _c !== void 0 ? _c : [],
|
|
56
|
+
updateType: 'replace',
|
|
57
|
+
}),
|
|
46
58
|
(0, setupViewReducer_1.updateSetupViewLocalStoreData)({
|
|
47
59
|
companyId: response.data.companies[0].company_id,
|
|
48
60
|
}),
|
|
49
|
-
(0, plaidAccountViewReducer_1.updatePlaidAccountViewAccountDetails)(allBankAccountIds,
|
|
61
|
+
(0, plaidAccountViewReducer_1.updatePlaidAccountViewAccountDetails)(allBankAccountIds, 'charge_card_setup'),
|
|
50
62
|
(0, chargeCardSetUpViewReducer_1.fetchChargeCardSetupViewSuccess)(),
|
|
51
63
|
];
|
|
52
64
|
return (0, rxjs_1.from)(actions);
|
|
@@ -62,10 +74,10 @@ const fetchChargeCardSetupViewEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
62
74
|
JSON.stringify(error))))));
|
|
63
75
|
}
|
|
64
76
|
else {
|
|
65
|
-
const { allBankAccountIds
|
|
77
|
+
const { allBankAccountIds } = plaidAccountViewState['spend_management_setup'].accountDetails;
|
|
66
78
|
return (0, rxjs_1.of)((0, setupViewReducer_1.updateSetupViewLocalStoreData)({
|
|
67
79
|
companyId,
|
|
68
|
-
}), (0, plaidAccountViewReducer_1.updatePlaidAccountViewAccountDetails)(allBankAccountIds,
|
|
80
|
+
}), (0, plaidAccountViewReducer_1.updatePlaidAccountViewAccountDetails)(allBankAccountIds, 'charge_card_setup'), (0, chargeCardSetUpViewReducer_1.fetchChargeCardSetupViewSuccess)());
|
|
69
81
|
}
|
|
70
82
|
}));
|
|
71
83
|
exports.fetchChargeCardSetupViewEpic = fetchChargeCardSetupViewEpic;
|
|
@@ -77,6 +77,10 @@ export interface BusinessVerificationDetails extends CompanyAndOfficerLocalData
|
|
|
77
77
|
updateStatus: FetchStateAndError;
|
|
78
78
|
}
|
|
79
79
|
export declare function getCommonSetupViewDetails(state: RootState, companyId: ID, setupViewType: SetupViewType, plaidAccountKeyType: PlaidAccountKeyType): SetupView;
|
|
80
|
+
export declare function getPrimaryAccountForTheProduct(state: RootState, companyId: ID, setupViewType: SetupViewType): {
|
|
81
|
+
accountId: ID;
|
|
82
|
+
accountType: AccountTypeSubConfigCodeKeyType;
|
|
83
|
+
} | undefined;
|
|
80
84
|
export declare function getBusinessVerificationDetails(state: RootState, companyId: ID): BusinessVerificationDetails;
|
|
81
85
|
export declare const getCompanyAndIdentityDetails: (state: RootState, companyId: ID, companyAndIdentityDetails: CompanyAndIdentityDetails) => CompanyAndOfficerLocalData;
|
|
82
86
|
export declare const getAllFundingAccounts: (depositAccounts: DepositAccount[], paymentAccounts: PaymentAccount[], includeOnlyVerifiedAccounts?: boolean) => FundingAccount[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mapPaymentAccToFundingAccount = exports.mapDepositAccToFundingAccount = exports.getAllFundingAccounts = exports.getCompanyAndIdentityDetails = exports.getBusinessVerificationDetails = exports.getCommonSetupViewDetails = void 0;
|
|
3
|
+
exports.mapPaymentAccToFundingAccount = exports.mapDepositAccToFundingAccount = exports.getAllFundingAccounts = exports.getCompanyAndIdentityDetails = exports.getBusinessVerificationDetails = exports.getPrimaryAccountForTheProduct = 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");
|
|
@@ -10,62 +10,72 @@ const paymentAccountSelector_1 = require("../../../entity/paymentAccount/payment
|
|
|
10
10
|
const depositAccountSelector_1 = require("../../../entity/depositAccount/depositAccountSelector");
|
|
11
11
|
const depositAccountPayload_1 = require("../../../entity/depositAccount/depositAccountPayload");
|
|
12
12
|
function getCommonSetupViewDetails(state, companyId, setupViewType, plaidAccountKeyType) {
|
|
13
|
-
var _a, _b, _c
|
|
13
|
+
var _a, _b, _c;
|
|
14
14
|
const { accountState, setupViewState, paymentAccountState, paymentAccountListState, depositAccountState, depositAccountListState, plaidAccountViewState, } = state;
|
|
15
15
|
const { updateStatus } = setupViewState;
|
|
16
16
|
const { accountDetails, plaidConnectionDetails } = (0, plaidAccountViewSelector_1.getPlaidAccountDetails)(plaidAccountViewState, plaidAccountKeyType);
|
|
17
|
-
const { allBankAccountIds
|
|
17
|
+
const { allBankAccountIds } = accountDetails;
|
|
18
18
|
const { paymentAccountIds } = paymentAccountListState;
|
|
19
19
|
const { accountIds: depositAccountIds } = depositAccountListState;
|
|
20
20
|
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 : [];
|
|
21
21
|
const paymentAccounts = (_b = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, paymentAccountIds).filter((account) => account != null)) !== null && _b !== void 0 ? _b : [];
|
|
22
22
|
const depositAccounts = (_c = (0, depositAccountSelector_1.getDepositAccountsByDepositAccountIds)(depositAccountState, depositAccountIds).filter((account) => account != null)) !== null && _c !== void 0 ? _c : [];
|
|
23
|
-
const allFundingAccounts = (0, exports.getAllFundingAccounts)(depositAccounts,
|
|
23
|
+
const allFundingAccounts = (0, exports.getAllFundingAccounts)(setupViewType === 'zeni_accounts' ? [] : depositAccounts, // only external acct can be made primary for accounts setup
|
|
24
|
+
paymentAccounts, false);
|
|
24
25
|
const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
|
|
25
26
|
const companyBillPayInfo = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyBillPayInfo;
|
|
26
|
-
|
|
27
|
-
let
|
|
28
|
-
if ((
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
// For reimbursement setup, use primaryFundingAccount as the payment account.
|
|
34
|
-
// For other setup pages, continue using first payment account
|
|
35
|
-
if (plaidAccountKeyType === 'reimbursement_setup') {
|
|
36
|
-
if ((primaryFundingAccount === null || primaryFundingAccount === void 0 ? void 0 : primaryFundingAccount.accountType) === 'depositAccount') {
|
|
37
|
-
const depositAccount = (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, primaryFundingAccount.accountId);
|
|
38
|
-
if (depositAccount != null) {
|
|
39
|
-
primaryAccount = (0, exports.mapDepositAccToFundingAccount)(depositAccount);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
else if ((primaryFundingAccount === null || primaryFundingAccount === void 0 ? void 0 : primaryFundingAccount.accountType) === 'paymentAccount') {
|
|
43
|
-
const paymentAccount = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, primaryFundingAccount.accountId);
|
|
44
|
-
if (paymentAccount != null) {
|
|
45
|
-
primaryAccount = (0, exports.mapPaymentAccToFundingAccount)(paymentAccount);
|
|
46
|
-
}
|
|
27
|
+
const primaryAccount = getPrimaryAccountForTheProduct(state, companyId, setupViewType);
|
|
28
|
+
let primaryFundingAccount;
|
|
29
|
+
if ((primaryAccount === null || primaryAccount === void 0 ? void 0 : primaryAccount.accountType) === 'depositAccount') {
|
|
30
|
+
const depositAccount = (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, primaryAccount.accountId);
|
|
31
|
+
if (depositAccount != null) {
|
|
32
|
+
primaryFundingAccount = (0, exports.mapDepositAccToFundingAccount)(depositAccount);
|
|
47
33
|
}
|
|
48
34
|
}
|
|
49
|
-
else if ((
|
|
50
|
-
const
|
|
51
|
-
const paymentAccount = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, paymentAccountId);
|
|
35
|
+
else if ((primaryAccount === null || primaryAccount === void 0 ? void 0 : primaryAccount.accountType) === 'paymentAccount') {
|
|
36
|
+
const paymentAccount = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, primaryAccount.accountId);
|
|
52
37
|
if (paymentAccount != null) {
|
|
53
|
-
|
|
38
|
+
primaryFundingAccount = (0, exports.mapPaymentAccToFundingAccount)(paymentAccount);
|
|
54
39
|
}
|
|
55
40
|
}
|
|
56
41
|
return {
|
|
57
42
|
companyBillPayInfo,
|
|
58
|
-
|
|
59
|
-
primaryFundingAccount: primaryAccount,
|
|
43
|
+
primaryFundingAccount,
|
|
60
44
|
allFundingAccounts,
|
|
61
45
|
allBankAccounts,
|
|
62
46
|
plaidConnectionDetails,
|
|
63
|
-
accountUpdateStatus: accountDetails.
|
|
47
|
+
accountUpdateStatus: accountDetails.cashAccountUpdateStatus,
|
|
64
48
|
accountFetchStatus: accountDetails.fetchStatus,
|
|
65
49
|
updateStatus,
|
|
66
50
|
};
|
|
67
51
|
}
|
|
68
52
|
exports.getCommonSetupViewDetails = getCommonSetupViewDetails;
|
|
53
|
+
function getPrimaryAccountForTheProduct(state, companyId, setupViewType) {
|
|
54
|
+
const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
|
|
55
|
+
if (companyView == null) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
let primaryFundingAccount;
|
|
59
|
+
if (setupViewType === 'bill_pay') {
|
|
60
|
+
primaryFundingAccount =
|
|
61
|
+
companyView.company.company.companyBillPayInfo.primaryFundingAccount;
|
|
62
|
+
}
|
|
63
|
+
else if (setupViewType === 'reimbursement') {
|
|
64
|
+
primaryFundingAccount =
|
|
65
|
+
companyView.company.company.companyReimbursementInfo
|
|
66
|
+
.primaryFundingAccount;
|
|
67
|
+
}
|
|
68
|
+
else if (setupViewType === 'charge_cards') {
|
|
69
|
+
primaryFundingAccount =
|
|
70
|
+
companyView.company.company.companyChargeCardInfo.primaryFundingAccount;
|
|
71
|
+
}
|
|
72
|
+
else if (setupViewType === 'zeni_accounts') {
|
|
73
|
+
primaryFundingAccount =
|
|
74
|
+
companyView.company.company.companyZeniAccountInfo.primaryFundingAccount;
|
|
75
|
+
}
|
|
76
|
+
return primaryFundingAccount;
|
|
77
|
+
}
|
|
78
|
+
exports.getPrimaryAccountForTheProduct = getPrimaryAccountForTheProduct;
|
|
69
79
|
function getBusinessVerificationDetails(state, companyId) {
|
|
70
80
|
const { setupViewState } = state;
|
|
71
81
|
const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, updateStatus, } = setupViewState;
|
package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/getPaymentAccountsEpic.js
CHANGED
|
@@ -24,11 +24,10 @@ const getPaymentAccountsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0,
|
|
|
24
24
|
.getJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/payment-accounts?query=${encodeURIComponent(JSON.stringify(queryParams))}`)
|
|
25
25
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
26
26
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
27
|
-
const paymentAccountIds = response.data.payment_accounts.map((paymentAccount) => paymentAccount.payment_account_id);
|
|
28
27
|
const actions = [
|
|
29
28
|
(0, accountReducer_1.updateAccounts)(response.data.accounts, setupViewType),
|
|
30
29
|
(0, paymentAccountReducer_1.updatePaymentAccounts)(response.data.payment_accounts),
|
|
31
|
-
(0, plaidAccountViewReducer_1.getPaymentAccountsSuccess)(
|
|
30
|
+
(0, plaidAccountViewReducer_1.getPaymentAccountsSuccess)(plaidAccountKeyType),
|
|
32
31
|
];
|
|
33
32
|
return (0, rxjs_1.from)(actions);
|
|
34
33
|
}
|
package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updateMappedCashAccountEpic.js
CHANGED
|
@@ -7,7 +7,7 @@ const responsePayload_1 = require("../../../../../responsePayload");
|
|
|
7
7
|
const plaidAccountViewReducer_1 = require("../../plaidAccountViewReducer");
|
|
8
8
|
const depositAccountReducer_1 = require("../../../../../entity/depositAccount/depositAccountReducer");
|
|
9
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;
|
|
10
|
+
const { plaidAccountKeyType, accountId, depositAccountId } = action.payload;
|
|
11
11
|
return zeniAPI
|
|
12
12
|
.putAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/deposit-accounts/${depositAccountId}`, {
|
|
13
13
|
zeni_mapped_account_id: accountId,
|
|
@@ -15,17 +15,16 @@ const updateMappedCashAccountEpic = (actions$, _state$, zeniAPI) => actions$.pip
|
|
|
15
15
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
16
16
|
var _a, _b;
|
|
17
17
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
18
|
-
const depositAccountIds = response.data.deposit_accounts.map((depositAccount) => depositAccount.deposit_account_id);
|
|
19
18
|
const actions = [
|
|
20
19
|
(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)(
|
|
20
|
+
(0, plaidAccountViewReducer_1.updateMappedCashAccountSuccess)(plaidAccountKeyType),
|
|
22
21
|
];
|
|
23
22
|
return (0, rxjs_1.from)(actions);
|
|
24
23
|
}
|
|
25
24
|
else {
|
|
26
|
-
return (0, rxjs_1.of)((0, plaidAccountViewReducer_1.updateMappedCashAccountFailure)(response.status));
|
|
25
|
+
return (0, rxjs_1.of)((0, plaidAccountViewReducer_1.updateMappedCashAccountFailure)(plaidAccountKeyType, response.status));
|
|
27
26
|
}
|
|
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' +
|
|
27
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, plaidAccountViewReducer_1.updateMappedCashAccountFailure)(plaidAccountKeyType, (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Update Mapped Cash Account errored out' +
|
|
29
28
|
JSON.stringify(error))))));
|
|
30
29
|
}));
|
|
31
30
|
exports.updateMappedCashAccountEpic = updateMappedCashAccountEpic;
|