@zeniai/client-epic-state 4.7.74 → 4.7.76
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/workingDayHelper.d.ts +9 -5
- package/lib/commonStateTypes/workingDayHelper.js +36 -12
- package/lib/entity/account/accountPayload.d.ts +1 -1
- package/lib/entity/billPay/billTransaction/billTransactionPayload.d.ts +3 -0
- package/lib/entity/billPay/billTransaction/billTransactionPayload.js +2 -2
- package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +3 -0
- package/lib/entity/billPay/recurringBills/recurringBillsPayload.d.ts +34 -0
- package/lib/entity/billPay/recurringBills/recurringBillsPayload.js +44 -0
- package/lib/entity/billPay/recurringBills/recurringBillsReducer.d.ts +6 -0
- package/lib/entity/billPay/recurringBills/recurringBillsReducer.js +40 -0
- package/lib/entity/billPay/recurringBills/recurringBillsState.d.ts +33 -0
- package/lib/entity/billPay/recurringBills/recurringBillsState.js +14 -0
- package/lib/entity/chargeCard/chargeCard.d.ts +3 -2
- package/lib/entity/chargeCard/chargeCardPayload.d.ts +4 -14
- package/lib/entity/chargeCard/chargeCardPayload.js +1 -0
- package/lib/entity/depositAccount/depositAccountPayload.d.ts +2 -5
- package/lib/entity/entityApprovalStatus/entityApprovalStatusPayload.d.ts +1 -0
- package/lib/entity/entityApprovalStatus/entityApprovalStatusPayload.js +1 -0
- package/lib/entity/entityApprovalStatus/entityApprovalStatusState.d.ts +1 -0
- package/lib/entity/paymentAccount/paymentAccountPayload.d.ts +1 -0
- package/lib/entity/paymentAccount/paymentAccountPayload.js +2 -1
- package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +2 -0
- package/lib/entity/paymentAccount/paymentAccountSelector.js +14 -1
- package/lib/entity/paymentAccount/paymentAccountState.d.ts +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 +5 -2
- package/lib/entity/tenant/clearAllEpic.js +6 -0
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.d.ts +2 -2
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +2 -2
- package/lib/entity/transaction/stateTypes/attachment.js +5 -5
- package/lib/epic.d.ts +9 -10
- package/lib/epic.js +9 -10
- package/lib/index.d.ts +26 -14
- package/lib/index.js +37 -22
- package/lib/reducer.d.ts +9 -0
- package/lib/reducer.js +9 -0
- package/lib/view/accountList/accountListReducer.js +2 -1
- package/lib/view/accountList/accountListState.d.ts +1 -1
- package/lib/view/accountList/fetchAccountListEpic.js +16 -7
- package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +1 -0
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/verifyUserEpic.d.ts +2 -2
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/verifyUserEpic.js +2 -2
- package/lib/view/commonVendorView/vendorView/vendorViewReducer.d.ts +4 -9
- package/lib/view/commonVendorView/vendorView/vendorViewReducer.js +41 -70
- package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +2 -2
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +2 -9
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +70 -102
- package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
- package/lib/view/people/deletePersonEpic.d.ts +1 -1
- package/lib/view/people/invitePeopleEpic.d.ts +1 -1
- package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
- package/lib/view/people/resendInviteEpic.d.ts +1 -1
- package/lib/view/settingsView/epic/fetchBankAccountsListEpic.d.ts +22 -0
- package/lib/view/settingsView/epic/fetchBankAccountsListEpic.js +30 -0
- package/lib/view/settingsView/epic/fetchBankConnectionsViewEpic.d.ts +6 -0
- package/lib/view/settingsView/epic/fetchBankConnectionsViewEpic.js +14 -0
- package/lib/view/settingsView/epic/fetchMyProfileEpic.d.ts +43 -0
- package/lib/view/settingsView/epic/fetchMyProfileEpic.js +50 -0
- package/lib/view/settingsView/epic/fetchMyProfileViewEpic.d.ts +7 -0
- package/lib/view/settingsView/epic/fetchMyProfileViewEpic.js +17 -0
- package/lib/view/settingsView/settingsViewPayload.d.ts +8 -0
- package/lib/view/settingsView/settingsViewReducer.d.ts +13 -0
- package/lib/view/settingsView/settingsViewReducer.js +71 -0
- package/lib/view/settingsView/settingsViewSelector.d.ts +14 -0
- package/lib/view/settingsView/settingsViewSelector.js +119 -0
- package/lib/view/settingsView/settingsViewState.d.ts +12 -0
- package/lib/view/settingsView/settingsViewState.js +2 -0
- package/lib/view/settingsView/types/settingsViewSelectorTypes.d.ts +29 -0
- package/lib/view/settingsView/types/settingsViewSelectorTypes.js +2 -0
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewPayload.d.ts +3 -0
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.d.ts +5 -0
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +13 -2
- package/lib/view/spendManagement/billPay/billDetailView/epics/cancelAndDeleteBillEpic.d.ts +2 -1
- package/lib/view/spendManagement/billPay/billDetailView/epics/cancelAndDeleteBillEpic.js +19 -8
- package/lib/view/spendManagement/billPay/billDetailView/epics/deleteBillEpic.d.ts +2 -1
- package/lib/view/spendManagement/billPay/billDetailView/epics/deleteBillEpic.js +14 -4
- package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.d.ts +2 -1
- package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.js +5 -2
- package/lib/view/spendManagement/billPay/billList/billListPayload.d.ts +2 -0
- package/lib/view/spendManagement/billPay/billList/billListSelector.d.ts +3 -0
- package/lib/view/spendManagement/billPay/billList/billListSelector.js +10 -2
- package/lib/view/spendManagement/billPay/billList/fetchBillListPerTabEpic.d.ts +2 -1
- package/lib/view/spendManagement/billPay/billList/fetchBillListPerTabEpic.js +3 -1
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.d.ts +4 -0
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +31 -9
- package/lib/view/spendManagement/billPay/editBillView/editBillViewPayload.d.ts +4 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +17 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +10 -2
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +59 -14
- package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +28 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewState.js +1 -0
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +3 -3
- package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.js +13 -2
- package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +3 -2
- package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.d.ts +11 -24
- package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.js +100 -14
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.d.ts +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +4 -1
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigState.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +1 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.js +4 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +7 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +25 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.d.ts +3 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +6 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateChargeCardDetailEpic.d.ts +11 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateChargeCardDetailEpic.js +60 -0
- package/lib/view/spendManagement/commonHistoryView/commonHistory.d.ts +1 -0
- package/lib/view/spendManagement/commonHistoryView/commonHistoryPayload.d.ts +1 -0
- package/lib/view/spendManagement/commonHistoryView/commonHistoryPayload.js +9 -5
- package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +2 -9
- package/lib/view/spendManagement/commonSetup/setupViewReducer.js +72 -104
- package/lib/view/spendManagement/helpers.d.ts +11 -1
- package/lib/view/spendManagement/helpers.js +134 -1
- package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.d.ts +1 -0
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigPayload.d.ts +1 -0
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigPayload.js +1 -0
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigReducer.js +3 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigSelector.d.ts +1 -0
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigSelector.js +2 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigState.d.ts +1 -0
- package/lib/view/twoFactorAuthentication/resendOtpEpic.d.ts +10 -0
- package/lib/view/twoFactorAuthentication/resendOtpEpic.js +90 -0
- package/lib/view/twoFactorAuthentication/sendOtpEpic.d.ts +10 -0
- package/lib/view/twoFactorAuthentication/sendOtpEpic.js +93 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthentication.d.ts +16 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthentication.js +2 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.d.ts +19 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.js +11 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.d.ts +21 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.js +101 -0
- package/lib/view/twoFactorAuthentication/verifyOtpEpic.d.ts +10 -0
- package/lib/view/twoFactorAuthentication/verifyOtpEpic.js +90 -0
- package/package.json +5 -4
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewResendOtpEpic.d.ts +0 -7
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewResendOtpEpic.js +0 -24
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewSendOtpEpic.d.ts +0 -7
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewSendOtpEpic.js +0 -26
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewVerifyOtpEpic.d.ts +0 -7
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewVerifyOtpEpic.js +0 -28
- package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/resendOnboardingOfficerOtpEpic.d.ts +0 -7
- package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/resendOnboardingOfficerOtpEpic.js +0 -24
- package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/sendOnboardingOfficerOtpEpic.d.ts +0 -7
- package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/sendOnboardingOfficerOtpEpic.js +0 -27
- package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/verifyOnboardingOfficerOtpEpic.d.ts +0 -7
- package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/verifyOnboardingOfficerOtpEpic.js +0 -30
- package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/resendOtpEpic.d.ts +0 -7
- package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/resendOtpEpic.js +0 -23
- package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/sendOtpEpic.d.ts +0 -7
- package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/sendOtpEpic.js +0 -26
- package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/verifyOtpEpic.d.ts +0 -7
- package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/verifyOtpEpic.js +0 -27
- package/lib/view/spendManagement/commonSetup/types/twoFactorAuthentication.d.ts +0 -10
- /package/lib/view/{spendManagement/commonSetup/types/twoFactorAuthentication.js → settingsView/settingsViewPayload.js} +0 -0
|
@@ -118,7 +118,7 @@ const parseInvoiceToBillEpic = (actions$, state$) => actions$.pipe((0, operators
|
|
|
118
118
|
}));
|
|
119
119
|
exports.parseInvoiceToBillEpic = parseInvoiceToBillEpic;
|
|
120
120
|
const toBillDetailLocalData = (state, billPayload, vendor, recommendedVendorId) => {
|
|
121
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
121
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
122
122
|
const currency = {
|
|
123
123
|
currencyCode: (_a = billPayload.currency_code) !== null && _a !== void 0 ? _a : '',
|
|
124
124
|
currencySymbol: (_b = billPayload.currency_symbol) !== null && _b !== void 0 ? _b : '', //api not returning symbol
|
|
@@ -147,7 +147,7 @@ const toBillDetailLocalData = (state, billPayload, vendor, recommendedVendorId)
|
|
|
147
147
|
const lineState = (0, transactionLinePayload_1.toTransactionWithAccountAndClassLine)(line, currency);
|
|
148
148
|
const { accountListState, accountState, classListState, classState } = state;
|
|
149
149
|
const classList = (0, classListSelector_1.getClassList)(classState, classListState);
|
|
150
|
-
const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, '
|
|
150
|
+
const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'billPayAccountList');
|
|
151
151
|
const lineWithRecommendations = (0, initializeBillToLocalStoreEpic_1.getLineRecommendationsLocalData)(line.line_id, lineState, recommendations, accountList, classList, vendor);
|
|
152
152
|
linesById[line.line_id] = Object.assign(Object.assign({}, lineWithRecommendations), { account: ((_b = lineWithRecommendations.account) === null || _b === void 0 ? void 0 : _b.accountId) === '' &&
|
|
153
153
|
vendorCategory != null
|
|
@@ -212,6 +212,7 @@ const toBillDetailLocalData = (state, billPayload, vendor, recommendedVendorId)
|
|
|
212
212
|
isCancelled: false,
|
|
213
213
|
toAccountVendorEmail: (_t = (_s = billPayload.bill_pay_info) === null || _s === void 0 ? void 0 : _s.to_account_vendor_email) !== null && _t !== void 0 ? _t : undefined,
|
|
214
214
|
isCollectToAccountInfoFromVendorContact: (_v = (_u = billPayload.bill_pay_info) === null || _u === void 0 ? void 0 : _u.is_collect_to_account_info_from_vendor_contact) !== null && _v !== void 0 ? _v : false,
|
|
215
|
+
isRecurring: (_w = billPayload.is_recurring) !== null && _w !== void 0 ? _w : false,
|
|
215
216
|
};
|
|
216
217
|
};
|
|
217
218
|
exports.toBillDetailLocalData = toBillDetailLocalData;
|
|
@@ -3,28 +3,15 @@ import { ZeniAPI } from '../../../../../zeniAPI';
|
|
|
3
3
|
import { RootState } from '../../../../../reducer';
|
|
4
4
|
import { saveBillDetail, saveBillSuccessOrFailure } from '../editBillViewReducer';
|
|
5
5
|
import { updateBillTransaction } from '../../../../../entity/billPay/billTransaction/billTransactionReducer';
|
|
6
|
+
import { RecurringBillInstance } from '../editBillViewState';
|
|
7
|
+
import { updateRecurringBillConfigs, updateRecurringBills } from '../../../../../entity/billPay/recurringBills/recurringBillsReducer';
|
|
6
8
|
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
7
|
-
export declare type ActionType = ReturnType<typeof saveBillDetail> | ReturnType<typeof updateBillTransaction> | ReturnType<typeof openSnackbar> | ReturnType<typeof saveBillSuccessOrFailure>;
|
|
8
|
-
export declare const saveBillDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
showStatusIcon?: boolean | undefined;
|
|
17
|
-
variables?: {
|
|
18
|
-
variableName: string;
|
|
19
|
-
variableValue: string;
|
|
20
|
-
}[] | undefined;
|
|
21
|
-
};
|
|
22
|
-
type: string;
|
|
23
|
-
} | {
|
|
24
|
-
payload: {
|
|
25
|
-
fetchState: import("../../../../..").FetchState;
|
|
26
|
-
billId: string | undefined;
|
|
27
|
-
error: import("../../../../../responsePayload").ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
28
|
-
};
|
|
29
|
-
type: string;
|
|
30
|
-
}>;
|
|
9
|
+
export declare type ActionType = ReturnType<typeof saveBillDetail> | ReturnType<typeof updateBillTransaction> | ReturnType<typeof openSnackbar> | ReturnType<typeof saveBillSuccessOrFailure> | ReturnType<typeof updateRecurringBillConfigs> | ReturnType<typeof updateRecurringBills>;
|
|
10
|
+
export declare const saveBillDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
|
|
11
|
+
export interface RecurringBillInstancePayload {
|
|
12
|
+
instance: number;
|
|
13
|
+
payment_date: string;
|
|
14
|
+
vendor_receive_date: string;
|
|
15
|
+
vendor_receive_date_notes: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const toRecurringBillInstancePayload: (recurringBillInstance: RecurringBillInstance, maxPaymentProcessingDays: number) => RecurringBillInstancePayload;
|
|
@@ -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.toRecurringBillInstancePayload = exports.saveBillDetailEpic = void 0;
|
|
7
7
|
const rxjs_1 = require("rxjs");
|
|
8
8
|
const operators_1 = require("rxjs/operators");
|
|
9
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
@@ -15,11 +15,15 @@ const editBillViewPayload_1 = require("../editBillViewPayload");
|
|
|
15
15
|
const transactionLinePayload_1 = require("../../../../../entity/transaction/payloadTypes/transactionLinePayload");
|
|
16
16
|
const accountSelector_1 = require("../../../../../entity/account/accountSelector");
|
|
17
17
|
const paymentAccountSelector_1 = require("../../../../../entity/paymentAccount/paymentAccountSelector");
|
|
18
|
+
const recurringBillsReducer_1 = require("../../../../../entity/billPay/recurringBills/recurringBillsReducer");
|
|
18
19
|
const billDetailViewState_1 = require("../../billDetailView/billDetailViewState");
|
|
19
20
|
const billPayConfigState_1 = require("../../billPayConfig/billPayConfigState");
|
|
20
21
|
const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
|
|
21
22
|
const billPayConfigPayload_1 = require("../../billPayConfig/billPayConfigPayload");
|
|
22
23
|
const vendorSelector_1 = require("../../../../../entity/vendor/vendorSelector");
|
|
24
|
+
const recurringBillsPayload_1 = require("../../../../../entity/billPay/recurringBills/recurringBillsPayload");
|
|
25
|
+
const workingDayHelper_1 = require("../../../../../commonStateTypes/workingDayHelper");
|
|
26
|
+
const helpers_1 = require("../../../helpers");
|
|
23
27
|
const saveBillDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(editBillViewReducer_1.saveBillDetail.match), (0, operators_1.mergeMap)((action) => {
|
|
24
28
|
const state = state$.value;
|
|
25
29
|
const { billStageCode, billId, isLocalCurrencyEnabled, isVendorRecommendationEnabled, } = action.payload;
|
|
@@ -27,21 +31,30 @@ const saveBillDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, oper
|
|
|
27
31
|
const billDetail = billId != null
|
|
28
32
|
? state.editBillDetailViewState.editBillStateById[key]
|
|
29
33
|
: state.editBillDetailViewState.newBillState;
|
|
30
|
-
const payload = prepareSaveBillPayload(state.accountState, state.billTransactionState, state.paymentAccountState, state.setupViewState, state.vendorState, billDetail, billStageCode, isVendorRecommendationEnabled, isLocalCurrencyEnabled);
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const payload = prepareSaveBillPayload(state.accountState, state.billTransactionState, state.paymentAccountState, state.setupViewState, state.vendorState, state.recurringBillState, billDetail, billStageCode, isVendorRecommendationEnabled, isLocalCurrencyEnabled);
|
|
35
|
+
const isRecurringBill = billDetail.billDetailLocalData.isRecurring;
|
|
36
|
+
const saveBillBaseURL = `${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/bills/transactions`;
|
|
37
|
+
const saveBillApi = billId != null
|
|
38
|
+
? zeniAPI.putAndGetJSON(getSaveBillApiURL(saveBillBaseURL, isRecurringBill, billId), payload)
|
|
39
|
+
: zeniAPI.postAndGetJSON(getSaveBillApiURL(saveBillBaseURL, isRecurringBill), payload);
|
|
40
|
+
return saveBillApi.pipe((0, operators_1.mergeMap)((response) => {
|
|
41
|
+
var _a, _b, _c, _d;
|
|
36
42
|
if ((0, responsePayload_1.isSuccessResponse)(response) &&
|
|
37
43
|
((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.transactions[0]) === null || _b === void 0 ? void 0 : _b.transaction_id) != null) {
|
|
38
|
-
|
|
44
|
+
const actions = [
|
|
45
|
+
(0, billTransactionReducer_1.updateBillTransaction)(response.data.transactions[0]),
|
|
46
|
+
];
|
|
47
|
+
if (isRecurringBill) {
|
|
48
|
+
actions.push((0, recurringBillsReducer_1.updateRecurringBillConfigs)((_c = response.data.recurring_bill_configs) !== null && _c !== void 0 ? _c : []), (0, recurringBillsReducer_1.updateRecurringBills)((_d = response.data.recurring_bill_instances) !== null && _d !== void 0 ? _d : []));
|
|
49
|
+
}
|
|
50
|
+
actions.push((0, editBillViewReducer_1.saveBillSuccessOrFailure)('Completed', action.payload.billId), (0, snackbarReducer_1.openSnackbar)({
|
|
39
51
|
messageSection: billStageCode === 'pending_approval'
|
|
40
52
|
? 'bill_pay_sent_for_approval'
|
|
41
53
|
: 'bill_pay_updated',
|
|
42
54
|
messageText: 'success',
|
|
43
55
|
type: 'success',
|
|
44
56
|
}));
|
|
57
|
+
return (0, rxjs_1.from)(actions);
|
|
45
58
|
}
|
|
46
59
|
else {
|
|
47
60
|
return (0, rxjs_1.of)((0, editBillViewReducer_1.saveBillSuccessOrFailure)('Error', action.payload.billId, response.status), (0, snackbarReducer_1.openSnackbar)({
|
|
@@ -59,9 +72,20 @@ const saveBillDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, oper
|
|
|
59
72
|
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, editBillViewReducer_1.saveBillSuccessOrFailure)('Error', action.payload.billId, (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `REST API call errored out ${JSON.stringify(error)}`)))));
|
|
60
73
|
}));
|
|
61
74
|
exports.saveBillDetailEpic = saveBillDetailEpic;
|
|
62
|
-
|
|
63
|
-
|
|
75
|
+
const getSaveBillApiURL = (saveBillBaseURL, isRecurring, billId) => {
|
|
76
|
+
if (billId != null) {
|
|
77
|
+
return isRecurring
|
|
78
|
+
? `${saveBillBaseURL}/${billId}/recurring`
|
|
79
|
+
: `${saveBillBaseURL}/${billId}`;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
return isRecurring ? `${saveBillBaseURL}/recurring` : `${saveBillBaseURL}`;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
function prepareSaveBillPayload(accountState, billTransactionState, paymentAccountState, setupViewState, vendorState, recurringBillState, billDetail, billStageCode, isVendorRecommendationEnabled, isLocalCurrencyEnabled) {
|
|
86
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21;
|
|
64
87
|
const billId = billDetail.billId;
|
|
88
|
+
let detail;
|
|
65
89
|
const withdrawFromList = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, setupViewState.accountDetails.paymentAccountIds);
|
|
66
90
|
const withdrawFromAccount = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, (_c = (_b = (_a = billDetail.billDetailLocalData.paymentDetailsSection) === null || _a === void 0 ? void 0 : _a.withdrawFrom) !== null && _b !== void 0 ? _b : withdrawFromList === null || withdrawFromList === void 0 ? void 0 : withdrawFromList[0].paymentAccountId) !== null && _c !== void 0 ? _c : '');
|
|
67
91
|
const recommendedVendor = billDetail.billDetailLocalData.recommendedVendorId != null
|
|
@@ -70,6 +94,7 @@ function prepareSaveBillPayload(accountState, billTransactionState, paymentAccou
|
|
|
70
94
|
const isRecommendedVendor = isVendorRecommendationEnabled &&
|
|
71
95
|
recommendedVendor != null &&
|
|
72
96
|
billDetail.addBillAutoFields.tentativeVendorName != null;
|
|
97
|
+
const isRecurring = Boolean(billDetail.billDetailLocalData.isRecurring) === true;
|
|
73
98
|
const payload = {
|
|
74
99
|
vendor_id: isRecommendedVendor
|
|
75
100
|
? recommendedVendor.qboId
|
|
@@ -130,20 +155,71 @@ function prepareSaveBillPayload(accountState, billTransactionState, paymentAccou
|
|
|
130
155
|
return (0, transactionLinePayload_1.toAccountAndClassLinePayload)(lineAsTransactionLinePayload);
|
|
131
156
|
}),
|
|
132
157
|
};
|
|
158
|
+
if (!isRecurring) {
|
|
159
|
+
payload.vendor_name = (_15 = (_14 = billDetail.billDetailLocalData.vendor) === null || _14 === void 0 ? void 0 : _14.name) !== null && _15 !== void 0 ? _15 : '';
|
|
160
|
+
}
|
|
133
161
|
if (billId != null) {
|
|
134
|
-
|
|
135
|
-
payload.sync_token = (
|
|
136
|
-
payload.update_time = (
|
|
162
|
+
detail = (0, get_1.default)(billTransactionState.transactionById, billId, undefined);
|
|
163
|
+
payload.sync_token = (_16 = detail === null || detail === void 0 ? void 0 : detail.syncToken) !== null && _16 !== void 0 ? _16 : null;
|
|
164
|
+
payload.update_time = (_17 = detail === null || detail === void 0 ? void 0 : detail.updateTime.format('YYYY-MM-DD')) !== null && _17 !== void 0 ? _17 : null;
|
|
137
165
|
}
|
|
138
166
|
else {
|
|
139
167
|
payload.are_approvals_serialized = true;
|
|
140
168
|
}
|
|
141
169
|
if (billStageCode === 'pending_approval' &&
|
|
142
|
-
((
|
|
170
|
+
((_18 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _18 === void 0 ? void 0 : _18.conversionRate) != null) {
|
|
143
171
|
// required by platform
|
|
144
172
|
payload.exchange_rate =
|
|
145
173
|
1 / billDetail.billDetailLocalData.paymentDetailsSection.conversionRate;
|
|
146
174
|
}
|
|
175
|
+
if (Boolean(billDetail.billDetailLocalData.isRecurring) === true) {
|
|
176
|
+
payload.is_recurring = true;
|
|
177
|
+
const recurringConfig = billDetail.billDetailLocalData.recurringConfig;
|
|
178
|
+
const recurringBillInstances = billDetail.billDetailLocalData.recurringBillInstances;
|
|
179
|
+
if (recurringConfig != null) {
|
|
180
|
+
payload.recurring_bill_config = (0, recurringBillsPayload_1.toRecurringConfigPayload)(recurringConfig);
|
|
181
|
+
}
|
|
182
|
+
if ((recurringConfig === null || recurringConfig === void 0 ? void 0 : recurringConfig.id) != null) {
|
|
183
|
+
const originalRecurringDetail = (0, get_1.default)(recurringBillState.recurringBillDetailByConfigId, recurringConfig.id);
|
|
184
|
+
const isConfigChangedForExistingBill = (0, helpers_1.isRecurringConfigChanged)(recurringConfig, originalRecurringDetail.recurringBillConfig, true);
|
|
185
|
+
payload.is_update_recurring_bill_config = isConfigChangedForExistingBill;
|
|
186
|
+
payload.is_update_future_recurring_bills =
|
|
187
|
+
recurringConfig.updateRecurringBills === 'all';
|
|
188
|
+
payload.is_update_current_bill =
|
|
189
|
+
recurringConfig.updateRecurringBills === 'all' ||
|
|
190
|
+
((_20 = (_19 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _19 === void 0 ? void 0 : _19.paymentDate) === null || _20 === void 0 ? void 0 : _20.toString()) !==
|
|
191
|
+
((_21 = detail === null || detail === void 0 ? void 0 : detail.billPayInfo.paymentDate) === null || _21 === void 0 ? void 0 : _21.toString())
|
|
192
|
+
? true
|
|
193
|
+
: recurringConfig.updateRecurringBills === 'current';
|
|
194
|
+
if ((isConfigChangedForExistingBill ||
|
|
195
|
+
recurringConfig.updateRecurringBills === 'all') &&
|
|
196
|
+
payload.recurring_bill_config != null) {
|
|
197
|
+
payload.recurring_bill_config.sync_token =
|
|
198
|
+
originalRecurringDetail.recurringBillConfig.syncToken;
|
|
199
|
+
}
|
|
200
|
+
if (recurringBillInstances != null) {
|
|
201
|
+
const futureRecurringBills = recurringBillInstances
|
|
202
|
+
.filter((instance) => Boolean(instance.readonly) === false)
|
|
203
|
+
.slice(1)
|
|
204
|
+
.map((instance) => {
|
|
205
|
+
var _a, _b, _c, _d;
|
|
206
|
+
return (0, exports.toRecurringBillInstancePayload)(instance, (_d = (_c = (_b = (_a = billDetail.billDetailLocalData.paymentDetailsSection) === null || _a === void 0 ? void 0 : _a.paymentType) === null || _b === void 0 ? void 0 : _b.maxPeriod) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : workingDayHelper_1.PAYMENT_BUSINESS_DAYS);
|
|
207
|
+
});
|
|
208
|
+
payload.future_recurring_bill_instances = futureRecurringBills;
|
|
209
|
+
if (payload.recurring_bill_config != null) {
|
|
210
|
+
payload.recurring_bill_config.future_total_payment_cycles =
|
|
211
|
+
futureRecurringBills === null || futureRecurringBills === void 0 ? void 0 : futureRecurringBills.length;
|
|
212
|
+
delete payload.recurring_bill_config.total_payment_cycles;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
payload.recurring_bill_instances = recurringBillInstances === null || recurringBillInstances === void 0 ? void 0 : recurringBillInstances.map((instance) => {
|
|
218
|
+
var _a, _b, _c, _d;
|
|
219
|
+
return (0, exports.toRecurringBillInstancePayload)(instance, (_d = (_c = (_b = (_a = billDetail.billDetailLocalData.paymentDetailsSection) === null || _a === void 0 ? void 0 : _a.paymentType) === null || _b === void 0 ? void 0 : _b.maxPeriod) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : workingDayHelper_1.PAYMENT_BUSINESS_DAYS);
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
147
223
|
return payload;
|
|
148
224
|
}
|
|
149
225
|
const getBillPaymentMethodTypePayload = (paymentType) => {
|
|
@@ -160,3 +236,13 @@ const getBillPaymentMethodTypePayload = (paymentType) => {
|
|
|
160
236
|
: null,
|
|
161
237
|
};
|
|
162
238
|
};
|
|
239
|
+
const toRecurringBillInstancePayload = (recurringBillInstance, maxPaymentProcessingDays) => {
|
|
240
|
+
const calculatedPaymentDate = (0, helpers_1.getPaymentDateFromVendorReceiveDate)(recurringBillInstance.vendorReceiveDate, maxPaymentProcessingDays);
|
|
241
|
+
return {
|
|
242
|
+
instance: recurringBillInstance.instance,
|
|
243
|
+
payment_date: calculatedPaymentDate.format('YYYY-MM-DD'),
|
|
244
|
+
vendor_receive_date: recurringBillInstance.vendorReceiveDate.format('YYYY-MM-DD'),
|
|
245
|
+
vendor_receive_date_notes: recurringBillInstance.vendorReceiveDateNotes,
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
exports.toRecurringBillInstancePayload = toRecurringBillInstancePayload;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { AllowedValueWithCode } from '../../../../commonStateTypes/allowedValue';
|
|
1
2
|
import { ZeniAPIResponse } from '../../../../responsePayload';
|
|
2
3
|
import { CreditTerm, RePaymentInfo } from './chargeCardConfigState';
|
|
3
4
|
export interface ChargeCardConfigPayload {
|
|
4
|
-
allowed_credit_limit_span_options:
|
|
5
|
+
allowed_credit_limit_span_options: AllowedValueWithCode[];
|
|
5
6
|
credit_terms: CreditTermsPayload;
|
|
6
7
|
repayment_info: RePaymentInfoPayload;
|
|
7
8
|
}
|
|
@@ -30,7 +30,10 @@ const chargeCardConfig = (0, toolkit_1.createSlice)({
|
|
|
30
30
|
updateChargeCardConfig(draft, action) {
|
|
31
31
|
const { payload } = action;
|
|
32
32
|
draft.creditLimitFrequency =
|
|
33
|
-
payload.allowed_credit_limit_span_options.map((
|
|
33
|
+
payload.allowed_credit_limit_span_options.map((fequency) => ({
|
|
34
|
+
code: (0, chargeCard_1.toCreditLimitFrequencyCodeType)(fequency.code),
|
|
35
|
+
name: fequency.name,
|
|
36
|
+
}));
|
|
34
37
|
draft.creditTerm = (0, chargeCardConfigPayload_1.toCreditTerm)(payload.credit_terms);
|
|
35
38
|
draft.rePaymentInfo = (0, chargeCardConfigPayload_1.toRePaymentInfo)(payload.repayment_info);
|
|
36
39
|
draft.fetchState = 'Completed';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FetchedState, ID } from '../../../../commonStateTypes/common';
|
|
2
2
|
import { TimeframeTick } from '../../../../commonStateTypes/timeframeTick';
|
|
3
|
-
import {
|
|
3
|
+
import { CreditLimitFrequency } from '../../../../entity/chargeCard/chargeCard';
|
|
4
4
|
import { ZeniDate } from '../../../../zeniDayJS';
|
|
5
5
|
export interface ChargeCardConfigState extends FetchedState {
|
|
6
|
-
creditLimitFrequency:
|
|
6
|
+
creditLimitFrequency: CreditLimitFrequency[];
|
|
7
7
|
creditTerm: CreditTerm;
|
|
8
8
|
rePaymentInfo?: RePaymentInfo;
|
|
9
9
|
}
|
|
@@ -7,6 +7,7 @@ export interface ChargeCardDetailState {
|
|
|
7
7
|
export interface ChargeCardDetail extends FetchedState {
|
|
8
8
|
id: ID;
|
|
9
9
|
transactionList: ChargeCardDetailTransactionList;
|
|
10
|
+
updateStatus: FetchStateAndError;
|
|
10
11
|
}
|
|
11
12
|
export interface ChargeCardDetailTransactionList extends FetchStateAndError {
|
|
12
13
|
transactionIds: ID[];
|
|
@@ -23,6 +23,13 @@ export declare const fetchChargeCardDetailPage: import("@reduxjs/toolkit").Actio
|
|
|
23
23
|
}, string>, updateChargeCardTransactionListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
24
24
|
chargeCardId: ID;
|
|
25
25
|
error: ZeniAPIStatus;
|
|
26
|
+
}, string>, updateChargeCardDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[chargeCardId: string, colorCode: string], {
|
|
27
|
+
chargeCardId: string;
|
|
28
|
+
colorCode: string;
|
|
29
|
+
}, string, never, never>, updateChargeCardDetailUpdateStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
30
|
+
chargeCardId: ID;
|
|
31
|
+
fetchState: FetchState;
|
|
32
|
+
error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
26
33
|
}, string>, clearChargeCardDetail: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
27
34
|
declare const _default: import("@reduxjs/toolkit").Reducer<ChargeCardDetailState, import("@reduxjs/toolkit").AnyAction>;
|
|
28
35
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearChargeCardDetail = exports.updateChargeCardTransactionListFailure = exports.updateChargeCardTransactionList = exports.fetchChargeCardTransactionList = exports.updateChargeCardDetailFetchState = exports.fetchChargeCardDetail = exports.fetchChargeCardDetailPage = exports.initialState = void 0;
|
|
4
|
+
exports.clearChargeCardDetail = exports.updateChargeCardDetailUpdateStatus = exports.updateChargeCardDetail = exports.updateChargeCardTransactionListFailure = exports.updateChargeCardTransactionList = exports.fetchChargeCardTransactionList = exports.updateChargeCardDetailFetchState = exports.fetchChargeCardDetail = exports.fetchChargeCardDetailPage = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const chargeCardDetail_1 = require("./chargeCardDetail");
|
|
7
7
|
const sortOrderPayload_1 = require("../../../../commonPayloadTypes/sortOrderPayload");
|
|
@@ -76,10 +76,33 @@ const chargeCardDetail = (0, toolkit_1.createSlice)({
|
|
|
76
76
|
const existingCardDetail = draft.detailById[chargeCardId];
|
|
77
77
|
draft.detailById[chargeCardId] = Object.assign(Object.assign({}, existingCardDetail), { transactionList: Object.assign(Object.assign({}, existingCardDetail.transactionList), { fetchState: 'Error', error }) });
|
|
78
78
|
},
|
|
79
|
+
updateChargeCardDetail: {
|
|
80
|
+
reducer(draft, action) {
|
|
81
|
+
const { chargeCardId } = action.payload;
|
|
82
|
+
const existingCardDetail = draft.detailById[chargeCardId];
|
|
83
|
+
draft.detailById[chargeCardId] = Object.assign(Object.assign({}, existingCardDetail), { updateStatus: {
|
|
84
|
+
fetchState: 'In-Progress',
|
|
85
|
+
error: undefined,
|
|
86
|
+
} });
|
|
87
|
+
},
|
|
88
|
+
prepare(chargeCardId, colorCode) {
|
|
89
|
+
return {
|
|
90
|
+
payload: { chargeCardId, colorCode },
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
updateChargeCardDetailUpdateStatus(draft, action) {
|
|
95
|
+
const { chargeCardId, fetchState, error } = action.payload;
|
|
96
|
+
const existingCardDetail = draft.detailById[chargeCardId];
|
|
97
|
+
draft.detailById[chargeCardId] = Object.assign(Object.assign({}, existingCardDetail), { updateStatus: {
|
|
98
|
+
fetchState,
|
|
99
|
+
error,
|
|
100
|
+
} });
|
|
101
|
+
},
|
|
79
102
|
clearChargeCardDetail(draft) {
|
|
80
103
|
Object.assign(draft, exports.initialState);
|
|
81
104
|
},
|
|
82
105
|
},
|
|
83
106
|
});
|
|
84
|
-
_a = chargeCardDetail.actions, exports.fetchChargeCardDetailPage = _a.fetchChargeCardDetailPage, exports.fetchChargeCardDetail = _a.fetchChargeCardDetail, exports.updateChargeCardDetailFetchState = _a.updateChargeCardDetailFetchState, exports.fetchChargeCardTransactionList = _a.fetchChargeCardTransactionList, exports.updateChargeCardTransactionList = _a.updateChargeCardTransactionList, exports.updateChargeCardTransactionListFailure = _a.updateChargeCardTransactionListFailure, exports.clearChargeCardDetail = _a.clearChargeCardDetail;
|
|
107
|
+
_a = chargeCardDetail.actions, exports.fetchChargeCardDetailPage = _a.fetchChargeCardDetailPage, exports.fetchChargeCardDetail = _a.fetchChargeCardDetail, exports.updateChargeCardDetailFetchState = _a.updateChargeCardDetailFetchState, exports.fetchChargeCardTransactionList = _a.fetchChargeCardTransactionList, exports.updateChargeCardTransactionList = _a.updateChargeCardTransactionList, exports.updateChargeCardTransactionListFailure = _a.updateChargeCardTransactionListFailure, exports.updateChargeCardDetail = _a.updateChargeCardDetail, exports.updateChargeCardDetailUpdateStatus = _a.updateChargeCardDetailUpdateStatus, exports.clearChargeCardDetail = _a.clearChargeCardDetail;
|
|
85
108
|
exports.default = chargeCardDetail.reducer;
|
|
@@ -5,11 +5,14 @@ import { RootState } from '../../../../reducer';
|
|
|
5
5
|
import { ChargeCardConfigState } from '../chargeCardConfig/chargeCardConfigState';
|
|
6
6
|
import { ChargeCardWithUser } from '../chargeCardList/chargeCardListSelector';
|
|
7
7
|
import { ChargeCardDetailUiState } from './chargeCardDetail';
|
|
8
|
+
import { TwoFactorAuthenticationState } from '../../../twoFactorAuthentication/twoFactorAuthentication';
|
|
8
9
|
export interface ChargeCardDetailSelectorView extends SelectorView {
|
|
9
10
|
chargeCardConfig: ChargeCardConfigState;
|
|
10
11
|
transactions: ChargeCardTransaction[];
|
|
11
12
|
uiState: ChargeCardDetailUiState;
|
|
12
13
|
transactionListFetchState: FetchStateAndError;
|
|
14
|
+
twoFAView: TwoFactorAuthenticationState;
|
|
15
|
+
loggedInUserPhone: string;
|
|
13
16
|
chargeCard?: ChargeCardWithUser;
|
|
14
17
|
}
|
|
15
18
|
export declare const getChargeCardDetailView: (state: RootState, chargeCardId: ID) => ChargeCardDetailSelectorView;
|
|
@@ -14,7 +14,10 @@ const userSelector_1 = require("../../../../entity/user/userSelector");
|
|
|
14
14
|
const userRoleSelector_1 = require("../../../../entity/userRole/userRoleSelector");
|
|
15
15
|
const chargeCardDetail_1 = require("./chargeCardDetail");
|
|
16
16
|
const getChargeCardDetailView = (state, chargeCardId) => {
|
|
17
|
-
|
|
17
|
+
var _a, _b, _c, _d, _e;
|
|
18
|
+
const { tenantState, addressState, chargeCardDetailState, chargeCardState, classState, userState, userRoleState, chargeCardConfigState, chargeCardTransactionState, twoFactorAuthenticationState, } = state;
|
|
19
|
+
const loggedInUserId = (_b = (_a = tenantState.loggedInUser) === null || _a === void 0 ? void 0 : _a.userId) !== null && _b !== void 0 ? _b : '';
|
|
20
|
+
const loggedInUserPhone = (_e = (_c = twoFactorAuthenticationState.phone) !== null && _c !== void 0 ? _c : (_d = (0, userSelector_1.getUserByUserId)(userState, loggedInUserId)) === null || _d === void 0 ? void 0 : _d.phone) !== null && _e !== void 0 ? _e : '';
|
|
18
21
|
let chargeCardWithUser = undefined;
|
|
19
22
|
const chargeCardDetail = (0, get_1.default)(chargeCardDetailState.detailById, chargeCardId, undefined);
|
|
20
23
|
const chargeCard = (0, chargeCardSelector_1.getChargeCardById)(chargeCardState, chargeCardId);
|
|
@@ -62,6 +65,8 @@ const getChargeCardDetailView = (state, chargeCardId) => {
|
|
|
62
65
|
transactions,
|
|
63
66
|
uiState,
|
|
64
67
|
transactionListFetchState,
|
|
68
|
+
twoFAView: twoFactorAuthenticationState,
|
|
69
|
+
loggedInUserPhone,
|
|
65
70
|
version: '1.0',
|
|
66
71
|
};
|
|
67
72
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
5
|
+
import { updateChargeCardDetail, updateChargeCardDetailUpdateStatus } from './chargeCardDetailReducer';
|
|
6
|
+
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
7
|
+
import { updateAllUsers } from '../../../../entity/user/userReducer';
|
|
8
|
+
import { updateUserRoles } from '../../../../entity/userRole/userRoleReducer';
|
|
9
|
+
import { updateChargeCard } from '../../../../entity/chargeCard/chargeCardReducer';
|
|
10
|
+
export declare type ActionType = ReturnType<typeof updateChargeCardDetail> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateChargeCardDetailUpdateStatus> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateChargeCard>;
|
|
11
|
+
export declare const updateChargeCardDetailEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateChargeCardDetailEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
|
+
const chargeCardDetailReducer_1 = require("./chargeCardDetailReducer");
|
|
8
|
+
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
9
|
+
const userReducer_1 = require("../../../../entity/user/userReducer");
|
|
10
|
+
const userRoleReducer_1 = require("../../../../entity/userRole/userRoleReducer");
|
|
11
|
+
const chargeCardReducer_1 = require("../../../../entity/chargeCard/chargeCardReducer");
|
|
12
|
+
const updateChargeCardDetailEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardDetailReducer_1.updateChargeCardDetail.match), (0, operators_1.switchMap)((action) => {
|
|
13
|
+
const { chargeCardId, colorCode } = action.payload;
|
|
14
|
+
const payload = { card_color_code: colorCode };
|
|
15
|
+
return zeniAPI
|
|
16
|
+
.putAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/${chargeCardId}`, payload)
|
|
17
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
18
|
+
if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
|
|
19
|
+
return (0, rxjs_1.of)((0, chargeCardReducer_1.updateChargeCard)(response.data.card), (0, userReducer_1.updateAllUsers)({ users: response.data.users }), (0, userRoleReducer_1.updateUserRoles)(response.data.user_roles), (0, chargeCardDetailReducer_1.updateChargeCardDetailUpdateStatus)({
|
|
20
|
+
chargeCardId,
|
|
21
|
+
fetchState: 'Completed',
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
|
|
26
|
+
messageSection: 'update_charge_card',
|
|
27
|
+
messageText: 'failed',
|
|
28
|
+
type: 'error',
|
|
29
|
+
variables: [
|
|
30
|
+
{
|
|
31
|
+
variableName: '_api-error_',
|
|
32
|
+
variableValue: response.status.message,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
}), (0, chargeCardDetailReducer_1.updateChargeCardDetailUpdateStatus)({
|
|
36
|
+
chargeCardId,
|
|
37
|
+
fetchState: 'Error',
|
|
38
|
+
error: response.status,
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
}), (0, operators_1.catchError)((error) => {
|
|
42
|
+
return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
|
|
43
|
+
messageSection: 'update_charge_card',
|
|
44
|
+
messageText: 'failed',
|
|
45
|
+
type: 'error',
|
|
46
|
+
variables: [
|
|
47
|
+
{
|
|
48
|
+
variableName: '_api-error_',
|
|
49
|
+
variableValue: JSON.stringify(error),
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
}), (0, chargeCardDetailReducer_1.updateChargeCardDetailUpdateStatus)({
|
|
53
|
+
chargeCardId,
|
|
54
|
+
fetchState: 'Error',
|
|
55
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Update card detail API call errored out' +
|
|
56
|
+
JSON.stringify(error)),
|
|
57
|
+
}));
|
|
58
|
+
}));
|
|
59
|
+
}));
|
|
60
|
+
exports.updateChargeCardDetailEpic = updateChargeCardDetailEpic;
|
|
@@ -9,6 +9,7 @@ export interface CommonHistoryView extends FetchedState {
|
|
|
9
9
|
export declare const initialCommonHistory: CommonHistoryView;
|
|
10
10
|
export interface HistoricEvent {
|
|
11
11
|
eventText: string[];
|
|
12
|
+
eventSubText: string[];
|
|
12
13
|
timestamp?: ZeniDate;
|
|
13
14
|
updates: HistoricEventUpdate[];
|
|
14
15
|
}
|
|
@@ -3,11 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toHistoricEventUpdate = exports.toHistoricEvent = void 0;
|
|
4
4
|
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
5
5
|
const commonHistory_1 = require("./commonHistory");
|
|
6
|
-
const toHistoricEvent = (payload) =>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
const toHistoricEvent = (payload) => {
|
|
7
|
+
var _a;
|
|
8
|
+
return ({
|
|
9
|
+
eventText: payload.event_text,
|
|
10
|
+
eventSubText: (_a = payload.event_sub_text) !== null && _a !== void 0 ? _a : [],
|
|
11
|
+
timestamp: payload.timestamp != null ? (0, zeniDayJS_1.dateLocal)(payload.timestamp) : undefined,
|
|
12
|
+
updates: payload.updates.map((eventUpdatePayload) => (0, exports.toHistoricEventUpdate)(eventUpdatePayload)),
|
|
13
|
+
});
|
|
14
|
+
};
|
|
11
15
|
exports.toHistoricEvent = toHistoricEvent;
|
|
12
16
|
const toHistoricEventUpdate = (payload) => ({
|
|
13
17
|
title: payload.title,
|
|
@@ -80,16 +80,9 @@ export declare const enableSetup: import("@reduxjs/toolkit").ActionCreatorWithPr
|
|
|
80
80
|
}, string>, updateSetupViewAccountDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[allBankAccountIds: string[], paymentAccountIds: string[]], {
|
|
81
81
|
allBankAccountIds: string[];
|
|
82
82
|
paymentAccountIds: string[];
|
|
83
|
-
}, string, never, never>,
|
|
84
|
-
phoneNumber: string;
|
|
85
|
-
}, string, never, never>, resendOtp: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[otpChallenge: string], {
|
|
83
|
+
}, string, never, never>, sendOtpSpendManagementSetUp: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resendOtpSpendManagementSetUp: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, sendOtpSuccessSpendManagementSetUp: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
86
84
|
otpChallenge: string;
|
|
87
|
-
}, string
|
|
88
|
-
otpChallenge: string;
|
|
89
|
-
}, string, never, never>, sendOtpFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, string, never, never>, verifyOtp: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[otpCode: string, otpChallenge: string], {
|
|
90
|
-
otpCode: string;
|
|
91
|
-
otpChallenge: string;
|
|
92
|
-
}, string, never, never>, verifyOtpSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, verifyOtpFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, string, never, never>, saveIndustryAndIncDateInLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
85
|
+
}, string>, sendOtpFailureSpendManagementSetUp: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, verifyOtpSpendManagementSetUp: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, verifyOtpSuccessSpendManagementSetUp: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, verifyOtpFailureSpendManagementSetUp: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, saveIndustryAndIncDateInLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
93
86
|
industry: string;
|
|
94
87
|
incDate: ZeniDate;
|
|
95
88
|
}, string>, clearSetupViewDataInLocalStore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, clearSetupView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|