@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,79 @@
|
|
|
1
|
+
import orderBy from 'lodash/orderBy';
|
|
2
|
+
import { getUserName } from '../../../../entity/user/userSelector';
|
|
3
|
+
import { applyAdvancedFiltersOnList } from '../../spendManagementFilterHelpers';
|
|
4
|
+
export function getPaymentHistorySourceAccountName(repayment, accountInfoByAccountId) {
|
|
5
|
+
const fromMap = repayment.paymentAccountId != null
|
|
6
|
+
? accountInfoByAccountId?.[repayment.paymentAccountId]?.depositAccountName
|
|
7
|
+
: undefined;
|
|
8
|
+
return fromMap ?? repayment.paymentAccountName ?? '';
|
|
9
|
+
}
|
|
10
|
+
export function getPaymentStatusDisplayText(status) {
|
|
11
|
+
const statusMap = {
|
|
12
|
+
PendingReview: 'In Progress',
|
|
13
|
+
Pending: 'In Progress',
|
|
14
|
+
Sent: 'Complete',
|
|
15
|
+
Clear: 'Complete',
|
|
16
|
+
Rejected: 'Failed',
|
|
17
|
+
Returned: 'Failed',
|
|
18
|
+
};
|
|
19
|
+
return statusMap[status] ?? status;
|
|
20
|
+
}
|
|
21
|
+
function getPaymentHistorySortValue(repayment, sortKey, accountInfoByAccountId) {
|
|
22
|
+
switch (sortKey) {
|
|
23
|
+
case 'paymentDate':
|
|
24
|
+
return repayment.repaymentDate.valueOf();
|
|
25
|
+
case 'amount':
|
|
26
|
+
return repayment.amount.amount;
|
|
27
|
+
case 'paymentStatus':
|
|
28
|
+
return getPaymentStatusDisplayText(repayment.status);
|
|
29
|
+
case 'initiatedBy':
|
|
30
|
+
return repayment.repaymentType === 'scheduled'
|
|
31
|
+
? 'autopay'
|
|
32
|
+
: getUserName(repayment.paidByUser);
|
|
33
|
+
case 'sourceAccount':
|
|
34
|
+
return getPaymentHistorySourceAccountName(repayment, accountInfoByAccountId);
|
|
35
|
+
default:
|
|
36
|
+
return '';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function sortPaymentHistory(repayments, sortKey, sortOrder, accountInfoByAccountId) {
|
|
40
|
+
const getColumnWiseSortOrder = (sortOrder) => {
|
|
41
|
+
// Note: For date and amount fields, the sort order is intentionally inverted.
|
|
42
|
+
// This allows the UI to request 'ascending' sort to get the most recent dates
|
|
43
|
+
// or largest amounts first, which is a more intuitive default for users.
|
|
44
|
+
switch (sortKey) {
|
|
45
|
+
case 'sourceAccount':
|
|
46
|
+
case 'paymentStatus':
|
|
47
|
+
case 'initiatedBy':
|
|
48
|
+
return sortOrder === 'ascending' ? 'asc' : 'desc';
|
|
49
|
+
default:
|
|
50
|
+
return sortOrder === 'ascending' ? 'desc' : 'asc';
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const order = getColumnWiseSortOrder(sortOrder);
|
|
54
|
+
return orderBy(repayments, (repayment) => getPaymentHistorySortValue(repayment, sortKey, accountInfoByAccountId), [order]);
|
|
55
|
+
}
|
|
56
|
+
function filterPaymentHistoryBySearchText(repayments, searchText, accountInfoByAccountId) {
|
|
57
|
+
const loweredSearchText = searchText.trim().toLowerCase();
|
|
58
|
+
if (loweredSearchText.length === 0) {
|
|
59
|
+
return repayments;
|
|
60
|
+
}
|
|
61
|
+
return repayments.filter((repayment) => {
|
|
62
|
+
const amountString = repayment.amount.amount.toString();
|
|
63
|
+
const statusString = getPaymentStatusDisplayText(repayment.status).toLowerCase();
|
|
64
|
+
const initiatedByString = repayment.repaymentType === 'scheduled'
|
|
65
|
+
? 'autopay'
|
|
66
|
+
: getUserName(repayment.paidByUser);
|
|
67
|
+
const accountNameString = getPaymentHistorySourceAccountName(repayment, accountInfoByAccountId).toLowerCase();
|
|
68
|
+
return (amountString.includes(loweredSearchText) ||
|
|
69
|
+
statusString.includes(loweredSearchText) ||
|
|
70
|
+
initiatedByString.toLowerCase().includes(loweredSearchText) ||
|
|
71
|
+
accountNameString.includes(loweredSearchText));
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
export function applyPaymentHistoryFiltersSearchAndSort(repayments, filters, searchText, uiState, accountInfoByAccountId) {
|
|
75
|
+
let result = applyAdvancedFiltersOnList('charge_card_payment_history', repayments, filters);
|
|
76
|
+
result = filterPaymentHistoryBySearchText(result, searchText, accountInfoByAccountId);
|
|
77
|
+
result = sortPaymentHistory(result, uiState.sortKey, uiState.sortOrder, accountInfoByAccountId);
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
import { initialChargeCardPaymentHistoryState, } from './chargeCardPaymentHistory';
|
|
3
|
+
export const initialState = initialChargeCardPaymentHistoryState;
|
|
4
|
+
const chargeCardPaymentHistory = createSlice({
|
|
5
|
+
name: 'chargeCardPaymentHistory',
|
|
6
|
+
initialState,
|
|
7
|
+
reducers: {
|
|
8
|
+
fetchChargeCardPaymentPage: {
|
|
9
|
+
reducer() {
|
|
10
|
+
// do nothing
|
|
11
|
+
},
|
|
12
|
+
prepare(cacheOverride = false) {
|
|
13
|
+
return {
|
|
14
|
+
payload: {
|
|
15
|
+
cacheOverride,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
fetchChargeCardPaymentHistory(draft) {
|
|
21
|
+
draft.fetchState = 'In-Progress';
|
|
22
|
+
draft.error = undefined;
|
|
23
|
+
},
|
|
24
|
+
updateChargeCardPaymentHistory(draft, action) {
|
|
25
|
+
const payload = action.payload;
|
|
26
|
+
draft.creditAccountId = payload.credit_account_id;
|
|
27
|
+
draft.currencyCode = payload.currency_code;
|
|
28
|
+
draft.currencySymbol = payload.currency_symbol;
|
|
29
|
+
draft.isAutoPayEnabled = payload.is_auto_pay_enabled;
|
|
30
|
+
draft.repaymentHistoryIds = payload.repayment_history.map((repayment) => repayment.card_repayment_id);
|
|
31
|
+
draft.totalRepayments = payload.total_repayments;
|
|
32
|
+
draft.fetchState = 'Completed';
|
|
33
|
+
draft.error = undefined;
|
|
34
|
+
},
|
|
35
|
+
updateChargeCardPaymentHistoryFailure(draft, action) {
|
|
36
|
+
draft.fetchState = 'Error';
|
|
37
|
+
draft.error = action.payload;
|
|
38
|
+
},
|
|
39
|
+
addRepaymentToChargeCardPaymentHistory(draft, action) {
|
|
40
|
+
const { cardRepaymentId, zeniCreditAccountId } = action.payload;
|
|
41
|
+
if (draft.creditAccountId !== zeniCreditAccountId) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (draft.repaymentHistoryIds.includes(cardRepaymentId)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
draft.repaymentHistoryIds.unshift(cardRepaymentId);
|
|
48
|
+
draft.totalRepayments += 1;
|
|
49
|
+
},
|
|
50
|
+
clearChargeCardPaymentHistory(draft) {
|
|
51
|
+
Object.assign(draft, initialState);
|
|
52
|
+
},
|
|
53
|
+
updatePaymentHistoryFilters(draft, action) {
|
|
54
|
+
if (action.payload.filters != null) {
|
|
55
|
+
draft.filters = action.payload.filters;
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
updatePaymentHistorySearchText(draft, action) {
|
|
59
|
+
if (action.payload != null) {
|
|
60
|
+
draft.searchText = action.payload;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
updatePaymentHistoryUIState(draft, action) {
|
|
64
|
+
if (action.payload.uiState.sortKey != null) {
|
|
65
|
+
draft.uiState.sortKey = action.payload.uiState.sortKey;
|
|
66
|
+
}
|
|
67
|
+
if (action.payload.uiState.sortOrder != null) {
|
|
68
|
+
draft.uiState.sortOrder = action.payload.uiState.sortOrder;
|
|
69
|
+
}
|
|
70
|
+
if (action.payload.uiState.scrollYOffset != null) {
|
|
71
|
+
draft.uiState.scrollYOffset = action.payload.uiState.scrollYOffset;
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
updatePaymentHistoryDownloadUIState(draft, action) {
|
|
75
|
+
if (action.payload.uiState.downloadState != null) {
|
|
76
|
+
draft.downloadUIState.downloadState =
|
|
77
|
+
action.payload.uiState.downloadState;
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
export const { addRepaymentToChargeCardPaymentHistory, fetchChargeCardPaymentPage, fetchChargeCardPaymentHistory, updateChargeCardPaymentHistory, updateChargeCardPaymentHistoryFailure, clearChargeCardPaymentHistory, updatePaymentHistoryFilters, updatePaymentHistorySearchText, updatePaymentHistoryDownloadUIState, updatePaymentHistoryUIState, } = chargeCardPaymentHistory.actions;
|
|
83
|
+
export default chargeCardPaymentHistory.reducer;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { reduceAllFetchState } from '../../../../commonStateTypes/reduceFetchState';
|
|
2
|
+
import { getChargeCardRepaymentByIds } from '../../../../entity/chargeCardRepayment/chargeCardRepaymentSelector';
|
|
3
|
+
import { getDepositAccountByDepositAccountId } from '../../../../entity/depositAccount/depositAccountSelector';
|
|
4
|
+
import { getPaymentAccountByPaymentAccountId } from '../../../../entity/paymentAccount/paymentAccountSelector';
|
|
5
|
+
import { getUsersByUserIds } from '../../../../entity/user/userSelector';
|
|
6
|
+
import { getAllFundingAccounts, mapDepositAccToFundingAccount, mapPaymentAccToFundingAccount, } from '../../commonSetup/setupViewSelector';
|
|
7
|
+
import { getAllDepositAccounts } from '../../zeniAccounts/depositAccountList/depositAccountListSelector';
|
|
8
|
+
import { getAllPaymentAccounts } from '../../zeniAccounts/paymentAccountList/paymentAccountListSelector';
|
|
9
|
+
import { applyPaymentHistoryFiltersSearchAndSort } from './chargeCardPaymentHistoryHelpers';
|
|
10
|
+
export const getChargeCardPaymentHistoryView = (state) => {
|
|
11
|
+
const { chargeCardPaymentHistoryState, chargeCardRepaymentState, userState, depositAccountState, paymentAccountState, depositAccountListState, paymentAccountListState, } = state;
|
|
12
|
+
const { creditAccountId, currencyCode, currencySymbol, filters, isAutoPayEnabled, repaymentHistoryIds, searchText, totalRepayments, uiState, fetchState, error, } = chargeCardPaymentHistoryState;
|
|
13
|
+
// Get the full repayment details from the entity state
|
|
14
|
+
const repaymentHistory = getChargeCardRepaymentByIds(chargeCardRepaymentState, repaymentHistoryIds);
|
|
15
|
+
const repaymentHistoryUserIds = Array.from(new Set(repaymentHistory.map((r) => r.paidById)));
|
|
16
|
+
// Get users first to enrich repayments
|
|
17
|
+
const repaymentHistoryUsers = getUsersByUserIds(userState, repaymentHistoryUserIds);
|
|
18
|
+
// Create a map of userId -> User for quick lookup
|
|
19
|
+
const userMap = new Map();
|
|
20
|
+
repaymentHistoryUsers.forEach((user) => {
|
|
21
|
+
userMap.set(user.userId, user);
|
|
22
|
+
});
|
|
23
|
+
// Enrich repayments with paidByUser details
|
|
24
|
+
let repaymentHistoryWithUsers = repaymentHistory.map((repayment) => ({
|
|
25
|
+
...repayment,
|
|
26
|
+
paidByUser: userMap.get(repayment.paidById),
|
|
27
|
+
}));
|
|
28
|
+
// Get deposit and payment accounts views (used for funding accounts and fetch state)
|
|
29
|
+
const depositAccountsView = getAllDepositAccounts(depositAccountState, depositAccountListState);
|
|
30
|
+
const paymentAccountsView = getAllPaymentAccounts(paymentAccountState, paymentAccountListState);
|
|
31
|
+
// Extract unique funding account IDs from unfiltered repayment history (for accountInfoMap used in filter/sort)
|
|
32
|
+
const repaymentHistoryFundingAccountIdsForMap = Array.from(new Set(repaymentHistory
|
|
33
|
+
.map((repayment) => repayment.paymentAccountId)
|
|
34
|
+
.filter((id) => id !== undefined && id !== null)));
|
|
35
|
+
let fundingAccountsForMap = [];
|
|
36
|
+
if (repaymentHistoryFundingAccountIdsForMap.length > 0) {
|
|
37
|
+
const hasDepositData = depositAccountsView.fetchState === 'Completed';
|
|
38
|
+
const hasPaymentData = paymentAccountsView.fetchState === 'Completed';
|
|
39
|
+
if (hasDepositData || hasPaymentData) {
|
|
40
|
+
const matchingDepositAccountsForMap = hasDepositData
|
|
41
|
+
? depositAccountsView.depositAccounts.filter((depositAccount) => repaymentHistoryFundingAccountIdsForMap.includes(depositAccount.id))
|
|
42
|
+
: [];
|
|
43
|
+
const matchingPaymentAccountsForMap = hasPaymentData
|
|
44
|
+
? paymentAccountsView.paymentAccounts.filter((paymentAccount) => repaymentHistoryFundingAccountIdsForMap.includes(paymentAccount.paymentAccountId))
|
|
45
|
+
: [];
|
|
46
|
+
fundingAccountsForMap = getAllFundingAccounts(matchingDepositAccountsForMap, matchingPaymentAccountsForMap, paymentAccountListState.paymentAccountBalanceFetchStatus, false);
|
|
47
|
+
// Fallback: look up repayment-referenced accounts directly from entity stores
|
|
48
|
+
// in case they're not in the list state (e.g. race condition, stale list)
|
|
49
|
+
const existingIds = new Set(fundingAccountsForMap.map((fa) => fa.id).filter(Boolean));
|
|
50
|
+
for (const accountId of repaymentHistoryFundingAccountIdsForMap) {
|
|
51
|
+
if (existingIds.has(accountId)) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const depositAccount = getDepositAccountByDepositAccountId(depositAccountState, accountId);
|
|
55
|
+
if (depositAccount != null) {
|
|
56
|
+
fundingAccountsForMap.push(mapDepositAccToFundingAccount(depositAccount));
|
|
57
|
+
existingIds.add(accountId);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
const paymentAccount = getPaymentAccountByPaymentAccountId(paymentAccountState, accountId);
|
|
61
|
+
if (paymentAccount != null) {
|
|
62
|
+
fundingAccountsForMap.push(mapPaymentAccToFundingAccount(paymentAccount, paymentAccountListState.paymentAccountBalanceFetchStatus));
|
|
63
|
+
existingIds.add(accountId);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const accountInfoByAccountId = {};
|
|
69
|
+
fundingAccountsForMap.forEach((fa) => {
|
|
70
|
+
if (fa.id != null) {
|
|
71
|
+
accountInfoByAccountId[fa.id] = {
|
|
72
|
+
accountId: fa.id,
|
|
73
|
+
accountLogo: fa.logo,
|
|
74
|
+
accountType: fa.accType === 'depositAccount' ? 'depositAccount' : 'paymentAccount',
|
|
75
|
+
depositAccountLast4: fa.accountLast4,
|
|
76
|
+
depositAccountName: fa.label,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
repaymentHistoryWithUsers = applyPaymentHistoryFiltersSearchAndSort(repaymentHistoryWithUsers, filters, searchText, uiState, accountInfoByAccountId);
|
|
81
|
+
const reducedFetchState = reduceAllFetchState([
|
|
82
|
+
{ fetchState, error },
|
|
83
|
+
depositAccountsView,
|
|
84
|
+
paymentAccountsView,
|
|
85
|
+
...Object.values(paymentAccountListState.paymentAccountBalanceFetchStatus),
|
|
86
|
+
]);
|
|
87
|
+
return {
|
|
88
|
+
accountInfoByAccountId,
|
|
89
|
+
creditAccountId,
|
|
90
|
+
currencyCode,
|
|
91
|
+
currencySymbol,
|
|
92
|
+
filters,
|
|
93
|
+
isAutoPayEnabled,
|
|
94
|
+
repaymentHistory: repaymentHistoryWithUsers,
|
|
95
|
+
repaymentHistoryIds,
|
|
96
|
+
repaymentHistoryUsers,
|
|
97
|
+
searchText,
|
|
98
|
+
totalRepayments,
|
|
99
|
+
uiState,
|
|
100
|
+
fetchState: reducedFetchState.fetchState,
|
|
101
|
+
error: reducedFetchState.error,
|
|
102
|
+
version: 0,
|
|
103
|
+
};
|
|
104
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
+
import { updateChargeCardRepayments } from '../../../../entity/chargeCardRepayment/chargeCardRepaymentReducer';
|
|
4
|
+
import { updateAllUsers } from '../../../../entity/user/userReducer';
|
|
5
|
+
import { createZeniAPIStatus, isSuccessStatus, } from '../../../../responsePayload';
|
|
6
|
+
import { fetchChargeCardPaymentHistory, updateChargeCardPaymentHistory, updateChargeCardPaymentHistoryFailure, } from './chargeCardPaymentHistoryReducer';
|
|
7
|
+
export const fetchChargeCardPaymentHistoryEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchChargeCardPaymentHistory.match), switchMap(() => {
|
|
8
|
+
const queryParams = { include_history: true };
|
|
9
|
+
const queryString = encodeURIComponent(JSON.stringify(queryParams));
|
|
10
|
+
return zeniAPI
|
|
11
|
+
.getJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/repayments?query=${queryString}`)
|
|
12
|
+
.pipe(mergeMap((response) => {
|
|
13
|
+
if (isSuccessStatus(response) && response.data != null) {
|
|
14
|
+
return of(
|
|
15
|
+
// Store repayments FIRST before marking as completed
|
|
16
|
+
updateChargeCardRepayments(response.data.repayment_history), updateAllUsers({
|
|
17
|
+
users: response.data.repayment_history
|
|
18
|
+
.map((repayment) => repayment.paid_by_user)
|
|
19
|
+
.filter((user) => user != null),
|
|
20
|
+
}),
|
|
21
|
+
// Mark as completed LAST, after all data is stored
|
|
22
|
+
updateChargeCardPaymentHistory(response.data));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return of(updateChargeCardPaymentHistoryFailure(response.status));
|
|
26
|
+
}
|
|
27
|
+
}), catchError((error) => {
|
|
28
|
+
return of(updateChargeCardPaymentHistoryFailure(createZeniAPIStatus('Unexpected Error', 'Fetch charge card payment history REST API call errored out' +
|
|
29
|
+
JSON.stringify(error))));
|
|
30
|
+
}));
|
|
31
|
+
}));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { concat, from } from 'rxjs';
|
|
2
|
+
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
|
+
import { fetchChargeCardRepaymentDetail } from '../chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer';
|
|
4
|
+
import { fetchChargeCardPaymentHistory, fetchChargeCardPaymentPage, } from './chargeCardPaymentHistoryReducer';
|
|
5
|
+
export const fetchChargeCardPaymentPageEpic = (actions$, state$) => actions$.pipe(filter(fetchChargeCardPaymentPage.match), mergeMap((action) => {
|
|
6
|
+
const { cacheOverride } = action.payload;
|
|
7
|
+
const chargeCardPaymentPageActions = [];
|
|
8
|
+
const state = state$.value;
|
|
9
|
+
const chargeCardPaymentHistoryState = state.chargeCardPaymentHistoryState;
|
|
10
|
+
if (cacheOverride === true) {
|
|
11
|
+
chargeCardPaymentPageActions.push(fetchChargeCardPaymentHistory());
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
if (chargeCardPaymentHistoryState.fetchState !== 'Completed' &&
|
|
15
|
+
chargeCardPaymentHistoryState.fetchState !== 'In-Progress') {
|
|
16
|
+
chargeCardPaymentPageActions.push(fetchChargeCardPaymentHistory());
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// Fetch repayment detail if deposit or payment accounts are not fetched
|
|
20
|
+
//These are needed to get the transfer from accounts for the repayment history
|
|
21
|
+
const depositAccountListState = state.depositAccountListState;
|
|
22
|
+
const paymentAccountListState = state.paymentAccountListState;
|
|
23
|
+
const needsRepaymentDetailFetch = (depositAccountListState.fetchState !== 'Completed' &&
|
|
24
|
+
depositAccountListState.fetchState !== 'In-Progress') ||
|
|
25
|
+
(paymentAccountListState.fetchState !== 'Completed' &&
|
|
26
|
+
paymentAccountListState.fetchState !== 'In-Progress');
|
|
27
|
+
if (needsRepaymentDetailFetch) {
|
|
28
|
+
chargeCardPaymentPageActions.push(fetchChargeCardRepaymentDetail());
|
|
29
|
+
}
|
|
30
|
+
return concat(from(chargeCardPaymentPageActions));
|
|
31
|
+
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getAllFundingAccounts, } from '../../commonSetup/setupViewSelector';
|
|
1
|
+
import { reduceAnyCompletedFetchState } from '../../../../commonStateTypes/reduceFetchState';
|
|
2
|
+
import { getAllFundingAccounts, mapDepositAccountWithLimitToFundingAccount, } from '../../commonSetup/setupViewSelector';
|
|
3
3
|
import { getAllDepositAccounts } from '../../zeniAccounts/depositAccountList/depositAccountListSelector';
|
|
4
4
|
import { getAllPaymentAccounts } from '../../zeniAccounts/paymentAccountList/paymentAccountListSelector';
|
|
5
5
|
export const getChargeCardRepaymentDetail = (state) => {
|
|
@@ -8,11 +8,20 @@ export const getChargeCardRepaymentDetail = (state) => {
|
|
|
8
8
|
const depositAccountsView = getAllDepositAccounts(depositAccountState, depositAccountListState);
|
|
9
9
|
const paymentAccountsView = getAllPaymentAccounts(paymentAccountState, paymentAccountListState);
|
|
10
10
|
let transferFromAccounts = [];
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
if (paymentAccountsView.fetchState === 'Completed') {
|
|
12
|
+
if (depositAccountsView.fetchState === 'Completed') {
|
|
13
|
+
transferFromAccounts = getAllFundingAccounts(depositAccountsView.depositAccounts, paymentAccountsView.paymentAccounts, paymentAccountListState.paymentAccountBalanceFetchStatus);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
const depositFundingFromLimit = Object.values(depositAccountState.depositAccountLimitForChargeCardByID ?? {}).map(mapDepositAccountWithLimitToFundingAccount);
|
|
17
|
+
const paymentFundingAccounts = getAllFundingAccounts([], paymentAccountsView.paymentAccounts, paymentAccountListState.paymentAccountBalanceFetchStatus);
|
|
18
|
+
transferFromAccounts = [
|
|
19
|
+
...depositFundingFromLimit,
|
|
20
|
+
...paymentFundingAccounts,
|
|
21
|
+
];
|
|
22
|
+
}
|
|
14
23
|
}
|
|
15
|
-
const reducedFetchState =
|
|
24
|
+
const reducedFetchState = reduceAnyCompletedFetchState([
|
|
16
25
|
depositAccountsView,
|
|
17
26
|
paymentAccountsView,
|
|
18
27
|
...Object.values(paymentAccountListState.paymentAccountBalanceFetchStatus),
|
|
@@ -7,8 +7,9 @@ export const fetchChargeCardRepaymentDetailEpic = (actions$, state$) => actions$
|
|
|
7
7
|
const fetchChargeCardRepaymentDetailActions = [];
|
|
8
8
|
const state = state$.value;
|
|
9
9
|
const depositAccounts = state.depositAccountListState;
|
|
10
|
-
|
|
11
|
-
depositAccounts.fetchState !== 'Completed'
|
|
10
|
+
const willFetchDeposit = depositAccounts.fetchState !== 'In-Progress' &&
|
|
11
|
+
depositAccounts.fetchState !== 'Completed';
|
|
12
|
+
if (willFetchDeposit) {
|
|
12
13
|
fetchChargeCardRepaymentDetailActions.push(fetchDepositAccountList());
|
|
13
14
|
}
|
|
14
15
|
const paymentAccounts = state.paymentAccountListState;
|
|
@@ -10,6 +10,7 @@ import { accountTypeSubConfigCodeToAccType } from '../../helpers';
|
|
|
10
10
|
import { getAllDepositAccounts } from '../../zeniAccounts/depositAccountList/depositAccountListSelector';
|
|
11
11
|
import { getAllPaymentAccounts } from '../../zeniAccounts/paymentAccountList/paymentAccountListSelector';
|
|
12
12
|
import { updateCreditAccountRepaymentAmountAndDate } from '../chargeCardList/chargeCardListReducer';
|
|
13
|
+
import { addRepaymentToChargeCardPaymentHistory } from '../chargeCardPaymentHistory/chargeCardPaymentHistoryReducer';
|
|
13
14
|
import { initiateChargeCardRepayment, updateChargeCardRepaymentStatus, } from './chargeCardRepaymentDetailReducer';
|
|
14
15
|
export const initiateChargeCardRepaymentEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(initiateChargeCardRepayment.match), switchMap((action) => {
|
|
15
16
|
const state = state$.value;
|
|
@@ -36,6 +37,10 @@ export const initiateChargeCardRepaymentEpic = (actions$, state$, zeniAPI) => ac
|
|
|
36
37
|
if (isSuccessResponse(response) && response.data != null) {
|
|
37
38
|
const actions = [
|
|
38
39
|
updateChargeCardRepayment(response.data.card_repayment),
|
|
40
|
+
addRepaymentToChargeCardPaymentHistory({
|
|
41
|
+
cardRepaymentId: response.data.card_repayment.card_repayment_id,
|
|
42
|
+
zeniCreditAccountId: response.data.card_repayment.zeni_credit_account_id,
|
|
43
|
+
}),
|
|
39
44
|
updateCreditAccountRepaymentAmountAndDate({
|
|
40
45
|
amount: toAmount(response.data.card_repayment.amount, response.data.card_repayment.currency_code, response.data.card_repayment.currency_symbol),
|
|
41
46
|
date: date(response.data.card_repayment.repayment_date),
|
|
@@ -48,7 +48,7 @@ export const fetchChargeCardSetupViewEpic = (actions$, state$, zeniAPI) => actio
|
|
|
48
48
|
updateDepositAccounts(response.data.deposit_accounts ?? []),
|
|
49
49
|
updateDepositAccountList({
|
|
50
50
|
data: response.data?.deposit_accounts ?? [],
|
|
51
|
-
updateType: '
|
|
51
|
+
updateType: 'merge',
|
|
52
52
|
}),
|
|
53
53
|
updateSetupViewLocalStoreData({
|
|
54
54
|
companyId: response.data.companies[0].company_id,
|
package/lib/esm/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js
CHANGED
|
@@ -115,8 +115,28 @@ export const updateBusinessVerificationDetailsEpic = (actions$, state$, zeniAPI)
|
|
|
115
115
|
return from([]);
|
|
116
116
|
}
|
|
117
117
|
}));
|
|
118
|
+
/** US Nexus API keys. Form may submit these or display labels; we send keys to API. */
|
|
119
|
+
const US_NEXUS_KEYS = new Set([
|
|
120
|
+
'employees',
|
|
121
|
+
'customers',
|
|
122
|
+
'physical_office',
|
|
123
|
+
'banking_relationships',
|
|
124
|
+
]);
|
|
125
|
+
/** Maps display label → API key for US nexus types (English labels from strings). */
|
|
126
|
+
const US_NEXUS_LABEL_TO_KEY = {
|
|
127
|
+
Employees: 'employees',
|
|
128
|
+
Customers: 'customers',
|
|
129
|
+
'Physical office or facility': 'physical_office',
|
|
130
|
+
'Banking relationships': 'banking_relationships',
|
|
131
|
+
};
|
|
132
|
+
function toUsNexusTypeKey(value) {
|
|
133
|
+
if (US_NEXUS_KEYS.has(value)) {
|
|
134
|
+
return value;
|
|
135
|
+
}
|
|
136
|
+
return US_NEXUS_LABEL_TO_KEY[value] ?? value;
|
|
137
|
+
}
|
|
118
138
|
export const toBusinessVerificationCompanyDataPayload = (companyLocalData, sendForVerification, companyAddressData, registeredAddressData, setupViewType) => {
|
|
119
|
-
const { companyDescription, companyLegalName, companyIndustry, website, incDate, taxIdOrEIN, phone, syncToken, fileIds, typeOfIncorporation, sourceOfFunds, } = companyLocalData;
|
|
139
|
+
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;
|
|
120
140
|
const company = {
|
|
121
141
|
is_ready_for_verification: sendForVerification,
|
|
122
142
|
file_ids: fileIds,
|
|
@@ -167,9 +187,52 @@ export const toBusinessVerificationCompanyDataPayload = (companyLocalData, sendF
|
|
|
167
187
|
if (typeOfIncorporation != null) {
|
|
168
188
|
company['company_inc_type'] = typeOfIncorporation;
|
|
169
189
|
}
|
|
190
|
+
if (stateOfIncorporation != null) {
|
|
191
|
+
company['company_inc_state'] = stateOfIncorporation;
|
|
192
|
+
}
|
|
170
193
|
if (companyIndustry != null) {
|
|
171
194
|
company['company_industry'] = companyIndustry;
|
|
172
195
|
}
|
|
196
|
+
Object.assign(company, {
|
|
197
|
+
...(companySubIndustry != null && {
|
|
198
|
+
company_industry_sub_type: companySubIndustry,
|
|
199
|
+
}),
|
|
200
|
+
...(countriesOfOperations != null &&
|
|
201
|
+
countriesOfOperations.length > 0 && {
|
|
202
|
+
company_countries_of_operations: countriesOfOperations,
|
|
203
|
+
}),
|
|
204
|
+
...(companySourceOfFunds != null && {
|
|
205
|
+
company_source_of_funds: companySourceOfFunds,
|
|
206
|
+
}),
|
|
207
|
+
...(companySourceOfFundsDescription != null && {
|
|
208
|
+
company_source_of_funds_desc: companySourceOfFundsDescription,
|
|
209
|
+
}),
|
|
210
|
+
...(transactionVolume != null && {
|
|
211
|
+
company_transaction_vol_expectations: transactionVolume,
|
|
212
|
+
}),
|
|
213
|
+
...(transactionVolumeDescription != null && {
|
|
214
|
+
company_transaction_vol_expectations_desc: transactionVolumeDescription,
|
|
215
|
+
}),
|
|
216
|
+
...(purposeOfAccount != null && {
|
|
217
|
+
company_purpose_of_account: purposeOfAccount,
|
|
218
|
+
}),
|
|
219
|
+
...(purposeOfAccountDescription != null && {
|
|
220
|
+
company_purpose_of_account_desc: purposeOfAccountDescription,
|
|
221
|
+
}),
|
|
222
|
+
...(regulatedStatus != null && {
|
|
223
|
+
company_regulated_states: regulatedStatus === 'yes',
|
|
224
|
+
}),
|
|
225
|
+
...(regulatedStatusDescription != null && {
|
|
226
|
+
company_regulated_states_desc: regulatedStatusDescription,
|
|
227
|
+
}),
|
|
228
|
+
...(usNexus != null && {
|
|
229
|
+
company_us_nexus: usNexus === 'yes',
|
|
230
|
+
}),
|
|
231
|
+
...(usNexusTypes != null &&
|
|
232
|
+
usNexusTypes.length > 0 && {
|
|
233
|
+
company_us_nexus_desc: usNexusTypes.map(toUsNexusTypeKey),
|
|
234
|
+
}),
|
|
235
|
+
});
|
|
173
236
|
if (setupViewType === 'zeni_treasury' && sourceOfFunds != null) {
|
|
174
237
|
company['source_of_funds'] = sourceOfFunds;
|
|
175
238
|
}
|
package/lib/esm/view/spendManagement/commonSetup/epic/setup/updateSetupViewLocalStoreDataEpic.js
CHANGED
|
@@ -45,7 +45,7 @@ export function toSetupViewLocalData(company, users, userRoles, primaryContact)
|
|
|
45
45
|
const { companyInfo, incInfo, taxInfo, questionaire, companyBillPayInfo } = company;
|
|
46
46
|
const { companyId, companyDescription, companyLegalName, companyUrl, phone, syncToken, sourceOfFunds, } = companyInfo;
|
|
47
47
|
const { usersSelectedForVerification: usersSelected } = companyBillPayInfo;
|
|
48
|
-
const { fileIds, companyIncDate: incDate, companyIncType } = incInfo;
|
|
48
|
+
const { fileIds, companyIncDate: incDate, companyIncType, companyIncState, companySubIndustry, countriesOfOperations, companySourceOfFunds: incCompanySourceOfFunds, companySourceOfFundsDescription, transactionVolume, transactionVolumeDescription, purposeOfAccount, purposeOfAccountDescription, regulatedStatus, regulatedStatusDescription, usNexus, usNexusTypes, } = incInfo;
|
|
49
49
|
const { companyIndustry } = questionaire;
|
|
50
50
|
const { taxId } = taxInfo;
|
|
51
51
|
const companyDetails = {
|
|
@@ -53,6 +53,10 @@ export function toSetupViewLocalData(company, users, userRoles, primaryContact)
|
|
|
53
53
|
companyDescription,
|
|
54
54
|
companyIndustry,
|
|
55
55
|
companyLegalName,
|
|
56
|
+
companySubIndustry,
|
|
57
|
+
companySourceOfFunds: incCompanySourceOfFunds,
|
|
58
|
+
companySourceOfFundsDescription,
|
|
59
|
+
countriesOfOperations,
|
|
56
60
|
taxIdOrEIN: taxId,
|
|
57
61
|
incDate,
|
|
58
62
|
phone,
|
|
@@ -61,6 +65,15 @@ export function toSetupViewLocalData(company, users, userRoles, primaryContact)
|
|
|
61
65
|
syncToken,
|
|
62
66
|
typeOfIncorporation: companyIncType,
|
|
63
67
|
sourceOfFunds,
|
|
68
|
+
stateOfIncorporation: companyIncState,
|
|
69
|
+
transactionVolume,
|
|
70
|
+
transactionVolumeDescription,
|
|
71
|
+
purposeOfAccount,
|
|
72
|
+
purposeOfAccountDescription,
|
|
73
|
+
regulatedStatus,
|
|
74
|
+
regulatedStatusDescription,
|
|
75
|
+
usNexus,
|
|
76
|
+
usNexusTypes,
|
|
64
77
|
};
|
|
65
78
|
let primaryContactDetails = undefined;
|
|
66
79
|
if (primaryContact != null) {
|
|
@@ -109,7 +109,7 @@ export const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentit
|
|
|
109
109
|
if (companyDetails.localData != null) {
|
|
110
110
|
const deleteFileStatusById = {};
|
|
111
111
|
const updateFileStatusById = {};
|
|
112
|
-
const { syncToken, companyDescription, companyLegalName, website, companyIndustry, phone, taxIdOrEIN, incDate, fileIds, typeOfIncorporation, sourceOfFunds, } = companyDetails.localData;
|
|
112
|
+
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;
|
|
113
113
|
fileIds.forEach((fileId) => {
|
|
114
114
|
deleteFileStatusById[fileId] = getFileDeleteStatusById(state, fileId);
|
|
115
115
|
});
|
|
@@ -123,6 +123,10 @@ export const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentit
|
|
|
123
123
|
companyDescription,
|
|
124
124
|
companyLegalName,
|
|
125
125
|
companyIndustry,
|
|
126
|
+
companySubIndustry,
|
|
127
|
+
companySourceOfFunds,
|
|
128
|
+
companySourceOfFundsDescription,
|
|
129
|
+
countriesOfOperations,
|
|
126
130
|
website,
|
|
127
131
|
phone,
|
|
128
132
|
taxIdOrEIN,
|
|
@@ -136,6 +140,15 @@ export const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentit
|
|
|
136
140
|
primaryContactLocalData,
|
|
137
141
|
typeOfIncorporation,
|
|
138
142
|
sourceOfFunds,
|
|
143
|
+
transactionVolume,
|
|
144
|
+
transactionVolumeDescription,
|
|
145
|
+
purposeOfAccount,
|
|
146
|
+
purposeOfAccountDescription,
|
|
147
|
+
regulatedStatus,
|
|
148
|
+
regulatedStatusDescription,
|
|
149
|
+
stateOfIncorporation,
|
|
150
|
+
usNexus,
|
|
151
|
+
usNexusTypes,
|
|
139
152
|
};
|
|
140
153
|
}
|
|
141
154
|
const companyOfficerLocalData = {
|
|
@@ -219,6 +232,21 @@ export const mapDepositAccToFundingAccount = (depositAcc) => ({
|
|
|
219
232
|
createTime: depositAcc.createTime,
|
|
220
233
|
accountLast4: depositAcc.accountLast4,
|
|
221
234
|
});
|
|
235
|
+
export const mapDepositAccountWithLimitToFundingAccount = (depositAcc) => ({
|
|
236
|
+
id: depositAcc.id,
|
|
237
|
+
accType: 'depositAccount',
|
|
238
|
+
label: depositAcc.accountName,
|
|
239
|
+
maskedAccountNumber: depositAcc.maskedAccountNumber,
|
|
240
|
+
accountBalance: depositAcc.accountBalance,
|
|
241
|
+
logo: undefined,
|
|
242
|
+
zeniAccountId: depositAcc.zeniAccountId,
|
|
243
|
+
balanceFetchStatus: {
|
|
244
|
+
fetchState: 'Completed',
|
|
245
|
+
error: undefined,
|
|
246
|
+
},
|
|
247
|
+
createTime: depositAcc.createTime,
|
|
248
|
+
accountLast4: depositAcc.maskedAccountNumber.match(/(\d{4})$/)?.[1] ?? undefined,
|
|
249
|
+
});
|
|
222
250
|
export const mapPaymentAccToFundingAccount = (paymentAcc, paymentAccountBalanceFetchStatus) => ({
|
|
223
251
|
id: paymentAcc.paymentAccountId,
|
|
224
252
|
accType: 'paymentAccount',
|
package/lib/esm/view/spendManagement/reimbursement/remiDetailView/epics/fetchRemiDetailEpic.js
CHANGED
|
@@ -38,7 +38,6 @@ export const fetchRemiDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
38
38
|
const query = {
|
|
39
39
|
transaction_type: 'reimbursement',
|
|
40
40
|
reimbursement_provider: 'zeni',
|
|
41
|
-
is_include_payment_accounts_info: true,
|
|
42
41
|
is_include_approval_info: true,
|
|
43
42
|
is_include_deleted: isShowDeletedReimbursementEnabled,
|
|
44
43
|
};
|
|
@@ -2,6 +2,7 @@ import { createSlice } from '@reduxjs/toolkit';
|
|
|
2
2
|
export const initialState = {
|
|
3
3
|
fetchState: 'Not-Started',
|
|
4
4
|
error: undefined,
|
|
5
|
+
listeningToPusherEvent: false,
|
|
5
6
|
approverListState: {
|
|
6
7
|
approverIds: [],
|
|
7
8
|
attributes: [],
|
|
@@ -176,6 +177,11 @@ const remiSetupApproverView = createSlice({
|
|
|
176
177
|
reducer(draft, action) {
|
|
177
178
|
const { approvalRuleIds } = action.payload;
|
|
178
179
|
if (draft.remiSetupApproverViewUpdateData != null) {
|
|
180
|
+
if (draft.remiSetupApproverViewUpdateData.type === 'approval_update' &&
|
|
181
|
+
draft.remiSetupApproverViewUpdateData.data
|
|
182
|
+
?.isApplicableOnPendingApprovalEntity === true) {
|
|
183
|
+
draft.listeningToPusherEvent = true;
|
|
184
|
+
}
|
|
179
185
|
draft.remiSetupApproverViewUpdateData.updateStatus = {
|
|
180
186
|
fetchState: 'Completed',
|
|
181
187
|
error: undefined,
|
|
@@ -236,6 +242,9 @@ const remiSetupApproverView = createSlice({
|
|
|
236
242
|
return { payload: { remiSetupApproverViewUpdateData } };
|
|
237
243
|
},
|
|
238
244
|
},
|
|
245
|
+
setListeningToPusherEvent(draft, action) {
|
|
246
|
+
draft.listeningToPusherEvent = action.payload;
|
|
247
|
+
},
|
|
239
248
|
clearRemiSetupApproverViewUpdateData(draft) {
|
|
240
249
|
if (draft.remiSetupApproverViewUpdateData != null) {
|
|
241
250
|
draft.remiSetupApproverViewUpdateData.data = undefined;
|
|
@@ -246,5 +255,5 @@ const remiSetupApproverView = createSlice({
|
|
|
246
255
|
},
|
|
247
256
|
},
|
|
248
257
|
});
|
|
249
|
-
export const { fetchRemiSetupApproverView, fetchRemiSetupApproverViewSuccess, fetchRemiSetupApproverViewFailure, fetchRemiApproversDetails, fetchRemiApproversList, fetchRemiApproversListSuccess, fetchRemiApproversListFailure, deleteRemiApprovalRule, deleteRemiApprovalRuleSuccess, deleteRemiApprovalRuleFailure, saveRemiSetupApproverViewUpdates, saveRemiSetupApproverViewUpdatesSuccess, saveRemiSetupApproverViewUpdatesFailure, initializeRemiSetupApproverViewUpdateData, saveRemiSetupApproverViewUpdateData, clearRemiSetupApproverViewUpdateData, clearRemiSetupApproverView, } = remiSetupApproverView.actions;
|
|
258
|
+
export const { fetchRemiSetupApproverView, fetchRemiSetupApproverViewSuccess, fetchRemiSetupApproverViewFailure, fetchRemiApproversDetails, fetchRemiApproversList, fetchRemiApproversListSuccess, fetchRemiApproversListFailure, deleteRemiApprovalRule, deleteRemiApprovalRuleSuccess, deleteRemiApprovalRuleFailure, saveRemiSetupApproverViewUpdates, saveRemiSetupApproverViewUpdatesSuccess, saveRemiSetupApproverViewUpdatesFailure, initializeRemiSetupApproverViewUpdateData, saveRemiSetupApproverViewUpdateData, setListeningToPusherEvent, clearRemiSetupApproverViewUpdateData, clearRemiSetupApproverView, } = remiSetupApproverView.actions;
|
|
250
259
|
export default remiSetupApproverView.reducer;
|