@zeniai/client-epic-state 4.14.78 → 4.14.80
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/depositAccountTransaction/depositAccountTransaction.d.ts +1 -0
- package/lib/entity/depositAccountTransaction/depositAccountTransactionPayload.d.ts +1 -0
- package/lib/entity/depositAccountTransaction/depositAccountTransactionPayload.js +1 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -1
- package/lib/entity/tenant/clearAllEpic.js +2 -0
- package/lib/epic.d.ts +3 -1
- package/lib/epic.js +3 -1
- package/lib/index.d.ts +5 -2
- package/lib/index.js +20 -12
- package/lib/init.js +1 -1
- package/lib/reducer.d.ts +3 -0
- package/lib/reducer.js +3 -0
- package/lib/view/bankAccountView/bankAccountViewState.d.ts +1 -1
- package/lib/view/bankAccountView/epic/createBankAccountEpic.d.ts +2 -1
- package/lib/view/bankAccountView/epic/createBankAccountEpic.js +18 -4
- package/lib/view/bankAccountView/epic/createInternationalBankAccountEpic.js +4 -2
- package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.d.ts +2 -1
- package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +49 -24
- package/lib/view/commonVendorView/vendorView/vendorViewPayload.js +2 -2
- package/lib/view/commonVendorView/vendorView/vendorViewReducer.d.ts +5 -2
- package/lib/view/commonVendorView/vendorView/vendorViewReducer.js +30 -3
- package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.d.ts +7 -1
- package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.js +3 -2
- package/lib/view/spendManagement/billPay/internationalWire/epics/createInternationalPaymentInstrumentEpic.js +4 -2
- package/lib/view/spendManagement/zeniAccounts/depositAccountTransactionList/depositAccountTransactionListSelector.js +1 -1
- package/lib/view/spendManagement/zeniAccounts/expressPay/epics/fetchExpressPayInitialDetailsEpic.d.ts +10 -0
- package/lib/view/spendManagement/zeniAccounts/expressPay/epics/fetchExpressPayInitialDetailsEpic.js +46 -0
- package/lib/view/spendManagement/zeniAccounts/expressPay/epics/submitExpressPayEpic.d.ts +8 -0
- package/lib/view/spendManagement/zeniAccounts/expressPay/epics/submitExpressPayEpic.js +67 -0
- package/lib/view/spendManagement/zeniAccounts/expressPay/expressPayReducer.d.ts +15 -0
- package/lib/view/spendManagement/zeniAccounts/expressPay/expressPayReducer.js +61 -0
- package/lib/view/spendManagement/zeniAccounts/expressPay/expressPaySelector.d.ts +27 -0
- package/lib/view/spendManagement/zeniAccounts/expressPay/expressPaySelector.js +85 -0
- package/lib/view/spendManagement/zeniAccounts/expressPay/expressPayState.d.ts +19 -0
- package/lib/view/spendManagement/zeniAccounts/expressPay/expressPayState.js +2 -0
- package/package.json +1 -1
package/lib/init.js
CHANGED
|
@@ -38,7 +38,7 @@ function initialize(restEndPoints, userId, sessionId, tenantId) {
|
|
|
38
38
|
console.info(`initializing with ${JSON.stringify(restEndPoints)}`);
|
|
39
39
|
initialize3rdPartyExtensions();
|
|
40
40
|
exports.zeniAPI = new zeniAPI_1.ZeniAPIClient(restEndPoints, userId, sessionId, tenantId);
|
|
41
|
-
exports.store = (0, configureStore_1.default)(exports.zeniAPI,
|
|
41
|
+
exports.store = (0, configureStore_1.default)(exports.zeniAPI, true);
|
|
42
42
|
return exports.store;
|
|
43
43
|
}
|
|
44
44
|
let isPusherInitialized = false;
|
package/lib/reducer.d.ts
CHANGED
|
@@ -188,6 +188,7 @@ import { VendorTabViewState } from './view/vendorTabView/vendorTabViewState';
|
|
|
188
188
|
import { VendorTypeListState } from './view/vendorTypeList/vendorTypeListState';
|
|
189
189
|
import { ZeniAccStatementListState } from './view/zeniAccStatementList/zeniAccStatementList';
|
|
190
190
|
import { ZeniAccountsPromoCardState } from './view/zeniAccountsPromoCard/zeniAccountsPromoCardState';
|
|
191
|
+
import { ExpressPayState } from './view/spendManagement/zeniAccounts/expressPay/expressPayState';
|
|
191
192
|
type EntitiesState = {
|
|
192
193
|
accountGroupState: AccountGroupState;
|
|
193
194
|
accountingSummaryState: AccountingSummaryState;
|
|
@@ -302,6 +303,7 @@ type ViewsState = {
|
|
|
302
303
|
expenseAutomationMissingReceiptsViewState: ExpenseAutomationMissingReceiptsViewState;
|
|
303
304
|
expenseAutomationTransactionsViewState: ExpenseAutomationTransactionsViewState;
|
|
304
305
|
expenseAutomationViewState: ExpenseAutomationViewState;
|
|
306
|
+
expressPayState: ExpressPayState;
|
|
305
307
|
fileViewState: FileViewState;
|
|
306
308
|
financeStatementState: FinanceStatementState;
|
|
307
309
|
forecastListState: ForecastListState;
|
|
@@ -438,6 +440,7 @@ declare const reducers: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
438
440
|
expenseAutomationMissingReceiptsViewState: ExpenseAutomationMissingReceiptsViewState;
|
|
439
441
|
expenseAutomationTransactionsViewState: ExpenseAutomationTransactionsViewState;
|
|
440
442
|
expenseAutomationViewState: ExpenseAutomationViewState;
|
|
443
|
+
expressPayState: ExpressPayState;
|
|
441
444
|
fileViewState: FileViewState;
|
|
442
445
|
financeStatementState: FinanceStatementState;
|
|
443
446
|
forecastListState: ForecastListState;
|
package/lib/reducer.js
CHANGED
|
@@ -229,6 +229,7 @@ const vendorTabViewReducer_1 = __importStar(require("./view/vendorTabView/vendor
|
|
|
229
229
|
const vendorTypeListReducer_1 = __importStar(require("./view/vendorTypeList/vendorTypeListReducer"));
|
|
230
230
|
const zeniAccStatementListReducer_1 = __importStar(require("./view/zeniAccStatementList/zeniAccStatementListReducer"));
|
|
231
231
|
const zeniAccountsPromoCardReducer_1 = __importStar(require("./view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer"));
|
|
232
|
+
const expressPayReducer_1 = __importStar(require("./view/spendManagement/zeniAccounts/expressPay/expressPayReducer"));
|
|
232
233
|
// Note: Please maintain strict alphabetical order
|
|
233
234
|
const initialEntitiesState = {
|
|
234
235
|
accountGroupState: accountGroupReducer_1.initialState,
|
|
@@ -345,6 +346,7 @@ const initialViewsState = {
|
|
|
345
346
|
expenseAutomationMissingReceiptsViewState: missingReceiptsViewReducer_1.initialState,
|
|
346
347
|
expenseAutomationTransactionsViewState: transactionsViewReducer_1.initialState,
|
|
347
348
|
expenseAutomationViewState: expenseAutomationViewReducer_1.initialState,
|
|
349
|
+
expressPayState: expressPayReducer_1.initialState,
|
|
348
350
|
fileViewState: fileViewState_1.initialFileViewState,
|
|
349
351
|
financeStatementState: financeStatementReducer_1.initialFinanceStatementState,
|
|
350
352
|
forecastListState: forecastListReducer_1.initialState,
|
|
@@ -543,6 +545,7 @@ const viewReducers = {
|
|
|
543
545
|
expenseAutomationMissingReceiptsViewState: missingReceiptsViewReducer_1.default,
|
|
544
546
|
expenseAutomationTransactionsViewState: transactionsViewReducer_1.default,
|
|
545
547
|
expenseAutomationViewState: expenseAutomationViewReducer_1.default,
|
|
548
|
+
expressPayState: expressPayReducer_1.default,
|
|
546
549
|
fileViewState: fileViewReducer_1.default,
|
|
547
550
|
financeStatementState: financeStatementReducer_1.default,
|
|
548
551
|
forecastListState: forecastListReducer_1.default,
|
|
@@ -5,6 +5,7 @@ import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
|
5
5
|
import { RootState } from '../../../reducer';
|
|
6
6
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
7
7
|
import { saveVendor, updateBankAccountsInVendorView } from '../../commonVendorView/vendorView/vendorViewReducer';
|
|
8
|
+
import { updateExpressPayFormLocalData } from '../../spendManagement/zeniAccounts/expressPay/expressPayReducer';
|
|
8
9
|
import { createBankAccount, updateStatusForCreateBankAccountFlow } from '../bankAccountViewReducer';
|
|
9
|
-
export type ActionType = ReturnType<typeof createBankAccount> | ReturnType<typeof updateBankAccounts> | ReturnType<typeof updateBankAccountsInVendorView> | ReturnType<typeof saveVendor> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateStatusForCreateBankAccountFlow>;
|
|
10
|
+
export type ActionType = ReturnType<typeof createBankAccount> | ReturnType<typeof updateBankAccounts> | ReturnType<typeof updateBankAccountsInVendorView> | ReturnType<typeof saveVendor> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateStatusForCreateBankAccountFlow> | ReturnType<typeof updateExpressPayFormLocalData>;
|
|
10
11
|
export declare const createBankAccountEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -6,18 +6,20 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const bankAccountReducer_1 = require("../../../entity/bankAccount/bankAccountReducer");
|
|
7
7
|
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
8
8
|
const responsePayload_1 = require("../../../responsePayload");
|
|
9
|
+
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
9
10
|
const vendorViewReducer_1 = require("../../commonVendorView/vendorView/vendorViewReducer");
|
|
11
|
+
const expressPayReducer_1 = require("../../spendManagement/zeniAccounts/expressPay/expressPayReducer");
|
|
10
12
|
const bankAccountViewPayload_1 = require("../bankAccountViewPayload");
|
|
11
13
|
const bankAccountViewReducer_1 = require("../bankAccountViewReducer");
|
|
12
14
|
const createBankAccountEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(bankAccountViewReducer_1.createBankAccount.match), (0, operators_1.switchMap)((action) => {
|
|
13
|
-
const { bankAccountViewState } = state$.value;
|
|
15
|
+
const { bankAccountViewState, expressPayState } = state$.value;
|
|
14
16
|
const { paymentMethodType, bankAccountContext, vendorId } = action.payload;
|
|
15
17
|
const bankAccountLocalData = bankAccountViewState.createBankAccountDetails.localData;
|
|
16
18
|
if (bankAccountLocalData != null) {
|
|
17
19
|
return zeniAPI
|
|
18
20
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/bank-accounts`, (0, bankAccountViewPayload_1.toBankAccountPayload)(bankAccountLocalData, paymentMethodType))
|
|
19
21
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
20
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
22
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
21
23
|
const bankAccountActions = [];
|
|
22
24
|
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
23
25
|
bankAccountActions.push((0, bankAccountReducer_1.updateBankAccounts)((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.bank_accounts) !== null && _b !== void 0 ? _b : []), (0, bankAccountViewReducer_1.updateStatusForCreateBankAccountFlow)({
|
|
@@ -25,7 +27,8 @@ const createBankAccountEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, o
|
|
|
25
27
|
isInternationalBankAccount: false,
|
|
26
28
|
}));
|
|
27
29
|
if (bankAccountContext === 'vendor' ||
|
|
28
|
-
bankAccountContext === 'billDetail'
|
|
30
|
+
bankAccountContext === 'billDetail' ||
|
|
31
|
+
bankAccountContext === 'express-pay') {
|
|
29
32
|
bankAccountActions.push((0, vendorViewReducer_1.updateBankAccountsInVendorView)({
|
|
30
33
|
bankAccountIds: [
|
|
31
34
|
(_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.bank_accounts[0].bank_account_id) !== null && _d !== void 0 ? _d : '',
|
|
@@ -81,7 +84,8 @@ const createBankAccountEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, o
|
|
|
81
84
|
],
|
|
82
85
|
}));
|
|
83
86
|
if (bankAccountContext === 'vendor' ||
|
|
84
|
-
bankAccountContext === 'billDetail'
|
|
87
|
+
bankAccountContext === 'billDetail' ||
|
|
88
|
+
bankAccountContext === 'express-pay') {
|
|
85
89
|
bankAccountActions.push((0, vendorViewReducer_1.updateBankAccountsInVendorView)({
|
|
86
90
|
bankAccountIds: [
|
|
87
91
|
(_m = (_l = response.data) === null || _l === void 0 ? void 0 : _l.bank_accounts[0].bank_account_id) !== null && _m !== void 0 ? _m : '',
|
|
@@ -92,6 +96,16 @@ const createBankAccountEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, o
|
|
|
92
96
|
// if you are adding bank detail directly from bill page, you have to link it to vendor
|
|
93
97
|
bankAccountActions.push((0, vendorViewReducer_1.saveVendor)(vendorId));
|
|
94
98
|
}
|
|
99
|
+
if (bankAccountContext === 'express-pay') {
|
|
100
|
+
// if bank detail is added from express pay page, it has to be selected by default
|
|
101
|
+
bankAccountActions.push((0, expressPayReducer_1.updateExpressPayFormLocalData)({
|
|
102
|
+
localData: Object.assign(Object.assign({}, expressPayState.formLocalData), { amount: (_p = (_o = expressPayState.formLocalData) === null || _o === void 0 ? void 0 : _o.amount) !== null && _p !== void 0 ? _p : {
|
|
103
|
+
amount: 0,
|
|
104
|
+
currencyCode: 'USD',
|
|
105
|
+
currencySymbol: '$',
|
|
106
|
+
}, paymentDate: (_r = (_q = expressPayState.formLocalData) === null || _q === void 0 ? void 0 : _q.paymentDate) !== null && _r !== void 0 ? _r : (0, zeniDayJS_1.dateNow)(), paymentToAccountId: (_t = (_s = response.data) === null || _s === void 0 ? void 0 : _s.bank_accounts[0].bank_account_id) !== null && _t !== void 0 ? _t : '' }),
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
95
109
|
}
|
|
96
110
|
}
|
|
97
111
|
else {
|
|
@@ -27,7 +27,8 @@ const createInternationalBankAccountEpic = (actions$, state$, zeniAPI) => action
|
|
|
27
27
|
isInternationalBankAccount: true,
|
|
28
28
|
}));
|
|
29
29
|
if (bankAccountContext === 'vendor' ||
|
|
30
|
-
bankAccountContext === 'billDetail'
|
|
30
|
+
bankAccountContext === 'billDetail' ||
|
|
31
|
+
bankAccountContext === 'express-pay') {
|
|
31
32
|
bankAccountActions.push((0, vendorViewReducer_1.updatePaymentInstrumentsInVendorView)({
|
|
32
33
|
paymentInstrumentIds: [
|
|
33
34
|
(_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.payment_instruments[0].zeni_payment_instrument_id) !== null && _d !== void 0 ? _d : '',
|
|
@@ -69,7 +70,8 @@ const createInternationalBankAccountEpic = (actions$, state$, zeniAPI) => action
|
|
|
69
70
|
],
|
|
70
71
|
}));
|
|
71
72
|
if (bankAccountContext === 'vendor' ||
|
|
72
|
-
bankAccountContext === 'billDetail'
|
|
73
|
+
bankAccountContext === 'billDetail' ||
|
|
74
|
+
bankAccountContext === 'express-pay') {
|
|
73
75
|
bankAccountActions.push((0, vendorViewReducer_1.updatePaymentInstrumentsInVendorView)({
|
|
74
76
|
paymentInstrumentIds: [
|
|
75
77
|
(_f = (_e = response.data) === null || _e === void 0 ? void 0 : _e.payment_instruments[0].zeni_payment_instrument_id) !== null && _f !== void 0 ? _f : '',
|
|
@@ -9,6 +9,7 @@ import { RootState } from '../../../../reducer';
|
|
|
9
9
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
10
10
|
import { convertAmountToHomeCurrency, saveBillUpdatesToLocalStore, updateAddBillAutoFields, updateRecommendedVendorId } from '../../../spendManagement/billPay/editBillView/editBillViewReducer';
|
|
11
11
|
import { fetchPreviousBills } from '../../../spendManagement/billPay/previousBills/previousBillsReducer';
|
|
12
|
+
import { updateExpressPayFormLocalData } from '../../../spendManagement/zeniAccounts/expressPay/expressPayReducer';
|
|
12
13
|
import { fetchUserDetails, resetVendorDetailLocalData, saveVendor, saveVendorSuccessOrFailure, updateVendorDetailLocalData } from '../vendorViewReducer';
|
|
13
|
-
export type ActionType = ReturnType<typeof saveVendor> | ReturnType<typeof updateVendors> | ReturnType<typeof updateContacts> | ReturnType<typeof updateBankAccounts> | ReturnType<typeof saveBillUpdatesToLocalStore> | ReturnType<typeof fetchPreviousBills> | ReturnType<typeof openSnackbar> | ReturnType<typeof saveVendorSuccessOrFailure> | ReturnType<typeof resetVendorDetailLocalData> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateVendorDetailLocalData> | ReturnType<typeof fetchUserDetails> | ReturnType<typeof updatePaymentInstruments> | ReturnType<typeof convertAmountToHomeCurrency> | ReturnType<typeof updateRecommendedVendorId> | ReturnType<typeof updateAddBillAutoFields>;
|
|
14
|
+
export type ActionType = ReturnType<typeof saveVendor> | ReturnType<typeof updateVendors> | ReturnType<typeof updateContacts> | ReturnType<typeof updateBankAccounts> | ReturnType<typeof saveBillUpdatesToLocalStore> | ReturnType<typeof fetchPreviousBills> | ReturnType<typeof openSnackbar> | ReturnType<typeof saveVendorSuccessOrFailure> | ReturnType<typeof resetVendorDetailLocalData> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateVendorDetailLocalData> | ReturnType<typeof fetchUserDetails> | ReturnType<typeof updatePaymentInstruments> | ReturnType<typeof convertAmountToHomeCurrency> | ReturnType<typeof updateRecommendedVendorId> | ReturnType<typeof updateAddBillAutoFields> | ReturnType<typeof updateExpressPayFormLocalData>;
|
|
14
15
|
export declare const saveVendorEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
|
|
@@ -21,9 +21,11 @@ const billDetailViewState_1 = require("../../../spendManagement/billPay/billDeta
|
|
|
21
21
|
const editBillViewReducer_1 = require("../../../spendManagement/billPay/editBillView/editBillViewReducer");
|
|
22
22
|
const editBillViewState_1 = require("../../../spendManagement/billPay/editBillView/editBillViewState");
|
|
23
23
|
const previousBillsReducer_1 = require("../../../spendManagement/billPay/previousBills/previousBillsReducer");
|
|
24
|
+
const expressPayReducer_1 = require("../../../spendManagement/zeniAccounts/expressPay/expressPayReducer");
|
|
24
25
|
const commonVendorViewHelper_1 = require("../../commonVendorViewHelper");
|
|
25
26
|
const vendorViewPayload_1 = require("../vendorViewPayload");
|
|
26
27
|
const vendorViewReducer_1 = require("../vendorViewReducer");
|
|
28
|
+
const vendorDetailLocalDataHelpers_1 = require("./vendorDetailLocalDataHelpers");
|
|
27
29
|
const saveVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(vendorViewReducer_1.saveVendor.match), (0, operators_1.mergeMap)((action) => {
|
|
28
30
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
29
31
|
const state = state$.value;
|
|
@@ -35,7 +37,7 @@ const saveVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
|
|
|
35
37
|
const effectiveVendorId = (_c = action.payload.vendorId) !== null && _c !== void 0 ? _c : newlySelectedVendor;
|
|
36
38
|
const payload = (0, vendorViewPayload_1.prepareEditVendorPayload)(state, vendorDetailsUpdated !== null && vendorDetailsUpdated !== void 0 ? vendorDetailsUpdated : vendorViewReducer_1.initialVendorDetailLocalData, effectiveVendorId);
|
|
37
39
|
let billInLocalStore = state.editBillDetailViewState.newBillState;
|
|
38
|
-
const { tenantState, companyState } = state;
|
|
40
|
+
const { tenantState, companyState, expressPayState } = state;
|
|
39
41
|
const { currentTenantId } = tenantState;
|
|
40
42
|
const companyId = currentTenantId != null
|
|
41
43
|
? (_e = (_d = tenantState.tenantsById) === null || _d === void 0 ? void 0 : _d[currentTenantId]) === null || _e === void 0 ? void 0 : _e.companyId
|
|
@@ -45,6 +47,7 @@ const saveVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
|
|
|
45
47
|
const isPayNowEnabled = payNowCutOffTime != null
|
|
46
48
|
? (0, zeniDayJS_1.dateNow)().isSameOrBefore(payNowCutOffTime)
|
|
47
49
|
: false;
|
|
50
|
+
const expressPayLocalData = expressPayState.formLocalData;
|
|
48
51
|
if (action.payload.billId != null) {
|
|
49
52
|
const billDetailKey = (0, billDetailViewState_1.getBillTransactionDetailKey)(action.payload.billId);
|
|
50
53
|
billInLocalStore =
|
|
@@ -57,7 +60,7 @@ const saveVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
|
|
|
57
60
|
: zeniAPI.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/vendors`, payload);
|
|
58
61
|
const userId = (_g = (_f = state.tenantState.loggedInUser) === null || _f === void 0 ? void 0 : _f.userId) !== null && _g !== void 0 ? _g : '';
|
|
59
62
|
return saveVendorApi.pipe((0, operators_1.mergeMap)((response) => {
|
|
60
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
63
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
61
64
|
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
62
65
|
const updatedVendor = ((_a = response.data) === null || _a === void 0 ? void 0 : _a.vendors[0]) != null
|
|
63
66
|
? (0, vendorPayload_1.mapVendorPayloadToVendor)((_b = response.data) === null || _b === void 0 ? void 0 : _b.vendors[0])
|
|
@@ -139,29 +142,33 @@ const saveVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
|
|
|
139
142
|
actions.push((0, editBillViewReducer_1.updateRecommendedVendorId)(updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.id));
|
|
140
143
|
}
|
|
141
144
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
.paymentDetailsSection) === null ||
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
145
|
+
if (action.payload.isExpressPayPage !== true) {
|
|
146
|
+
actions.push((0, editBillViewReducer_1.saveBillUpdatesToLocalStore)({
|
|
147
|
+
billDetailLocalData: {
|
|
148
|
+
showVendorGptRecommendationText,
|
|
149
|
+
vendor: updatedVendor,
|
|
150
|
+
isCancelled: isCancelled,
|
|
151
|
+
updatesByLineId: updatedLines,
|
|
152
|
+
whatForSection: Object.assign(Object.assign({}, billInLocalStore.billDetailLocalData.whatForSection), { currencyCode: updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.vendorCurrencyCode, recipientCurrencyCode: updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.vendorCurrencyCode }),
|
|
153
|
+
paymentDetailsSection: Object.assign(Object.assign({}, billInLocalStore.billDetailLocalData
|
|
154
|
+
.paymentDetailsSection), { paymentTo: undefined, internationalTransferFeeBearerPaymentMethod: updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.preferredInternationalTransferFeeBearerPaymentMethod, paymentDate: (_u = (_t = billInLocalStore.billDetailLocalData
|
|
155
|
+
.paymentDetailsSection) === null || _t === void 0 ? void 0 : _t.paymentDate) !== null && _u !== void 0 ? _u :
|
|
156
|
+
//in case paymentDate is not present in the billDetailLocalData, then today/next working date will be considered.
|
|
157
|
+
//this is done beacuse we are doing similar calcualtion in getDefaultValues of editBillDetailPage.
|
|
158
|
+
(0, zeniDayJS_1.date)((0, workingDayHelper_1.getNextNthWorkingDay)((0, zeniDayJS_1.dateNow)().toDate(), [0, 6], isPayNowEnabled ? 0 : 1).toISOString()) }),
|
|
159
|
+
isCollectToAccountInfoFromVendorContact: false,
|
|
160
|
+
isRecurring: false,
|
|
161
|
+
},
|
|
162
|
+
billId: action.payload.billId,
|
|
163
|
+
}));
|
|
164
|
+
if ((updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.qboId) != null) {
|
|
165
|
+
actions.push((0, previousBillsReducer_1.fetchPreviousBills)(updatedVendor.qboId, false));
|
|
166
|
+
}
|
|
162
167
|
}
|
|
163
168
|
}
|
|
164
|
-
|
|
169
|
+
if (action.payload.isExpressPayPage !== true) {
|
|
170
|
+
actions.push((0, vendorViewReducer_1.resetVendorDetailLocalData)(action.payload.vendorId));
|
|
171
|
+
}
|
|
165
172
|
actions.push((0, vendorViewReducer_1.saveVendorSuccessOrFailure)('Completed', action.payload.vendorId));
|
|
166
173
|
if (action.payload.view === 'vendorsTab') {
|
|
167
174
|
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
@@ -170,10 +177,28 @@ const saveVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
|
|
|
170
177
|
type: 'success',
|
|
171
178
|
}));
|
|
172
179
|
}
|
|
180
|
+
// if a new vendor is created from express pay recipient page, we want the same vendor information to be passed to editVendorState
|
|
181
|
+
// so that further updates in the vendor info on the next pages can be done
|
|
182
|
+
if (action.payload.isExpressPayPage === true &&
|
|
183
|
+
action.payload.vendorId == null &&
|
|
184
|
+
updatedVendor != null) {
|
|
185
|
+
actions.push((0, vendorViewReducer_1.updateVendorDetailLocalData)({
|
|
186
|
+
vendorId: updatedVendor.id,
|
|
187
|
+
localData: (0, vendorDetailLocalDataHelpers_1.getInitializedVendorDetailLocalData)(updatedVendor, state$.value, (_v = response.data) === null || _v === void 0 ? void 0 : _v.vendors[0]),
|
|
188
|
+
}));
|
|
189
|
+
actions.push((0, vendorViewReducer_1.saveVendorSuccessOrFailure)('Completed', updatedVendor.id));
|
|
190
|
+
actions.push((0, expressPayReducer_1.updateExpressPayFormLocalData)({
|
|
191
|
+
localData: Object.assign(Object.assign({}, expressPayLocalData), { vendorId: updatedVendor.id, amount: (_w = expressPayLocalData === null || expressPayLocalData === void 0 ? void 0 : expressPayLocalData.amount) !== null && _w !== void 0 ? _w : {
|
|
192
|
+
amount: 0,
|
|
193
|
+
currencyCode: updatedVendor.vendorCurrencyCode,
|
|
194
|
+
currencySymbol: updatedVendor.vendorCurrencySymbol,
|
|
195
|
+
}, paymentDate: (_x = expressPayLocalData === null || expressPayLocalData === void 0 ? void 0 : expressPayLocalData.paymentDate) !== null && _x !== void 0 ? _x : (0, zeniDayJS_1.dateNow)() }),
|
|
196
|
+
}));
|
|
197
|
+
}
|
|
173
198
|
return (0, rxjs_1.from)(actions);
|
|
174
199
|
}
|
|
175
200
|
else {
|
|
176
|
-
if (((
|
|
201
|
+
if (((_y = response.data) === null || _y === void 0 ? void 0 : _y.error_code) === 1001) {
|
|
177
202
|
return (0, rxjs_1.of)((0, vendorViewReducer_1.saveVendorSuccessOrFailure)('Error', action.payload.vendorId, response.status, true), (0, vendorViewReducer_1.fetchUserDetails)({ userId: userId }));
|
|
178
203
|
}
|
|
179
204
|
return (0, rxjs_1.of)((0, vendorViewReducer_1.saveVendorSuccessOrFailure)('Error', action.payload.vendorId, response.status), (0, snackbarReducer_1.openSnackbar)({
|
|
@@ -8,7 +8,7 @@ const classPayload_1 = require("../../../entity/class/classPayload");
|
|
|
8
8
|
const classSelector_1 = require("../../../entity/class/classSelector");
|
|
9
9
|
const addressViewPayload_1 = require("../../addressView/addressViewPayload");
|
|
10
10
|
const prepareEditVendorPayload = (state, vendorDetailLocalData, vendorId) => {
|
|
11
|
-
var _a, _b;
|
|
11
|
+
var _a, _b, _c;
|
|
12
12
|
const { accountState, classState, addressViewState, vendorState } = state;
|
|
13
13
|
const payload = {};
|
|
14
14
|
if (vendorDetailLocalData != null) {
|
|
@@ -71,7 +71,7 @@ const prepareEditVendorPayload = (state, vendorDetailLocalData, vendorId) => {
|
|
|
71
71
|
payload.bank_account_ids = vendorDetailLocalData.bankAccountIds;
|
|
72
72
|
payload.payment_instrument_ids = vendorDetailLocalData.paymentInstrumentIds;
|
|
73
73
|
}
|
|
74
|
-
const vendorAddressToCreate = (_b = addressViewState.newAddressState) === null || _b === void 0 ? void 0 : _b['vendor_address'].addressToCreate;
|
|
74
|
+
const vendorAddressToCreate = (_c = (_b = addressViewState.newAddressState) === null || _b === void 0 ? void 0 : _b['vendor_address']) === null || _c === void 0 ? void 0 : _c.addressToCreate;
|
|
75
75
|
const vendorAddressPayload = vendorAddressToCreate != null
|
|
76
76
|
? (0, addressViewPayload_1.toAddressUpdatableInfoPayload)(vendorAddressToCreate)
|
|
77
77
|
: undefined;
|
|
@@ -37,10 +37,11 @@ export declare const fetchVendorDetails: import("@reduxjs/toolkit").ActionCreato
|
|
|
37
37
|
countryCode?: string;
|
|
38
38
|
currencyCode?: string;
|
|
39
39
|
vendorId?: ID;
|
|
40
|
-
}, "vendorView/updateCountryCurrencyInVendorView">, saveVendor: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId?: string | undefined, billId?: string | undefined, view?: "vendorsTab" | undefined], {
|
|
40
|
+
}, "vendorView/updateCountryCurrencyInVendorView">, saveVendor: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId?: string | undefined, billId?: string | undefined, view?: "vendorsTab" | undefined, isExpressPayPage?: boolean | undefined], {
|
|
41
41
|
vendorId: string | undefined;
|
|
42
42
|
billId: string | undefined;
|
|
43
43
|
view: "vendorsTab" | undefined;
|
|
44
|
+
isExpressPayPage: boolean | undefined;
|
|
44
45
|
}, "vendorView/saveVendor", never, never>, saveVendorSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[fetchState: FetchState, vendorId?: string | undefined, error?: ZeniAPIStatus<Record<string, unknown>> | undefined, userVerificationFailed?: boolean | undefined], {
|
|
45
46
|
fetchState: FetchState;
|
|
46
47
|
vendorId: string | undefined;
|
|
@@ -54,7 +55,9 @@ export declare const fetchVendorDetails: import("@reduxjs/toolkit").ActionCreato
|
|
|
54
55
|
isCreatable?: boolean;
|
|
55
56
|
}, "vendorView/updateVendorDetailLocalData">, resetVendorDetailLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId?: string | undefined], {
|
|
56
57
|
vendorId: string | undefined;
|
|
57
|
-
}, "vendorView/resetVendorDetailLocalData", never, never>,
|
|
58
|
+
}, "vendorView/resetVendorDetailLocalData", never, never>, resetVendorSaveStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
59
|
+
vendorId?: ID;
|
|
60
|
+
}, "vendorView/resetVendorSaveStatus">, updateContactsInVendorDetailLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
58
61
|
vendorId?: ID;
|
|
59
62
|
contacts: VendorContactInfo[];
|
|
60
63
|
}, "vendorView/updateContactsInVendorDetailLocalData">, fetchVendorDetailPageView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId: string, entity: Entity, cacheOverride?: boolean | undefined], {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.indicateReadyToInitializeBillLocalStore = exports.waitForVendorRecommendationAndUpdatedRecommendationByLineId = exports.updateRecommendationsInVendorDetailLocalData = exports.fetchAndUpdateVendorRecommendations = exports.clearVendorView = exports.verifyUserFailure = exports.verifyUserSuccess = exports.verifyUser = exports.verifyOtpVendorViewFailure = exports.verifyOtpVendorViewSuccess = exports.verifyOtpVendorView = exports.resendOtpVendorView = exports.sendOtpVendorViewFailure = exports.sendOtpVendorViewSuccess = exports.sendOtpVendorView = exports.fetchUserDetailsFailure = exports.fetchUserDetailsSuccess = exports.fetchUserDetails = exports.fetchVendorDetailPageView = exports.updateContactsInVendorDetailLocalData = exports.resetVendorDetailLocalData = exports.updateVendorDetailLocalData = exports.initializeVendorAddress = exports.updateSelectedVendorForCreateFlow = exports.saveVendorSuccessOrFailure = exports.saveVendor = exports.updateCountryCurrencyInVendorView = exports.removePaymentInstrumentsInVendorView = exports.updatePaymentInstrumentsInVendorView = exports.removeBankAccountsInVendorView = exports.updateBankAccountsInVendorView = exports.updateVendorSaveStatus = exports.updateVendorFetchStatus = exports.fetchVendor = exports.fetchVendorDetails = exports.initialState = exports.initialVendorDetailLocalData = void 0;
|
|
4
|
+
exports.indicateReadyToInitializeBillLocalStore = exports.waitForVendorRecommendationAndUpdatedRecommendationByLineId = exports.updateRecommendationsInVendorDetailLocalData = exports.fetchAndUpdateVendorRecommendations = exports.clearVendorView = exports.verifyUserFailure = exports.verifyUserSuccess = exports.verifyUser = exports.verifyOtpVendorViewFailure = exports.verifyOtpVendorViewSuccess = exports.verifyOtpVendorView = exports.resendOtpVendorView = exports.sendOtpVendorViewFailure = exports.sendOtpVendorViewSuccess = exports.sendOtpVendorView = exports.fetchUserDetailsFailure = exports.fetchUserDetailsSuccess = exports.fetchUserDetails = exports.fetchVendorDetailPageView = exports.updateContactsInVendorDetailLocalData = exports.resetVendorSaveStatus = exports.resetVendorDetailLocalData = exports.updateVendorDetailLocalData = exports.initializeVendorAddress = exports.updateSelectedVendorForCreateFlow = exports.saveVendorSuccessOrFailure = exports.saveVendor = exports.updateCountryCurrencyInVendorView = exports.removePaymentInstrumentsInVendorView = exports.updatePaymentInstrumentsInVendorView = exports.removeBankAccountsInVendorView = exports.updateBankAccountsInVendorView = exports.updateVendorSaveStatus = exports.updateVendorFetchStatus = exports.fetchVendor = exports.fetchVendorDetails = exports.initialState = exports.initialVendorDetailLocalData = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
exports.initialVendorDetailLocalData = {
|
|
7
7
|
contacts: [],
|
|
@@ -267,12 +267,13 @@ const vendorView = (0, toolkit_1.createSlice)({
|
|
|
267
267
|
draft.newVendorState.saveStatus.error = undefined;
|
|
268
268
|
}
|
|
269
269
|
},
|
|
270
|
-
prepare(vendorId, billId, view) {
|
|
270
|
+
prepare(vendorId, billId, view, isExpressPayPage) {
|
|
271
271
|
return {
|
|
272
272
|
payload: {
|
|
273
273
|
vendorId,
|
|
274
274
|
billId,
|
|
275
275
|
view,
|
|
276
|
+
isExpressPayPage,
|
|
276
277
|
},
|
|
277
278
|
};
|
|
278
279
|
},
|
|
@@ -348,6 +349,17 @@ const vendorView = (0, toolkit_1.createSlice)({
|
|
|
348
349
|
if (draft.editVendorStateById[vendorId] != null) {
|
|
349
350
|
draft.editVendorStateById[vendorId].vendorDetailLocalData = Object.assign(Object.assign(Object.assign({}, exports.initialVendorDetailLocalData), localData), { contacts: contacts.map((contact) => (Object.assign({}, contact))) });
|
|
350
351
|
}
|
|
352
|
+
else {
|
|
353
|
+
draft.editVendorStateById[vendorId] = {
|
|
354
|
+
vendorDetailLocalData: Object.assign(Object.assign({}, exports.initialVendorDetailLocalData), localData),
|
|
355
|
+
fetchStatus: {
|
|
356
|
+
fetchState: 'Not-Started',
|
|
357
|
+
},
|
|
358
|
+
saveStatus: {
|
|
359
|
+
fetchState: 'Not-Started',
|
|
360
|
+
},
|
|
361
|
+
};
|
|
362
|
+
}
|
|
351
363
|
}
|
|
352
364
|
}
|
|
353
365
|
},
|
|
@@ -373,6 +385,21 @@ const vendorView = (0, toolkit_1.createSlice)({
|
|
|
373
385
|
};
|
|
374
386
|
},
|
|
375
387
|
},
|
|
388
|
+
resetVendorSaveStatus(draft, action) {
|
|
389
|
+
const { vendorId } = action.payload;
|
|
390
|
+
if (vendorId != null && draft.editVendorStateById[vendorId] != null) {
|
|
391
|
+
draft.editVendorStateById[vendorId].saveStatus = {
|
|
392
|
+
fetchState: 'Not-Started',
|
|
393
|
+
error: undefined,
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
draft.newVendorState.saveStatus = {
|
|
398
|
+
fetchState: 'Not-Started',
|
|
399
|
+
error: undefined,
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
},
|
|
376
403
|
fetchVendorDetailPageView: {
|
|
377
404
|
reducer(
|
|
378
405
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -493,5 +520,5 @@ const vendorView = (0, toolkit_1.createSlice)({
|
|
|
493
520
|
},
|
|
494
521
|
},
|
|
495
522
|
});
|
|
496
|
-
_a = vendorView.actions, exports.fetchVendorDetails = _a.fetchVendorDetails, exports.fetchVendor = _a.fetchVendor, exports.updateVendorFetchStatus = _a.updateVendorFetchStatus, exports.updateVendorSaveStatus = _a.updateVendorSaveStatus, exports.updateBankAccountsInVendorView = _a.updateBankAccountsInVendorView, exports.removeBankAccountsInVendorView = _a.removeBankAccountsInVendorView, exports.updatePaymentInstrumentsInVendorView = _a.updatePaymentInstrumentsInVendorView, exports.removePaymentInstrumentsInVendorView = _a.removePaymentInstrumentsInVendorView, exports.updateCountryCurrencyInVendorView = _a.updateCountryCurrencyInVendorView, exports.saveVendor = _a.saveVendor, exports.saveVendorSuccessOrFailure = _a.saveVendorSuccessOrFailure, exports.updateSelectedVendorForCreateFlow = _a.updateSelectedVendorForCreateFlow, exports.initializeVendorAddress = _a.initializeVendorAddress, exports.updateVendorDetailLocalData = _a.updateVendorDetailLocalData, exports.resetVendorDetailLocalData = _a.resetVendorDetailLocalData, exports.updateContactsInVendorDetailLocalData = _a.updateContactsInVendorDetailLocalData, exports.fetchVendorDetailPageView = _a.fetchVendorDetailPageView, exports.fetchUserDetails = _a.fetchUserDetails, exports.fetchUserDetailsSuccess = _a.fetchUserDetailsSuccess, exports.fetchUserDetailsFailure = _a.fetchUserDetailsFailure, exports.sendOtpVendorView = _a.sendOtpVendorView, exports.sendOtpVendorViewSuccess = _a.sendOtpVendorViewSuccess, exports.sendOtpVendorViewFailure = _a.sendOtpVendorViewFailure, exports.resendOtpVendorView = _a.resendOtpVendorView, exports.verifyOtpVendorView = _a.verifyOtpVendorView, exports.verifyOtpVendorViewSuccess = _a.verifyOtpVendorViewSuccess, exports.verifyOtpVendorViewFailure = _a.verifyOtpVendorViewFailure, exports.verifyUser = _a.verifyUser, exports.verifyUserSuccess = _a.verifyUserSuccess, exports.verifyUserFailure = _a.verifyUserFailure, exports.clearVendorView = _a.clearVendorView, exports.fetchAndUpdateVendorRecommendations = _a.fetchAndUpdateVendorRecommendations, exports.updateRecommendationsInVendorDetailLocalData = _a.updateRecommendationsInVendorDetailLocalData, exports.waitForVendorRecommendationAndUpdatedRecommendationByLineId = _a.waitForVendorRecommendationAndUpdatedRecommendationByLineId, exports.indicateReadyToInitializeBillLocalStore = _a.indicateReadyToInitializeBillLocalStore;
|
|
523
|
+
_a = vendorView.actions, exports.fetchVendorDetails = _a.fetchVendorDetails, exports.fetchVendor = _a.fetchVendor, exports.updateVendorFetchStatus = _a.updateVendorFetchStatus, exports.updateVendorSaveStatus = _a.updateVendorSaveStatus, exports.updateBankAccountsInVendorView = _a.updateBankAccountsInVendorView, exports.removeBankAccountsInVendorView = _a.removeBankAccountsInVendorView, exports.updatePaymentInstrumentsInVendorView = _a.updatePaymentInstrumentsInVendorView, exports.removePaymentInstrumentsInVendorView = _a.removePaymentInstrumentsInVendorView, exports.updateCountryCurrencyInVendorView = _a.updateCountryCurrencyInVendorView, exports.saveVendor = _a.saveVendor, exports.saveVendorSuccessOrFailure = _a.saveVendorSuccessOrFailure, exports.updateSelectedVendorForCreateFlow = _a.updateSelectedVendorForCreateFlow, exports.initializeVendorAddress = _a.initializeVendorAddress, exports.updateVendorDetailLocalData = _a.updateVendorDetailLocalData, exports.resetVendorDetailLocalData = _a.resetVendorDetailLocalData, exports.resetVendorSaveStatus = _a.resetVendorSaveStatus, exports.updateContactsInVendorDetailLocalData = _a.updateContactsInVendorDetailLocalData, exports.fetchVendorDetailPageView = _a.fetchVendorDetailPageView, exports.fetchUserDetails = _a.fetchUserDetails, exports.fetchUserDetailsSuccess = _a.fetchUserDetailsSuccess, exports.fetchUserDetailsFailure = _a.fetchUserDetailsFailure, exports.sendOtpVendorView = _a.sendOtpVendorView, exports.sendOtpVendorViewSuccess = _a.sendOtpVendorViewSuccess, exports.sendOtpVendorViewFailure = _a.sendOtpVendorViewFailure, exports.resendOtpVendorView = _a.resendOtpVendorView, exports.verifyOtpVendorView = _a.verifyOtpVendorView, exports.verifyOtpVendorViewSuccess = _a.verifyOtpVendorViewSuccess, exports.verifyOtpVendorViewFailure = _a.verifyOtpVendorViewFailure, exports.verifyUser = _a.verifyUser, exports.verifyUserSuccess = _a.verifyUserSuccess, exports.verifyUserFailure = _a.verifyUserFailure, exports.clearVendorView = _a.clearVendorView, exports.fetchAndUpdateVendorRecommendations = _a.fetchAndUpdateVendorRecommendations, exports.updateRecommendationsInVendorDetailLocalData = _a.updateRecommendationsInVendorDetailLocalData, exports.waitForVendorRecommendationAndUpdatedRecommendationByLineId = _a.waitForVendorRecommendationAndUpdatedRecommendationByLineId, exports.indicateReadyToInitializeBillLocalStore = _a.indicateReadyToInitializeBillLocalStore;
|
|
497
524
|
exports.default = vendorView.reducer;
|
|
@@ -10,12 +10,18 @@ import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
|
10
10
|
import { TransactionWithAccountAndClassLinePayload } from '../../../../../entity/transaction/payloadTypes/transactionLinePayload';
|
|
11
11
|
import { RootState } from '../../../../../reducer';
|
|
12
12
|
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
13
|
-
import { BillPaymentConfigCodeType, BillPaymentSubConfigCodeType } from '../../billPayConfig/billPayConfigState';
|
|
13
|
+
import { BillPayConfig, BillPaymentConfigCodeType, BillPaymentSubConfigCodeType } from '../../billPayConfig/billPayConfigState';
|
|
14
14
|
import { saveBillDetail, saveBillSuccessOrFailure } from '../editBillViewReducer';
|
|
15
15
|
import { EditBillDetail } from '../editBillViewState';
|
|
16
16
|
export type ActionType = ReturnType<typeof saveBillDetail> | ReturnType<typeof updateBillTransaction> | ReturnType<typeof openSnackbar> | ReturnType<typeof saveBillSuccessOrFailure> | ReturnType<typeof updateRecurringBillConfigs> | ReturnType<typeof updateRecurringBills>;
|
|
17
17
|
export declare const saveBillDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
|
|
18
18
|
export declare function prepareSaveBillPayload(accountState: AccountState, billTransactionState: BillTransactionState, paymentAccountState: PaymentAccountState, recurringBillState: RecurringBillState, billDetail: EditBillDetail, billStageCode: BillStageCodeType, isForMarkAsPaid: boolean, isApproverMarkingAsPaid: boolean): Partial<SaveBillPayload>;
|
|
19
|
+
export declare const getBillPaymentMethodTypePayload: (paymentType?: BillPayConfig) => BillPaymentMethodTypePayload;
|
|
20
|
+
interface BillPaymentMethodTypePayload {
|
|
21
|
+
code: BillPaymentConfigCodeType | null;
|
|
22
|
+
name: string;
|
|
23
|
+
sub_code: BillPaymentSubConfigCodeType | null;
|
|
24
|
+
}
|
|
19
25
|
interface SaveBillPayload {
|
|
20
26
|
vendor_id: string;
|
|
21
27
|
vendor_name?: string | null;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.saveBillDetailEpic = void 0;
|
|
6
|
+
exports.getBillPaymentMethodTypePayload = exports.saveBillDetailEpic = void 0;
|
|
7
7
|
exports.prepareSaveBillPayload = prepareSaveBillPayload;
|
|
8
8
|
const get_1 = __importDefault(require("lodash/get"));
|
|
9
9
|
const rxjs_1 = require("rxjs");
|
|
@@ -134,7 +134,7 @@ function prepareSaveBillPayload(accountState, billTransactionState, paymentAccou
|
|
|
134
134
|
to_account_vendor_email: (_9 = billDetail.billDetailLocalData.toAccountVendorEmail) !== null && _9 !== void 0 ? _9 : null,
|
|
135
135
|
is_collect_to_account_info_from_vendor_contact: billDetail.billDetailLocalData.isCollectToAccountInfoFromVendorContact,
|
|
136
136
|
is_cancelled: false,
|
|
137
|
-
bill_payment_method_type: getBillPaymentMethodTypePayload((_10 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _10 === void 0 ? void 0 : _10.paymentType),
|
|
137
|
+
bill_payment_method_type: (0, exports.getBillPaymentMethodTypePayload)((_10 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _10 === void 0 ? void 0 : _10.paymentType),
|
|
138
138
|
international_transfer_fee_bearer_payment_method: ((_12 = (_11 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _11 === void 0 ? void 0 : _11.paymentType) === null || _12 === void 0 ? void 0 : _12.method.includes('international')) === true &&
|
|
139
139
|
((_13 = billDetail.billDetailLocalData.vendor) === null || _13 === void 0 ? void 0 : _13.vendorCurrencyCode) === 'USD'
|
|
140
140
|
? ((_14 = billDetail.billDetailLocalData.paymentDetailsSection
|
|
@@ -240,6 +240,7 @@ const getBillPaymentMethodTypePayload = (paymentType) => {
|
|
|
240
240
|
: null,
|
|
241
241
|
};
|
|
242
242
|
};
|
|
243
|
+
exports.getBillPaymentMethodTypePayload = getBillPaymentMethodTypePayload;
|
|
243
244
|
const getPaymentDate = (billDetailLocalData) => {
|
|
244
245
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
245
246
|
const isPaymentOutsideZeni = (0, helpers_1.isPaymentMethodOutsideZeni)((_b = (_a = billDetailLocalData.paymentDetailsSection) === null || _a === void 0 ? void 0 : _a.paymentType) === null || _b === void 0 ? void 0 : _b.method);
|
|
@@ -24,7 +24,8 @@ const createPaymentInstrumentEpic = (actions$, state$, zeniAPI) => actions$.pipe
|
|
|
24
24
|
fetchState: 'Completed',
|
|
25
25
|
}));
|
|
26
26
|
if (bankAccountContext === 'vendor' ||
|
|
27
|
-
bankAccountContext === 'billDetail'
|
|
27
|
+
bankAccountContext === 'billDetail' ||
|
|
28
|
+
bankAccountContext === 'express-pay') {
|
|
28
29
|
bankAccountActions.push((0, vendorViewReducer_1.updatePaymentInstrumentsInVendorView)({
|
|
29
30
|
paymentInstrumentIds: [
|
|
30
31
|
(_b = response.data.payment_instruments[0]
|
|
@@ -71,7 +72,8 @@ const createPaymentInstrumentEpic = (actions$, state$, zeniAPI) => actions$.pipe
|
|
|
71
72
|
],
|
|
72
73
|
}));
|
|
73
74
|
if (bankAccountContext === 'vendor' ||
|
|
74
|
-
bankAccountContext === 'billDetail'
|
|
75
|
+
bankAccountContext === 'billDetail' ||
|
|
76
|
+
bankAccountContext === 'express-pay') {
|
|
75
77
|
bankAccountActions.push((0, vendorViewReducer_1.updatePaymentInstrumentsInVendorView)({
|
|
76
78
|
paymentInstrumentIds: [
|
|
77
79
|
(_h = (_g = response.data) === null || _g === void 0 ? void 0 : _g.payment_instruments[0].zeni_payment_instrument_id) !== null && _h !== void 0 ? _h : '',
|
|
@@ -12,7 +12,7 @@ const getDepositAccountTransactionList = (state, depositAccountId, transactionsC
|
|
|
12
12
|
const transactionsByDeposit = depositAccountTransactionListState.byDepositId[depositAccountId];
|
|
13
13
|
const transactionIds = (_a = transactionsByDeposit === null || transactionsByDeposit === void 0 ? void 0 : transactionsByDeposit.transactions) !== null && _a !== void 0 ? _a : [];
|
|
14
14
|
const transactionsUnsorted = (0, depositAccountTransactionSelector_1.getDepositAccountTransactionByIds)(depositAccountTransactionState, transactionIds);
|
|
15
|
-
const transactions = (0, orderBy_1.default)(transactionsUnsorted, (value) => value.
|
|
15
|
+
const transactions = (0, orderBy_1.default)(transactionsUnsorted, (value) => value.transactionDate.valueOf(), 'desc');
|
|
16
16
|
return {
|
|
17
17
|
transactions: transactionsCount != null
|
|
18
18
|
? transactions.slice(0, transactionsCount)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../../../reducer';
|
|
4
|
+
import { fetchVendorTypeList } from '../../../../vendorTypeList/vendorTypeListReducer';
|
|
5
|
+
import { fetchBillPayConfig } from '../../../billPay/billPayConfig/billPayConfigReducer';
|
|
6
|
+
import { fetchDepositAccountList } from '../../depositAccountList/depositAccountListReducer';
|
|
7
|
+
import { fetchPaymentAccountList } from '../../paymentAccountList/paymentAccountListReducer';
|
|
8
|
+
import { fetchExpressPayInitialDetails, updateExpressPayFetchState } from '../expressPayReducer';
|
|
9
|
+
export type ActionType = ReturnType<typeof fetchExpressPayInitialDetails> | ReturnType<typeof fetchBillPayConfig> | ReturnType<typeof fetchVendorTypeList> | ReturnType<typeof fetchDepositAccountList> | ReturnType<typeof fetchPaymentAccountList> | ReturnType<typeof updateExpressPayFetchState>;
|
|
10
|
+
export declare const fetchExpressPayInitialDetailsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
package/lib/view/spendManagement/zeniAccounts/expressPay/epics/fetchExpressPayInitialDetailsEpic.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchExpressPayInitialDetailsEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const vendorTypeListReducer_1 = require("../../../../vendorTypeList/vendorTypeListReducer");
|
|
7
|
+
const billPayConfigReducer_1 = require("../../../billPay/billPayConfig/billPayConfigReducer");
|
|
8
|
+
const depositAccountListReducer_1 = require("../../depositAccountList/depositAccountListReducer");
|
|
9
|
+
const paymentAccountListReducer_1 = require("../../paymentAccountList/paymentAccountListReducer");
|
|
10
|
+
const expressPayReducer_1 = require("../expressPayReducer");
|
|
11
|
+
const fetchExpressPayInitialDetailsEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(expressPayReducer_1.fetchExpressPayInitialDetails.match), (0, operators_1.mergeMap)((action) => {
|
|
12
|
+
const { cacheOverride, isInternationalWireEnabled } = action.payload;
|
|
13
|
+
const state = state$.value;
|
|
14
|
+
const fetchActions = [];
|
|
15
|
+
if (cacheOverride === true) {
|
|
16
|
+
fetchActions.push((0, vendorTypeListReducer_1.fetchVendorTypeList)());
|
|
17
|
+
fetchActions.push((0, billPayConfigReducer_1.fetchBillPayConfig)(isInternationalWireEnabled));
|
|
18
|
+
fetchActions.push((0, depositAccountListReducer_1.fetchDepositAccountList)());
|
|
19
|
+
fetchActions.push((0, paymentAccountListReducer_1.fetchPaymentAccountList)());
|
|
20
|
+
fetchActions.push((0, expressPayReducer_1.updateExpressPayFetchState)());
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
if (state.vendorTypeListState.hasValidState() === false &&
|
|
24
|
+
state.vendorTypeListState.fetchState !== 'In-Progress') {
|
|
25
|
+
fetchActions.push((0, vendorTypeListReducer_1.fetchVendorTypeList)());
|
|
26
|
+
}
|
|
27
|
+
const billPayConfigFetchState = state.billPayConfigState.fetchState;
|
|
28
|
+
if (billPayConfigFetchState !== 'Completed' &&
|
|
29
|
+
billPayConfigFetchState !== 'In-Progress') {
|
|
30
|
+
fetchActions.push((0, billPayConfigReducer_1.fetchBillPayConfig)(isInternationalWireEnabled));
|
|
31
|
+
}
|
|
32
|
+
const depositAccounts = state.depositAccountListState;
|
|
33
|
+
if (depositAccounts.fetchState !== 'In-Progress' &&
|
|
34
|
+
depositAccounts.fetchState !== 'Completed') {
|
|
35
|
+
fetchActions.push((0, depositAccountListReducer_1.fetchDepositAccountList)());
|
|
36
|
+
}
|
|
37
|
+
const paymentAccounts = state.paymentAccountListState;
|
|
38
|
+
if (paymentAccounts.fetchState !== 'In-Progress' &&
|
|
39
|
+
paymentAccounts.fetchState !== 'Completed') {
|
|
40
|
+
fetchActions.push((0, paymentAccountListReducer_1.fetchPaymentAccountList)());
|
|
41
|
+
}
|
|
42
|
+
fetchActions.push((0, expressPayReducer_1.updateExpressPayFetchState)());
|
|
43
|
+
}
|
|
44
|
+
return (0, rxjs_1.concat)((0, rxjs_1.from)(fetchActions));
|
|
45
|
+
}));
|
|
46
|
+
exports.fetchExpressPayInitialDetailsEpic = fetchExpressPayInitialDetailsEpic;
|
|
@@ -0,0 +1,8 @@
|
|
|
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 { submitExpressPay, updateExpressPaySubmissionStatus } from '../expressPayReducer';
|
|
7
|
+
export type ActionType = ReturnType<typeof submitExpressPay> | ReturnType<typeof updateExpressPaySubmissionStatus> | ReturnType<typeof openSnackbar>;
|
|
8
|
+
export declare const submitExpressPayEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|