@zeniai/client-epic-state 4.16.0 → 4.16.2
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/animations.d.ts +1 -1
- package/lib/commonStateTypes/animations.js +1 -1
- package/lib/entity/chargeCard/chargeCard.d.ts +26 -8
- package/lib/entity/chargeCard/chargeCard.js +25 -6
- package/lib/entity/chargeCard/chargeCardPayload.d.ts +41 -5
- package/lib/entity/chargeCard/chargeCardPayload.js +20 -8
- package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
- package/lib/entity/chargeCardTransaction/chargeCardTransaction.js +5 -1
- package/lib/entity/company/companyPayload.d.ts +12 -1
- package/lib/entity/company/companyPayload.js +14 -0
- package/lib/entity/company/companyStateTypes.d.ts +11 -0
- package/lib/entity/connectedAccount/connectedAccount.d.ts +19 -0
- package/lib/entity/connectedAccount/connectedAccount.js +10 -0
- package/lib/entity/connectedAccount/connectedAccountPayload.d.ts +11 -0
- package/lib/entity/connectedAccount/connectedAccountPayload.js +15 -0
- package/lib/entity/connectedAccount/connectedAccountReducer.d.ts +6 -0
- package/lib/entity/connectedAccount/connectedAccountReducer.js +27 -0
- package/lib/entity/connectedAccount/connectedAccountSelector.d.ts +4 -0
- package/lib/entity/connectedAccount/connectedAccountSelector.js +17 -0
- package/lib/entity/depositAccount/depositAccount.d.ts +20 -2
- package/lib/entity/depositAccount/depositAccountPayload.d.ts +22 -1
- package/lib/entity/depositAccount/depositAccountPayload.js +39 -1
- package/lib/entity/depositAccount/depositAccountReducer.d.ts +2 -2
- package/lib/entity/depositAccount/depositAccountReducer.js +8 -2
- package/lib/entity/depositAccount/depositAccountSelector.d.ts +3 -1
- package/lib/entity/depositAccount/depositAccountSelector.js +10 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +2 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -1
- package/lib/entity/tenant/clearAllEpic.js +2 -0
- package/lib/entity/tenant/tenantSelector.d.ts +6 -2
- package/lib/entity/tenant/tenantSelector.js +10 -2
- package/lib/epic.d.ts +5 -1
- package/lib/epic.js +5 -1
- package/lib/index.d.ts +18 -18
- package/lib/index.js +26 -17
- package/lib/reducer.d.ts +3 -0
- package/lib/reducer.js +3 -0
- package/lib/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +8 -0
- package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +16 -0
- package/lib/view/addressView/addressViewState.d.ts +1 -1
- package/lib/view/dashboard/dashboardSelector.js +7 -6
- package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.js +5 -4
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +1 -2
- package/lib/view/expenseAutomationView/epics/fluxAnalysis/fetchFluxAnalysisViewEpic.js +18 -6
- package/lib/view/expenseAutomationView/epics/fluxAnalysis/reviewFluxAnalysisEpic.js +1 -4
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +7 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/initializeTransactionCategorizationLocalDataEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscatgorizedEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscatgorizedEpic.js +3 -3
- package/lib/view/expenseAutomationView/helpers/helpers.js +4 -4
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +2 -2
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +27 -24
- package/lib/view/expenseAutomationView/payload/fluxAnalysisPayload.d.ts +22 -9
- package/lib/view/expenseAutomationView/payload/fluxAnalysisPayload.js +2 -2
- package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.d.ts +13 -5
- package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.js +245 -115
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +4 -3
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +14 -19
- package/lib/view/expenseAutomationView/selectorTypes/fluxAnalysisViewSelectorTypes.d.ts +29 -9
- package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +108 -40
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +9 -1
- package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.d.ts +40 -15
- package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.js +1 -1
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +1 -0
- package/lib/view/expenseAutomationView/types/transactionsViewState.js +1 -0
- package/lib/view/onboardingView/cockpitView/epic/initializeOnboardingCustomerViewUpdateDataEpic.js +4 -4
- package/lib/view/onboardingView/cockpitView/onboardingCockpitViewReducer.d.ts +2 -1
- package/lib/view/onboardingView/cockpitView/onboardingCockpitViewReducer.js +2 -2
- package/lib/view/settingsView/settingsViewHelpers.d.ts +4 -4
- package/lib/view/settingsView/settingsViewHelpers.js +9 -8
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +1 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +6 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +20 -2
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +5 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +9 -2
- package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +1 -0
- package/lib/view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingSelector.js +4 -3
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.d.ts +5 -3
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.js +4 -2
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +8 -3
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigState.d.ts +4 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +12 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.js +26 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailPayload.d.ts +2 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +43 -4
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +104 -9
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.d.ts +15 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +70 -16
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.d.ts +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +12 -3
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardTransactionListEpic.js +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchDepositAccountLimitEpic.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchDepositAccountLimitEpic.js +41 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateChargeCardLimitEpic.js +2 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateDebitCardPinAttemptEpic.d.ts +11 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateDebitCardPinAttemptEpic.js +42 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +11 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +20 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListPayload.d.ts +16 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +6 -4
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +30 -4
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +5 -2
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +26 -14
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +20 -5
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchDebitCardSummaryEpic.d.ts +7 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchDebitCardSummaryEpic.js +23 -0
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewReducer.d.ts +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewReducer.js +4 -2
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewSelector.d.ts +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewSelector.js +2 -0
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/epic/acceptChargeCardTermsEpic.js +19 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/depositAccountWithLimitPayload.d.ts +6 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/depositAccountWithLimitPayload.js +2 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchDepositAccountListForCardsEpic.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchDepositAccountListForCardsEpic.js +31 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchIssueCardPageEpic.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchIssueCardPageEpic.js +15 -3
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +65 -25
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.d.ts +11 -3
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +45 -11
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.d.ts +6 -3
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +33 -18
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +41 -8
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.js +0 -21
- package/lib/view/spendManagement/commonSetup/epic/setup/enableSetupEpic.js +9 -0
- package/lib/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js +8 -3
- package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +4 -4
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +2 -1
- package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +3 -1
- package/lib/view/spendManagement/commonSetup/setupViewState.js +13 -1
- package/lib/view/spendManagement/helpers.d.ts +3 -0
- package/lib/view/spendManagement/helpers.js +13 -1
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/getPaymentAccountsEpic.js +2 -1
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountEpic.js +2 -1
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountLoginStatusEpic.js +2 -1
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountStatusEpic.js +2 -1
- package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.d.ts +2 -1
- package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js +6 -1
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +10 -10
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +1 -0
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +1 -1
- package/lib/view/spendManagement/zeniAccounts/checkDeposit/checkDepositSelector.js +1 -1
- package/lib/view/spendManagement/zeniAccounts/depositAccountList/depositAccountListSelector.d.ts +1 -1
- package/lib/view/spendManagement/zeniAccounts/depositAccountList/depositAccountListSelector.js +3 -3
- package/lib/view/spendManagement/zeniAccounts/expressPay/expressPaySelector.js +1 -1
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.js +1 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountList/zeniAccountListSelector.js +1 -1
- package/lib/view/transactionDetail/epics/markTransactionAsNotMiscategorizedEpic.d.ts +4 -3
- package/lib/view/transactionDetail/epics/markTransactionAsNotMiscategorizedEpic.js +25 -1
- package/lib/view/transactionDetail/epics/saveTransactionDetailEpic.js +1 -1
- package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +1 -1
- package/lib/view/transactionDetail/transactionDetailReducer.d.ts +4 -2
- package/lib/view/transactionDetail/transactionDetailReducer.js +4 -2
- package/lib/view/twoFactorAuthentication/resendOtpEpic.d.ts +3 -2
- package/lib/view/twoFactorAuthentication/resendOtpEpic.js +44 -19
- package/lib/view/twoFactorAuthentication/sendOtpEpic.d.ts +2 -1
- package/lib/view/twoFactorAuthentication/sendOtpEpic.js +45 -18
- package/lib/view/twoFactorAuthentication/twoFactorAuthentication.d.ts +17 -5
- package/lib/view/twoFactorAuthentication/twoFactorAuthentication.js +33 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.d.ts +7 -7
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.js +6 -6
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.d.ts +22 -6
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.js +176 -60
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationSelector.d.ts +5 -3
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationSelector.js +13 -2
- package/lib/view/twoFactorAuthentication/verifyOtpEpic.d.ts +5 -2
- package/lib/view/twoFactorAuthentication/verifyOtpEpic.js +46 -5
- package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +2 -2
- package/lib/view/userListView/fetchUserListByTypeEpic.js +4 -3
- package/lib/view/userListView/userListViewPayload.d.ts +11 -0
- package/package.json +5 -4
|
@@ -13,7 +13,7 @@ const classSelector_1 = require("../../../../entity/class/classSelector");
|
|
|
13
13
|
const userSelector_1 = require("../../../../entity/user/userSelector");
|
|
14
14
|
const userRoleSelector_1 = require("../../../../entity/userRole/userRoleSelector");
|
|
15
15
|
const userListViewSelector_1 = require("../../../userListView/userListViewSelector");
|
|
16
|
-
const getChargeCardListView = (state,
|
|
16
|
+
const getChargeCardListView = (state, includeCreditAccountDebitSummaryAndCashbackInfo, isDebitCardEnabled, isCreditCardEnabled) => {
|
|
17
17
|
const { chargeCardListState, chargeCardState, classState, userState, userRoleState, chargeCardConfigState, classListState, cashbackDetailState, userListViewState, } = state;
|
|
18
18
|
const searchText = chargeCardListState.searchText.toLowerCase();
|
|
19
19
|
const cards = (0, chargeCardSelector_1.getChargeCardsByIds)(chargeCardState, chargeCardListState.cardIds);
|
|
@@ -37,15 +37,20 @@ const getChargeCardListView = (state, includeCreditAccountAndCashbackInfo) => {
|
|
|
37
37
|
const cardsInOrder = (0, orderBy_1.default)(chargeCardsWithUserFiltered, (person) => getCardsBySortKey(person, sortKey), sortOrder);
|
|
38
38
|
const userListSelectorView = (0, userListViewSelector_1.getUserList)(userState, userRoleState, userListViewState, 'cardHolderCandidate');
|
|
39
39
|
const userList = userListSelectorView.users;
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
const requiredFetchStates = [
|
|
41
|
+
chargeCardListState,
|
|
42
|
+
chargeCardConfigState,
|
|
43
|
+
];
|
|
44
|
+
if (includeCreditAccountDebitSummaryAndCashbackInfo) {
|
|
45
|
+
if (isCreditCardEnabled) {
|
|
46
|
+
requiredFetchStates.push(chargeCardListState.creditAccount);
|
|
47
|
+
}
|
|
48
|
+
if (isDebitCardEnabled) {
|
|
49
|
+
requiredFetchStates.push(chargeCardListState.debitCardSummaries);
|
|
50
|
+
}
|
|
51
|
+
requiredFetchStates.push(cashbackDetailState);
|
|
52
|
+
}
|
|
53
|
+
const fetchState = (0, reduceFetchState_1.reduceFetchState)(requiredFetchStates).fetchState;
|
|
49
54
|
const issueCardPageFetchState = (0, reduceFetchState_1.reduceFetchState)([
|
|
50
55
|
chargeCardConfigState,
|
|
51
56
|
userListSelectorView,
|
|
@@ -55,6 +60,9 @@ const getChargeCardListView = (state, includeCreditAccountAndCashbackInfo) => {
|
|
|
55
60
|
classIds: classIds,
|
|
56
61
|
reportId: 'class_list',
|
|
57
62
|
});
|
|
63
|
+
// used to determine which card (summary or promo) to show in the UI
|
|
64
|
+
const hasCreditCard = chargeCardsWithUser.some((card) => card.type.code.includes('credit'));
|
|
65
|
+
const hasDebitCard = chargeCardsWithUser.some((card) => card.type.code.includes('debit'));
|
|
58
66
|
return {
|
|
59
67
|
fetchState,
|
|
60
68
|
error: chargeCardListState.error,
|
|
@@ -71,6 +79,9 @@ const getChargeCardListView = (state, includeCreditAccountAndCashbackInfo) => {
|
|
|
71
79
|
version: '1.0',
|
|
72
80
|
resendCardInvite: chargeCardListState.resendCardInvite,
|
|
73
81
|
revokeCardInvite: chargeCardListState.revokeCardInvite,
|
|
82
|
+
debitCardSummary: chargeCardListState.debitCardSummaries,
|
|
83
|
+
hasCreditCard,
|
|
84
|
+
hasDebitCard,
|
|
74
85
|
};
|
|
75
86
|
};
|
|
76
87
|
exports.getChargeCardListView = getChargeCardListView;
|
|
@@ -80,7 +91,8 @@ const getMyPendingActivationChargeCardListView = (state) => {
|
|
|
80
91
|
const cards = (0, chargeCardSelector_1.getChargeCardsByIds)(chargeCardState, chargeCardListState.cardIds);
|
|
81
92
|
const myUserId = (_a = tenantState.loggedInUser) === null || _a === void 0 ? void 0 : _a.userId;
|
|
82
93
|
const myPendingActivationChargeCardWithUser = getChargeCardsWithUser(cards, state).filter((chargeCard) => chargeCard.cardHolderUserId === myUserId &&
|
|
83
|
-
chargeCard.type.code === 'business_physical_credit_card'
|
|
94
|
+
(chargeCard.type.code === 'business_physical_credit_card' ||
|
|
95
|
+
chargeCard.type.code === 'business_physical_debit_card') &&
|
|
84
96
|
chargeCard.status.code === 'inactive');
|
|
85
97
|
const sortKey = chargeCardListState.uiState.sortKey;
|
|
86
98
|
const sortOrder = (0, sortOrderPayload_1.getSortOrder)(chargeCardListState.uiState.sortOrder);
|
|
@@ -164,7 +176,7 @@ const getChargeCardsWithUser = (cards, { userState, userRoleState, classState, a
|
|
|
164
176
|
return chargeCardsWithUser;
|
|
165
177
|
};
|
|
166
178
|
const getCardsBySortKey = (card, sortKey) => {
|
|
167
|
-
var _a, _b
|
|
179
|
+
var _a, _b;
|
|
168
180
|
switch (sortKey) {
|
|
169
181
|
case 'owner': {
|
|
170
182
|
const firstName = (_a = card.cardHolderUser) === null || _a === void 0 ? void 0 : _a.firstName.toLowerCase();
|
|
@@ -179,8 +191,8 @@ const getCardsBySortKey = (card, sortKey) => {
|
|
|
179
191
|
}
|
|
180
192
|
case 'cardName':
|
|
181
193
|
return card.cardName.toLowerCase();
|
|
182
|
-
case '
|
|
183
|
-
return
|
|
194
|
+
case 'cardType':
|
|
195
|
+
return card.type.code;
|
|
184
196
|
case 'status':
|
|
185
197
|
return card.status.code;
|
|
186
198
|
case 'utilisation':
|
package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ import { fetchClassList } from '../../../classList/classListReducer';
|
|
|
5
5
|
import { fetchUserListByType } from '../../../userListView/userListViewReducer';
|
|
6
6
|
import { fetchCashbackDetail } from '../cashbackDetail/cashbackDetailReducer';
|
|
7
7
|
import { fetchChargeCardConfig } from '../chargeCardConfig/chargeCardConfigReducer';
|
|
8
|
-
import { fetchChargeCardList, fetchChargeCardListPage, fetchCreditAccount } from './chargeCardListReducer';
|
|
9
|
-
export type ActionType = ReturnType<typeof fetchChargeCardListPage> | ReturnType<typeof fetchCreditAccount> | ReturnType<typeof fetchChargeCardList> | ReturnType<typeof fetchChargeCardConfig> | ReturnType<typeof fetchUserListByType> | ReturnType<typeof fetchCashbackDetail> | ReturnType<typeof fetchClassList>;
|
|
8
|
+
import { fetchChargeCardList, fetchChargeCardListPage, fetchCreditAccount, fetchDebitCardSummary } from './chargeCardListReducer';
|
|
9
|
+
export type ActionType = ReturnType<typeof fetchChargeCardListPage> | ReturnType<typeof fetchCreditAccount> | ReturnType<typeof fetchChargeCardList> | ReturnType<typeof fetchChargeCardConfig> | ReturnType<typeof fetchUserListByType> | ReturnType<typeof fetchCashbackDetail> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchDebitCardSummary>;
|
|
10
10
|
export declare const fetchChargeCardListPageEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -9,13 +9,19 @@ const cashbackDetailReducer_1 = require("../cashbackDetail/cashbackDetailReducer
|
|
|
9
9
|
const chargeCardConfigReducer_1 = require("../chargeCardConfig/chargeCardConfigReducer");
|
|
10
10
|
const chargeCardListReducer_1 = require("./chargeCardListReducer");
|
|
11
11
|
const fetchChargeCardListPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(chargeCardListReducer_1.fetchChargeCardListPage.match), (0, operators_1.mergeMap)((action) => {
|
|
12
|
-
const {
|
|
12
|
+
const { doFetchCreditAccountsDebitSummaryAndCashback, isDebitCardEnabled, isCreditCardEnabled, cacheOverride, } = action.payload;
|
|
13
13
|
const chargeCardListPageAction = [];
|
|
14
14
|
const state = state$.value;
|
|
15
15
|
const cashbackDetailState = state.cashbackDetailState;
|
|
16
16
|
if (cacheOverride === true) {
|
|
17
|
-
if (
|
|
18
|
-
|
|
17
|
+
if (doFetchCreditAccountsDebitSummaryAndCashback === true) {
|
|
18
|
+
if (isCreditCardEnabled) {
|
|
19
|
+
chargeCardListPageAction.push((0, chargeCardListReducer_1.fetchCreditAccount)());
|
|
20
|
+
}
|
|
21
|
+
if (isDebitCardEnabled) {
|
|
22
|
+
chargeCardListPageAction.push((0, chargeCardListReducer_1.fetchDebitCardSummary)());
|
|
23
|
+
}
|
|
24
|
+
chargeCardListPageAction.push((0, cashbackDetailReducer_1.fetchCashbackDetail)());
|
|
19
25
|
}
|
|
20
26
|
chargeCardListPageAction.push((0, chargeCardListReducer_1.fetchChargeCardList)());
|
|
21
27
|
chargeCardListPageAction.push((0, chargeCardConfigReducer_1.fetchChargeCardConfig)());
|
|
@@ -25,12 +31,13 @@ const fetchChargeCardListPageEpic = (actions$, state$) => actions$.pipe((0, oper
|
|
|
25
31
|
}
|
|
26
32
|
else {
|
|
27
33
|
const chargeCardList = state.chargeCardListState;
|
|
28
|
-
if (
|
|
34
|
+
if (doFetchCreditAccountsDebitSummaryAndCashback === true &&
|
|
35
|
+
isCreditCardEnabled &&
|
|
29
36
|
chargeCardList.creditAccount.fetchState !== 'Completed' &&
|
|
30
37
|
chargeCardList.creditAccount.fetchState !== 'In-Progress') {
|
|
31
38
|
chargeCardListPageAction.push((0, chargeCardListReducer_1.fetchCreditAccount)());
|
|
32
39
|
}
|
|
33
|
-
if (
|
|
40
|
+
if (doFetchCreditAccountsDebitSummaryAndCashback &&
|
|
34
41
|
cashbackDetailState.fetchState !== 'In-Progress' &&
|
|
35
42
|
cashbackDetailState.hasValidState() === false) {
|
|
36
43
|
chargeCardListPageAction.push((0, cashbackDetailReducer_1.fetchCashbackDetail)());
|
|
@@ -58,6 +65,14 @@ const fetchChargeCardListPageEpic = (actions$, state$) => actions$.pipe((0, oper
|
|
|
58
65
|
state.classListState.fetchState !== 'In-Progress') {
|
|
59
66
|
chargeCardListPageAction.push((0, classListReducer_1.fetchClassList)());
|
|
60
67
|
}
|
|
68
|
+
if (doFetchCreditAccountsDebitSummaryAndCashback &&
|
|
69
|
+
isDebitCardEnabled &&
|
|
70
|
+
state.chargeCardListState.debitCardSummaries.fetchState !==
|
|
71
|
+
'In-Progress' &&
|
|
72
|
+
state.chargeCardListState.debitCardSummaries.fetchState !==
|
|
73
|
+
'Completed') {
|
|
74
|
+
chargeCardListPageAction.push((0, chargeCardListReducer_1.fetchDebitCardSummary)());
|
|
75
|
+
}
|
|
61
76
|
}
|
|
62
77
|
return (0, rxjs_1.concat)((0, rxjs_1.from)(chargeCardListPageAction));
|
|
63
78
|
}));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
5
|
+
import { fetchDebitCardSummary, updateDebitCardSummary, updateDebitCardSummaryFailure } from './chargeCardListReducer';
|
|
6
|
+
export type ActionType = ReturnType<typeof fetchDebitCardSummary> | ReturnType<typeof updateDebitCardSummary> | ReturnType<typeof updateDebitCardSummaryFailure>;
|
|
7
|
+
export declare const fetchDebitCardSummaryEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchDebitCardSummaryEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
|
+
const chargeCardListReducer_1 = require("./chargeCardListReducer");
|
|
8
|
+
const fetchDebitCardSummaryEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardListReducer_1.fetchDebitCardSummary.match), (0, operators_1.switchMap)(() => {
|
|
9
|
+
return zeniAPI
|
|
10
|
+
.getJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/summaries?query={"card_types": ["debit"]}`)
|
|
11
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
12
|
+
if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
|
|
13
|
+
return (0, rxjs_1.of)((0, chargeCardListReducer_1.updateDebitCardSummary)(response.data.debit_card_summaries));
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return (0, rxjs_1.of)((0, chargeCardListReducer_1.updateDebitCardSummaryFailure)(response.status));
|
|
17
|
+
}
|
|
18
|
+
}), (0, operators_1.catchError)((error) => {
|
|
19
|
+
return (0, rxjs_1.of)((0, chargeCardListReducer_1.updateDebitCardSummaryFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Debit Card Summary REST API call errored out' +
|
|
20
|
+
JSON.stringify(error))));
|
|
21
|
+
}));
|
|
22
|
+
}));
|
|
23
|
+
exports.fetchDebitCardSummaryEpic = fetchDebitCardSummaryEpic;
|
package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewReducer.d.ts
CHANGED
|
@@ -5,9 +5,10 @@ export declare const fetchChargeCardSetupView: import("@reduxjs/toolkit").Action
|
|
|
5
5
|
companyId: string;
|
|
6
6
|
cacheOverride: any;
|
|
7
7
|
refreshViewInBackground: any;
|
|
8
|
-
}, "chargeCardSetupView/fetchChargeCardSetupView", never, never>, fetchChargeCardSetupViewSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chargeCardSetupView/fetchChargeCardSetupViewSuccess">, fetchChargeCardSetupViewFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, "chargeCardSetupView/fetchChargeCardSetupViewFailure", never, never>, acceptChargeCardTerms: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, enableChargeCard: boolean], {
|
|
8
|
+
}, "chargeCardSetupView/fetchChargeCardSetupView", never, never>, fetchChargeCardSetupViewSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chargeCardSetupView/fetchChargeCardSetupViewSuccess">, fetchChargeCardSetupViewFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, "chargeCardSetupView/fetchChargeCardSetupViewFailure", never, never>, acceptChargeCardTerms: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, enableChargeCard: boolean, chargeCardSetupViewType: "charge_cards" | "debit_cards" | "charge_cards__debit_cards"], {
|
|
9
9
|
companyId: string;
|
|
10
10
|
enableChargeCard: boolean;
|
|
11
|
+
chargeCardSetupViewType: "charge_cards" | "debit_cards" | "charge_cards__debit_cards";
|
|
11
12
|
}, "chargeCardSetupView/acceptChargeCardTerms", never, never>, acceptChargeCardTermsSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chargeCardSetupView/acceptChargeCardTermsSuccess">, acceptChargeCardTermsFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, "chargeCardSetupView/acceptChargeCardTermsFailure", never, never>, clearChargeCardSetupView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chargeCardSetupView/clearChargeCardSetupView">;
|
|
12
13
|
declare const _default: import("redux").Reducer<ChargeCardSetupViewState>;
|
|
13
14
|
export default _default;
|
|
@@ -57,8 +57,10 @@ const chargeCardSetupView = (0, toolkit_1.createSlice)({
|
|
|
57
57
|
},
|
|
58
58
|
});
|
|
59
59
|
},
|
|
60
|
-
prepare(companyId, enableChargeCard) {
|
|
61
|
-
return {
|
|
60
|
+
prepare(companyId, enableChargeCard, chargeCardSetupViewType) {
|
|
61
|
+
return {
|
|
62
|
+
payload: { companyId, enableChargeCard, chargeCardSetupViewType },
|
|
63
|
+
};
|
|
62
64
|
},
|
|
63
65
|
},
|
|
64
66
|
acceptChargeCardTermsSuccess(draft) {
|
package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewSelector.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { FetchStateAndError, ID } from '../../../../commonStateTypes/common';
|
|
2
2
|
import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
|
-
import { CompanyChargeCardInfo, CompanyLocaleInfo } from '../../../../entity/company/companyStateTypes';
|
|
3
|
+
import { CompanyChargeCardInfo, CompanyDebitCardInfo, CompanyLocaleInfo } from '../../../../entity/company/companyStateTypes';
|
|
4
4
|
import { RootState } from '../../../../reducer';
|
|
5
5
|
import { BusinessVerificationDetails, CompanyOfficersDetails, SetupView } from '../../commonSetup/setupViewSelector';
|
|
6
6
|
export interface ChargeCardSetupView extends SetupView, SelectorView {
|
|
7
7
|
companyChargeCardInfo?: CompanyChargeCardInfo;
|
|
8
|
+
companyDebitCardInfo?: CompanyDebitCardInfo;
|
|
8
9
|
companyLocaleInfo?: CompanyLocaleInfo;
|
|
9
10
|
chargeCardTermsDetails?: {
|
|
10
11
|
fetchStatus: FetchStateAndError;
|
|
@@ -9,6 +9,7 @@ function getChargeCardSetupViewDetails(state, companyId) {
|
|
|
9
9
|
const chargeCardSetupViewDetails = (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'charge_cards', 'charge_card_setup');
|
|
10
10
|
const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
|
|
11
11
|
const companyChargeCardInfo = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyChargeCardInfo;
|
|
12
|
+
const companyDebitCardInfo = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyDebitCardInfo;
|
|
12
13
|
const companyLocaleInfo = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyLocaleInfo;
|
|
13
14
|
const { chargeCardSetupViewState, setupViewState } = state;
|
|
14
15
|
const { chargeCardTermsDetails, isRefreshingViewInBackground } = chargeCardSetupViewState;
|
|
@@ -18,6 +19,7 @@ function getChargeCardSetupViewDetails(state, companyId) {
|
|
|
18
19
|
const selectedCompanyOfficer = (0, helpers_1.getSelectedCompanyOfficer)(businessVerificationDetails);
|
|
19
20
|
return Object.assign(Object.assign({}, chargeCardSetupViewDetails), { chargeCardTermsDetails,
|
|
20
21
|
companyChargeCardInfo,
|
|
22
|
+
companyDebitCardInfo,
|
|
21
23
|
companyLocaleInfo, version: 1, fetchState,
|
|
22
24
|
error,
|
|
23
25
|
updateStatus,
|
package/lib/view/spendManagement/chargeCards/chargeCardSetUp/epic/acceptChargeCardTermsEpic.js
CHANGED
|
@@ -10,9 +10,26 @@ const userRoleReducer_1 = require("../../../../../entity/userRole/userRoleReduce
|
|
|
10
10
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
11
11
|
const chargeCardSetUpViewReducer_1 = require("../chargeCardSetUpViewReducer");
|
|
12
12
|
const acceptChargeCardTermsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardSetUpViewReducer_1.acceptChargeCardTerms.match), (0, operators_1.mergeMap)((action) => {
|
|
13
|
-
const { companyId, enableChargeCard } = action.payload;
|
|
13
|
+
const { companyId, enableChargeCard, chargeCardSetupViewType } = action.payload;
|
|
14
|
+
let payload;
|
|
15
|
+
switch (chargeCardSetupViewType) {
|
|
16
|
+
case 'charge_cards':
|
|
17
|
+
payload = Object.assign({ is_charge_cards_tos_accepted: true }, (enableChargeCard && { is_charge_cards_enabled: true }));
|
|
18
|
+
break;
|
|
19
|
+
case 'charge_cards__debit_cards':
|
|
20
|
+
payload = Object.assign({ is_charge_cards_tos_accepted: true, is_debit_cards_tos_accepted: true }, (enableChargeCard && {
|
|
21
|
+
is_charge_cards_enabled: true,
|
|
22
|
+
is_debit_cards_enabled: true,
|
|
23
|
+
}));
|
|
24
|
+
break;
|
|
25
|
+
case 'debit_cards':
|
|
26
|
+
payload = Object.assign({ is_debit_cards_tos_accepted: true }, (enableChargeCard && { is_debit_cards_enabled: true }));
|
|
27
|
+
break;
|
|
28
|
+
default:
|
|
29
|
+
payload = {};
|
|
30
|
+
}
|
|
14
31
|
return zeniAPI
|
|
15
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`,
|
|
32
|
+
.putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, payload)
|
|
16
33
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
17
34
|
if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
|
|
18
35
|
const actions = [
|
package/lib/view/spendManagement/chargeCards/issueChargeCard/depositAccountWithLimitPayload.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DepositAccountWithLimitPayload } from '../../../../entity/depositAccount/depositAccountPayload';
|
|
2
|
+
import { ZeniAPIResponse } from '../../../../responsePayload';
|
|
3
|
+
export interface FetchDepositAccountsForCardsPayload {
|
|
4
|
+
deposit_accounts: DepositAccountWithLimitPayload[];
|
|
5
|
+
}
|
|
6
|
+
export type FetchDepositAccountsForCardsResponse = ZeniAPIResponse<FetchDepositAccountsForCardsPayload>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { updateDepositAccountLimitsForChargeCard } from '../../../../entity/depositAccount/depositAccountReducer';
|
|
4
|
+
import { RootState } from '../../../../reducer';
|
|
5
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
|
+
import { fetchDepositAccountListForCards, updateDepositAccountListForCardsFetchStatus, updateDepositAccountsInCards } from './issueChargeCardReducer';
|
|
7
|
+
export type ActionType = ReturnType<typeof fetchDepositAccountListForCards> | ReturnType<typeof updateDepositAccountsInCards> | ReturnType<typeof updateDepositAccountLimitsForChargeCard> | ReturnType<typeof updateDepositAccountListForCardsFetchStatus>;
|
|
8
|
+
export declare const fetchDepositAccountListForCardsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchDepositAccountListForCardsEpic.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchDepositAccountListForCardsEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const depositAccountReducer_1 = require("../../../../entity/depositAccount/depositAccountReducer");
|
|
7
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
|
+
const issueChargeCardReducer_1 = require("./issueChargeCardReducer");
|
|
9
|
+
const fetchDepositAccountListForCardsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(issueChargeCardReducer_1.fetchDepositAccountListForCards.match), (0, operators_1.switchMap)(() => {
|
|
10
|
+
return zeniAPI
|
|
11
|
+
.getJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/deposit-accounts/limits`)
|
|
12
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
13
|
+
var _a, _b, _c, _d;
|
|
14
|
+
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
15
|
+
return (0, rxjs_1.of)((0, issueChargeCardReducer_1.updateDepositAccountsInCards)((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.deposit_accounts) !== null && _b !== void 0 ? _b : []), (0, depositAccountReducer_1.updateDepositAccountLimitsForChargeCard)((_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.deposit_accounts) !== null && _d !== void 0 ? _d : []));
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return (0, rxjs_1.of)((0, issueChargeCardReducer_1.updateDepositAccountListForCardsFetchStatus)({
|
|
19
|
+
fetchState: 'Error',
|
|
20
|
+
error: response.status,
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
}), (0, operators_1.catchError)((error) => {
|
|
24
|
+
return (0, rxjs_1.of)((0, issueChargeCardReducer_1.updateDepositAccountListForCardsFetchStatus)({
|
|
25
|
+
fetchState: 'Error',
|
|
26
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch deposit Accounts For Cards REST API call errored out' +
|
|
27
|
+
JSON.stringify(error)),
|
|
28
|
+
}));
|
|
29
|
+
}));
|
|
30
|
+
}));
|
|
31
|
+
exports.fetchDepositAccountListForCardsEpic = fetchDepositAccountListForCardsEpic;
|
|
@@ -5,6 +5,6 @@ import { fetchClassList } from '../../../classList/classListReducer';
|
|
|
5
5
|
import { fetchUserListByType } from '../../../userListView/userListViewReducer';
|
|
6
6
|
import { fetchChargeCardConfig } from '../chargeCardConfig/chargeCardConfigReducer';
|
|
7
7
|
import { fetchChargeCardList, fetchCreditAccount } from '../chargeCardList/chargeCardListReducer';
|
|
8
|
-
import { fetchIssueCardPage } from './issueChargeCardReducer';
|
|
9
|
-
export type ActionType = ReturnType<typeof fetchIssueCardPage> | ReturnType<typeof fetchChargeCardConfig> | ReturnType<typeof fetchUserListByType> | ReturnType<typeof fetchChargeCardList> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchCreditAccount>;
|
|
8
|
+
import { fetchDepositAccountListForCards, fetchIssueCardPage } from './issueChargeCardReducer';
|
|
9
|
+
export type ActionType = ReturnType<typeof fetchIssueCardPage> | ReturnType<typeof fetchChargeCardConfig> | ReturnType<typeof fetchUserListByType> | ReturnType<typeof fetchDepositAccountListForCards> | ReturnType<typeof fetchChargeCardList> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchCreditAccount>;
|
|
10
10
|
export declare const fetchIssueCardPageEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -9,15 +9,20 @@ const chargeCardConfigReducer_1 = require("../chargeCardConfig/chargeCardConfigR
|
|
|
9
9
|
const chargeCardListReducer_1 = require("../chargeCardList/chargeCardListReducer");
|
|
10
10
|
const issueChargeCardReducer_1 = require("./issueChargeCardReducer");
|
|
11
11
|
const fetchIssueCardPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(issueChargeCardReducer_1.fetchIssueCardPage.match), (0, operators_1.mergeMap)((action) => {
|
|
12
|
-
const { cacheOverride } = action.payload;
|
|
12
|
+
const { cacheOverride, isDebitCardFlagEnabled, isCreditCardFlagEnabled } = action.payload;
|
|
13
13
|
const issueCardPageAction = [];
|
|
14
14
|
const state = state$.value;
|
|
15
15
|
if (cacheOverride === true) {
|
|
16
16
|
issueCardPageAction.push((0, chargeCardConfigReducer_1.fetchChargeCardConfig)());
|
|
17
|
-
|
|
17
|
+
if (isCreditCardFlagEnabled) {
|
|
18
|
+
issueCardPageAction.push((0, chargeCardListReducer_1.fetchCreditAccount)());
|
|
19
|
+
}
|
|
18
20
|
issueCardPageAction.push((0, userListViewReducer_1.fetchUserListByType)('cardHolderCandidate', true));
|
|
19
21
|
issueCardPageAction.push((0, classListReducer_1.fetchClassList)());
|
|
20
22
|
issueCardPageAction.push((0, chargeCardListReducer_1.fetchChargeCardList)());
|
|
23
|
+
if (isDebitCardFlagEnabled) {
|
|
24
|
+
issueCardPageAction.push((0, issueChargeCardReducer_1.fetchDepositAccountListForCards)());
|
|
25
|
+
}
|
|
21
26
|
}
|
|
22
27
|
else {
|
|
23
28
|
const chargeCardConfig = state.chargeCardConfigState;
|
|
@@ -27,7 +32,8 @@ const fetchIssueCardPageEpic = (actions$, state$) => actions$.pipe((0, operators
|
|
|
27
32
|
}
|
|
28
33
|
const chargeCardList = state.chargeCardListState;
|
|
29
34
|
if (chargeCardList.creditAccount.fetchState !== 'Completed' &&
|
|
30
|
-
chargeCardList.creditAccount.fetchState !== 'In-Progress'
|
|
35
|
+
chargeCardList.creditAccount.fetchState !== 'In-Progress' &&
|
|
36
|
+
isCreditCardFlagEnabled) {
|
|
31
37
|
issueCardPageAction.push((0, chargeCardListReducer_1.fetchCreditAccount)());
|
|
32
38
|
}
|
|
33
39
|
const userList = state.userListViewState.userListByType.cardHolderCandidate;
|
|
@@ -43,6 +49,12 @@ const fetchIssueCardPageEpic = (actions$, state$) => actions$.pipe((0, operators
|
|
|
43
49
|
chargeCardList.fetchState !== 'In-Progress') {
|
|
44
50
|
issueCardPageAction.push((0, chargeCardListReducer_1.fetchChargeCardList)());
|
|
45
51
|
}
|
|
52
|
+
const depositAccountsFetchState = state.issueChargeCardState.depositAccountsFetchState;
|
|
53
|
+
if (isDebitCardFlagEnabled &&
|
|
54
|
+
depositAccountsFetchState.fetchState !== 'Completed' &&
|
|
55
|
+
depositAccountsFetchState.fetchState !== 'In-Progress') {
|
|
56
|
+
issueCardPageAction.push((0, issueChargeCardReducer_1.fetchDepositAccountListForCards)());
|
|
57
|
+
}
|
|
46
58
|
}
|
|
47
59
|
return (0, rxjs_1.concat)((0, rxjs_1.from)(issueCardPageAction));
|
|
48
60
|
}));
|
|
@@ -8,6 +8,6 @@ import { updateUserRoles } from '../../../../entity/userRole/userRoleReducer';
|
|
|
8
8
|
import { RootState } from '../../../../reducer';
|
|
9
9
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
10
10
|
import { updateChargeCardList } from '../chargeCardList/chargeCardListReducer';
|
|
11
|
-
import { issueChargeCardSuccessOrFailure, issueChargeCards,
|
|
12
|
-
export type ActionType = ReturnType<typeof issueChargeCards> | ReturnType<typeof updateChargeCards> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateChargeCardList> | ReturnType<typeof
|
|
11
|
+
import { issueChargeCardSuccessOrFailure, issueChargeCards, updateChargeCardCount, updateDebitCardCount } from './issueChargeCardReducer';
|
|
12
|
+
export type ActionType = ReturnType<typeof issueChargeCards> | ReturnType<typeof updateChargeCards> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateChargeCardList> | ReturnType<typeof updateChargeCardCount> | ReturnType<typeof updateDebitCardCount> | ReturnType<typeof issueChargeCardSuccessOrFailure> | ReturnType<typeof updateAddresses>;
|
|
13
13
|
export declare const issueChargeCardEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -15,42 +15,82 @@ const issueChargeCardEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
|
|
|
15
15
|
const state = state$.value;
|
|
16
16
|
const localData = state.issueChargeCardState.localData;
|
|
17
17
|
const payload = localData.map((data) => {
|
|
18
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
19
|
-
if (data.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
18
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
19
|
+
if (data.chargeCardType === 'credit_card') {
|
|
20
|
+
if (data.creditCard.cardType === 'business_physical_credit_card') {
|
|
21
|
+
return {
|
|
22
|
+
card_holder_user_ids: data.creditCard.physicalCard.userId != null
|
|
23
|
+
? [data.creditCard.physicalCard.userId]
|
|
24
|
+
: [],
|
|
25
|
+
card_name: data.creditCard.physicalCard.cardName,
|
|
26
|
+
purchase_limit: (_b = (_a = data.creditCard.physicalCard.amount) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0,
|
|
27
|
+
currency_code: (_d = (_c = data.creditCard.physicalCard.amount) === null || _c === void 0 ? void 0 : _c.currencyCode) !== null && _d !== void 0 ? _d : 'USD',
|
|
28
|
+
purchase_limit_frequency: {
|
|
29
|
+
code: data.creditCard.physicalCard.frequency,
|
|
30
|
+
},
|
|
31
|
+
card_type: data.creditCard.cardType,
|
|
32
|
+
shipping_address_type: data.creditCard.physicalCard.addressType,
|
|
33
|
+
shipping_address_id: data.creditCard.physicalCard.addressId,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
{
|
|
37
|
+
return {
|
|
38
|
+
card_holder_user_ids: data.creditCard.virtualCard.userIds,
|
|
39
|
+
card_name: data.creditCard.virtualCard.cardName,
|
|
40
|
+
purchase_limit: (_f = (_e = data.creditCard.virtualCard.amount) === null || _e === void 0 ? void 0 : _e.amount) !== null && _f !== void 0 ? _f : 0,
|
|
41
|
+
currency_code: (_h = (_g = data.creditCard.virtualCard.amount) === null || _g === void 0 ? void 0 : _g.currencyCode) !== null && _h !== void 0 ? _h : 'USD',
|
|
42
|
+
purchase_limit_frequency: {
|
|
43
|
+
code: data.creditCard.virtualCard.frequency,
|
|
44
|
+
},
|
|
45
|
+
card_type: data.creditCard.cardType,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
32
48
|
}
|
|
33
49
|
else {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
50
|
+
if (data.debitCard.cardType === 'business_physical_debit_card') {
|
|
51
|
+
return {
|
|
52
|
+
card_holder_user_ids: data.debitCard.physicalCard.userId != null
|
|
53
|
+
? [data.debitCard.physicalCard.userId]
|
|
54
|
+
: [],
|
|
55
|
+
card_name: data.debitCard.physicalCard.cardName,
|
|
56
|
+
purchase_limit: (_k = (_j = data.debitCard.physicalCard.amount) === null || _j === void 0 ? void 0 : _j.amount) !== null && _k !== void 0 ? _k : 0,
|
|
57
|
+
currency_code: (_m = (_l = data.debitCard.physicalCard.amount) === null || _l === void 0 ? void 0 : _l.currencyCode) !== null && _m !== void 0 ? _m : 'USD',
|
|
58
|
+
purchase_limit_frequency: {
|
|
59
|
+
code: data.debitCard.physicalCard.frequency,
|
|
60
|
+
},
|
|
61
|
+
card_type: data.debitCard.cardType,
|
|
62
|
+
shipping_address_type: data.debitCard.physicalCard.addressType,
|
|
63
|
+
shipping_address_id: data.debitCard.physicalCard.addressId,
|
|
64
|
+
connected_account_id: data.debitCard.physicalCard.connectedAccountId,
|
|
65
|
+
connected_account_type: 'deposit_account',
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return {
|
|
70
|
+
card_holder_user_ids: data.debitCard.virtualCard.userIds,
|
|
71
|
+
card_name: data.debitCard.virtualCard.cardName,
|
|
72
|
+
purchase_limit: (_p = (_o = data.debitCard.virtualCard.amount) === null || _o === void 0 ? void 0 : _o.amount) !== null && _p !== void 0 ? _p : 0,
|
|
73
|
+
currency_code: (_r = (_q = data.debitCard.virtualCard.amount) === null || _q === void 0 ? void 0 : _q.currencyCode) !== null && _r !== void 0 ? _r : 'USD',
|
|
74
|
+
purchase_limit_frequency: {
|
|
75
|
+
code: data.debitCard.virtualCard.frequency,
|
|
76
|
+
},
|
|
77
|
+
connected_account_id: data.debitCard.virtualCard.connectedAccountId,
|
|
78
|
+
card_type: data.debitCard.cardType,
|
|
79
|
+
connected_account_type: 'deposit_account',
|
|
80
|
+
};
|
|
81
|
+
}
|
|
42
82
|
}
|
|
43
83
|
});
|
|
44
84
|
return zeniAPI
|
|
45
85
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards`, { cards: payload })
|
|
46
86
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
47
|
-
var _a, _b, _c;
|
|
87
|
+
var _a, _b, _c, _d, _e;
|
|
48
88
|
if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
|
|
49
89
|
const actions = [];
|
|
50
90
|
actions.push((0, chargeCardReducer_1.updateChargeCards)(response.data.cards), (0, userReducer_1.updateAllUsers)({ users: response.data.users }), (0, userRoleReducer_1.updateUserRoles)(response.data.user_roles), (0, chargeCardListReducer_1.updateChargeCardList)({
|
|
51
91
|
chargeCardListPayload: response.data,
|
|
52
92
|
keepExistingListItems: true,
|
|
53
|
-
}), (0, addressReducer_1.updateAddresses)(response.data.addresses), (0, issueChargeCardReducer_1.
|
|
93
|
+
}), (0, addressReducer_1.updateAddresses)(response.data.addresses), (0, issueChargeCardReducer_1.updateChargeCardCount)((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.cards_count_by_user_id) !== null && _b !== void 0 ? _b : []), (0, issueChargeCardReducer_1.updateDebitCardCount)((_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.debit_cards_count_by_deposit_account_id) !== null && _d !== void 0 ? _d : {}), (0, issueChargeCardReducer_1.issueChargeCardSuccessOrFailure)({ fetchState: 'Completed' }));
|
|
54
94
|
const cardHolderIds = response.data.cards.map((card) => card.holder_user_id);
|
|
55
95
|
const namesList = response.data.users
|
|
56
96
|
.filter((user) => cardHolderIds.includes(user.user_id))
|
|
@@ -65,7 +105,7 @@ const issueChargeCardEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
|
|
|
65
105
|
variables: [
|
|
66
106
|
{
|
|
67
107
|
variableName: '_user-name_',
|
|
68
|
-
variableValue: (
|
|
108
|
+
variableValue: (_e = namesList[0]) !== null && _e !== void 0 ? _e : '',
|
|
69
109
|
},
|
|
70
110
|
{
|
|
71
111
|
variableName: '_card_',
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { FetchState, ID } from '../../../../commonStateTypes/common';
|
|
2
|
+
import { CardCodeType } from '../../../../entity/chargeCard/chargeCard';
|
|
3
|
+
import { DepositAccountWithLimitPayload } from '../../../../entity/depositAccount/depositAccountPayload';
|
|
2
4
|
import { ZeniAPIStatus } from '../../../../responsePayload';
|
|
3
|
-
import { ActiveChargeCardCountPayload } from '../../../userListView/userListViewPayload';
|
|
5
|
+
import { ActiveChargeCardCountPayload, ActiveDebitCardCountByUserIdPayload } from '../../../userListView/userListViewPayload';
|
|
4
6
|
import { IssueChargeCardLocalData, IssueChargeCardState } from './issueChargeCardState';
|
|
5
7
|
export declare const initialState: IssueChargeCardState;
|
|
6
8
|
export declare const issueChargeCards: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[], {}, "issueChargeCard/issueChargeCards", never, never>, updateChargeCardsLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPayload<IssueChargeCardLocalData[], "issueChargeCard/updateChargeCardsLocalStore">, issueChargeCardSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
@@ -9,8 +11,14 @@ export declare const issueChargeCards: import("@reduxjs/toolkit").ActionCreatorW
|
|
|
9
11
|
}, "issueChargeCard/issueChargeCardSuccessOrFailure">, resetIssueChargeCardForm: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"issueChargeCard/resetIssueChargeCardForm">, updateCustomAddressId: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
10
12
|
addressId: ID;
|
|
11
13
|
cardLineId: ID;
|
|
12
|
-
|
|
14
|
+
cardType: CardCodeType;
|
|
15
|
+
}, "issueChargeCard/updateCustomAddressId">, updateChargeCardCount: import("@reduxjs/toolkit").ActionCreatorWithPayload<ActiveChargeCardCountPayload[], "issueChargeCard/updateChargeCardCount">, updateDebitCardCount: import("@reduxjs/toolkit").ActionCreatorWithPayload<Record<string, ActiveDebitCardCountByUserIdPayload>, "issueChargeCard/updateDebitCardCount">, fetchIssueCardPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[isDebitCardFlagEnabled: boolean, isCreditCardFlagEnabled: boolean, cacheOverride?: any], {
|
|
16
|
+
isDebitCardFlagEnabled: boolean;
|
|
17
|
+
isCreditCardFlagEnabled: boolean;
|
|
13
18
|
cacheOverride: any;
|
|
14
|
-
}, "issueChargeCard/fetchIssueCardPage", never, never>,
|
|
19
|
+
}, "issueChargeCard/fetchIssueCardPage", never, never>, updateDepositAccountsInCards: import("@reduxjs/toolkit").ActionCreatorWithPayload<DepositAccountWithLimitPayload[], "issueChargeCard/updateDepositAccountsInCards">, fetchDepositAccountListForCards: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"issueChargeCard/fetchDepositAccountListForCards">, updateDepositAccountListForCardsFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
20
|
+
fetchState: FetchState;
|
|
21
|
+
error?: ZeniAPIStatus;
|
|
22
|
+
}, "issueChargeCard/updateDepositAccountListForCardsFetchStatus">, clearIssueChargeCard: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"issueChargeCard/clearIssueChargeCard">;
|
|
15
23
|
declare const _default: import("redux").Reducer<IssueChargeCardState>;
|
|
16
24
|
export default _default;
|