@zeniai/client-epic-state 4.19.53 → 4.19.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/entity/chargeCardRepayment/chargeCardRepayment.d.ts +1 -6
- package/lib/entity/chargeCardRepayment/chargeCardRepayment.js +1 -4
- package/lib/entity/chargeCardRepayment/chargeCardRepaymentPayload.d.ts +3 -8
- package/lib/entity/chargeCardRepayment/chargeCardRepaymentPayload.js +2 -5
- package/lib/epic.d.ts +1 -3
- package/lib/epic.js +1 -3
- package/lib/esm/entity/chargeCardRepayment/chargeCardRepayment.js +0 -2
- package/lib/esm/entity/chargeCardRepayment/chargeCardRepaymentPayload.js +3 -6
- package/lib/esm/epic.js +1 -3
- package/lib/esm/index.js +5 -10
- package/lib/esm/reducer.js +0 -3
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementDocumentAIHelper.js +1 -1
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementEpic.js +1 -3
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +1 -10
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +2 -4
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +2 -5
- package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailSelector.js +6 -12
- package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/fetchChargeCardRepaymentDetailEpic.js +2 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/initiateChargeCardRepaymentEpic.js +0 -5
- package/lib/esm/view/spendManagement/chargeCards/chargeCardSetUp/epic/fetchChargeCardSetupViewEpic.js +1 -1
- package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +0 -15
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +1 -10
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelector.js +2 -4
- package/lib/esm/view/spendManagement/spendManagementFilterHelpers.js +2 -29
- package/lib/esm/view/spendManagement/zeniAccounts/depositAccountList/fetchDepositAccountListEpic.js +3 -5
- package/lib/index.d.ts +5 -11
- package/lib/index.js +13 -32
- package/lib/reducer.d.ts +0 -3
- package/lib/reducer.js +0 -3
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementDocumentAIHelper.js +1 -1
- package/lib/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementEpic.js +1 -3
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +2 -11
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +2 -4
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelectorTypes.d.ts +0 -2
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewState.d.ts +0 -1
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.d.ts +0 -1
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +2 -5
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonState.d.ts +0 -2
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailSelector.js +4 -10
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/fetchChargeCardRepaymentDetailEpic.js +2 -2
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/initiateChargeCardRepaymentEpic.d.ts +1 -2
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/initiateChargeCardRepaymentEpic.js +0 -5
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/epic/fetchChargeCardSetupViewEpic.js +1 -1
- package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +1 -2
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +1 -17
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +2 -11
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelector.js +2 -4
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelectorTypes.d.ts +0 -2
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewState.d.ts +0 -1
- package/lib/view/spendManagement/spendManagementFilterHelpers.d.ts +4 -6
- package/lib/view/spendManagement/spendManagementFilterHelpers.js +2 -29
- package/lib/view/spendManagement/zeniAccounts/depositAccountList/fetchDepositAccountListEpic.js +3 -5
- package/package.json +1 -1
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistory.js +0 -32
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryDownloadSelector.js +0 -22
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryHelpers.js +0 -79
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryPayload.js +0 -1
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +0 -83
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistorySelector.js +0 -104
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentHistoryEpic.js +0 -31
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +0 -31
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistory.d.ts +0 -50
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistory.js +0 -35
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryDownloadSelector.d.ts +0 -8
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryDownloadSelector.js +0 -26
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryHelpers.d.ts +0 -7
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryHelpers.js +0 -87
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryPayload.d.ts +0 -13
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryPayload.js +0 -2
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.d.ts +0 -19
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +0 -87
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistorySelector.d.ts +0 -24
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistorySelector.js +0 -108
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentHistoryEpic.d.ts +0 -9
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentHistoryEpic.js +0 -35
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.d.ts +0 -7
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +0 -35
|
@@ -1,87 +0,0 @@
|
|
|
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;
|
|
@@ -1,24 +0,0 @@
|
|
|
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;
|
|
@@ -1,108 +0,0 @@
|
|
|
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 userSelector_1 = require("../../../../entity/user/userSelector");
|
|
7
|
-
const setupViewSelector_1 = require("../../commonSetup/setupViewSelector");
|
|
8
|
-
const depositAccountSelector_1 = require("../../../../entity/depositAccount/depositAccountSelector");
|
|
9
|
-
const paymentAccountSelector_1 = require("../../../../entity/paymentAccount/paymentAccountSelector");
|
|
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;
|
|
@@ -1,9 +0,0 @@
|
|
|
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>;
|
|
@@ -1,35 +0,0 @@
|
|
|
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;
|
|
@@ -1,7 +0,0 @@
|
|
|
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>;
|
|
@@ -1,35 +0,0 @@
|
|
|
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;
|