@zeniai/client-epic-state 4.19.60 → 4.19.61
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/commonStateTypes/fileType.d.ts +1 -1
- package/lib/entity/chargeCardRepayment/chargeCardRepayment.d.ts +6 -1
- package/lib/entity/chargeCardRepayment/chargeCardRepayment.js +4 -1
- package/lib/entity/chargeCardRepayment/chargeCardRepaymentPayload.d.ts +8 -3
- package/lib/entity/chargeCardRepayment/chargeCardRepaymentPayload.js +5 -2
- package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -2
- package/lib/entity/chargeCardTransaction/chargeCardTransactionPayload.d.ts +3 -1
- package/lib/entity/chargeCardTransaction/chargeCardTransactionPayload.js +26 -3
- package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.js +11 -7
- package/lib/entity/company/companyPayload.d.ts +12 -0
- package/lib/entity/company/companyPayload.js +20 -0
- package/lib/entity/company/companyStateTypes.d.ts +12 -0
- package/lib/epic.d.ts +3 -1
- package/lib/epic.js +3 -1
- package/lib/esm/entity/chargeCardRepayment/chargeCardRepayment.js +3 -1
- package/lib/esm/entity/chargeCardRepayment/chargeCardRepaymentPayload.js +6 -3
- package/lib/esm/entity/chargeCardTransaction/chargeCardTransactionPayload.js +25 -3
- package/lib/esm/entity/chargeCardTransaction/chargeCardTransactionReducer.js +11 -7
- package/lib/esm/entity/company/companyPayload.js +20 -0
- package/lib/esm/epic.js +3 -1
- package/lib/esm/index.js +11 -5
- package/lib/esm/reducer.js +3 -0
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/deleteAccountStatementEpic.js +1 -1
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +1 -0
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementDocumentAIHelper.js +1 -1
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementEpic.js +3 -1
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/triggerReviewTabRefetchEpic.js +2 -3
- package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +20 -2
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +11 -1
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +4 -2
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +5 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistory.js +32 -0
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryDownloadSelector.js +22 -0
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryHelpers.js +79 -0
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryPayload.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +83 -0
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistorySelector.js +104 -0
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentHistoryEpic.js +31 -0
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +31 -0
- package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailSelector.js +15 -6
- package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/fetchChargeCardRepaymentDetailEpic.js +3 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/initiateChargeCardRepaymentEpic.js +5 -0
- package/lib/esm/view/spendManagement/chargeCards/chargeCardSetUp/epic/fetchChargeCardSetupViewEpic.js +1 -1
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js +64 -1
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/updateSetupViewLocalStoreDataEpic.js +14 -1
- package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +29 -1
- package/lib/esm/view/spendManagement/reimbursement/remiDetailView/epics/fetchRemiDetailEpic.js +0 -1
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +10 -1
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelector.js +4 -2
- package/lib/esm/view/spendManagement/spendManagementFilterHelpers.js +29 -2
- package/lib/esm/view/spendManagement/zeniAccounts/depositAccountList/fetchDepositAccountListEpic.js +5 -3
- package/lib/index.d.ts +12 -6
- package/lib/index.js +34 -13
- package/lib/reducer.d.ts +3 -0
- package/lib/reducer.js +3 -0
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/expenseAutomationView/epics/accountRecon/deleteAccountStatementEpic.js +1 -1
- package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +1 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementDocumentAIHelper.js +1 -1
- package/lib/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementEpic.js +3 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/triggerReviewTabRefetchEpic.js +2 -3
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +20 -2
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +12 -2
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +4 -2
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelectorTypes.d.ts +2 -0
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewState.d.ts +1 -0
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.d.ts +1 -0
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +5 -2
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonState.d.ts +2 -0
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistory.d.ts +50 -0
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistory.js +35 -0
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryDownloadSelector.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryDownloadSelector.js +26 -0
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryHelpers.d.ts +7 -0
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryHelpers.js +87 -0
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryPayload.d.ts +13 -0
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryPayload.js +2 -0
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.d.ts +19 -0
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +87 -0
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistorySelector.d.ts +24 -0
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistorySelector.js +108 -0
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentHistoryEpic.d.ts +9 -0
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentHistoryEpic.js +35 -0
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.d.ts +7 -0
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +35 -0
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailSelector.js +13 -4
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/fetchChargeCardRepaymentDetailEpic.js +3 -2
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/initiateChargeCardRepaymentEpic.d.ts +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/initiateChargeCardRepaymentEpic.js +5 -0
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/epic/fetchChargeCardSetupViewEpic.js +1 -1
- package/lib/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js +64 -1
- package/lib/view/spendManagement/commonSetup/epic/setup/updateSetupViewLocalStoreDataEpic.js +14 -1
- package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +15 -1
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +31 -2
- package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +13 -0
- package/lib/view/spendManagement/commonSetup/types/businessVerification.d.ts +13 -0
- package/lib/view/spendManagement/reimbursement/remiDetailView/epics/fetchRemiDetailEpic.js +0 -1
- package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewPayload.d.ts +0 -1
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +11 -2
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelector.js +4 -2
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelectorTypes.d.ts +2 -0
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewState.d.ts +1 -0
- package/lib/view/spendManagement/spendManagementFilterHelpers.d.ts +6 -4
- package/lib/view/spendManagement/spendManagementFilterHelpers.js +29 -2
- package/lib/view/spendManagement/zeniAccounts/depositAccountList/fetchDepositAccountListEpic.js +5 -3
- package/package.json +1 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.updatePaymentHistoryUIState = exports.updatePaymentHistoryDownloadUIState = exports.updatePaymentHistorySearchText = exports.updatePaymentHistoryFilters = exports.clearChargeCardPaymentHistory = exports.updateChargeCardPaymentHistoryFailure = exports.updateChargeCardPaymentHistory = exports.fetchChargeCardPaymentHistory = exports.fetchChargeCardPaymentPage = exports.addRepaymentToChargeCardPaymentHistory = exports.initialState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const chargeCardPaymentHistory_1 = require("./chargeCardPaymentHistory");
|
|
7
|
+
exports.initialState = chargeCardPaymentHistory_1.initialChargeCardPaymentHistoryState;
|
|
8
|
+
const chargeCardPaymentHistory = (0, toolkit_1.createSlice)({
|
|
9
|
+
name: 'chargeCardPaymentHistory',
|
|
10
|
+
initialState: exports.initialState,
|
|
11
|
+
reducers: {
|
|
12
|
+
fetchChargeCardPaymentPage: {
|
|
13
|
+
reducer() {
|
|
14
|
+
// do nothing
|
|
15
|
+
},
|
|
16
|
+
prepare(cacheOverride = false) {
|
|
17
|
+
return {
|
|
18
|
+
payload: {
|
|
19
|
+
cacheOverride,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
fetchChargeCardPaymentHistory(draft) {
|
|
25
|
+
draft.fetchState = 'In-Progress';
|
|
26
|
+
draft.error = undefined;
|
|
27
|
+
},
|
|
28
|
+
updateChargeCardPaymentHistory(draft, action) {
|
|
29
|
+
const payload = action.payload;
|
|
30
|
+
draft.creditAccountId = payload.credit_account_id;
|
|
31
|
+
draft.currencyCode = payload.currency_code;
|
|
32
|
+
draft.currencySymbol = payload.currency_symbol;
|
|
33
|
+
draft.isAutoPayEnabled = payload.is_auto_pay_enabled;
|
|
34
|
+
draft.repaymentHistoryIds = payload.repayment_history.map((repayment) => repayment.card_repayment_id);
|
|
35
|
+
draft.totalRepayments = payload.total_repayments;
|
|
36
|
+
draft.fetchState = 'Completed';
|
|
37
|
+
draft.error = undefined;
|
|
38
|
+
},
|
|
39
|
+
updateChargeCardPaymentHistoryFailure(draft, action) {
|
|
40
|
+
draft.fetchState = 'Error';
|
|
41
|
+
draft.error = action.payload;
|
|
42
|
+
},
|
|
43
|
+
addRepaymentToChargeCardPaymentHistory(draft, action) {
|
|
44
|
+
const { cardRepaymentId, zeniCreditAccountId } = action.payload;
|
|
45
|
+
if (draft.creditAccountId !== zeniCreditAccountId) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (draft.repaymentHistoryIds.includes(cardRepaymentId)) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
draft.repaymentHistoryIds.unshift(cardRepaymentId);
|
|
52
|
+
draft.totalRepayments += 1;
|
|
53
|
+
},
|
|
54
|
+
clearChargeCardPaymentHistory(draft) {
|
|
55
|
+
Object.assign(draft, exports.initialState);
|
|
56
|
+
},
|
|
57
|
+
updatePaymentHistoryFilters(draft, action) {
|
|
58
|
+
if (action.payload.filters != null) {
|
|
59
|
+
draft.filters = action.payload.filters;
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
updatePaymentHistorySearchText(draft, action) {
|
|
63
|
+
if (action.payload != null) {
|
|
64
|
+
draft.searchText = action.payload;
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
updatePaymentHistoryUIState(draft, action) {
|
|
68
|
+
if (action.payload.uiState.sortKey != null) {
|
|
69
|
+
draft.uiState.sortKey = action.payload.uiState.sortKey;
|
|
70
|
+
}
|
|
71
|
+
if (action.payload.uiState.sortOrder != null) {
|
|
72
|
+
draft.uiState.sortOrder = action.payload.uiState.sortOrder;
|
|
73
|
+
}
|
|
74
|
+
if (action.payload.uiState.scrollYOffset != null) {
|
|
75
|
+
draft.uiState.scrollYOffset = action.payload.uiState.scrollYOffset;
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
updatePaymentHistoryDownloadUIState(draft, action) {
|
|
79
|
+
if (action.payload.uiState.downloadState != null) {
|
|
80
|
+
draft.downloadUIState.downloadState =
|
|
81
|
+
action.payload.uiState.downloadState;
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
_a = chargeCardPaymentHistory.actions, exports.addRepaymentToChargeCardPaymentHistory = _a.addRepaymentToChargeCardPaymentHistory, exports.fetchChargeCardPaymentPage = _a.fetchChargeCardPaymentPage, exports.fetchChargeCardPaymentHistory = _a.fetchChargeCardPaymentHistory, exports.updateChargeCardPaymentHistory = _a.updateChargeCardPaymentHistory, exports.updateChargeCardPaymentHistoryFailure = _a.updateChargeCardPaymentHistoryFailure, exports.clearChargeCardPaymentHistory = _a.clearChargeCardPaymentHistory, exports.updatePaymentHistoryFilters = _a.updatePaymentHistoryFilters, exports.updatePaymentHistorySearchText = _a.updatePaymentHistorySearchText, exports.updatePaymentHistoryDownloadUIState = _a.updatePaymentHistoryDownloadUIState, exports.updatePaymentHistoryUIState = _a.updatePaymentHistoryUIState;
|
|
87
|
+
exports.default = chargeCardPaymentHistory.reducer;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ID } from '../../../../commonStateTypes/common';
|
|
2
|
+
import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
|
+
import { ChargeCardRepayment } from '../../../../entity/chargeCardRepayment/chargeCardRepayment';
|
|
4
|
+
import { User } from '../../../../entity/user/userState';
|
|
5
|
+
import { RootState } from '../../../../reducer';
|
|
6
|
+
import { PaymentHistoryAccountInfo, PaymentHistoryFilters, PaymentHistoryUIState } from './chargeCardPaymentHistory';
|
|
7
|
+
export interface ChargeCardRepaymentWithUser extends ChargeCardRepayment {
|
|
8
|
+
paidByUser?: User;
|
|
9
|
+
}
|
|
10
|
+
export interface ChargeCardPaymentHistorySelectorView extends SelectorView {
|
|
11
|
+
accountInfoByAccountId: Record<ID, PaymentHistoryAccountInfo>;
|
|
12
|
+
creditAccountId: ID;
|
|
13
|
+
currencyCode: string;
|
|
14
|
+
currencySymbol: string;
|
|
15
|
+
filters: PaymentHistoryFilters;
|
|
16
|
+
isAutoPayEnabled: boolean;
|
|
17
|
+
repaymentHistory: ChargeCardRepaymentWithUser[];
|
|
18
|
+
repaymentHistoryIds: ID[];
|
|
19
|
+
repaymentHistoryUsers: User[];
|
|
20
|
+
searchText: string;
|
|
21
|
+
totalRepayments: number;
|
|
22
|
+
uiState: PaymentHistoryUIState;
|
|
23
|
+
}
|
|
24
|
+
export declare const getChargeCardPaymentHistoryView: (state: RootState) => ChargeCardPaymentHistorySelectorView;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getChargeCardPaymentHistoryView = void 0;
|
|
4
|
+
const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
|
|
5
|
+
const chargeCardRepaymentSelector_1 = require("../../../../entity/chargeCardRepayment/chargeCardRepaymentSelector");
|
|
6
|
+
const depositAccountSelector_1 = require("../../../../entity/depositAccount/depositAccountSelector");
|
|
7
|
+
const paymentAccountSelector_1 = require("../../../../entity/paymentAccount/paymentAccountSelector");
|
|
8
|
+
const userSelector_1 = require("../../../../entity/user/userSelector");
|
|
9
|
+
const setupViewSelector_1 = require("../../commonSetup/setupViewSelector");
|
|
10
|
+
const depositAccountListSelector_1 = require("../../zeniAccounts/depositAccountList/depositAccountListSelector");
|
|
11
|
+
const paymentAccountListSelector_1 = require("../../zeniAccounts/paymentAccountList/paymentAccountListSelector");
|
|
12
|
+
const chargeCardPaymentHistoryHelpers_1 = require("./chargeCardPaymentHistoryHelpers");
|
|
13
|
+
const getChargeCardPaymentHistoryView = (state) => {
|
|
14
|
+
const { chargeCardPaymentHistoryState, chargeCardRepaymentState, userState, depositAccountState, paymentAccountState, depositAccountListState, paymentAccountListState, } = state;
|
|
15
|
+
const { creditAccountId, currencyCode, currencySymbol, filters, isAutoPayEnabled, repaymentHistoryIds, searchText, totalRepayments, uiState, fetchState, error, } = chargeCardPaymentHistoryState;
|
|
16
|
+
// Get the full repayment details from the entity state
|
|
17
|
+
const repaymentHistory = (0, chargeCardRepaymentSelector_1.getChargeCardRepaymentByIds)(chargeCardRepaymentState, repaymentHistoryIds);
|
|
18
|
+
const repaymentHistoryUserIds = Array.from(new Set(repaymentHistory.map((r) => r.paidById)));
|
|
19
|
+
// Get users first to enrich repayments
|
|
20
|
+
const repaymentHistoryUsers = (0, userSelector_1.getUsersByUserIds)(userState, repaymentHistoryUserIds);
|
|
21
|
+
// Create a map of userId -> User for quick lookup
|
|
22
|
+
const userMap = new Map();
|
|
23
|
+
repaymentHistoryUsers.forEach((user) => {
|
|
24
|
+
userMap.set(user.userId, user);
|
|
25
|
+
});
|
|
26
|
+
// Enrich repayments with paidByUser details
|
|
27
|
+
let repaymentHistoryWithUsers = repaymentHistory.map((repayment) => ({
|
|
28
|
+
...repayment,
|
|
29
|
+
paidByUser: userMap.get(repayment.paidById),
|
|
30
|
+
}));
|
|
31
|
+
// Get deposit and payment accounts views (used for funding accounts and fetch state)
|
|
32
|
+
const depositAccountsView = (0, depositAccountListSelector_1.getAllDepositAccounts)(depositAccountState, depositAccountListState);
|
|
33
|
+
const paymentAccountsView = (0, paymentAccountListSelector_1.getAllPaymentAccounts)(paymentAccountState, paymentAccountListState);
|
|
34
|
+
// Extract unique funding account IDs from unfiltered repayment history (for accountInfoMap used in filter/sort)
|
|
35
|
+
const repaymentHistoryFundingAccountIdsForMap = Array.from(new Set(repaymentHistory
|
|
36
|
+
.map((repayment) => repayment.paymentAccountId)
|
|
37
|
+
.filter((id) => id !== undefined && id !== null)));
|
|
38
|
+
let fundingAccountsForMap = [];
|
|
39
|
+
if (repaymentHistoryFundingAccountIdsForMap.length > 0) {
|
|
40
|
+
const hasDepositData = depositAccountsView.fetchState === 'Completed';
|
|
41
|
+
const hasPaymentData = paymentAccountsView.fetchState === 'Completed';
|
|
42
|
+
if (hasDepositData || hasPaymentData) {
|
|
43
|
+
const matchingDepositAccountsForMap = hasDepositData
|
|
44
|
+
? depositAccountsView.depositAccounts.filter((depositAccount) => repaymentHistoryFundingAccountIdsForMap.includes(depositAccount.id))
|
|
45
|
+
: [];
|
|
46
|
+
const matchingPaymentAccountsForMap = hasPaymentData
|
|
47
|
+
? paymentAccountsView.paymentAccounts.filter((paymentAccount) => repaymentHistoryFundingAccountIdsForMap.includes(paymentAccount.paymentAccountId))
|
|
48
|
+
: [];
|
|
49
|
+
fundingAccountsForMap = (0, setupViewSelector_1.getAllFundingAccounts)(matchingDepositAccountsForMap, matchingPaymentAccountsForMap, paymentAccountListState.paymentAccountBalanceFetchStatus, false);
|
|
50
|
+
// Fallback: look up repayment-referenced accounts directly from entity stores
|
|
51
|
+
// in case they're not in the list state (e.g. race condition, stale list)
|
|
52
|
+
const existingIds = new Set(fundingAccountsForMap.map((fa) => fa.id).filter(Boolean));
|
|
53
|
+
for (const accountId of repaymentHistoryFundingAccountIdsForMap) {
|
|
54
|
+
if (existingIds.has(accountId)) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const depositAccount = (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, accountId);
|
|
58
|
+
if (depositAccount != null) {
|
|
59
|
+
fundingAccountsForMap.push((0, setupViewSelector_1.mapDepositAccToFundingAccount)(depositAccount));
|
|
60
|
+
existingIds.add(accountId);
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const paymentAccount = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, accountId);
|
|
64
|
+
if (paymentAccount != null) {
|
|
65
|
+
fundingAccountsForMap.push((0, setupViewSelector_1.mapPaymentAccToFundingAccount)(paymentAccount, paymentAccountListState.paymentAccountBalanceFetchStatus));
|
|
66
|
+
existingIds.add(accountId);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const accountInfoByAccountId = {};
|
|
72
|
+
fundingAccountsForMap.forEach((fa) => {
|
|
73
|
+
if (fa.id != null) {
|
|
74
|
+
accountInfoByAccountId[fa.id] = {
|
|
75
|
+
accountId: fa.id,
|
|
76
|
+
accountLogo: fa.logo,
|
|
77
|
+
accountType: fa.accType === 'depositAccount' ? 'depositAccount' : 'paymentAccount',
|
|
78
|
+
depositAccountLast4: fa.accountLast4,
|
|
79
|
+
depositAccountName: fa.label,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
repaymentHistoryWithUsers = (0, chargeCardPaymentHistoryHelpers_1.applyPaymentHistoryFiltersSearchAndSort)(repaymentHistoryWithUsers, filters, searchText, uiState, accountInfoByAccountId);
|
|
84
|
+
const reducedFetchState = (0, reduceFetchState_1.reduceAllFetchState)([
|
|
85
|
+
{ fetchState, error },
|
|
86
|
+
depositAccountsView,
|
|
87
|
+
paymentAccountsView,
|
|
88
|
+
...Object.values(paymentAccountListState.paymentAccountBalanceFetchStatus),
|
|
89
|
+
]);
|
|
90
|
+
return {
|
|
91
|
+
accountInfoByAccountId,
|
|
92
|
+
creditAccountId,
|
|
93
|
+
currencyCode,
|
|
94
|
+
currencySymbol,
|
|
95
|
+
filters,
|
|
96
|
+
isAutoPayEnabled,
|
|
97
|
+
repaymentHistory: repaymentHistoryWithUsers,
|
|
98
|
+
repaymentHistoryIds,
|
|
99
|
+
repaymentHistoryUsers,
|
|
100
|
+
searchText,
|
|
101
|
+
totalRepayments,
|
|
102
|
+
uiState,
|
|
103
|
+
fetchState: reducedFetchState.fetchState,
|
|
104
|
+
error: reducedFetchState.error,
|
|
105
|
+
version: 0,
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
exports.getChargeCardPaymentHistoryView = getChargeCardPaymentHistoryView;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { updateChargeCardRepayments } from '../../../../entity/chargeCardRepayment/chargeCardRepaymentReducer';
|
|
4
|
+
import { updateAllUsers } from '../../../../entity/user/userReducer';
|
|
5
|
+
import { RootState } from '../../../../reducer';
|
|
6
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
7
|
+
import { fetchChargeCardPaymentHistory, updateChargeCardPaymentHistory, updateChargeCardPaymentHistoryFailure } from './chargeCardPaymentHistoryReducer';
|
|
8
|
+
export type ActionType = ReturnType<typeof fetchChargeCardPaymentHistory> | ReturnType<typeof updateChargeCardPaymentHistory> | ReturnType<typeof updateChargeCardPaymentHistoryFailure> | ReturnType<typeof updateChargeCardRepayments> | ReturnType<typeof updateAllUsers>;
|
|
9
|
+
export declare const fetchChargeCardPaymentHistoryEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchChargeCardPaymentHistoryEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const chargeCardRepaymentReducer_1 = require("../../../../entity/chargeCardRepayment/chargeCardRepaymentReducer");
|
|
7
|
+
const userReducer_1 = require("../../../../entity/user/userReducer");
|
|
8
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
9
|
+
const chargeCardPaymentHistoryReducer_1 = require("./chargeCardPaymentHistoryReducer");
|
|
10
|
+
const fetchChargeCardPaymentHistoryEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardPaymentHistoryReducer_1.fetchChargeCardPaymentHistory.match), (0, operators_1.switchMap)(() => {
|
|
11
|
+
const queryParams = { include_history: true };
|
|
12
|
+
const queryString = encodeURIComponent(JSON.stringify(queryParams));
|
|
13
|
+
return zeniAPI
|
|
14
|
+
.getJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/repayments?query=${queryString}`)
|
|
15
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
16
|
+
if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
|
|
17
|
+
return (0, rxjs_1.of)(
|
|
18
|
+
// Store repayments FIRST before marking as completed
|
|
19
|
+
(0, chargeCardRepaymentReducer_1.updateChargeCardRepayments)(response.data.repayment_history), (0, userReducer_1.updateAllUsers)({
|
|
20
|
+
users: response.data.repayment_history
|
|
21
|
+
.map((repayment) => repayment.paid_by_user)
|
|
22
|
+
.filter((user) => user != null),
|
|
23
|
+
}),
|
|
24
|
+
// Mark as completed LAST, after all data is stored
|
|
25
|
+
(0, chargeCardPaymentHistoryReducer_1.updateChargeCardPaymentHistory)(response.data));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return (0, rxjs_1.of)((0, chargeCardPaymentHistoryReducer_1.updateChargeCardPaymentHistoryFailure)(response.status));
|
|
29
|
+
}
|
|
30
|
+
}), (0, operators_1.catchError)((error) => {
|
|
31
|
+
return (0, rxjs_1.of)((0, chargeCardPaymentHistoryReducer_1.updateChargeCardPaymentHistoryFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch charge card payment history REST API call errored out' +
|
|
32
|
+
JSON.stringify(error))));
|
|
33
|
+
}));
|
|
34
|
+
}));
|
|
35
|
+
exports.fetchChargeCardPaymentHistoryEpic = fetchChargeCardPaymentHistoryEpic;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../../reducer';
|
|
4
|
+
import { fetchChargeCardRepaymentDetail } from '../chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer';
|
|
5
|
+
import { fetchChargeCardPaymentHistory, fetchChargeCardPaymentPage } from './chargeCardPaymentHistoryReducer';
|
|
6
|
+
export type ActionType = ReturnType<typeof fetchChargeCardPaymentPage> | ReturnType<typeof fetchChargeCardPaymentHistory> | ReturnType<typeof fetchChargeCardRepaymentDetail>;
|
|
7
|
+
export declare const fetchChargeCardPaymentPageEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchChargeCardPaymentPageEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const chargeCardRepaymentDetailReducer_1 = require("../chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer");
|
|
7
|
+
const chargeCardPaymentHistoryReducer_1 = require("./chargeCardPaymentHistoryReducer");
|
|
8
|
+
const fetchChargeCardPaymentPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(chargeCardPaymentHistoryReducer_1.fetchChargeCardPaymentPage.match), (0, operators_1.mergeMap)((action) => {
|
|
9
|
+
const { cacheOverride } = action.payload;
|
|
10
|
+
const chargeCardPaymentPageActions = [];
|
|
11
|
+
const state = state$.value;
|
|
12
|
+
const chargeCardPaymentHistoryState = state.chargeCardPaymentHistoryState;
|
|
13
|
+
if (cacheOverride === true) {
|
|
14
|
+
chargeCardPaymentPageActions.push((0, chargeCardPaymentHistoryReducer_1.fetchChargeCardPaymentHistory)());
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
if (chargeCardPaymentHistoryState.fetchState !== 'Completed' &&
|
|
18
|
+
chargeCardPaymentHistoryState.fetchState !== 'In-Progress') {
|
|
19
|
+
chargeCardPaymentPageActions.push((0, chargeCardPaymentHistoryReducer_1.fetchChargeCardPaymentHistory)());
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
// Fetch repayment detail if deposit or payment accounts are not fetched
|
|
23
|
+
//These are needed to get the transfer from accounts for the repayment history
|
|
24
|
+
const depositAccountListState = state.depositAccountListState;
|
|
25
|
+
const paymentAccountListState = state.paymentAccountListState;
|
|
26
|
+
const needsRepaymentDetailFetch = (depositAccountListState.fetchState !== 'Completed' &&
|
|
27
|
+
depositAccountListState.fetchState !== 'In-Progress') ||
|
|
28
|
+
(paymentAccountListState.fetchState !== 'Completed' &&
|
|
29
|
+
paymentAccountListState.fetchState !== 'In-Progress');
|
|
30
|
+
if (needsRepaymentDetailFetch) {
|
|
31
|
+
chargeCardPaymentPageActions.push((0, chargeCardRepaymentDetailReducer_1.fetchChargeCardRepaymentDetail)());
|
|
32
|
+
}
|
|
33
|
+
return (0, rxjs_1.concat)((0, rxjs_1.from)(chargeCardPaymentPageActions));
|
|
34
|
+
}));
|
|
35
|
+
exports.fetchChargeCardPaymentPageEpic = fetchChargeCardPaymentPageEpic;
|
|
@@ -11,11 +11,20 @@ const getChargeCardRepaymentDetail = (state) => {
|
|
|
11
11
|
const depositAccountsView = (0, depositAccountListSelector_1.getAllDepositAccounts)(depositAccountState, depositAccountListState);
|
|
12
12
|
const paymentAccountsView = (0, paymentAccountListSelector_1.getAllPaymentAccounts)(paymentAccountState, paymentAccountListState);
|
|
13
13
|
let transferFromAccounts = [];
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
if (paymentAccountsView.fetchState === 'Completed') {
|
|
15
|
+
if (depositAccountsView.fetchState === 'Completed') {
|
|
16
|
+
transferFromAccounts = (0, setupViewSelector_1.getAllFundingAccounts)(depositAccountsView.depositAccounts, paymentAccountsView.paymentAccounts, paymentAccountListState.paymentAccountBalanceFetchStatus);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
const depositFundingFromLimit = Object.values(depositAccountState.depositAccountLimitForChargeCardByID ?? {}).map(setupViewSelector_1.mapDepositAccountWithLimitToFundingAccount);
|
|
20
|
+
const paymentFundingAccounts = (0, setupViewSelector_1.getAllFundingAccounts)([], paymentAccountsView.paymentAccounts, paymentAccountListState.paymentAccountBalanceFetchStatus);
|
|
21
|
+
transferFromAccounts = [
|
|
22
|
+
...depositFundingFromLimit,
|
|
23
|
+
...paymentFundingAccounts,
|
|
24
|
+
];
|
|
25
|
+
}
|
|
17
26
|
}
|
|
18
|
-
const reducedFetchState = (0, reduceFetchState_1.
|
|
27
|
+
const reducedFetchState = (0, reduceFetchState_1.reduceAnyCompletedFetchState)([
|
|
19
28
|
depositAccountsView,
|
|
20
29
|
paymentAccountsView,
|
|
21
30
|
...Object.values(paymentAccountListState.paymentAccountBalanceFetchStatus),
|
|
@@ -10,8 +10,9 @@ const fetchChargeCardRepaymentDetailEpic = (actions$, state$) => actions$.pipe((
|
|
|
10
10
|
const fetchChargeCardRepaymentDetailActions = [];
|
|
11
11
|
const state = state$.value;
|
|
12
12
|
const depositAccounts = state.depositAccountListState;
|
|
13
|
-
|
|
14
|
-
depositAccounts.fetchState !== 'Completed'
|
|
13
|
+
const willFetchDeposit = depositAccounts.fetchState !== 'In-Progress' &&
|
|
14
|
+
depositAccounts.fetchState !== 'Completed';
|
|
15
|
+
if (willFetchDeposit) {
|
|
15
16
|
fetchChargeCardRepaymentDetailActions.push((0, depositAccountListReducer_1.fetchDepositAccountList)());
|
|
16
17
|
}
|
|
17
18
|
const paymentAccounts = state.paymentAccountListState;
|
|
@@ -5,6 +5,7 @@ import { updateCompanyPrimaryAccount, updateEnableAutoPayForChargeCard } from '.
|
|
|
5
5
|
import { RootState } from '../../../../reducer';
|
|
6
6
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
7
7
|
import { updateCreditAccountRepaymentAmountAndDate } from '../chargeCardList/chargeCardListReducer';
|
|
8
|
+
import { addRepaymentToChargeCardPaymentHistory } from '../chargeCardPaymentHistory/chargeCardPaymentHistoryReducer';
|
|
8
9
|
import { initiateChargeCardRepayment, updateChargeCardRepaymentStatus } from './chargeCardRepaymentDetailReducer';
|
|
9
|
-
export type ActionType = ReturnType<typeof initiateChargeCardRepayment> | ReturnType<typeof updateChargeCardRepayment> | ReturnType<typeof updateCreditAccountRepaymentAmountAndDate> | ReturnType<typeof updateChargeCardRepaymentStatus> | ReturnType<typeof updateCompanyPrimaryAccount> | ReturnType<typeof updateEnableAutoPayForChargeCard>;
|
|
10
|
+
export type ActionType = ReturnType<typeof addRepaymentToChargeCardPaymentHistory> | ReturnType<typeof initiateChargeCardRepayment> | ReturnType<typeof updateChargeCardRepayment> | ReturnType<typeof updateCreditAccountRepaymentAmountAndDate> | ReturnType<typeof updateChargeCardRepaymentStatus> | ReturnType<typeof updateCompanyPrimaryAccount> | ReturnType<typeof updateEnableAutoPayForChargeCard>;
|
|
10
11
|
export declare const initiateChargeCardRepaymentEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -13,6 +13,7 @@ const helpers_1 = require("../../helpers");
|
|
|
13
13
|
const depositAccountListSelector_1 = require("../../zeniAccounts/depositAccountList/depositAccountListSelector");
|
|
14
14
|
const paymentAccountListSelector_1 = require("../../zeniAccounts/paymentAccountList/paymentAccountListSelector");
|
|
15
15
|
const chargeCardListReducer_1 = require("../chargeCardList/chargeCardListReducer");
|
|
16
|
+
const chargeCardPaymentHistoryReducer_1 = require("../chargeCardPaymentHistory/chargeCardPaymentHistoryReducer");
|
|
16
17
|
const chargeCardRepaymentDetailReducer_1 = require("./chargeCardRepaymentDetailReducer");
|
|
17
18
|
const initiateChargeCardRepaymentEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardRepaymentDetailReducer_1.initiateChargeCardRepayment.match), (0, operators_1.switchMap)((action) => {
|
|
18
19
|
const state = state$.value;
|
|
@@ -39,6 +40,10 @@ const initiateChargeCardRepaymentEpic = (actions$, state$, zeniAPI) => actions$.
|
|
|
39
40
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
40
41
|
const actions = [
|
|
41
42
|
(0, chargeCardRepaymentReducer_1.updateChargeCardRepayment)(response.data.card_repayment),
|
|
43
|
+
(0, chargeCardPaymentHistoryReducer_1.addRepaymentToChargeCardPaymentHistory)({
|
|
44
|
+
cardRepaymentId: response.data.card_repayment.card_repayment_id,
|
|
45
|
+
zeniCreditAccountId: response.data.card_repayment.zeni_credit_account_id,
|
|
46
|
+
}),
|
|
42
47
|
(0, chargeCardListReducer_1.updateCreditAccountRepaymentAmountAndDate)({
|
|
43
48
|
amount: (0, amount_1.toAmount)(response.data.card_repayment.amount, response.data.card_repayment.currency_code, response.data.card_repayment.currency_symbol),
|
|
44
49
|
date: (0, zeniDayJS_1.date)(response.data.card_repayment.repayment_date),
|
package/lib/view/spendManagement/chargeCards/chargeCardSetUp/epic/fetchChargeCardSetupViewEpic.js
CHANGED
|
@@ -51,7 +51,7 @@ const fetchChargeCardSetupViewEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
51
51
|
(0, depositAccountReducer_1.updateDepositAccounts)(response.data.deposit_accounts ?? []),
|
|
52
52
|
(0, depositAccountListReducer_1.updateDepositAccountList)({
|
|
53
53
|
data: response.data?.deposit_accounts ?? [],
|
|
54
|
-
updateType: '
|
|
54
|
+
updateType: 'merge',
|
|
55
55
|
}),
|
|
56
56
|
(0, setupViewReducer_1.updateSetupViewLocalStoreData)({
|
|
57
57
|
companyId: response.data.companies[0].company_id,
|
package/lib/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js
CHANGED
|
@@ -122,8 +122,28 @@ const updateBusinessVerificationDetailsEpic = (actions$, state$, zeniAPI) => act
|
|
|
122
122
|
}
|
|
123
123
|
}));
|
|
124
124
|
exports.updateBusinessVerificationDetailsEpic = updateBusinessVerificationDetailsEpic;
|
|
125
|
+
/** US Nexus API keys. Form may submit these or display labels; we send keys to API. */
|
|
126
|
+
const US_NEXUS_KEYS = new Set([
|
|
127
|
+
'employees',
|
|
128
|
+
'customers',
|
|
129
|
+
'physical_office',
|
|
130
|
+
'banking_relationships',
|
|
131
|
+
]);
|
|
132
|
+
/** Maps display label → API key for US nexus types (English labels from strings). */
|
|
133
|
+
const US_NEXUS_LABEL_TO_KEY = {
|
|
134
|
+
Employees: 'employees',
|
|
135
|
+
Customers: 'customers',
|
|
136
|
+
'Physical office or facility': 'physical_office',
|
|
137
|
+
'Banking relationships': 'banking_relationships',
|
|
138
|
+
};
|
|
139
|
+
function toUsNexusTypeKey(value) {
|
|
140
|
+
if (US_NEXUS_KEYS.has(value)) {
|
|
141
|
+
return value;
|
|
142
|
+
}
|
|
143
|
+
return US_NEXUS_LABEL_TO_KEY[value] ?? value;
|
|
144
|
+
}
|
|
125
145
|
const toBusinessVerificationCompanyDataPayload = (companyLocalData, sendForVerification, companyAddressData, registeredAddressData, setupViewType) => {
|
|
126
|
-
const { companyDescription, companyLegalName, companyIndustry, website, incDate, taxIdOrEIN, phone, syncToken, fileIds, typeOfIncorporation, sourceOfFunds, } = companyLocalData;
|
|
146
|
+
const { companyDescription, companyLegalName, companyIndustry, companySubIndustry, countriesOfOperations, companySourceOfFunds, companySourceOfFundsDescription, transactionVolume, transactionVolumeDescription, purposeOfAccount, purposeOfAccountDescription, regulatedStatus, regulatedStatusDescription, usNexus, usNexusTypes, website, incDate, taxIdOrEIN, phone, syncToken, fileIds, typeOfIncorporation, stateOfIncorporation, sourceOfFunds, } = companyLocalData;
|
|
127
147
|
const company = {
|
|
128
148
|
is_ready_for_verification: sendForVerification,
|
|
129
149
|
file_ids: fileIds,
|
|
@@ -174,9 +194,52 @@ const toBusinessVerificationCompanyDataPayload = (companyLocalData, sendForVerif
|
|
|
174
194
|
if (typeOfIncorporation != null) {
|
|
175
195
|
company['company_inc_type'] = typeOfIncorporation;
|
|
176
196
|
}
|
|
197
|
+
if (stateOfIncorporation != null) {
|
|
198
|
+
company['company_inc_state'] = stateOfIncorporation;
|
|
199
|
+
}
|
|
177
200
|
if (companyIndustry != null) {
|
|
178
201
|
company['company_industry'] = companyIndustry;
|
|
179
202
|
}
|
|
203
|
+
Object.assign(company, {
|
|
204
|
+
...(companySubIndustry != null && {
|
|
205
|
+
company_industry_sub_type: companySubIndustry,
|
|
206
|
+
}),
|
|
207
|
+
...(countriesOfOperations != null &&
|
|
208
|
+
countriesOfOperations.length > 0 && {
|
|
209
|
+
company_countries_of_operations: countriesOfOperations,
|
|
210
|
+
}),
|
|
211
|
+
...(companySourceOfFunds != null && {
|
|
212
|
+
company_source_of_funds: companySourceOfFunds,
|
|
213
|
+
}),
|
|
214
|
+
...(companySourceOfFundsDescription != null && {
|
|
215
|
+
company_source_of_funds_desc: companySourceOfFundsDescription,
|
|
216
|
+
}),
|
|
217
|
+
...(transactionVolume != null && {
|
|
218
|
+
company_transaction_vol_expectations: transactionVolume,
|
|
219
|
+
}),
|
|
220
|
+
...(transactionVolumeDescription != null && {
|
|
221
|
+
company_transaction_vol_expectations_desc: transactionVolumeDescription,
|
|
222
|
+
}),
|
|
223
|
+
...(purposeOfAccount != null && {
|
|
224
|
+
company_purpose_of_account: purposeOfAccount,
|
|
225
|
+
}),
|
|
226
|
+
...(purposeOfAccountDescription != null && {
|
|
227
|
+
company_purpose_of_account_desc: purposeOfAccountDescription,
|
|
228
|
+
}),
|
|
229
|
+
...(regulatedStatus != null && {
|
|
230
|
+
company_regulated_states: regulatedStatus === 'yes',
|
|
231
|
+
}),
|
|
232
|
+
...(regulatedStatusDescription != null && {
|
|
233
|
+
company_regulated_states_desc: regulatedStatusDescription,
|
|
234
|
+
}),
|
|
235
|
+
...(usNexus != null && {
|
|
236
|
+
company_us_nexus: usNexus === 'yes',
|
|
237
|
+
}),
|
|
238
|
+
...(usNexusTypes != null &&
|
|
239
|
+
usNexusTypes.length > 0 && {
|
|
240
|
+
company_us_nexus_desc: usNexusTypes.map(toUsNexusTypeKey),
|
|
241
|
+
}),
|
|
242
|
+
});
|
|
180
243
|
if (setupViewType === 'zeni_treasury' && sourceOfFunds != null) {
|
|
181
244
|
company['source_of_funds'] = sourceOfFunds;
|
|
182
245
|
}
|
package/lib/view/spendManagement/commonSetup/epic/setup/updateSetupViewLocalStoreDataEpic.js
CHANGED
|
@@ -53,7 +53,7 @@ function toSetupViewLocalData(company, users, userRoles, primaryContact) {
|
|
|
53
53
|
const { companyInfo, incInfo, taxInfo, questionaire, companyBillPayInfo } = company;
|
|
54
54
|
const { companyId, companyDescription, companyLegalName, companyUrl, phone, syncToken, sourceOfFunds, } = companyInfo;
|
|
55
55
|
const { usersSelectedForVerification: usersSelected } = companyBillPayInfo;
|
|
56
|
-
const { fileIds, companyIncDate: incDate, companyIncType } = incInfo;
|
|
56
|
+
const { fileIds, companyIncDate: incDate, companyIncType, companyIncState, companySubIndustry, countriesOfOperations, companySourceOfFunds: incCompanySourceOfFunds, companySourceOfFundsDescription, transactionVolume, transactionVolumeDescription, purposeOfAccount, purposeOfAccountDescription, regulatedStatus, regulatedStatusDescription, usNexus, usNexusTypes, } = incInfo;
|
|
57
57
|
const { companyIndustry } = questionaire;
|
|
58
58
|
const { taxId } = taxInfo;
|
|
59
59
|
const companyDetails = {
|
|
@@ -61,6 +61,10 @@ function toSetupViewLocalData(company, users, userRoles, primaryContact) {
|
|
|
61
61
|
companyDescription,
|
|
62
62
|
companyIndustry,
|
|
63
63
|
companyLegalName,
|
|
64
|
+
companySubIndustry,
|
|
65
|
+
companySourceOfFunds: incCompanySourceOfFunds,
|
|
66
|
+
companySourceOfFundsDescription,
|
|
67
|
+
countriesOfOperations,
|
|
64
68
|
taxIdOrEIN: taxId,
|
|
65
69
|
incDate,
|
|
66
70
|
phone,
|
|
@@ -69,6 +73,15 @@ function toSetupViewLocalData(company, users, userRoles, primaryContact) {
|
|
|
69
73
|
syncToken,
|
|
70
74
|
typeOfIncorporation: companyIncType,
|
|
71
75
|
sourceOfFunds,
|
|
76
|
+
stateOfIncorporation: companyIncState,
|
|
77
|
+
transactionVolume,
|
|
78
|
+
transactionVolumeDescription,
|
|
79
|
+
purposeOfAccount,
|
|
80
|
+
purposeOfAccountDescription,
|
|
81
|
+
regulatedStatus,
|
|
82
|
+
regulatedStatusDescription,
|
|
83
|
+
usNexus,
|
|
84
|
+
usNexusTypes,
|
|
72
85
|
};
|
|
73
86
|
let primaryContactDetails = undefined;
|
|
74
87
|
if (primaryContact != null) {
|
|
@@ -5,7 +5,7 @@ import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
|
5
5
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
6
6
|
import { CompanyBillPayInfo } from '../../../entity/company/companyStateTypes';
|
|
7
7
|
import { Country } from '../../../entity/countryList/countryListState';
|
|
8
|
-
import { DepositAccount } from '../../../entity/depositAccount/depositAccount';
|
|
8
|
+
import { DepositAccount, DepositAccountWithLimit } from '../../../entity/depositAccount/depositAccount';
|
|
9
9
|
import { File } from '../../../entity/file/fileState';
|
|
10
10
|
import { InstitutionDetails, Logo, PaymentAccount } from '../../../entity/paymentAccount/paymentAccountState';
|
|
11
11
|
import { RootState } from '../../../reducer';
|
|
@@ -70,14 +70,27 @@ export interface CompanyDetails {
|
|
|
70
70
|
companyDescription?: string;
|
|
71
71
|
companyIndustry?: string;
|
|
72
72
|
companyLegalName?: string;
|
|
73
|
+
companySourceOfFunds?: string;
|
|
74
|
+
companySourceOfFundsDescription?: string;
|
|
75
|
+
companySubIndustry?: string;
|
|
76
|
+
countriesOfOperations?: string[];
|
|
73
77
|
incDate?: ZeniDate;
|
|
74
78
|
phone?: string;
|
|
75
79
|
primaryContactLocalData?: PrimaryContactLocalData;
|
|
80
|
+
purposeOfAccount?: string;
|
|
81
|
+
purposeOfAccountDescription?: string;
|
|
76
82
|
registeredAddressStatus?: NewAddressData;
|
|
83
|
+
regulatedStatus?: string;
|
|
84
|
+
regulatedStatusDescription?: string;
|
|
77
85
|
sourceOfFunds?: string;
|
|
86
|
+
stateOfIncorporation?: string;
|
|
78
87
|
syncToken?: string;
|
|
79
88
|
taxIdOrEIN?: string;
|
|
89
|
+
transactionVolume?: string;
|
|
90
|
+
transactionVolumeDescription?: string;
|
|
80
91
|
typeOfIncorporation?: string;
|
|
92
|
+
usNexus?: string;
|
|
93
|
+
usNexusTypes?: string[];
|
|
81
94
|
website?: ZeniUrl;
|
|
82
95
|
}
|
|
83
96
|
interface CompanyAndOfficerLocalData {
|
|
@@ -94,5 +107,6 @@ export declare function getBusinessVerificationDetails(state: RootState, company
|
|
|
94
107
|
export declare const getCompanyAndIdentityDetails: (state: RootState, companyId: ID, companyAndIdentityDetails: CompanyAndIdentityDetails) => CompanyAndOfficerLocalData;
|
|
95
108
|
export declare const getAllFundingAccounts: (depositAccounts: DepositAccount[], paymentAccounts: PaymentAccount[], paymentAccountBalanceFetchStatus: Record<ID, FetchStateAndError>, includeOnlyVerifiedAccounts?: boolean) => FundingAccount[];
|
|
96
109
|
export declare const mapDepositAccToFundingAccount: (depositAcc: DepositAccount) => FundingAccount;
|
|
110
|
+
export declare const mapDepositAccountWithLimitToFundingAccount: (depositAcc: DepositAccountWithLimit) => FundingAccount;
|
|
97
111
|
export declare const mapPaymentAccToFundingAccount: (paymentAcc: PaymentAccount, paymentAccountBalanceFetchStatus: Record<ID, FetchStateAndError>) => FundingAccount;
|
|
98
112
|
export {};
|
|
@@ -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 = void 0;
|
|
3
|
+
exports.mapPaymentAccToFundingAccount = exports.mapDepositAccountWithLimitToFundingAccount = exports.mapDepositAccToFundingAccount = exports.getAllFundingAccounts = exports.getCompanyAndIdentityDetails = void 0;
|
|
4
4
|
exports.getCommonSetupViewDetails = getCommonSetupViewDetails;
|
|
5
5
|
exports.getBusinessVerificationDetails = getBusinessVerificationDetails;
|
|
6
6
|
const accountSelector_1 = require("../../../entity/account/accountSelector");
|
|
@@ -114,7 +114,7 @@ const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentityDetail
|
|
|
114
114
|
if (companyDetails.localData != null) {
|
|
115
115
|
const deleteFileStatusById = {};
|
|
116
116
|
const updateFileStatusById = {};
|
|
117
|
-
const { syncToken, companyDescription, companyLegalName, website, companyIndustry, phone, taxIdOrEIN, incDate, fileIds, typeOfIncorporation, sourceOfFunds, } = companyDetails.localData;
|
|
117
|
+
const { syncToken, companyDescription, companyLegalName, website, companyIndustry, companySubIndustry, companySourceOfFunds, companySourceOfFundsDescription, countriesOfOperations, phone, taxIdOrEIN, incDate, fileIds, typeOfIncorporation, sourceOfFunds, transactionVolume, transactionVolumeDescription, purposeOfAccount, purposeOfAccountDescription, regulatedStatus, regulatedStatusDescription, stateOfIncorporation, usNexus, usNexusTypes, } = companyDetails.localData;
|
|
118
118
|
fileIds.forEach((fileId) => {
|
|
119
119
|
deleteFileStatusById[fileId] = (0, fileViewSelector_1.getFileDeleteStatusById)(state, fileId);
|
|
120
120
|
});
|
|
@@ -128,6 +128,10 @@ const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentityDetail
|
|
|
128
128
|
companyDescription,
|
|
129
129
|
companyLegalName,
|
|
130
130
|
companyIndustry,
|
|
131
|
+
companySubIndustry,
|
|
132
|
+
companySourceOfFunds,
|
|
133
|
+
companySourceOfFundsDescription,
|
|
134
|
+
countriesOfOperations,
|
|
131
135
|
website,
|
|
132
136
|
phone,
|
|
133
137
|
taxIdOrEIN,
|
|
@@ -141,6 +145,15 @@ const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentityDetail
|
|
|
141
145
|
primaryContactLocalData,
|
|
142
146
|
typeOfIncorporation,
|
|
143
147
|
sourceOfFunds,
|
|
148
|
+
transactionVolume,
|
|
149
|
+
transactionVolumeDescription,
|
|
150
|
+
purposeOfAccount,
|
|
151
|
+
purposeOfAccountDescription,
|
|
152
|
+
regulatedStatus,
|
|
153
|
+
regulatedStatusDescription,
|
|
154
|
+
stateOfIncorporation,
|
|
155
|
+
usNexus,
|
|
156
|
+
usNexusTypes,
|
|
144
157
|
};
|
|
145
158
|
}
|
|
146
159
|
const companyOfficerLocalData = {
|
|
@@ -227,6 +240,22 @@ const mapDepositAccToFundingAccount = (depositAcc) => ({
|
|
|
227
240
|
accountLast4: depositAcc.accountLast4,
|
|
228
241
|
});
|
|
229
242
|
exports.mapDepositAccToFundingAccount = mapDepositAccToFundingAccount;
|
|
243
|
+
const mapDepositAccountWithLimitToFundingAccount = (depositAcc) => ({
|
|
244
|
+
id: depositAcc.id,
|
|
245
|
+
accType: 'depositAccount',
|
|
246
|
+
label: depositAcc.accountName,
|
|
247
|
+
maskedAccountNumber: depositAcc.maskedAccountNumber,
|
|
248
|
+
accountBalance: depositAcc.accountBalance,
|
|
249
|
+
logo: undefined,
|
|
250
|
+
zeniAccountId: depositAcc.zeniAccountId,
|
|
251
|
+
balanceFetchStatus: {
|
|
252
|
+
fetchState: 'Completed',
|
|
253
|
+
error: undefined,
|
|
254
|
+
},
|
|
255
|
+
createTime: depositAcc.createTime,
|
|
256
|
+
accountLast4: depositAcc.maskedAccountNumber.match(/(\d{4})$/)?.[1] ?? undefined,
|
|
257
|
+
});
|
|
258
|
+
exports.mapDepositAccountWithLimitToFundingAccount = mapDepositAccountWithLimitToFundingAccount;
|
|
230
259
|
const mapPaymentAccToFundingAccount = (paymentAcc, paymentAccountBalanceFetchStatus) => ({
|
|
231
260
|
id: paymentAcc.paymentAccountId,
|
|
232
261
|
accType: 'paymentAccount',
|