@zeniai/client-epic-state 4.20.0-betaNB1 → 4.20.0
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 +0 -3
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -5
- package/lib/epic.d.ts +1 -7
- package/lib/epic.js +1 -7
- package/lib/esm/commonStateTypes/animations.js +0 -3
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -5
- package/lib/esm/epic.js +1 -7
- package/lib/esm/index.js +0 -2
- package/lib/esm/reducer.js +0 -3
- package/lib/esm/view/spendManagement/treasury/treasuryList/epics/fetchTreasuryDetailEpic.js +2 -2
- package/lib/esm/view/spendManagement/treasury/treasuryList/treasuryDetailReducer.js +1 -2
- package/lib/index.d.ts +2 -6
- package/lib/index.js +1 -13
- package/lib/reducer.d.ts +0 -3
- package/lib/reducer.js +0 -3
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/spendManagement/treasury/treasuryList/epics/fetchTreasuryDetailEpic.js +2 -2
- package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailReducer.d.ts +1 -2
- package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailReducer.js +1 -2
- package/package.json +1 -1
- package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesPayload.js +0 -26
- package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesReducer.js +0 -199
- package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +0 -52
- package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesState.js +0 -1
- package/lib/esm/view/spendManagement/autotransferRules/epics/createAutoTransferRuleEpic.js +0 -91
- package/lib/esm/view/spendManagement/autotransferRules/epics/deleteAutoTransferRuleEpic.js +0 -48
- package/lib/esm/view/spendManagement/autotransferRules/epics/fetchAutoTransferReviewDetailEpic.js +0 -30
- package/lib/esm/view/spendManagement/autotransferRules/epics/fetchAutoTransferRuleHistory.js +0 -45
- package/lib/esm/view/spendManagement/autotransferRules/epics/fetchAutoTransferRulesEpic.js +0 -52
- package/lib/esm/view/spendManagement/autotransferRules/epics/updateAutoTransferRuleEpic.js +0 -69
- package/lib/view/spendManagement/autotransferRules/autoTransferRulesPayload.d.ts +0 -75
- package/lib/view/spendManagement/autotransferRules/autoTransferRulesPayload.js +0 -30
- package/lib/view/spendManagement/autotransferRules/autoTransferRulesReducer.d.ts +0 -50
- package/lib/view/spendManagement/autotransferRules/autoTransferRulesReducer.js +0 -206
- package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.d.ts +0 -24
- package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +0 -61
- package/lib/view/spendManagement/autotransferRules/autoTransferRulesState.d.ts +0 -38
- package/lib/view/spendManagement/autotransferRules/autoTransferRulesState.js +0 -2
- package/lib/view/spendManagement/autotransferRules/epics/createAutoTransferRuleEpic.d.ts +0 -12
- package/lib/view/spendManagement/autotransferRules/epics/createAutoTransferRuleEpic.js +0 -97
- package/lib/view/spendManagement/autotransferRules/epics/deleteAutoTransferRuleEpic.d.ts +0 -8
- package/lib/view/spendManagement/autotransferRules/epics/deleteAutoTransferRuleEpic.js +0 -52
- package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferReviewDetailEpic.d.ts +0 -7
- package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferReviewDetailEpic.js +0 -34
- package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRuleHistory.d.ts +0 -7
- package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRuleHistory.js +0 -52
- package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRulesEpic.d.ts +0 -10
- package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRulesEpic.js +0 -56
- package/lib/view/spendManagement/autotransferRules/epics/updateAutoTransferRuleEpic.d.ts +0 -8
- package/lib/view/spendManagement/autotransferRules/epics/updateAutoTransferRuleEpic.js +0 -73
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.accountTypeSubConfigCodeToAccType = exports.createAutoTransferRuleEpic = void 0;
|
|
4
|
-
exports.mapAutoTransferRuleLocalDataToPayload = mapAutoTransferRuleLocalDataToPayload;
|
|
5
|
-
const rxjs_1 = require("rxjs");
|
|
6
|
-
const operators_1 = require("rxjs/operators");
|
|
7
|
-
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
8
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
9
|
-
const autoTransferRulesPayload_1 = require("../autoTransferRulesPayload");
|
|
10
|
-
const autoTransferRulesReducer_1 = require("../autoTransferRulesReducer");
|
|
11
|
-
const createAutoTransferRuleEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(autoTransferRulesReducer_1.createAutoTransferRule.match), (0, operators_1.switchMap)(() => {
|
|
12
|
-
const requestBody = mapAutoTransferRuleLocalDataToPayload(state$.value.autotransferRulesState.ruleUpdateLocalData);
|
|
13
|
-
return zeniAPI
|
|
14
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/rules/transfer/auto`, requestBody)
|
|
15
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
16
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
17
|
-
const rule = (0, autoTransferRulesPayload_1.mapPayloadToAutoTransferRule)(response.data.auto_transfer_rule);
|
|
18
|
-
const actions = [
|
|
19
|
-
(0, autoTransferRulesReducer_1.createAutoTransferRuleSuccess)({ rule }),
|
|
20
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
21
|
-
messageSection: 'auto_transfer_rule_create',
|
|
22
|
-
messageText: 'success',
|
|
23
|
-
type: 'success',
|
|
24
|
-
}),
|
|
25
|
-
];
|
|
26
|
-
return (0, rxjs_1.from)(actions);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
return (0, rxjs_1.from)([
|
|
30
|
-
(0, autoTransferRulesReducer_1.createAutoTransferRuleFailure)({
|
|
31
|
-
fetchState: 'Error',
|
|
32
|
-
error: response.status,
|
|
33
|
-
}),
|
|
34
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
35
|
-
messageSection: 'auto_transfer_rule_create',
|
|
36
|
-
messageText: 'failed',
|
|
37
|
-
type: 'error',
|
|
38
|
-
variables: [
|
|
39
|
-
{
|
|
40
|
-
variableName: '_api-error_',
|
|
41
|
-
variableValue: response.status.message,
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
}),
|
|
45
|
-
]);
|
|
46
|
-
}
|
|
47
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, autoTransferRulesReducer_1.createAutoTransferRuleFailure)({
|
|
48
|
-
fetchState: 'Error',
|
|
49
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Create auto transfer rule REST API call errored out ' +
|
|
50
|
-
JSON.stringify(error)),
|
|
51
|
-
}))));
|
|
52
|
-
}));
|
|
53
|
-
exports.createAutoTransferRuleEpic = createAutoTransferRuleEpic;
|
|
54
|
-
function mapAutoTransferRuleLocalDataToPayload(localData, pauseRule, resumeRule) {
|
|
55
|
-
if (pauseRule === true) {
|
|
56
|
-
return {
|
|
57
|
-
is_active: false,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
if (resumeRule === true) {
|
|
61
|
-
return {
|
|
62
|
-
is_active: true,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
const payload = {
|
|
66
|
-
amount: localData.amount?.amount,
|
|
67
|
-
currency_code: localData.amount?.currencyCode,
|
|
68
|
-
destination_bank_account_id: localData.destinationAccount?.id,
|
|
69
|
-
destination_bank_account_type: (0, exports.accountTypeSubConfigCodeToAccType)(localData.destinationAccount?.accType),
|
|
70
|
-
destination_bank_account_metadata: localData.destinationAccountWithPercentAllocation?.map((allocation) => ({
|
|
71
|
-
account_id: allocation.account.id,
|
|
72
|
-
account_type: (0, exports.accountTypeSubConfigCodeToAccType)(allocation.account.accType),
|
|
73
|
-
percentage: allocation.percentage,
|
|
74
|
-
})),
|
|
75
|
-
frequency: localData.frequency,
|
|
76
|
-
rule_type: localData.ruleType,
|
|
77
|
-
source_bank_account_id: localData.sourceAccount?.id,
|
|
78
|
-
source_bank_account_type: (0, exports.accountTypeSubConfigCodeToAccType)(localData.sourceAccount?.accType),
|
|
79
|
-
first_transfer_date: localData.firstTransferDate != null
|
|
80
|
-
? localData.firstTransferDate.format('YYYY-MM-DD')
|
|
81
|
-
: undefined,
|
|
82
|
-
};
|
|
83
|
-
return payload;
|
|
84
|
-
}
|
|
85
|
-
const accountTypeSubConfigCodeToAccType = (code) => {
|
|
86
|
-
switch (code) {
|
|
87
|
-
case 'depositAccount':
|
|
88
|
-
return 'deposit_account';
|
|
89
|
-
case 'paymentAccount':
|
|
90
|
-
return 'payment_account';
|
|
91
|
-
case 'treasuryAccount':
|
|
92
|
-
return 'treasury_account';
|
|
93
|
-
default:
|
|
94
|
-
return undefined;
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
exports.accountTypeSubConfigCodeToAccType = accountTypeSubConfigCodeToAccType;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
|
-
import { RootState } from '../../../../reducer';
|
|
5
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
|
-
import { deleteAutoTransferRule, deleteAutoTransferRuleFailure, deleteAutoTransferRuleSuccess } from '../autoTransferRulesReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof deleteAutoTransferRule> | ReturnType<typeof deleteAutoTransferRuleSuccess> | ReturnType<typeof deleteAutoTransferRuleFailure> | ReturnType<typeof openSnackbar>;
|
|
8
|
-
export declare const deleteAutoTransferRuleEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteAutoTransferRuleEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
7
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
|
-
const autoTransferRulesReducer_1 = require("../autoTransferRulesReducer");
|
|
9
|
-
const deleteAutoTransferRuleEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(autoTransferRulesReducer_1.deleteAutoTransferRule.match), (0, operators_1.switchMap)((action) => {
|
|
10
|
-
const { ruleId } = action.payload;
|
|
11
|
-
return zeniAPI
|
|
12
|
-
.deleteAndGetJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/rules/transfer/auto/${ruleId}`)
|
|
13
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
14
|
-
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
15
|
-
const actions = [
|
|
16
|
-
(0, autoTransferRulesReducer_1.deleteAutoTransferRuleSuccess)({ ruleId }),
|
|
17
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
18
|
-
messageSection: 'auto_transfer_rule_delete',
|
|
19
|
-
messageText: 'success',
|
|
20
|
-
type: 'success',
|
|
21
|
-
}),
|
|
22
|
-
];
|
|
23
|
-
return (0, rxjs_1.from)(actions);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
return (0, rxjs_1.from)([
|
|
27
|
-
(0, autoTransferRulesReducer_1.deleteAutoTransferRuleFailure)({
|
|
28
|
-
ruleId,
|
|
29
|
-
fetchState: 'Error',
|
|
30
|
-
error: response.status,
|
|
31
|
-
}),
|
|
32
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
33
|
-
messageSection: 'auto_transfer_rule_delete',
|
|
34
|
-
messageText: 'failed',
|
|
35
|
-
type: 'error',
|
|
36
|
-
variables: [
|
|
37
|
-
{
|
|
38
|
-
variableName: '_api-error_',
|
|
39
|
-
variableValue: response.status.message,
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
}),
|
|
43
|
-
]);
|
|
44
|
-
}
|
|
45
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, autoTransferRulesReducer_1.deleteAutoTransferRuleFailure)({
|
|
46
|
-
ruleId,
|
|
47
|
-
fetchState: 'Error',
|
|
48
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Delete auto transfer rule REST API call errored out ' +
|
|
49
|
-
JSON.stringify(error)),
|
|
50
|
-
}))));
|
|
51
|
-
}));
|
|
52
|
-
exports.deleteAutoTransferRuleEpic = deleteAutoTransferRuleEpic;
|
package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferReviewDetailEpic.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../../../reducer';
|
|
4
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
5
|
-
import { fetchAutoTransferReviewDetail, updateAutoTransferReviewDetail, updateAutoTransferReviewDetailFailure } from '../autoTransferRulesReducer';
|
|
6
|
-
export type ActionType = ReturnType<typeof fetchAutoTransferReviewDetail> | ReturnType<typeof updateAutoTransferReviewDetail> | ReturnType<typeof updateAutoTransferReviewDetailFailure>;
|
|
7
|
-
export declare const fetchAutoTransferReviewDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferReviewDetailEpic.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchAutoTransferReviewDetailEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
|
-
const autoTransferRulesReducer_1 = require("../autoTransferRulesReducer");
|
|
8
|
-
const createAutoTransferRuleEpic_1 = require("./createAutoTransferRuleEpic");
|
|
9
|
-
const fetchAutoTransferReviewDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(autoTransferRulesReducer_1.fetchAutoTransferReviewDetail.match), (0, operators_1.switchMap)(() => {
|
|
10
|
-
const localData = state$.value.autotransferRulesState.ruleUpdateLocalData;
|
|
11
|
-
const payload = {
|
|
12
|
-
from_account: {
|
|
13
|
-
account_id: localData.sourceAccount?.id,
|
|
14
|
-
account_type: (0, createAutoTransferRuleEpic_1.accountTypeSubConfigCodeToAccType)(localData.sourceAccount?.accType) ?? '',
|
|
15
|
-
},
|
|
16
|
-
to_account: {
|
|
17
|
-
account_id: localData.destinationAccount?.id,
|
|
18
|
-
account_type: (0, createAutoTransferRuleEpic_1.accountTypeSubConfigCodeToAccType)(localData.destinationAccount?.accType) ?? '',
|
|
19
|
-
},
|
|
20
|
-
amount: localData.amount?.amount ?? 0,
|
|
21
|
-
currency_code: localData.amount?.currencyCode ?? 'USD',
|
|
22
|
-
currency_symbol: localData.amount?.currencySymbol ?? '$',
|
|
23
|
-
};
|
|
24
|
-
return zeniAPI
|
|
25
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/rules/transfer/auto/review`, payload)
|
|
26
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
27
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
28
|
-
return (0, rxjs_1.of)((0, autoTransferRulesReducer_1.updateAutoTransferReviewDetail)(response.data));
|
|
29
|
-
}
|
|
30
|
-
return (0, rxjs_1.of)((0, autoTransferRulesReducer_1.updateAutoTransferReviewDetailFailure)(response.status));
|
|
31
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, autoTransferRulesReducer_1.updateAutoTransferReviewDetailFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch auto transfer review detail REST API call errored out ' +
|
|
32
|
-
JSON.stringify(error))))));
|
|
33
|
-
}));
|
|
34
|
-
exports.fetchAutoTransferReviewDetailEpic = fetchAutoTransferReviewDetailEpic;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../../../reducer';
|
|
4
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
5
|
-
import { fetchAutoTransferRuleHistory, updateAutoTransferRuleHistory, updateAutoTransferRuleHistoryFetchStatus } from '../autoTransferRulesReducer';
|
|
6
|
-
export type ActionType = ReturnType<typeof fetchAutoTransferRuleHistory> | ReturnType<typeof updateAutoTransferRuleHistory> | ReturnType<typeof updateAutoTransferRuleHistoryFetchStatus>;
|
|
7
|
-
export declare const fetchAutoTransferRuleHistoryEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fetchAutoTransferRuleHistoryEpic = void 0;
|
|
7
|
-
const get_1 = __importDefault(require("lodash/get"));
|
|
8
|
-
const rxjs_1 = require("rxjs");
|
|
9
|
-
const operators_1 = require("rxjs/operators");
|
|
10
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
11
|
-
const autoTransferRulesReducer_1 = require("../autoTransferRulesReducer");
|
|
12
|
-
const fetchAutoTransferRuleHistoryEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(autoTransferRulesReducer_1.fetchAutoTransferRuleHistory.match), (0, operators_1.mergeMap)((action) => {
|
|
13
|
-
const { ruleId, cacheOverride } = action.payload;
|
|
14
|
-
const historyActions = [];
|
|
15
|
-
const state = state$.value;
|
|
16
|
-
const historyDetail = (0, get_1.default)(state.autotransferRulesState.historyByRuleId, ruleId, undefined);
|
|
17
|
-
if (cacheOverride === true ||
|
|
18
|
-
historyDetail == null ||
|
|
19
|
-
historyDetail.fetchState !== 'In-Progress') {
|
|
20
|
-
historyActions.push((0, autoTransferRulesReducer_1.updateAutoTransferRuleHistoryFetchStatus)({
|
|
21
|
-
ruleId,
|
|
22
|
-
fetchState: 'In-Progress',
|
|
23
|
-
}));
|
|
24
|
-
const getHistoryDetail$ = zeniAPI
|
|
25
|
-
.getJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/rules/transfer/auto/${ruleId}/history`)
|
|
26
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
27
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
28
|
-
return (0, rxjs_1.of)((0, autoTransferRulesReducer_1.updateAutoTransferRuleHistory)({
|
|
29
|
-
ruleId,
|
|
30
|
-
historicEventsPayload: response.data.activities,
|
|
31
|
-
}));
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
return (0, rxjs_1.of)((0, autoTransferRulesReducer_1.updateAutoTransferRuleHistoryFetchStatus)({
|
|
35
|
-
ruleId,
|
|
36
|
-
fetchState: 'Error',
|
|
37
|
-
error: response.status,
|
|
38
|
-
}));
|
|
39
|
-
}
|
|
40
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, autoTransferRulesReducer_1.updateAutoTransferRuleHistoryFetchStatus)({
|
|
41
|
-
ruleId,
|
|
42
|
-
fetchState: 'Error',
|
|
43
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch auto transfer rule history REST API call errored out ' +
|
|
44
|
-
JSON.stringify(error)),
|
|
45
|
-
}))));
|
|
46
|
-
return (0, rxjs_1.concat)((0, rxjs_1.from)(historyActions), getHistoryDetail$);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
return (0, rxjs_1.from)(historyActions);
|
|
50
|
-
}
|
|
51
|
-
}));
|
|
52
|
-
exports.fetchAutoTransferRuleHistoryEpic = fetchAutoTransferRuleHistoryEpic;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../../../reducer';
|
|
4
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
5
|
-
import { fetchTreasuryOverviewDetail } from '../../treasury/treasuryList/treasuryDetailReducer';
|
|
6
|
-
import { fetchDepositAccountList } from '../../zeniAccounts/depositAccountList/depositAccountListReducer';
|
|
7
|
-
import { fetchPaymentAccountList } from '../../zeniAccounts/paymentAccountList/paymentAccountListReducer';
|
|
8
|
-
import { fetchAutoTransferRules, updateAutoTransferRules, updateAutoTransferRulesFailure } from '../autoTransferRulesReducer';
|
|
9
|
-
export type ActionType = ReturnType<typeof fetchAutoTransferRules> | ReturnType<typeof updateAutoTransferRules> | ReturnType<typeof updateAutoTransferRulesFailure> | ReturnType<typeof fetchDepositAccountList> | ReturnType<typeof fetchPaymentAccountList> | ReturnType<typeof fetchTreasuryOverviewDetail>;
|
|
10
|
-
export declare const fetchAutoTransferRulesEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchAutoTransferRulesEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
|
-
const treasuryDetailReducer_1 = require("../../treasury/treasuryList/treasuryDetailReducer");
|
|
8
|
-
const depositAccountListReducer_1 = require("../../zeniAccounts/depositAccountList/depositAccountListReducer");
|
|
9
|
-
const paymentAccountListReducer_1 = require("../../zeniAccounts/paymentAccountList/paymentAccountListReducer");
|
|
10
|
-
const autoTransferRulesPayload_1 = require("../autoTransferRulesPayload");
|
|
11
|
-
const autoTransferRulesReducer_1 = require("../autoTransferRulesReducer");
|
|
12
|
-
const fetchAutoTransferRulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(autoTransferRulesReducer_1.fetchAutoTransferRules.match), (0, operators_1.switchMap)((action) => {
|
|
13
|
-
const state = state$.value;
|
|
14
|
-
const { cacheOverride } = action.payload;
|
|
15
|
-
const { autotransferRulesState, depositAccountListState, paymentAccountListState, } = state;
|
|
16
|
-
if (cacheOverride === true ||
|
|
17
|
-
(autotransferRulesState.hasValidState() === false &&
|
|
18
|
-
autotransferRulesState.fetchState !== 'In-Progress')) {
|
|
19
|
-
return zeniAPI
|
|
20
|
-
.getJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/rules/transfer/auto/list`)
|
|
21
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
22
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
23
|
-
const rules = response.data.auto_transfer_rules.map(autoTransferRulesPayload_1.mapPayloadToAutoTransferRule);
|
|
24
|
-
const actions = [
|
|
25
|
-
(0, autoTransferRulesReducer_1.updateAutoTransferRules)({ rules }),
|
|
26
|
-
];
|
|
27
|
-
if (depositAccountListState.fetchState !== 'In-Progress' &&
|
|
28
|
-
depositAccountListState.fetchState !== 'Completed') {
|
|
29
|
-
actions.push((0, depositAccountListReducer_1.fetchDepositAccountList)());
|
|
30
|
-
}
|
|
31
|
-
if (paymentAccountListState.fetchState !== 'In-Progress' &&
|
|
32
|
-
paymentAccountListState.fetchState !== 'Completed') {
|
|
33
|
-
actions.push((0, paymentAccountListReducer_1.fetchPaymentAccountList)());
|
|
34
|
-
}
|
|
35
|
-
actions.push((0, treasuryDetailReducer_1.fetchTreasuryOverviewDetail)(false, true));
|
|
36
|
-
return (0, rxjs_1.from)(actions);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
return (0, rxjs_1.of)((0, autoTransferRulesReducer_1.updateAutoTransferRulesFailure)({
|
|
40
|
-
fetchState: 'Error',
|
|
41
|
-
error: response.status,
|
|
42
|
-
}));
|
|
43
|
-
}
|
|
44
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, autoTransferRulesReducer_1.updateAutoTransferRulesFailure)({
|
|
45
|
-
fetchState: 'Error',
|
|
46
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch auto transfer rules REST API call errored out ' +
|
|
47
|
-
JSON.stringify(error)),
|
|
48
|
-
}))));
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
return (0, rxjs_1.of)((0, autoTransferRulesReducer_1.updateAutoTransferRules)({
|
|
52
|
-
rules: autotransferRulesState.rules,
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
}));
|
|
56
|
-
exports.fetchAutoTransferRulesEpic = fetchAutoTransferRulesEpic;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
|
-
import { RootState } from '../../../../reducer';
|
|
5
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
|
-
import { updateAutoTransferRule, updateAutoTransferRuleFailure, updateAutoTransferRuleSuccess } from '../autoTransferRulesReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof updateAutoTransferRule> | ReturnType<typeof updateAutoTransferRuleSuccess> | ReturnType<typeof updateAutoTransferRuleFailure> | ReturnType<typeof openSnackbar>;
|
|
8
|
-
export declare const updateAutoTransferRuleEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateAutoTransferRuleEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
7
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
|
-
const autoTransferRulesPayload_1 = require("../autoTransferRulesPayload");
|
|
9
|
-
const autoTransferRulesReducer_1 = require("../autoTransferRulesReducer");
|
|
10
|
-
const createAutoTransferRuleEpic_1 = require("./createAutoTransferRuleEpic");
|
|
11
|
-
const updateAutoTransferRuleEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(autoTransferRulesReducer_1.updateAutoTransferRule.match), (0, operators_1.switchMap)((action) => {
|
|
12
|
-
const { ruleId, pauseRule, resumeRule } = action.payload;
|
|
13
|
-
const requestBody = (0, createAutoTransferRuleEpic_1.mapAutoTransferRuleLocalDataToPayload)(state$.value.autotransferRulesState.ruleUpdateLocalData, pauseRule, resumeRule);
|
|
14
|
-
return zeniAPI
|
|
15
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/rules/transfer/auto/${ruleId}`, requestBody)
|
|
16
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
17
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
18
|
-
const rule = (0, autoTransferRulesPayload_1.mapPayloadToAutoTransferRule)(response.data.auto_transfer_rule);
|
|
19
|
-
const isPauseOrResumeOnly = Object.keys(requestBody).length === 1 &&
|
|
20
|
-
'is_active' in requestBody;
|
|
21
|
-
const messageSection = isPauseOrResumeOnly
|
|
22
|
-
? requestBody.is_active === false
|
|
23
|
-
? 'auto_transfer_rule_pause'
|
|
24
|
-
: 'auto_transfer_rule_resume'
|
|
25
|
-
: 'auto_transfer_rule_update';
|
|
26
|
-
const actions = [
|
|
27
|
-
(0, autoTransferRulesReducer_1.updateAutoTransferRuleSuccess)({ rule }),
|
|
28
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
29
|
-
messageSection,
|
|
30
|
-
messageText: 'success',
|
|
31
|
-
type: 'success',
|
|
32
|
-
variables: [
|
|
33
|
-
{
|
|
34
|
-
variableName: '__ruleName__',
|
|
35
|
-
variableValue: rule.ruleType === 'minimum_balance'
|
|
36
|
-
? 'Maintain a Minimum Balance'
|
|
37
|
-
: rule.ruleType === 'recurring'
|
|
38
|
-
? 'Make a Recurring Transfer'
|
|
39
|
-
: 'Distribute Balance by Percentage',
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
}),
|
|
43
|
-
];
|
|
44
|
-
return (0, rxjs_1.from)(actions);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
return (0, rxjs_1.from)([
|
|
48
|
-
(0, autoTransferRulesReducer_1.updateAutoTransferRuleFailure)({
|
|
49
|
-
ruleId,
|
|
50
|
-
fetchState: 'Error',
|
|
51
|
-
error: response.status,
|
|
52
|
-
}),
|
|
53
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
54
|
-
messageSection: 'auto_transfer_rule_update',
|
|
55
|
-
messageText: 'failed',
|
|
56
|
-
type: 'error',
|
|
57
|
-
variables: [
|
|
58
|
-
{
|
|
59
|
-
variableName: '_api-error_',
|
|
60
|
-
variableValue: response.status.message,
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
}),
|
|
64
|
-
]);
|
|
65
|
-
}
|
|
66
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, autoTransferRulesReducer_1.updateAutoTransferRuleFailure)({
|
|
67
|
-
ruleId,
|
|
68
|
-
fetchState: 'Error',
|
|
69
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Update auto transfer rule REST API call errored out ' +
|
|
70
|
-
JSON.stringify(error)),
|
|
71
|
-
}))));
|
|
72
|
-
}));
|
|
73
|
-
exports.updateAutoTransferRuleEpic = updateAutoTransferRuleEpic;
|