@zeniai/client-epic-state 4.15.4 → 4.15.6
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/billPay/billTransaction/billTransactionPayload.d.ts +1 -0
- package/lib/entity/billPay/billTransaction/billTransactionPayload.js +2 -0
- package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +1 -0
- package/lib/epic.d.ts +2 -2
- package/lib/epic.js +2 -2
- package/lib/index.d.ts +4 -4
- package/lib/index.js +12 -11
- package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewCompleteStatusEpic.js +14 -2
- package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewEpic.js +4 -1
- package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.js +1 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewPayload.d.ts +5 -0
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +3 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +2 -2
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +1 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +9 -16
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.d.ts +1 -0
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +23 -17
- package/lib/view/spendManagement/billPay/billList/billListSelector.d.ts +2 -0
- package/lib/view/spendManagement/billPay/billList/billListSelector.js +4 -1
- package/lib/view/spendManagement/billPay/billList/fetchBillListEpic.d.ts +3 -1
- package/lib/view/spendManagement/billPay/billList/fetchBillListEpic.js +22 -0
- package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewPayload.d.ts +7 -6
- package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewReducer.d.ts +2 -1
- package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewReducer.js +44 -27
- package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewSelector.d.ts +5 -2
- package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewSelector.js +14 -4
- package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewState.d.ts +7 -6
- package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewState.js +2 -0
- package/lib/view/spendManagement/billPay/billsBulkActionView/epics/submitDraftBillsBulkActionEpic.js +1 -2
- package/lib/view/spendManagement/billPay/billsBulkActionView/epics/validateBillsBulkActionEpic.ts.d.ts +7 -0
- package/lib/view/spendManagement/billPay/billsBulkActionView/epics/{reviewDraftBillsBulkActionEpic.ts.js → validateBillsBulkActionEpic.ts.js} +10 -7
- package/lib/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js +7 -16
- package/lib/view/spendManagement/commonSetup/types/businessVerification.d.ts +2 -2
- package/lib/view/spendManagement/helpers.d.ts +2 -0
- package/lib/view/spendManagement/helpers.js +9 -1
- package/package.json +1 -1
- package/lib/view/spendManagement/billPay/billsBulkActionView/epics/reviewDraftBillsBulkActionEpic.ts.d.ts +0 -7
|
@@ -46,7 +46,7 @@ export interface OnboardingCustomerView {
|
|
|
46
46
|
}
|
|
47
47
|
export declare function getOnboardingCustomerView(state: RootState, companyId: ID): OnboardingCustomerView;
|
|
48
48
|
export declare function isOfficerDetailsCompleted(companyOfficers: User[], companyOfficerRoles: UserRole[], officerDetails: CompanyOfficerLocalData, fileState: FileState): boolean;
|
|
49
|
-
export declare const onboardingStepsData: (isValidConnection: boolean, productSettings: TenantProductSettings, accountingConnectionCreationMode?: AccountingConnectionCreationMode
|
|
49
|
+
export declare const onboardingStepsData: (isValidConnection: boolean, productSettings: TenantProductSettings, accountingConnectionCreationMode?: AccountingConnectionCreationMode) => {
|
|
50
50
|
allStepsData: OnboardingStep[];
|
|
51
51
|
requiredStepsData: OnboardingStep[];
|
|
52
52
|
};
|
|
@@ -69,11 +69,12 @@ function getOnboardingCustomerView(state, companyId) {
|
|
|
69
69
|
companyDetailsLocalData.addressStatus = subscriptionBillingAddress;
|
|
70
70
|
}
|
|
71
71
|
const completedSteps = [];
|
|
72
|
-
if ((((_l = (_k = paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.providerVerificationStatus) === null || _k === void 0 ? void 0 : _k.code) === null || _l === void 0 ? void 0 : _l.includes('verified')) ===
|
|
72
|
+
if (((((_l = (_k = paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.providerVerificationStatus) === null || _k === void 0 ? void 0 : _k.code) === null || _l === void 0 ? void 0 : _l.includes('verified')) ===
|
|
73
73
|
true &&
|
|
74
74
|
(paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.isLoginRequired) === false) ||
|
|
75
75
|
((_o = (_m = subscriptionPaymentAccount === null || subscriptionPaymentAccount === void 0 ? void 0 : subscriptionPaymentAccount.providerVerificationStatus) === null || _m === void 0 ? void 0 : _m.code) === null || _o === void 0 ? void 0 : _o.includes('verified')) === true ||
|
|
76
|
-
cardPaymentViewState.cardPaymentsIds.length > 0)
|
|
76
|
+
cardPaymentViewState.cardPaymentsIds.length > 0) &&
|
|
77
|
+
(companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyOnboardingInfo.subscriptionBillingAddressId) != null) {
|
|
77
78
|
completedSteps.push('link_payment_account');
|
|
78
79
|
}
|
|
79
80
|
const isValidConnection = (_q = (_p = externalConnections === null || externalConnections === void 0 ? void 0 : externalConnections.accounting[0]) === null || _p === void 0 ? void 0 : _p.isValid) !== null && _q !== void 0 ? _q : false;
|
|
@@ -93,7 +94,7 @@ function getOnboardingCustomerView(state, companyId) {
|
|
|
93
94
|
isOfficerDetailsCompleted(companyOfficers, companyOfficerRoles, companyOfficerLocalData[selectedOfficerType], fileState)) {
|
|
94
95
|
completedSteps.push('company_officer');
|
|
95
96
|
}
|
|
96
|
-
const { allStepsData, requiredStepsData } = (0, exports.onboardingStepsData)(isValidConnection, (_r = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.productSettings) !== null && _r !== void 0 ? _r : [], accountingConnectionCreationMode
|
|
97
|
+
const { allStepsData, requiredStepsData } = (0, exports.onboardingStepsData)(isValidConnection, (_r = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.productSettings) !== null && _r !== void 0 ? _r : [], accountingConnectionCreationMode);
|
|
97
98
|
const allRequiredStepsCompleted = requiredStepsData.every((step) => {
|
|
98
99
|
return completedSteps.includes(step);
|
|
99
100
|
});
|
|
@@ -189,25 +190,17 @@ function isOfficerDetailsCompleted(companyOfficers, companyOfficerRoles, officer
|
|
|
189
190
|
Boolean(userRole === null || userRole === void 0 ? void 0 : userRole.addressId) &&
|
|
190
191
|
files.length >= 2);
|
|
191
192
|
}
|
|
192
|
-
const onboardingStepsData = (isValidConnection, productSettings, accountingConnectionCreationMode
|
|
193
|
+
const onboardingStepsData = (isValidConnection, productSettings, accountingConnectionCreationMode) => {
|
|
193
194
|
const allStepsData = accountingConnectionCreationMode === 'zeni_user' ||
|
|
194
195
|
((productSettings.isBankingEnabled || productSettings.isCardsEnabled) &&
|
|
195
196
|
!productSettings.isBookkeepingEnabled)
|
|
196
|
-
?
|
|
197
|
-
|
|
198
|
-
: onboardingCustomerViewState_1.ALL_ZENI_USER_ONBOARDING_STEPS
|
|
199
|
-
: subscriptionPaymentAccount != null
|
|
200
|
-
? onboardingCustomerViewState_1.ALL_CUSTOMER_ONBOARDING_STEPS_WITH_QBO
|
|
201
|
-
: onboardingCustomerViewState_1.ALL_ONBOARDING_STEPS;
|
|
197
|
+
? onboardingCustomerViewState_1.ALL_ZENI_USER_ONBOARDING_STEPS
|
|
198
|
+
: onboardingCustomerViewState_1.ALL_ONBOARDING_STEPS;
|
|
202
199
|
const requiredStepsData = (accountingConnectionCreationMode === 'zeni_user' && isValidConnection) ||
|
|
203
200
|
((productSettings.isBankingEnabled || productSettings.isCardsEnabled) &&
|
|
204
201
|
!productSettings.isBookkeepingEnabled)
|
|
205
|
-
?
|
|
206
|
-
|
|
207
|
-
: onboardingCustomerViewState_1.ZENI_USER_REQUIRED_ONBOARDING_STEPS
|
|
208
|
-
: subscriptionPaymentAccount != null
|
|
209
|
-
? onboardingCustomerViewState_1.CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO
|
|
210
|
-
: onboardingCustomerViewState_1.REQUIRED_ONBOARDING_STEPS;
|
|
202
|
+
? onboardingCustomerViewState_1.ZENI_USER_REQUIRED_ONBOARDING_STEPS
|
|
203
|
+
: onboardingCustomerViewState_1.REQUIRED_ONBOARDING_STEPS;
|
|
211
204
|
return {
|
|
212
205
|
allStepsData: allStepsData.map((step) => (0, onboardingCustomerViewState_1.toOnboardingStepType)(step)),
|
|
213
206
|
requiredStepsData: requiredStepsData.map((step) => (0, onboardingCustomerViewState_1.toOnboardingStepType)(step)),
|
|
@@ -85,3 +85,4 @@ export declare const checkApproveRejectBtnShow: (billActivities: BillActivity[],
|
|
|
85
85
|
isMarkAsPaidBtnVisible: boolean;
|
|
86
86
|
};
|
|
87
87
|
export declare const checkShowMarkAsPaidButton: (bill: BillTransaction, isAdmin: boolean, loggedInUser?: LoggedInUser) => boolean;
|
|
88
|
+
export declare const getSelectedWithdrawFromAccount: (state: RootState, transaction?: BillTransaction) => FundingAccount | undefined;
|
|
@@ -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.checkShowMarkAsPaidButton = exports.checkApproveRejectBtnShow = exports.getBillDetailView = exports.getBillActivities = void 0;
|
|
6
|
+
exports.getSelectedWithdrawFromAccount = exports.checkShowMarkAsPaidButton = exports.checkApproveRejectBtnShow = exports.getBillDetailView = exports.getBillActivities = void 0;
|
|
7
7
|
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
8
8
|
const findLastIndex_1 = __importDefault(require("lodash/findLastIndex"));
|
|
9
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
@@ -85,8 +85,8 @@ const getBillActivities = (state, billId, billStageCode) => {
|
|
|
85
85
|
};
|
|
86
86
|
exports.getBillActivities = getBillActivities;
|
|
87
87
|
const getBillDetailView = (state, billId) => {
|
|
88
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q
|
|
89
|
-
const { bankAccountState, paymentInstrumentState, billDetailViewState, billTransactionState,
|
|
88
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
89
|
+
const { bankAccountState, paymentInstrumentState, billDetailViewState, billTransactionState, userState, billPayConfigState, userRoleState, classListState, classState, commonHistoryState, realTimeApprovalState, entityApprovalStatusState, billPaySetupApproverViewState, vendorState, recurringBillState, editBillDetailViewState, } = state;
|
|
90
90
|
const { approverListState } = billPaySetupApproverViewState;
|
|
91
91
|
const key = (0, billDetailViewState_1.getBillTransactionDetailKey)(billId !== null && billId !== void 0 ? billId : '');
|
|
92
92
|
const billTransactionDetails = (0, get_1.default)(billDetailViewState.billDetailById, key, undefined);
|
|
@@ -98,9 +98,7 @@ const getBillDetailView = (state, billId) => {
|
|
|
98
98
|
};
|
|
99
99
|
const bankAccount = (0, bankAccountSelector_1.getBankAccountByBankAccountId)(bankAccountState, (_b = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.toAccount.billAccountId) !== null && _b !== void 0 ? _b : '');
|
|
100
100
|
const paymentInstrument = (0, paymentInstrumentSelector_1.getPaymentInstrumentById)(paymentInstrumentState, (_c = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.toAccount.billAccountId) !== null && _c !== void 0 ? _c : '');
|
|
101
|
-
const
|
|
102
|
-
const depositAccount = (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, (_e = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountId) !== null && _e !== void 0 ? _e : '');
|
|
103
|
-
const withdrawFrom = (0, setupViewSelector_1.getAllFundingAccounts)((_f = (depositAccount && [depositAccount])) !== null && _f !== void 0 ? _f : [], (_g = (paymentAccount && [paymentAccount])) !== null && _g !== void 0 ? _g : [], paymentAccountListState.paymentAccountBalanceFetchStatus)[0];
|
|
101
|
+
const withdrawFrom = (0, exports.getSelectedWithdrawFromAccount)(state, transaction);
|
|
104
102
|
let previousBills = {
|
|
105
103
|
bills: [],
|
|
106
104
|
fetchState: 'Not-Started',
|
|
@@ -109,7 +107,7 @@ const getBillDetailView = (state, billId) => {
|
|
|
109
107
|
};
|
|
110
108
|
if ((billTransactionDetails === null || billTransactionDetails === void 0 ? void 0 : billTransactionDetails.fetchState) === 'Completed' &&
|
|
111
109
|
transaction != null) {
|
|
112
|
-
const previousBillsView = (0, previousBillsSelector_1.getPreviousBills)(state, (
|
|
110
|
+
const previousBillsView = (0, previousBillsSelector_1.getPreviousBills)(state, (_e = (_d = transaction.vendor) === null || _d === void 0 ? void 0 : _d.id) !== null && _e !== void 0 ? _e : '');
|
|
113
111
|
//don't include current bill
|
|
114
112
|
previousBills = Object.assign(Object.assign({}, previousBillsView), { bills: previousBillsView.bills.filter((bill) => bill.id !== billId) });
|
|
115
113
|
fetchState = (0, reduceFetchState_1.reduceFetchState)([billTransactionDetails, previousBillsView]);
|
|
@@ -121,7 +119,7 @@ const getBillDetailView = (state, billId) => {
|
|
|
121
119
|
const allApproverIds = [
|
|
122
120
|
...new Set([
|
|
123
121
|
...approverIds,
|
|
124
|
-
...((
|
|
122
|
+
...((_f = realTimeApprovalData === null || realTimeApprovalData === void 0 ? void 0 : realTimeApprovalData.realTimeApproverIds) !== null && _f !== void 0 ? _f : []),
|
|
125
123
|
]),
|
|
126
124
|
];
|
|
127
125
|
const allApprovers = allApproverIds
|
|
@@ -134,7 +132,7 @@ const getBillDetailView = (state, billId) => {
|
|
|
134
132
|
.filter((approver) => approver.user != null);
|
|
135
133
|
const filteredAttributes = (0, cloneDeep_1.default)(attributes);
|
|
136
134
|
const filteredApprovers = (0, cloneDeep_1.default)(allApprovers);
|
|
137
|
-
const entityApprovalStatusByIds = (0, entityApprovalStatusSelector_1.getEntityApprovalStatusByIds)(entityApprovalStatusState, (
|
|
135
|
+
const entityApprovalStatusByIds = (0, entityApprovalStatusSelector_1.getEntityApprovalStatusByIds)(entityApprovalStatusState, (_g = billTransactionDetails === null || billTransactionDetails === void 0 ? void 0 : billTransactionDetails.entityApprovalIds) !== null && _g !== void 0 ? _g : []);
|
|
138
136
|
if (billActivities != null &&
|
|
139
137
|
(transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.stage.code) !== 'draft') {
|
|
140
138
|
entityApprovalStatusByIds.forEach((approval) => {
|
|
@@ -154,12 +152,12 @@ const getBillDetailView = (state, billId) => {
|
|
|
154
152
|
}
|
|
155
153
|
});
|
|
156
154
|
}
|
|
157
|
-
const deleteStatus = (
|
|
158
|
-
const cancelStatus = (
|
|
159
|
-
const cancelAndDeleteStatus = (
|
|
160
|
-
const approvalUpdateStatus = (
|
|
155
|
+
const deleteStatus = (_h = billTransactionDetails === null || billTransactionDetails === void 0 ? void 0 : billTransactionDetails.deleteStatus) !== null && _h !== void 0 ? _h : billDetailViewState_1.initialBillDetailView.deleteStatus;
|
|
156
|
+
const cancelStatus = (_j = billTransactionDetails === null || billTransactionDetails === void 0 ? void 0 : billTransactionDetails.cancelStatus) !== null && _j !== void 0 ? _j : billDetailViewState_1.initialBillDetailView.cancelStatus;
|
|
157
|
+
const cancelAndDeleteStatus = (_k = billTransactionDetails === null || billTransactionDetails === void 0 ? void 0 : billTransactionDetails.cancelAndDeleteStatus) !== null && _k !== void 0 ? _k : billDetailViewState_1.initialBillDetailView.cancelAndDeleteStatus;
|
|
158
|
+
const approvalUpdateStatus = (_l = billTransactionDetails === null || billTransactionDetails === void 0 ? void 0 : billTransactionDetails.approvalUpdateStatus) !== null && _l !== void 0 ? _l : billDetailViewState_1.initialBillDetailView.approvalUpdateStatus;
|
|
161
159
|
const approvalType = billDetailViewState.approvalType;
|
|
162
|
-
const createdBy = (0, userSelector_1.getUserByUserId)(userState, (
|
|
160
|
+
const createdBy = (0, userSelector_1.getUserByUserId)(userState, (_m = transaction === null || transaction === void 0 ? void 0 : transaction.createdBy) !== null && _m !== void 0 ? _m : '');
|
|
163
161
|
const paymentMethodCode = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.billPaymentMethodType.code;
|
|
164
162
|
const paymentMethodSubCode = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.billPaymentMethodType.subCode;
|
|
165
163
|
const internationalTransferFeeBearerPaymentMethod = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.internationalTransferFeeBearerPaymentMethod;
|
|
@@ -181,8 +179,8 @@ const getBillDetailView = (state, billId) => {
|
|
|
181
179
|
classIds: classIds,
|
|
182
180
|
reportId: 'class_list',
|
|
183
181
|
});
|
|
184
|
-
const currentVendorDetails = (0, get_1.default)(vendorState.vendorByID, (
|
|
185
|
-
const isRecurring = (
|
|
182
|
+
const currentVendorDetails = (0, get_1.default)(vendorState.vendorByID, (_o = billTransactionDetails === null || billTransactionDetails === void 0 ? void 0 : billTransactionDetails.vendorId) !== null && _o !== void 0 ? _o : '', undefined);
|
|
183
|
+
const isRecurring = (_p = transaction === null || transaction === void 0 ? void 0 : transaction.isRecurring) !== null && _p !== void 0 ? _p : false;
|
|
186
184
|
let recurringBillConfigDetail = undefined;
|
|
187
185
|
let recurringBillInstances = undefined;
|
|
188
186
|
if (isRecurring && (transaction === null || transaction === void 0 ? void 0 : transaction.recurringBillConfigId) != null) {
|
|
@@ -192,7 +190,7 @@ const getBillDetailView = (state, billId) => {
|
|
|
192
190
|
}
|
|
193
191
|
const zeniAssist = billTransactionDetails === null || billTransactionDetails === void 0 ? void 0 : billTransactionDetails.zeniAssist;
|
|
194
192
|
const outsideZeniPaymentInfo = editBillDetail === null || editBillDetail === void 0 ? void 0 : editBillDetail.billDetailLocalData.outsideZeniPaymentLocalData;
|
|
195
|
-
const billSaveStatus = (
|
|
193
|
+
const billSaveStatus = (_q = editBillDetail === null || editBillDetail === void 0 ? void 0 : editBillDetail.saveStatus.fetchState) !== null && _q !== void 0 ? _q : 'Not-Started';
|
|
196
194
|
//offline bills without approval - show created as approved date
|
|
197
195
|
const latestApprovedDate = (transaction === null || transaction === void 0 ? void 0 : transaction.entityApprovalId) == null &&
|
|
198
196
|
(transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.billPaymentStatus.code) === 'mark_as_paid'
|
|
@@ -343,3 +341,11 @@ const checkShowMarkAsPaidButton = (bill, isAdmin, loggedInUser) => {
|
|
|
343
341
|
return (0, helpers_1.isAwaitingMarkAsPaid)(billPaymentStatus) && (isAdmin || isCreator);
|
|
344
342
|
};
|
|
345
343
|
exports.checkShowMarkAsPaidButton = checkShowMarkAsPaidButton;
|
|
344
|
+
const getSelectedWithdrawFromAccount = (state, transaction) => {
|
|
345
|
+
var _a, _b, _c, _d;
|
|
346
|
+
const { paymentAccountState, depositAccountState, paymentAccountListState } = state;
|
|
347
|
+
const paymentAccount = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, (_a = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountId) !== null && _a !== void 0 ? _a : '');
|
|
348
|
+
const depositAccount = (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, (_b = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountId) !== null && _b !== void 0 ? _b : '');
|
|
349
|
+
return (0, setupViewSelector_1.getAllFundingAccounts)((_c = (depositAccount && [depositAccount])) !== null && _c !== void 0 ? _c : [], (_d = (paymentAccount && [paymentAccount])) !== null && _d !== void 0 ? _d : [], paymentAccountListState.paymentAccountBalanceFetchStatus)[0];
|
|
350
|
+
};
|
|
351
|
+
exports.getSelectedWithdrawFromAccount = getSelectedWithdrawFromAccount;
|
|
@@ -9,6 +9,7 @@ import { RecurringBillConfig } from '../../../../entity/billPay/recurringBills/r
|
|
|
9
9
|
import { EntityApprovalStatusState } from '../../../../entity/entityApprovalStatus/entityApprovalStatusState';
|
|
10
10
|
import { User, UserState } from '../../../../entity/user/userState';
|
|
11
11
|
import { RootState } from '../../../../reducer';
|
|
12
|
+
import { FundingAccount } from '../../commonSetup/setupViewSelector';
|
|
12
13
|
import { BulkOperationType } from '../../helpers';
|
|
13
14
|
import { BillBulkSelectExceptionInfoType, BillListUIState, BillPayFilters, BillPayViewSortKey, BillTab, BillsSubTabType, SaveBillStageCode } from './billListState';
|
|
14
15
|
interface BillBulkSelectInfo {
|
|
@@ -29,6 +30,7 @@ export interface BillTransactionView extends BillTransaction {
|
|
|
29
30
|
createdByUser?: User;
|
|
30
31
|
bulkSelectInfo?: BillBulkSelectInfo;
|
|
31
32
|
recurringBillConfig?: RecurringBillConfig;
|
|
33
|
+
withdrawFrom?: FundingAccount;
|
|
32
34
|
}
|
|
33
35
|
export interface BillListReport extends SelectorView {
|
|
34
36
|
billOrder: EntityOrder;
|
|
@@ -12,6 +12,7 @@ const userSelector_1 = require("../../../../entity/user/userSelector");
|
|
|
12
12
|
const zeniDayJS_1 = require("../../../../zeniDayJS");
|
|
13
13
|
const helpers_1 = require("../../helpers");
|
|
14
14
|
const spendManagementFilterHelpers_1 = require("../../spendManagementFilterHelpers");
|
|
15
|
+
const billDetailViewSelector_1 = require("../billDetailView/billDetailViewSelector");
|
|
15
16
|
const billPayConfigSelector_1 = require("../billPayConfig/billPayConfigSelector");
|
|
16
17
|
const billListState_1 = require("./billListState");
|
|
17
18
|
const getBillList = (state, currentTimePeriod, isBulkActionFeatureEnabled, loggedInUserId) => {
|
|
@@ -142,10 +143,12 @@ const getBillList = (state, currentTimePeriod, isBulkActionFeatureEnabled, logge
|
|
|
142
143
|
}
|
|
143
144
|
const recurringBillConfig = recurringBillDetail === null || recurringBillDetail === void 0 ? void 0 : recurringBillDetail.recurringBillConfig;
|
|
144
145
|
const createdByUser = (0, userSelector_1.getUserByUserId)(userState, transaction.createdBy);
|
|
146
|
+
const withdrawFrom = (0, billDetailViewSelector_1.getSelectedWithdrawFromAccount)(state, transaction);
|
|
145
147
|
return Object.assign(Object.assign({}, transaction), { approvers,
|
|
146
148
|
createdByUser,
|
|
147
149
|
isRecurring,
|
|
148
|
-
recurringBillConfig
|
|
150
|
+
recurringBillConfig,
|
|
151
|
+
withdrawFrom });
|
|
149
152
|
});
|
|
150
153
|
transactionsView = (0, spendManagementFilterHelpers_1.applyAdvancedFiltersOnList)('bill_pay', transactionsView, billListState.filters);
|
|
151
154
|
const TransactionsPendingForMyApprovalLength = pendingApprovalTransactionIDs.length;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { RootState } from '../../../../reducer';
|
|
4
|
+
import { fetchDepositAccountList } from '../../zeniAccounts/depositAccountList/depositAccountListReducer';
|
|
5
|
+
import { fetchPaymentAccountList } from '../../zeniAccounts/paymentAccountList/paymentAccountListReducer';
|
|
4
6
|
import { fetchBillPayConfig } from '../billPayConfig/billPayConfigReducer';
|
|
5
7
|
import { fetchBillList, fetchBillListPerTab } from './billListReducer';
|
|
6
|
-
export type ActionType = ReturnType<typeof fetchBillList> | ReturnType<typeof fetchBillPayConfig> | ReturnType<typeof fetchBillListPerTab>;
|
|
8
|
+
export type ActionType = ReturnType<typeof fetchBillList> | ReturnType<typeof fetchBillPayConfig> | ReturnType<typeof fetchBillListPerTab> | ReturnType<typeof fetchPaymentAccountList> | ReturnType<typeof fetchDepositAccountList>;
|
|
7
9
|
export declare const fetchBillListEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -7,10 +7,14 @@ exports.fetchBillListEpic = void 0;
|
|
|
7
7
|
const get_1 = __importDefault(require("lodash/get"));
|
|
8
8
|
const rxjs_1 = require("rxjs");
|
|
9
9
|
const operators_1 = require("rxjs/operators");
|
|
10
|
+
const companySelector_1 = require("../../../../entity/company/companySelector");
|
|
11
|
+
const depositAccountListReducer_1 = require("../../zeniAccounts/depositAccountList/depositAccountListReducer");
|
|
12
|
+
const paymentAccountListReducer_1 = require("../../zeniAccounts/paymentAccountList/paymentAccountListReducer");
|
|
10
13
|
const billPayConfigReducer_1 = require("../billPayConfig/billPayConfigReducer");
|
|
11
14
|
const billListReducer_1 = require("./billListReducer");
|
|
12
15
|
const billListState_1 = require("./billListState");
|
|
13
16
|
const fetchBillListEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(billListReducer_1.fetchBillList.match), (0, operators_1.mergeMap)((action) => {
|
|
17
|
+
var _a, _b, _c;
|
|
14
18
|
const fetchBillListActions = [];
|
|
15
19
|
const tabIds = [
|
|
16
20
|
'draft',
|
|
@@ -19,6 +23,13 @@ const fetchBillListEpic = (actions$, state$) => actions$.pipe((0, operators_1.fi
|
|
|
19
23
|
'paid',
|
|
20
24
|
];
|
|
21
25
|
const state = state$.value;
|
|
26
|
+
const { tenantState, companyState } = state;
|
|
27
|
+
const { currentTenantId } = tenantState;
|
|
28
|
+
const companyId = currentTenantId != null
|
|
29
|
+
? (_b = (_a = tenantState.tenantsById) === null || _a === void 0 ? void 0 : _a[currentTenantId]) === null || _b === void 0 ? void 0 : _b.companyId
|
|
30
|
+
: undefined;
|
|
31
|
+
const currentCompany = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId !== null && companyId !== void 0 ? companyId : '');
|
|
32
|
+
const isCompanyZeniAccountsSetUpDone = (_c = currentCompany === null || currentCompany === void 0 ? void 0 : currentCompany.company.companyZeniAccountInfo.isZeniAccountEnabled) !== null && _c !== void 0 ? _c : false;
|
|
22
33
|
const { period, cacheOverride, isShowDeletedBillsEnabled, isInternationalWireEnabled, } = action.payload;
|
|
23
34
|
if (cacheOverride === true) {
|
|
24
35
|
fetchBillListActions.push((0, billPayConfigReducer_1.fetchBillPayConfig)(isInternationalWireEnabled));
|
|
@@ -29,6 +40,17 @@ const fetchBillListEpic = (actions$, state$) => actions$.pipe((0, operators_1.fi
|
|
|
29
40
|
state.billPayConfigState.fetchState !== 'In-Progress') {
|
|
30
41
|
fetchBillListActions.push((0, billPayConfigReducer_1.fetchBillPayConfig)(isInternationalWireEnabled));
|
|
31
42
|
}
|
|
43
|
+
const depositAccounts = state.depositAccountListState;
|
|
44
|
+
if (isCompanyZeniAccountsSetUpDone &&
|
|
45
|
+
depositAccounts.fetchState !== 'In-Progress' &&
|
|
46
|
+
depositAccounts.fetchState !== 'Completed') {
|
|
47
|
+
fetchBillListActions.push((0, depositAccountListReducer_1.fetchDepositAccountList)());
|
|
48
|
+
}
|
|
49
|
+
const paymentAccounts = state.paymentAccountListState;
|
|
50
|
+
if (paymentAccounts.fetchState !== 'In-Progress' &&
|
|
51
|
+
paymentAccounts.fetchState !== 'Completed') {
|
|
52
|
+
fetchBillListActions.push((0, paymentAccountListReducer_1.fetchPaymentAccountList)());
|
|
53
|
+
}
|
|
32
54
|
tabIds.forEach((tab) => {
|
|
33
55
|
const key = (0, billListState_1.getBillListKey)(period, tab);
|
|
34
56
|
const bills = (0, get_1.default)(state.billListState.byBillListKey, key, undefined);
|
package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewPayload.d.ts
CHANGED
|
@@ -19,12 +19,13 @@ export interface BulkActionResponsePayload {
|
|
|
19
19
|
operations: BulkActionItemResponsePayload[];
|
|
20
20
|
}
|
|
21
21
|
export type BillsBulkActionResponse = ZeniAPIResponse<BulkActionResponsePayload>;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
interface BulkActionReviewErrorResponsePayload {
|
|
23
|
+
error_code: string;
|
|
24
|
+
error_message: string;
|
|
25
|
+
duplicate_entity_ids?: string[];
|
|
26
|
+
}
|
|
27
|
+
export interface BulkActionReviewItemResponsePayload extends Omit<BulkActionItemResponseBasePayload, 'error'> {
|
|
28
|
+
errors: BulkActionReviewErrorResponsePayload[] | null;
|
|
28
29
|
}
|
|
29
30
|
interface BillsReviewBulkActionResponsePayload {
|
|
30
31
|
validation_results: BulkActionReviewItemResponsePayload[];
|
package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewReducer.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ZeniAPIStatus } from '../../../../responsePayload';
|
|
2
|
+
import { BulkOperationType } from '../../helpers';
|
|
2
3
|
import { BillApprovalType } from '../billDetailView/billDetailViewState';
|
|
3
4
|
import { BulkActionReviewItemResponsePayload } from './billsBulkActionViewPayload';
|
|
4
5
|
import { BillsBulkActionViewState } from './billsBulkActionViewState';
|
|
5
6
|
export declare const initialState: BillsBulkActionViewState;
|
|
6
|
-
export declare const updateBillsBulkActionList: import("@reduxjs/toolkit").ActionCreatorWithPayload<string[], "billsBulkActionView/updateBillsBulkActionList">, removeBillFromBulkActionList: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "billsBulkActionView/removeBillFromBulkActionList">, clearAllBillsFromBulkActionList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"billsBulkActionView/clearAllBillsFromBulkActionList">,
|
|
7
|
+
export declare const updateBillsBulkActionList: import("@reduxjs/toolkit").ActionCreatorWithPayload<string[], "billsBulkActionView/updateBillsBulkActionList">, removeBillFromBulkActionList: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "billsBulkActionView/removeBillFromBulkActionList">, clearAllBillsFromBulkActionList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"billsBulkActionView/clearAllBillsFromBulkActionList">, validateBillsBulkAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<BulkOperationType, "billsBulkActionView/validateBillsBulkAction">, validateBillsBulkActionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<BulkActionReviewItemResponsePayload[], "billsBulkActionView/validateBillsBulkActionSuccess">, validateBillsBulkActionFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "billsBulkActionView/validateBillsBulkActionFailure">, submitDraftBillsBulkAction: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"billsBulkActionView/submitDraftBillsBulkAction">, approveOrRejectBillsBulkAction: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalType: BillApprovalType, description: string], {
|
|
7
8
|
approvalType: BillApprovalType;
|
|
8
9
|
description: string;
|
|
9
10
|
}, "billsBulkActionView/approveOrRejectBillsBulkAction", never, never>, cancelOrDeleteBillsBulkAction: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[operationType: "cancel" | "delete", description: string], {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearBillPayBulkActionView = exports.billsBulkActionSuccess = exports.incrementBulkActionProcessedCount = exports.autoReviewPendingApprovalBills = exports.billsBulkActionFailure = exports.cancelOrDeleteBillsBulkAction = exports.approveOrRejectBillsBulkAction = exports.submitDraftBillsBulkAction = exports.
|
|
4
|
+
exports.clearBillPayBulkActionView = exports.billsBulkActionSuccess = exports.incrementBulkActionProcessedCount = exports.autoReviewPendingApprovalBills = exports.billsBulkActionFailure = exports.cancelOrDeleteBillsBulkAction = exports.approveOrRejectBillsBulkAction = exports.submitDraftBillsBulkAction = exports.validateBillsBulkActionFailure = exports.validateBillsBulkActionSuccess = exports.validateBillsBulkAction = exports.clearAllBillsFromBulkActionList = exports.removeBillFromBulkActionList = exports.updateBillsBulkActionList = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const billsBulkActionViewState_1 = require("./billsBulkActionViewState");
|
|
7
7
|
exports.initialState = {
|
|
@@ -30,29 +30,27 @@ const billsBulkActionView = (0, toolkit_1.createSlice)({
|
|
|
30
30
|
draft.billsSelectedForBulkAction = action.payload;
|
|
31
31
|
},
|
|
32
32
|
removeBillFromBulkActionList(draft, action) {
|
|
33
|
-
var _a, _b
|
|
33
|
+
var _a, _b;
|
|
34
34
|
draft.billsSelectedForBulkAction =
|
|
35
35
|
draft.billsSelectedForBulkAction.filter((billId) => billId !== action.payload);
|
|
36
36
|
//remove warning if duplicates within batch
|
|
37
|
-
if (draft.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (id in draft.bulkReviewStateById) {
|
|
43
|
-
if (((_b = (_a = draft.bulkReviewStateById[id].error) === null || _a === void 0 ? void 0 : _a.duplicateTransactionIds) === null || _b === void 0 ? void 0 : _b.length) === 1 &&
|
|
44
|
-
((_d = (_c = draft.bulkReviewStateById[id].error) === null || _c === void 0 ? void 0 : _c.duplicateTransactionIds) === null || _d === void 0 ? void 0 : _d[0]) === action.payload) {
|
|
45
|
-
draft.bulkReviewStateById[id].status = 'valid';
|
|
46
|
-
draft.bulkReviewStateById[id].error = undefined;
|
|
47
|
-
}
|
|
37
|
+
if (draft.bulkReviewFetchState.fetchState === 'Completed') {
|
|
38
|
+
let duplicateIds = [];
|
|
39
|
+
(_b = (_a = draft.bulkReviewStateById[action.payload]) === null || _a === void 0 ? void 0 : _a.errors) === null || _b === void 0 ? void 0 : _b.forEach((error) => {
|
|
40
|
+
if (error.code === 'ERR_POSSIBLE_DUPLICATE_TRANSACTION') {
|
|
41
|
+
duplicateIds = [...duplicateIds, ...error.duplicateTransactionIds];
|
|
48
42
|
}
|
|
49
43
|
});
|
|
44
|
+
//remove the error with duplicates within batch
|
|
45
|
+
duplicateIds.forEach((id) => {
|
|
46
|
+
removeDuplicatesWithinBatch(draft.bulkReviewStateById, id, action.payload);
|
|
47
|
+
});
|
|
50
48
|
}
|
|
51
49
|
},
|
|
52
50
|
clearAllBillsFromBulkActionList(draft) {
|
|
53
51
|
draft.billsSelectedForBulkAction = [];
|
|
54
52
|
},
|
|
55
|
-
|
|
53
|
+
validateBillsBulkAction(draft, action) {
|
|
56
54
|
draft.bulkReviewFetchState = {
|
|
57
55
|
fetchState: 'In-Progress',
|
|
58
56
|
error: undefined,
|
|
@@ -61,38 +59,41 @@ const billsBulkActionView = (0, toolkit_1.createSlice)({
|
|
|
61
59
|
fetchState: 'Not-Started',
|
|
62
60
|
error: undefined,
|
|
63
61
|
};
|
|
64
|
-
draft.bulkOperationTypeSelected =
|
|
62
|
+
draft.bulkOperationTypeSelected = action.payload;
|
|
65
63
|
},
|
|
66
|
-
|
|
64
|
+
validateBillsBulkActionSuccess(draft, action) {
|
|
67
65
|
draft.bulkReviewFetchState = {
|
|
68
66
|
fetchState: 'Completed',
|
|
69
67
|
error: undefined,
|
|
70
68
|
};
|
|
71
69
|
action.payload.forEach((result) => {
|
|
72
|
-
var _a;
|
|
73
70
|
const transactionId = result.entity_id;
|
|
74
71
|
const status = (0, billsBulkActionViewState_1.toBulkReviewStatusCode)(result.status);
|
|
72
|
+
const errors = status !== 'valid' && result.errors != null
|
|
73
|
+
? result.errors.map((error) => {
|
|
74
|
+
var _a;
|
|
75
|
+
return ({
|
|
76
|
+
code: (0, billsBulkActionViewState_1.toBulkReviewErrorCode)(error.error_code),
|
|
77
|
+
message: error.error_message,
|
|
78
|
+
duplicateTransactionIds: (_a = error.duplicate_entity_ids) !== null && _a !== void 0 ? _a : [],
|
|
79
|
+
});
|
|
80
|
+
})
|
|
81
|
+
: undefined;
|
|
75
82
|
draft.bulkReviewStateById[transactionId] = {
|
|
76
83
|
transactionId,
|
|
77
84
|
status,
|
|
78
|
-
|
|
79
|
-
? {
|
|
80
|
-
code: (0, billsBulkActionViewState_1.toBulkReviewErrorCode)(result.error.error_code),
|
|
81
|
-
message: result.error.error_message,
|
|
82
|
-
duplicateTransactionIds: (_a = result.error.duplicate_entity_ids) !== null && _a !== void 0 ? _a : [],
|
|
83
|
-
}
|
|
84
|
-
: undefined,
|
|
85
|
+
errors,
|
|
85
86
|
};
|
|
86
87
|
});
|
|
87
88
|
},
|
|
88
|
-
|
|
89
|
+
validateBillsBulkActionFailure(draft, action) {
|
|
89
90
|
draft.bulkReviewFetchState = {
|
|
90
91
|
fetchState: 'Error',
|
|
91
92
|
error: action.payload,
|
|
92
93
|
};
|
|
93
94
|
},
|
|
94
95
|
autoReviewPendingApprovalBills(draft) {
|
|
95
|
-
draft.bulkOperationTypeSelected = '
|
|
96
|
+
draft.bulkOperationTypeSelected = 'review';
|
|
96
97
|
draft.billsSelectedForBulkAction.forEach((id) => {
|
|
97
98
|
draft.bulkReviewStateById[id] = {
|
|
98
99
|
transactionId: id,
|
|
@@ -162,5 +163,21 @@ const billsBulkActionView = (0, toolkit_1.createSlice)({
|
|
|
162
163
|
},
|
|
163
164
|
},
|
|
164
165
|
});
|
|
165
|
-
_a = billsBulkActionView.actions, exports.updateBillsBulkActionList = _a.updateBillsBulkActionList, exports.removeBillFromBulkActionList = _a.removeBillFromBulkActionList, exports.clearAllBillsFromBulkActionList = _a.clearAllBillsFromBulkActionList, exports.
|
|
166
|
+
_a = billsBulkActionView.actions, exports.updateBillsBulkActionList = _a.updateBillsBulkActionList, exports.removeBillFromBulkActionList = _a.removeBillFromBulkActionList, exports.clearAllBillsFromBulkActionList = _a.clearAllBillsFromBulkActionList, exports.validateBillsBulkAction = _a.validateBillsBulkAction, exports.validateBillsBulkActionSuccess = _a.validateBillsBulkActionSuccess, exports.validateBillsBulkActionFailure = _a.validateBillsBulkActionFailure, exports.submitDraftBillsBulkAction = _a.submitDraftBillsBulkAction, exports.approveOrRejectBillsBulkAction = _a.approveOrRejectBillsBulkAction, exports.cancelOrDeleteBillsBulkAction = _a.cancelOrDeleteBillsBulkAction, exports.billsBulkActionFailure = _a.billsBulkActionFailure, exports.autoReviewPendingApprovalBills = _a.autoReviewPendingApprovalBills, exports.incrementBulkActionProcessedCount = _a.incrementBulkActionProcessedCount, exports.billsBulkActionSuccess = _a.billsBulkActionSuccess, exports.clearBillPayBulkActionView = _a.clearBillPayBulkActionView;
|
|
166
167
|
exports.default = billsBulkActionView.reducer;
|
|
168
|
+
const removeDuplicatesWithinBatch = (draft, billId, removedBillId) => {
|
|
169
|
+
if (billId in draft) {
|
|
170
|
+
const allErrors = draft[billId].errors;
|
|
171
|
+
if (allErrors != null) {
|
|
172
|
+
const duplicateError = allErrors.find((error) => error.code === 'ERR_POSSIBLE_DUPLICATE_TRANSACTION');
|
|
173
|
+
if (duplicateError != null &&
|
|
174
|
+
duplicateError.duplicateTransactionIds.length === 1 &&
|
|
175
|
+
duplicateError.duplicateTransactionIds[0] === removedBillId) {
|
|
176
|
+
if (allErrors.length === 1) {
|
|
177
|
+
draft[billId].status = 'valid';
|
|
178
|
+
}
|
|
179
|
+
draft[billId].errors = allErrors.filter((error) => error.code !== 'ERR_POSSIBLE_DUPLICATE_TRANSACTION');
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
};
|
package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewSelector.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ import { RootState } from '../../../../reducer';
|
|
|
5
5
|
import { BulkOperationType } from '../../helpers';
|
|
6
6
|
import { BillTab, BillsSubTabType } from '../billList/billListState';
|
|
7
7
|
import { BulkOperationProgress, BulkReviewErrorCode, BulkReviewStatusCode } from './billsBulkActionViewState';
|
|
8
|
+
interface ReviewError {
|
|
9
|
+
reviewErrorCode: BulkReviewErrorCode;
|
|
10
|
+
reviewInfoMessage: string;
|
|
11
|
+
}
|
|
8
12
|
interface BillForReview {
|
|
9
13
|
transactionId: ID;
|
|
10
14
|
vendorName: string;
|
|
@@ -12,8 +16,7 @@ interface BillForReview {
|
|
|
12
16
|
isRecurring: boolean;
|
|
13
17
|
amount?: Amount;
|
|
14
18
|
reviewStatus?: BulkReviewStatusCode;
|
|
15
|
-
|
|
16
|
-
reviewInfoMessage?: string;
|
|
19
|
+
reviewErrors?: ReviewError[];
|
|
17
20
|
}
|
|
18
21
|
export interface BillsBulkReviewView extends SelectorView {
|
|
19
22
|
billsForReview: BillForReview[];
|
|
@@ -26,9 +26,12 @@ const getBillsBulkReviewView = (state) => {
|
|
|
26
26
|
const bulkSubmissionFetchState = billsBulkActionViewState.bulkSubmissionFetchState.fetchState;
|
|
27
27
|
if (bulkReviewFetchState === 'Completed') {
|
|
28
28
|
selectedTransactions = selectedTransactions.map((transaction) => {
|
|
29
|
-
var _a
|
|
29
|
+
var _a;
|
|
30
30
|
const reviewStateOfBill = billsBulkActionViewState.bulkReviewStateById[transaction.transactionId];
|
|
31
|
-
return Object.assign(Object.assign({}, transaction), { reviewStatus: getBillReviewStatus(reviewStateOfBill),
|
|
31
|
+
return Object.assign(Object.assign({}, transaction), { reviewStatus: getBillReviewStatus(reviewStateOfBill), reviewErrors: (_a = reviewStateOfBill === null || reviewStateOfBill === void 0 ? void 0 : reviewStateOfBill.errors) === null || _a === void 0 ? void 0 : _a.map((error) => ({
|
|
32
|
+
reviewInfoMessage: error.message,
|
|
33
|
+
reviewErrorCode: error.code,
|
|
34
|
+
})) });
|
|
32
35
|
});
|
|
33
36
|
}
|
|
34
37
|
return {
|
|
@@ -49,8 +52,15 @@ exports.getBillsBulkOperationProgress = getBillsBulkOperationProgress;
|
|
|
49
52
|
const getBillReviewStatus = (reviewedBill) => {
|
|
50
53
|
var _a;
|
|
51
54
|
if (reviewedBill != null) {
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
if (((_a = reviewedBill.errors) === null || _a === void 0 ? void 0 : _a.length) === 1) {
|
|
56
|
+
const errorCode = reviewedBill.errors[0].code;
|
|
57
|
+
return (0, exports.isBillConditionallyValid)(errorCode)
|
|
58
|
+
? 'valid'
|
|
59
|
+
: reviewedBill.status;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return reviewedBill.status;
|
|
63
|
+
}
|
|
54
64
|
}
|
|
55
65
|
return undefined;
|
|
56
66
|
};
|
|
@@ -13,16 +13,17 @@ export interface BillsBulkActionViewState {
|
|
|
13
13
|
bulkOperationTypeSelected: BulkOperationType;
|
|
14
14
|
bulkOperationProgress: BulkOperationProgress;
|
|
15
15
|
}
|
|
16
|
+
export interface BulkActionReviewError {
|
|
17
|
+
code: BulkReviewErrorCode;
|
|
18
|
+
message: string;
|
|
19
|
+
duplicateTransactionIds: ID[];
|
|
20
|
+
}
|
|
16
21
|
export interface BulkReviewState {
|
|
17
22
|
transactionId: ID;
|
|
18
23
|
status: BulkReviewStatusCode;
|
|
19
|
-
|
|
20
|
-
code: BulkReviewErrorCode;
|
|
21
|
-
message: string;
|
|
22
|
-
duplicateTransactionIds: ID[];
|
|
23
|
-
};
|
|
24
|
+
errors?: BulkActionReviewError[];
|
|
24
25
|
}
|
|
25
26
|
export declare const toBulkReviewStatusCode: (v: string) => "error" | "warning" | "valid";
|
|
26
27
|
export declare type BulkReviewStatusCode = ReturnType<typeof toBulkReviewStatusCode>;
|
|
27
|
-
export declare const toBulkReviewErrorCode: (v: string) => "ERR_INSUFFICIENT_DATA" | "ERR_INVOICE_DATE_OUTSIDE_ACCOUNTING_PERIOD" | "ERR_FUTURE_PAYMENT_DATE_SUPPORTED" | "ERR_POSSIBLE_DUPLICATE_TRANSACTION" | "ERR_INVALID_DATA" | "ERR_PAYMENT_DATE_CURRENT_OR_FUTURE_DATE_SUPPORTED" | "ERR_PHYSICAL_ADDRESS_REQUIRED" | "ERR_START_DATE_GT_END_DATE" | "ERR_RECURRING_PAYMENT_START_DATE_IS_PAST_DATE" | "ERR_INCORRECT_RECURRING_PAYMENT_CYCLE" | "ERR_INCORRECT_FIELD" | "ERR_UPDATE_VENDOR_DETAILS" | "ERR_AMOUNT_ZERO";
|
|
28
|
+
export declare const toBulkReviewErrorCode: (v: string) => "ERR_INSUFFICIENT_DATA" | "ERR_INVOICE_DATE_OUTSIDE_ACCOUNTING_PERIOD" | "ERR_FUTURE_PAYMENT_DATE_SUPPORTED" | "ERR_POSSIBLE_DUPLICATE_TRANSACTION" | "ERR_INVALID_DATA" | "ERR_PAYMENT_DATE_CURRENT_OR_FUTURE_DATE_SUPPORTED" | "ERR_PHYSICAL_ADDRESS_REQUIRED" | "ERR_START_DATE_GT_END_DATE" | "ERR_RECURRING_PAYMENT_START_DATE_IS_PAST_DATE" | "ERR_INCORRECT_RECURRING_PAYMENT_CYCLE" | "ERR_INCORRECT_FIELD" | "ERR_UPDATE_VENDOR_DETAILS" | "ERR_AMOUNT_ZERO" | "ERR_INSUFFICIENT_FUNDS" | "ERR_BANK_CONNECTION";
|
|
28
29
|
export declare type BulkReviewErrorCode = ReturnType<typeof toBulkReviewErrorCode>;
|
|
@@ -19,6 +19,8 @@ const BULK_REVIEW_ERROR_CODES = [
|
|
|
19
19
|
'ERR_INCORRECT_FIELD',
|
|
20
20
|
'ERR_UPDATE_VENDOR_DETAILS',
|
|
21
21
|
'ERR_AMOUNT_ZERO',
|
|
22
|
+
'ERR_INSUFFICIENT_FUNDS',
|
|
23
|
+
'ERR_BANK_CONNECTION',
|
|
22
24
|
];
|
|
23
25
|
const toBulkReviewErrorCode = (v) => (0, stringToUnion_1.stringToUnion)(v, BULK_REVIEW_ERROR_CODES);
|
|
24
26
|
exports.toBulkReviewErrorCode = toBulkReviewErrorCode;
|
package/lib/view/spendManagement/billPay/billsBulkActionView/epics/submitDraftBillsBulkActionEpic.js
CHANGED
|
@@ -70,8 +70,7 @@ function prepareBulkSubmitPayload(bulkActionState, transactionsState) {
|
|
|
70
70
|
let itemPayload = {
|
|
71
71
|
entity_id: id,
|
|
72
72
|
};
|
|
73
|
-
if (((_b = (_a = bulkActionState.bulkReviewStateById[id]) === null || _a === void 0 ? void 0 : _a.
|
|
74
|
-
'ERR_INVOICE_DATE_OUTSIDE_ACCOUNTING_PERIOD') {
|
|
73
|
+
if (((_b = (_a = bulkActionState.bulkReviewStateById[id]) === null || _a === void 0 ? void 0 : _a.errors) === null || _b === void 0 ? void 0 : _b.some((error) => error.code === 'ERR_INVOICE_DATE_OUTSIDE_ACCOUNTING_PERIOD')) === true) {
|
|
75
74
|
const billTransaction = transactionsState.transactionById[id];
|
|
76
75
|
if (billTransaction != null) {
|
|
77
76
|
itemPayload = Object.assign(Object.assign({}, itemPayload), { request_data: {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
5
|
+
import { validateBillsBulkAction, validateBillsBulkActionFailure, validateBillsBulkActionSuccess } from '../billsBulkActionViewReducer';
|
|
6
|
+
export type ActionType = ReturnType<typeof validateBillsBulkAction> | ReturnType<typeof validateBillsBulkActionSuccess> | ReturnType<typeof validateBillsBulkActionFailure>;
|
|
7
|
+
export declare const validateBillsBulkActionEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.validateBillsBulkActionEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
7
7
|
const billsBulkActionViewReducer_1 = require("../billsBulkActionViewReducer");
|
|
8
|
-
const
|
|
8
|
+
const validateBillsBulkActionEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(billsBulkActionViewReducer_1.validateBillsBulkAction.match), (0, operators_1.mergeMap)(() => {
|
|
9
9
|
const { billsBulkActionViewState } = state$.value;
|
|
10
|
-
const transactionIds = billsBulkActionViewState
|
|
10
|
+
const { billsSelectedForBulkAction: transactionIds, bulkOperationTypeSelected, } = billsBulkActionViewState;
|
|
11
11
|
const queryParam = {
|
|
12
12
|
entity_ids: transactionIds,
|
|
13
|
+
validations: bulkOperationTypeSelected === 'send_for_approval'
|
|
14
|
+
? 'all'
|
|
15
|
+
: 'sufficient_funds',
|
|
13
16
|
};
|
|
14
17
|
return zeniAPI
|
|
15
18
|
.getJSON(`${zeniAPI.apiEndPoints.spendManagementMicroServiceBaseUrl}/1.0/bulk/bills/transactions/validate?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
@@ -17,13 +20,13 @@ const reviewDraftBillsBulkActionEpic = (actions$, state$, zeniAPI) => actions$.p
|
|
|
17
20
|
var _a, _b;
|
|
18
21
|
if ((0, responsePayload_1.isSuccessStatus)(response)) {
|
|
19
22
|
const actions = [];
|
|
20
|
-
actions.push((0, billsBulkActionViewReducer_1.
|
|
23
|
+
actions.push((0, billsBulkActionViewReducer_1.validateBillsBulkActionSuccess)((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.validation_results) !== null && _b !== void 0 ? _b : []));
|
|
21
24
|
return (0, rxjs_1.from)(actions);
|
|
22
25
|
}
|
|
23
26
|
else {
|
|
24
|
-
return (0, rxjs_1.of)((0, billsBulkActionViewReducer_1.
|
|
27
|
+
return (0, rxjs_1.of)((0, billsBulkActionViewReducer_1.validateBillsBulkActionFailure)(response.status));
|
|
25
28
|
}
|
|
26
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, billsBulkActionViewReducer_1.
|
|
29
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, billsBulkActionViewReducer_1.validateBillsBulkActionFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Bill bulk review action REST API call errored out ' +
|
|
27
30
|
JSON.stringify(error))))));
|
|
28
31
|
}));
|
|
29
|
-
exports.
|
|
32
|
+
exports.validateBillsBulkActionEpic = validateBillsBulkActionEpic;
|