@zeniai/client-epic-state 4.7.72 → 4.7.74
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 +5 -9
- package/lib/commonStateTypes/workingDayHelper.js +12 -36
- package/lib/entity/account/accountPayload.d.ts +1 -1
- package/lib/entity/billPay/billTransaction/billTransactionPayload.d.ts +0 -3
- package/lib/entity/billPay/billTransaction/billTransactionPayload.js +2 -2
- package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +0 -3
- package/lib/entity/chargeCard/chargeCard.d.ts +2 -2
- package/lib/entity/entityApprovalStatus/entityApprovalStatusPayload.d.ts +0 -1
- package/lib/entity/entityApprovalStatus/entityApprovalStatusPayload.js +0 -1
- package/lib/entity/entityApprovalStatus/entityApprovalStatusState.d.ts +0 -1
- package/lib/entity/paymentAccount/paymentAccountPayload.d.ts +0 -1
- package/lib/entity/paymentAccount/paymentAccountPayload.js +1 -2
- package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +0 -2
- package/lib/entity/paymentAccount/paymentAccountSelector.js +1 -14
- package/lib/entity/paymentAccount/paymentAccountState.d.ts +0 -1
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -4
- package/lib/entity/tenant/clearAllEpic.js +0 -4
- package/lib/entity/transaction/stateTypes/attachment.js +5 -5
- package/lib/epic.d.ts +1 -5
- package/lib/epic.js +1 -5
- package/lib/index.d.ts +6 -16
- package/lib/index.js +13 -32
- package/lib/reducer.d.ts +0 -6
- package/lib/reducer.js +0 -6
- package/lib/view/accountList/accountListReducer.js +1 -2
- package/lib/view/accountList/accountListState.d.ts +1 -1
- package/lib/view/accountList/fetchAccountListEpic.js +7 -16
- package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +0 -1
- package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +1 -1
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewPayload.d.ts +0 -3
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.d.ts +0 -5
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +2 -13
- package/lib/view/spendManagement/billPay/billDetailView/epics/cancelAndDeleteBillEpic.d.ts +1 -2
- package/lib/view/spendManagement/billPay/billDetailView/epics/cancelAndDeleteBillEpic.js +8 -19
- package/lib/view/spendManagement/billPay/billDetailView/epics/deleteBillEpic.d.ts +1 -2
- package/lib/view/spendManagement/billPay/billDetailView/epics/deleteBillEpic.js +4 -14
- package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.d.ts +1 -2
- package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.js +2 -5
- package/lib/view/spendManagement/billPay/billList/billListPayload.d.ts +0 -2
- package/lib/view/spendManagement/billPay/billList/billListSelector.d.ts +0 -3
- package/lib/view/spendManagement/billPay/billList/billListSelector.js +2 -10
- package/lib/view/spendManagement/billPay/billList/fetchBillListPerTabEpic.d.ts +1 -2
- package/lib/view/spendManagement/billPay/billList/fetchBillListPerTabEpic.js +1 -3
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.d.ts +0 -4
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +9 -31
- package/lib/view/spendManagement/billPay/editBillView/editBillViewPayload.d.ts +0 -4
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +0 -17
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +2 -10
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +14 -59
- package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +0 -28
- package/lib/view/spendManagement/billPay/editBillView/editBillViewState.js +0 -1
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +3 -3
- package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.js +2 -13
- package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +2 -3
- package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.d.ts +24 -11
- package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.js +14 -100
- package/lib/view/spendManagement/commonHistoryView/commonHistory.d.ts +0 -1
- package/lib/view/spendManagement/commonHistoryView/commonHistoryPayload.d.ts +0 -1
- package/lib/view/spendManagement/commonHistoryView/commonHistoryPayload.js +5 -9
- package/lib/view/spendManagement/helpers.d.ts +1 -11
- package/lib/view/spendManagement/helpers.js +1 -134
- package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.d.ts +0 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigPayload.d.ts +0 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigPayload.js +0 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigReducer.js +1 -3
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigSelector.d.ts +0 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigSelector.js +1 -2
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigState.d.ts +0 -1
- package/package.json +4 -5
- package/lib/entity/billPay/recurringBills/recurringBillsPayload.d.ts +0 -34
- package/lib/entity/billPay/recurringBills/recurringBillsPayload.js +0 -44
- package/lib/entity/billPay/recurringBills/recurringBillsReducer.d.ts +0 -6
- package/lib/entity/billPay/recurringBills/recurringBillsReducer.js +0 -40
- package/lib/entity/billPay/recurringBills/recurringBillsState.d.ts +0 -33
- package/lib/entity/billPay/recurringBills/recurringBillsState.js +0 -14
- package/lib/view/settingsView/epic/fetchBankAccountsListEpic.d.ts +0 -22
- package/lib/view/settingsView/epic/fetchBankAccountsListEpic.js +0 -30
- package/lib/view/settingsView/epic/fetchBankConnectionsViewEpic.d.ts +0 -6
- package/lib/view/settingsView/epic/fetchBankConnectionsViewEpic.js +0 -14
- package/lib/view/settingsView/epic/fetchMyProfileEpic.d.ts +0 -43
- package/lib/view/settingsView/epic/fetchMyProfileEpic.js +0 -50
- package/lib/view/settingsView/epic/fetchMyProfileViewEpic.d.ts +0 -7
- package/lib/view/settingsView/epic/fetchMyProfileViewEpic.js +0 -17
- package/lib/view/settingsView/settingsViewPayload.d.ts +0 -8
- package/lib/view/settingsView/settingsViewPayload.js +0 -2
- package/lib/view/settingsView/settingsViewReducer.d.ts +0 -13
- package/lib/view/settingsView/settingsViewReducer.js +0 -71
- package/lib/view/settingsView/settingsViewSelector.d.ts +0 -14
- package/lib/view/settingsView/settingsViewSelector.js +0 -119
- package/lib/view/settingsView/settingsViewState.d.ts +0 -12
- package/lib/view/settingsView/settingsViewState.js +0 -2
- package/lib/view/settingsView/types/settingsViewSelectorTypes.d.ts +0 -29
- package/lib/view/settingsView/types/settingsViewSelectorTypes.js +0 -2
|
@@ -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.
|
|
6
|
+
exports.getCurrentPaymentToOption = exports.toPaymentToOption = exports.getPaymentMethodType = exports.getBillPayConfigList = exports.getEditBillDetail = void 0;
|
|
7
7
|
const get_1 = __importDefault(require("lodash/get"));
|
|
8
8
|
const has_1 = __importDefault(require("lodash/has"));
|
|
9
9
|
const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
|
|
@@ -28,8 +28,8 @@ const billPayReviewSelector_1 = require("../billPayReview/billPayReviewSelector"
|
|
|
28
28
|
const paymentInstrumentSelector_1 = require("../../../../entity/paymentInstrument/paymentInstrumentSelector");
|
|
29
29
|
const billPayConfigPayload_1 = require("../billPayConfig/billPayConfigPayload");
|
|
30
30
|
const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, billId) => {
|
|
31
|
-
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
|
|
32
|
-
const { accountListState, accountState, bankAccountState, billDetailViewState, setupViewState, billTransactionState, billPayConfigState, classListState, classState, editBillDetailViewState, paymentAccountState, vendorState, tenantState, companyState, userState, commonHistoryState, contactState, paymentInstrumentState,
|
|
31
|
+
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;
|
|
32
|
+
const { accountListState, accountState, bankAccountState, billDetailViewState, setupViewState, billTransactionState, billPayConfigState, classListState, classState, editBillDetailViewState, paymentAccountState, vendorState, tenantState, companyState, userState, commonHistoryState, contactState, paymentInstrumentState, } = state;
|
|
33
33
|
let transaction = null;
|
|
34
34
|
let recommendations = {};
|
|
35
35
|
if (billId != null) {
|
|
@@ -85,13 +85,10 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, billId)
|
|
|
85
85
|
paymentDetailsSection: getPaymentSection(state, withdrawFromList, {}),
|
|
86
86
|
totalAmount: sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData.totalAmount,
|
|
87
87
|
};
|
|
88
|
-
const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, '
|
|
88
|
+
const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
|
|
89
89
|
let billPayInfo = undefined;
|
|
90
90
|
let toAccountVendorEmail = undefined;
|
|
91
91
|
let isCollectToAccountInfoFromVendorContact = false;
|
|
92
|
-
let isRecurring = false;
|
|
93
|
-
let recurringConfig;
|
|
94
|
-
let recurringBillInstances;
|
|
95
92
|
if (billId != null) {
|
|
96
93
|
const transaction = (0, get_1.default)(billTransactionState.transactionById, billId, undefined);
|
|
97
94
|
isDeleted = (_f = transaction === null || transaction === void 0 ? void 0 : transaction.isDeleted) !== null && _f !== void 0 ? _f : false;
|
|
@@ -150,24 +147,17 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, billId)
|
|
|
150
147
|
if (billViewState != null) {
|
|
151
148
|
fetchState = (0, reduceFetchState_1.reduceFetchState)([
|
|
152
149
|
billViewState,
|
|
153
|
-
accountListState.byReportId.
|
|
150
|
+
accountListState.byReportId.accountList,
|
|
154
151
|
classListState,
|
|
155
152
|
]).fetchState;
|
|
156
153
|
deleteStatus = billViewState.deleteStatus;
|
|
157
154
|
billActivities = (0, billDetailViewSelector_1.getBillActivities)(state, billId, billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.stage.code);
|
|
158
155
|
}
|
|
159
156
|
}
|
|
160
|
-
//recurringBill Details
|
|
161
|
-
isRecurring = (_r = transaction === null || transaction === void 0 ? void 0 : transaction.isRecurring) !== null && _r !== void 0 ? _r : false;
|
|
162
|
-
if (isRecurring && transaction != null) {
|
|
163
|
-
const { recurringConfigLocalData, recurringBillInstancesLocalData } = (0, exports.getRecurringBillLocalData)(recurringBillState, transaction);
|
|
164
|
-
recurringConfig = recurringConfigLocalData;
|
|
165
|
-
recurringBillInstances = recurringBillInstancesLocalData;
|
|
166
|
-
}
|
|
167
157
|
}
|
|
168
158
|
else {
|
|
169
159
|
fetchState = (0, reduceFetchState_1.reduceFetchState)([
|
|
170
|
-
accountListState.byReportId
|
|
160
|
+
accountListState.byReportId['accountList'],
|
|
171
161
|
classListState,
|
|
172
162
|
]).fetchState;
|
|
173
163
|
}
|
|
@@ -187,9 +177,9 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, billId)
|
|
|
187
177
|
? (0, vendorSelector_1.getVendorByVendorId)(vendorState, updatedRecord.vendor.id)
|
|
188
178
|
: undefined;
|
|
189
179
|
file = updatedRecord.file != null ? updatedRecord.file : undefined;
|
|
190
|
-
const bankAccInBill = (0, bankAccountSelector_1.getBankAccountByBankAccountId)(bankAccountState, (
|
|
191
|
-
const vendorBankAccounts = (0, bankAccountSelector_1.getBankAccountsByBankAccountIds)(bankAccountState, (
|
|
192
|
-
const vendorPaymentInstruments = (0, paymentInstrumentSelector_1.getPaymentInstrumentsByIds)(paymentInstrumentState, (
|
|
180
|
+
const bankAccInBill = (0, bankAccountSelector_1.getBankAccountByBankAccountId)(bankAccountState, (_s = (_r = updatedRecord.paymentDetailsSection) === null || _r === void 0 ? void 0 : _r.paymentTo) !== null && _s !== void 0 ? _s : '');
|
|
181
|
+
const vendorBankAccounts = (0, bankAccountSelector_1.getBankAccountsByBankAccountIds)(bankAccountState, (_t = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.bankAccountIds) !== null && _t !== void 0 ? _t : []);
|
|
182
|
+
const vendorPaymentInstruments = (0, paymentInstrumentSelector_1.getPaymentInstrumentsByIds)(paymentInstrumentState, (_u = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.paymentInstrumentIds) !== null && _u !== void 0 ? _u : []);
|
|
193
183
|
const isBankAccInBillExistInVendor = bankAccInBill != null
|
|
194
184
|
? vendorBankAccounts
|
|
195
185
|
.map((bankAc) => bankAc.bankAccountId)
|
|
@@ -239,10 +229,6 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, billId)
|
|
|
239
229
|
(recommendedVendor === null || recommendedVendor === void 0 ? void 0 : recommendedVendor.vendorCurrencyCode) != null) {
|
|
240
230
|
whatForSection.currencyCode = recommendedVendor.vendorCurrencyCode;
|
|
241
231
|
}
|
|
242
|
-
isRecurring = (_w = sourceBillDetail.billDetailLocalData.isRecurring) !== null && _w !== void 0 ? _w : false;
|
|
243
|
-
recurringConfig = sourceBillDetail.billDetailLocalData.recurringConfig;
|
|
244
|
-
recurringBillInstances =
|
|
245
|
-
sourceBillDetail.billDetailLocalData.recurringBillInstances;
|
|
246
232
|
//add paymentToOption on initial bill load for collect from email
|
|
247
233
|
if (isCollectToAccountInfoFromVendorContact &&
|
|
248
234
|
toAccountVendorEmail != null &&
|
|
@@ -259,7 +245,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, billId)
|
|
|
259
245
|
}
|
|
260
246
|
const vendorContactSaveStatus = editBillDetailViewState.updateVendorContactState;
|
|
261
247
|
const lineDetailSection = {};
|
|
262
|
-
const lineDetailSectionUpdatesByLineId = (
|
|
248
|
+
const lineDetailSectionUpdatesByLineId = (_w = (_v = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData) === null || _v === void 0 ? void 0 : _v.updatesByLineId) !== null && _w !== void 0 ? _w : {};
|
|
263
249
|
const classList = (0, classListSelector_1.getClassList)(classState, classListState);
|
|
264
250
|
if (accountList.fetchState === 'Completed') {
|
|
265
251
|
Object.keys(lineDetailSectionUpdatesByLineId).forEach((lineId) => {
|
|
@@ -277,16 +263,16 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, billId)
|
|
|
277
263
|
});
|
|
278
264
|
}
|
|
279
265
|
const billHistory = (0, commonHistorySelector_1.getActivityHistory)(commonHistoryState, billId !== null && billId !== void 0 ? billId : '', 'bill_pay');
|
|
280
|
-
const accountsHeirarchyList = (0, accountListSelector_1.getNestedAccountListHeirarchy)(accountListState, '
|
|
266
|
+
const accountsHeirarchyList = (0, accountListSelector_1.getNestedAccountListHeirarchy)(accountListState, 'accountList');
|
|
281
267
|
const classHeirarchyList = (0, classListSelector_1.getNestedClassListHeirarchy)(classListState);
|
|
282
268
|
const duplicateBills = (0, billPayReviewSelector_1.getDuplicateBills)(state, billId);
|
|
283
269
|
return {
|
|
284
270
|
recommendedVendor,
|
|
285
271
|
duplicateBills,
|
|
286
272
|
fetchState: fetchState,
|
|
287
|
-
saveStatus: (
|
|
288
|
-
error: (
|
|
289
|
-
uploadStatus: (
|
|
273
|
+
saveStatus: (_x = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.saveStatus) !== null && _x !== void 0 ? _x : undefined,
|
|
274
|
+
error: (_z = (_y = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.fetchStatus) === null || _y === void 0 ? void 0 : _y.error) !== null && _z !== void 0 ? _z : undefined,
|
|
275
|
+
uploadStatus: (_0 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.uploadFetchState) !== null && _0 !== void 0 ? _0 : undefined,
|
|
290
276
|
version: 0,
|
|
291
277
|
createdBy,
|
|
292
278
|
createTime,
|
|
@@ -322,9 +308,6 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, billId)
|
|
|
322
308
|
classHeirarchyList,
|
|
323
309
|
latestApprovedDate: (0, helpers_1.getLatestApprovalDate)(billActivities),
|
|
324
310
|
recommendationByLineID: recommendations,
|
|
325
|
-
isRecurring,
|
|
326
|
-
recurringBillInstances,
|
|
327
|
-
recurringConfig,
|
|
328
311
|
};
|
|
329
312
|
};
|
|
330
313
|
exports.getEditBillDetail = getEditBillDetail;
|
|
@@ -476,31 +459,3 @@ function getCurrentPaymentToOption(state, id) {
|
|
|
476
459
|
return selectedOption != null ? toPaymentToOption(selectedOption) : undefined;
|
|
477
460
|
}
|
|
478
461
|
exports.getCurrentPaymentToOption = getCurrentPaymentToOption;
|
|
479
|
-
const getRecurringBillLocalData = (recurringBillState, transaction) => {
|
|
480
|
-
let recurringConfigLocalData = undefined;
|
|
481
|
-
let recurringBillInstancesLocalData = [];
|
|
482
|
-
let recurringBillDetail = undefined;
|
|
483
|
-
if (transaction.recurringBillConfigId != null) {
|
|
484
|
-
recurringBillDetail = (0, get_1.default)(recurringBillState.recurringBillDetailByConfigId, transaction.recurringBillConfigId, undefined);
|
|
485
|
-
}
|
|
486
|
-
if (recurringBillDetail != null) {
|
|
487
|
-
const { recurringBillInstances: currentRecurringBillInstances, recurringBillConfig, } = recurringBillDetail;
|
|
488
|
-
recurringBillInstancesLocalData = [...currentRecurringBillInstances]
|
|
489
|
-
.map((recurringBill) => ({
|
|
490
|
-
instance: recurringBill.instance,
|
|
491
|
-
amount: recurringBill.amount,
|
|
492
|
-
stage: recurringBill.stage,
|
|
493
|
-
paymentDate: recurringBill.paymentDate,
|
|
494
|
-
vendorReceiveDate: recurringBill.vendorReceiveDate,
|
|
495
|
-
vendorReceiveDateNotes: recurringBill.vendorReceiveDateNotes,
|
|
496
|
-
readonly: transaction.recurringBillInstance != null
|
|
497
|
-
? recurringBill.instance < transaction.recurringBillInstance
|
|
498
|
-
: false,
|
|
499
|
-
transactionId: recurringBill.transactionId,
|
|
500
|
-
}))
|
|
501
|
-
.sort((a, b) => a.instance - b.instance);
|
|
502
|
-
recurringConfigLocalData = Object.assign(Object.assign({}, recurringBillConfig), { currentInstance: transaction.recurringBillInstance });
|
|
503
|
-
}
|
|
504
|
-
return { recurringConfigLocalData, recurringBillInstancesLocalData };
|
|
505
|
-
};
|
|
506
|
-
exports.getRecurringBillLocalData = getRecurringBillLocalData;
|
|
@@ -11,8 +11,6 @@ import { InternationalTransferFeeBearerPaymentMethod } from '../../../../entity/
|
|
|
11
11
|
import { PaymentInstrument } from '../../../../entity/paymentInstrument/paymentInstrument';
|
|
12
12
|
import { BankAccount } from '../../../../entity/bankAccount/bankAccount';
|
|
13
13
|
import { Contact } from '../../../../entity/billPay/contact/contact';
|
|
14
|
-
import { RecurringBillFrequency } from '../../../../entity/billPay/recurringBills/recurringBillsState';
|
|
15
|
-
import { BillStage } from '../../../../entity/billPay/billTransaction/billTransactionState';
|
|
16
14
|
export interface EditBillDetail {
|
|
17
15
|
fetchStatus: FetchStateAndError;
|
|
18
16
|
saveStatus: FetchStateAndError;
|
|
@@ -30,16 +28,6 @@ export interface EditBillDetailViewState {
|
|
|
30
28
|
editBillStateById: Record<BillTransactionDetailKey, EditBillDetail>;
|
|
31
29
|
updateVendorContactState: FetchStateAndError;
|
|
32
30
|
}
|
|
33
|
-
export interface RecurringBillInstance {
|
|
34
|
-
instance: number;
|
|
35
|
-
vendorReceiveDate: ZeniDate;
|
|
36
|
-
vendorReceiveDateNotes: string;
|
|
37
|
-
amount?: number;
|
|
38
|
-
stage?: BillStage;
|
|
39
|
-
readonly?: boolean;
|
|
40
|
-
paymentDate?: ZeniDate;
|
|
41
|
-
transactionId?: ID;
|
|
42
|
-
}
|
|
43
31
|
export interface BillDetailLocalData {
|
|
44
32
|
vendor?: Vendor;
|
|
45
33
|
candidateVendorname?: string;
|
|
@@ -54,9 +42,6 @@ export interface BillDetailLocalData {
|
|
|
54
42
|
isCollectToAccountInfoFromVendorContact: boolean;
|
|
55
43
|
currencyConversionState?: FetchStateAndError;
|
|
56
44
|
recommendedVendorId?: ID;
|
|
57
|
-
isRecurring: boolean;
|
|
58
|
-
recurringConfig?: RecurringBillConfigLocalData;
|
|
59
|
-
recurringBillInstances?: RecurringBillInstance[];
|
|
60
45
|
}
|
|
61
46
|
export interface WhatForSection {
|
|
62
47
|
invoiceNumber?: string;
|
|
@@ -88,16 +73,3 @@ export declare const PAYMENT_MODE_TYPE: readonly ["BankAccount", "Contact", "Pay
|
|
|
88
73
|
export declare const toPaymentModeType: (v: string) => "BankAccount" | "Contact" | "PaymentInstrument";
|
|
89
74
|
export declare type PaymentModeType = ReturnType<typeof toPaymentModeType>;
|
|
90
75
|
export declare type PaymentMode = BankAccount | PaymentInstrument | Contact;
|
|
91
|
-
export declare type EditRecurringBillType = 'current' | 'all';
|
|
92
|
-
export interface RecurringBillConfigLocalData {
|
|
93
|
-
isApprovalRequired: boolean;
|
|
94
|
-
frequency?: RecurringBillFrequency;
|
|
95
|
-
totalPaymentCycles: number;
|
|
96
|
-
id?: ID;
|
|
97
|
-
startDate?: ZeniDate;
|
|
98
|
-
endDate?: ZeniDate;
|
|
99
|
-
currentInstance?: number;
|
|
100
|
-
endDateSelectorOptionType?: 'date' | 'payments';
|
|
101
|
-
isActive: boolean;
|
|
102
|
-
updateRecurringBills?: EditRecurringBillType;
|
|
103
|
-
}
|
|
@@ -16,7 +16,7 @@ const fetchEditBillDetailPageEpic = (actions$, state$) => actions$.pipe((0, oper
|
|
|
16
16
|
const billDetailActions = [];
|
|
17
17
|
const state = state$.value;
|
|
18
18
|
if (cacheOverride == true) {
|
|
19
|
-
billDetailActions.push((0, accountListReducer_1.fetchAccountList)('
|
|
19
|
+
billDetailActions.push((0, accountListReducer_1.fetchAccountList)('accountList', true));
|
|
20
20
|
billDetailActions.push((0, classListReducer_1.fetchClassList)());
|
|
21
21
|
billDetailActions.push((0, vendorTypeListReducer_1.fetchVendorTypeList)());
|
|
22
22
|
billDetailActions.push((0, ownerListReducer_1.fetchOwnerList)());
|
|
@@ -35,10 +35,10 @@ const fetchEditBillDetailPageEpic = (actions$, state$) => actions$.pipe((0, oper
|
|
|
35
35
|
state.ownerListState.hasValidState() === false) {
|
|
36
36
|
billDetailActions.push((0, ownerListReducer_1.fetchOwnerList)());
|
|
37
37
|
}
|
|
38
|
-
const accountList = state.accountListState.byReportId
|
|
38
|
+
const accountList = state.accountListState.byReportId.accountList;
|
|
39
39
|
if (accountList.hasValidState() === false &&
|
|
40
40
|
accountList.fetchState !== 'In-Progress') {
|
|
41
|
-
billDetailActions.push((0, accountListReducer_1.fetchAccountList)('
|
|
41
|
+
billDetailActions.push((0, accountListReducer_1.fetchAccountList)('accountList', true));
|
|
42
42
|
}
|
|
43
43
|
const classList = state.classListState;
|
|
44
44
|
if (classList.hasValidState() === false &&
|
package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.js
CHANGED
|
@@ -94,8 +94,8 @@ const initializeBillToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
|
|
|
94
94
|
const editBillState = (0, get_1.default)(state.editBillDetailViewState.editBillStateById, detailKey, undefined);
|
|
95
95
|
const billDetail = (0, get_1.default)(state.billDetailViewState.billDetailById, detailKey, undefined);
|
|
96
96
|
const transaction = (0, get_1.default)(state.billTransactionState.transactionById, billId, undefined);
|
|
97
|
-
const { accountListState, accountState, classListState, classState
|
|
98
|
-
const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, '
|
|
97
|
+
const { accountListState, accountState, classListState, classState } = state;
|
|
98
|
+
const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
|
|
99
99
|
const classList = (0, classListSelector_1.getClassList)(classState, classListState);
|
|
100
100
|
const recommendations = transaction === null || transaction === void 0 ? void 0 : transaction.recommendations;
|
|
101
101
|
/* check vendor info is present in local store or not.
|
|
@@ -155,14 +155,6 @@ const initializeBillToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
|
|
|
155
155
|
const candidateVendorname = transaction.candidateVendorName;
|
|
156
156
|
const toAccountVendorEmail = transaction.billPayInfo.toAccountVendorEmail;
|
|
157
157
|
const isCollectToAccountInfoFromVendorContact = transaction.billPayInfo.isCollectToAccountInfoFromVendorContact;
|
|
158
|
-
const isRecurring = transaction.isRecurring;
|
|
159
|
-
let recurringConfig;
|
|
160
|
-
let recurringBillInstances = undefined;
|
|
161
|
-
if (isRecurring) {
|
|
162
|
-
const { recurringConfigLocalData, recurringBillInstancesLocalData } = (0, editBillViewSelector_1.getRecurringBillLocalData)(recurringBillState, transaction);
|
|
163
|
-
recurringConfig = recurringConfigLocalData;
|
|
164
|
-
recurringBillInstances = recurringBillInstancesLocalData;
|
|
165
|
-
}
|
|
166
158
|
const billDetailLocalData = {
|
|
167
159
|
vendor,
|
|
168
160
|
whatForSection,
|
|
@@ -174,9 +166,6 @@ const initializeBillToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
|
|
|
174
166
|
candidateVendorname,
|
|
175
167
|
toAccountVendorEmail,
|
|
176
168
|
isCollectToAccountInfoFromVendorContact,
|
|
177
|
-
isRecurring,
|
|
178
|
-
recurringConfig,
|
|
179
|
-
recurringBillInstances,
|
|
180
169
|
};
|
|
181
170
|
const actions = [
|
|
182
171
|
(0, editBillViewReducer_1.saveBillUpdatesToLocalStore)({ billDetailLocalData, billId }),
|
|
@@ -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;
|
|
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, 'accountList');
|
|
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,7 +212,6 @@ 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,
|
|
216
215
|
};
|
|
217
216
|
};
|
|
218
217
|
exports.toBillDetailLocalData = toBillDetailLocalData;
|
|
@@ -3,15 +3,28 @@ 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';
|
|
8
6
|
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
9
|
-
export declare type ActionType = ReturnType<typeof saveBillDetail> | ReturnType<typeof updateBillTransaction> | ReturnType<typeof openSnackbar> | ReturnType<typeof saveBillSuccessOrFailure
|
|
10
|
-
export declare const saveBillDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
+
payload: import("../../../../../entity/billPay/billTransaction/billTransactionPayload").BillTransactionPayload;
|
|
10
|
+
type: string;
|
|
11
|
+
} | {
|
|
12
|
+
payload: {
|
|
13
|
+
messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_monthEndEmailSent" | "cockpit_monthEndEmailSave" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_setup" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "zeni_account_accept_term" | "update_vendor" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "charge_card_setup" | "charge_card_accept_term";
|
|
14
|
+
messageText: "failed" | "success";
|
|
15
|
+
type: import("../../../../..").SnackbarMessageType;
|
|
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
|
+
}>;
|
|
@@ -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.
|
|
6
|
+
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,15 +15,11 @@ 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");
|
|
19
18
|
const billDetailViewState_1 = require("../../billDetailView/billDetailViewState");
|
|
20
19
|
const billPayConfigState_1 = require("../../billPayConfig/billPayConfigState");
|
|
21
20
|
const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
|
|
22
21
|
const billPayConfigPayload_1 = require("../../billPayConfig/billPayConfigPayload");
|
|
23
22
|
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");
|
|
27
23
|
const saveBillDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(editBillViewReducer_1.saveBillDetail.match), (0, operators_1.mergeMap)((action) => {
|
|
28
24
|
const state = state$.value;
|
|
29
25
|
const { billStageCode, billId, isLocalCurrencyEnabled, isVendorRecommendationEnabled, } = action.payload;
|
|
@@ -31,30 +27,21 @@ const saveBillDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, oper
|
|
|
31
27
|
const billDetail = billId != null
|
|
32
28
|
? state.editBillDetailViewState.editBillStateById[key]
|
|
33
29
|
: state.editBillDetailViewState.newBillState;
|
|
34
|
-
const payload = prepareSaveBillPayload(state.accountState, state.billTransactionState, state.paymentAccountState, state.setupViewState, state.vendorState,
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return saveBillApi.pipe((0, operators_1.mergeMap)((response) => {
|
|
41
|
-
var _a, _b, _c, _d;
|
|
30
|
+
const payload = prepareSaveBillPayload(state.accountState, state.billTransactionState, state.paymentAccountState, state.setupViewState, state.vendorState, billDetail, billStageCode, isVendorRecommendationEnabled, isLocalCurrencyEnabled);
|
|
31
|
+
const saveVendorApi = billId != null
|
|
32
|
+
? zeniAPI.putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/bills/transactions/${action.payload.billId}`, payload)
|
|
33
|
+
: zeniAPI.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/bills/transactions`, payload);
|
|
34
|
+
return saveVendorApi.pipe((0, operators_1.mergeMap)((response) => {
|
|
35
|
+
var _a, _b;
|
|
42
36
|
if ((0, responsePayload_1.isSuccessResponse)(response) &&
|
|
43
37
|
((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.transactions[0]) === null || _b === void 0 ? void 0 : _b.transaction_id) != null) {
|
|
44
|
-
|
|
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)({
|
|
38
|
+
return (0, rxjs_1.of)((0, billTransactionReducer_1.updateBillTransaction)(response.data.transactions[0]), (0, editBillViewReducer_1.saveBillSuccessOrFailure)('Completed', action.payload.billId), (0, snackbarReducer_1.openSnackbar)({
|
|
51
39
|
messageSection: billStageCode === 'pending_approval'
|
|
52
40
|
? 'bill_pay_sent_for_approval'
|
|
53
41
|
: 'bill_pay_updated',
|
|
54
42
|
messageText: 'success',
|
|
55
43
|
type: 'success',
|
|
56
44
|
}));
|
|
57
|
-
return (0, rxjs_1.from)(actions);
|
|
58
45
|
}
|
|
59
46
|
else {
|
|
60
47
|
return (0, rxjs_1.of)((0, editBillViewReducer_1.saveBillSuccessOrFailure)('Error', action.payload.billId, response.status), (0, snackbarReducer_1.openSnackbar)({
|
|
@@ -72,20 +59,9 @@ const saveBillDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, oper
|
|
|
72
59
|
}), (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)}`)))));
|
|
73
60
|
}));
|
|
74
61
|
exports.saveBillDetailEpic = saveBillDetailEpic;
|
|
75
|
-
|
|
76
|
-
|
|
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;
|
|
62
|
+
function prepareSaveBillPayload(accountState, billTransactionState, paymentAccountState, setupViewState, vendorState, billDetail, billStageCode, isVendorRecommendationEnabled, isLocalCurrencyEnabled) {
|
|
63
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16;
|
|
87
64
|
const billId = billDetail.billId;
|
|
88
|
-
let detail;
|
|
89
65
|
const withdrawFromList = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, setupViewState.accountDetails.paymentAccountIds);
|
|
90
66
|
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 : '');
|
|
91
67
|
const recommendedVendor = billDetail.billDetailLocalData.recommendedVendorId != null
|
|
@@ -94,7 +70,6 @@ function prepareSaveBillPayload(accountState, billTransactionState, paymentAccou
|
|
|
94
70
|
const isRecommendedVendor = isVendorRecommendationEnabled &&
|
|
95
71
|
recommendedVendor != null &&
|
|
96
72
|
billDetail.addBillAutoFields.tentativeVendorName != null;
|
|
97
|
-
const isRecurring = Boolean(billDetail.billDetailLocalData.isRecurring) === true;
|
|
98
73
|
const payload = {
|
|
99
74
|
vendor_id: isRecommendedVendor
|
|
100
75
|
? recommendedVendor.qboId
|
|
@@ -155,71 +130,20 @@ function prepareSaveBillPayload(accountState, billTransactionState, paymentAccou
|
|
|
155
130
|
return (0, transactionLinePayload_1.toAccountAndClassLinePayload)(lineAsTransactionLinePayload);
|
|
156
131
|
}),
|
|
157
132
|
};
|
|
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
|
-
}
|
|
161
133
|
if (billId != null) {
|
|
162
|
-
detail = (0, get_1.default)(billTransactionState.transactionById, billId, undefined);
|
|
163
|
-
payload.sync_token = (
|
|
164
|
-
payload.update_time = (
|
|
134
|
+
const detail = (0, get_1.default)(billTransactionState.transactionById, billId, undefined);
|
|
135
|
+
payload.sync_token = (_14 = detail === null || detail === void 0 ? void 0 : detail.syncToken) !== null && _14 !== void 0 ? _14 : null;
|
|
136
|
+
payload.update_time = (_15 = detail === null || detail === void 0 ? void 0 : detail.updateTime.format('YYYY-MM-DD')) !== null && _15 !== void 0 ? _15 : null;
|
|
165
137
|
}
|
|
166
138
|
else {
|
|
167
139
|
payload.are_approvals_serialized = true;
|
|
168
140
|
}
|
|
169
141
|
if (billStageCode === 'pending_approval' &&
|
|
170
|
-
((
|
|
142
|
+
((_16 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _16 === void 0 ? void 0 : _16.conversionRate) != null) {
|
|
171
143
|
// required by platform
|
|
172
144
|
payload.exchange_rate =
|
|
173
145
|
1 / billDetail.billDetailLocalData.paymentDetailsSection.conversionRate;
|
|
174
146
|
}
|
|
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
|
-
}
|
|
223
147
|
return payload;
|
|
224
148
|
}
|
|
225
149
|
const getBillPaymentMethodTypePayload = (paymentType) => {
|
|
@@ -236,13 +160,3 @@ const getBillPaymentMethodTypePayload = (paymentType) => {
|
|
|
236
160
|
: null,
|
|
237
161
|
};
|
|
238
162
|
};
|
|
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;
|
|
@@ -9,7 +9,6 @@ export interface CommonHistoryView extends FetchedState {
|
|
|
9
9
|
export declare const initialCommonHistory: CommonHistoryView;
|
|
10
10
|
export interface HistoricEvent {
|
|
11
11
|
eventText: string[];
|
|
12
|
-
eventSubText: string[];
|
|
13
12
|
timestamp?: ZeniDate;
|
|
14
13
|
updates: HistoricEventUpdate[];
|
|
15
14
|
}
|
|
@@ -3,15 +3,11 @@ 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
|
-
|
|
11
|
-
timestamp: payload.timestamp != null ? (0, zeniDayJS_1.dateLocal)(payload.timestamp) : undefined,
|
|
12
|
-
updates: payload.updates.map((eventUpdatePayload) => (0, exports.toHistoricEventUpdate)(eventUpdatePayload)),
|
|
13
|
-
});
|
|
14
|
-
};
|
|
6
|
+
const toHistoricEvent = (payload) => ({
|
|
7
|
+
eventText: payload.event_text,
|
|
8
|
+
timestamp: payload.timestamp != null ? (0, zeniDayJS_1.dateLocal)(payload.timestamp) : undefined,
|
|
9
|
+
updates: payload.updates.map((eventUpdatePayload) => (0, exports.toHistoricEventUpdate)(eventUpdatePayload)),
|
|
10
|
+
});
|
|
15
11
|
exports.toHistoricEvent = toHistoricEvent;
|
|
16
12
|
const toHistoricEventUpdate = (payload) => ({
|
|
17
13
|
title: payload.title,
|
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
import { ZeniDate } from '../../zeniDayJS';
|
|
2
2
|
import { BillActivity } from './billPay/billDetailView/billDetailViewSelector';
|
|
3
|
-
import { RemiActivity } from './reimbursement/remiDetailView/remiDetailViewSelector';
|
|
4
3
|
import { BusinessVerificationDetails, CompanyOfficersDetails } from './commonSetup/setupViewSelector';
|
|
5
|
-
import {
|
|
6
|
-
import { RecurringBillConfig, RecurringBillFrequency } from '../../entity/billPay/recurringBills/recurringBillsState';
|
|
4
|
+
import { RemiActivity } from './reimbursement/remiDetailView/remiDetailViewSelector';
|
|
7
5
|
export declare const getLatestApprovalDate: (allActivities: BillActivity[] | RemiActivity[]) => ZeniDate | undefined;
|
|
8
6
|
export declare function getSpendManagementEffectiveListPeriod(): import("../..").TimePeriod;
|
|
9
7
|
export declare const getSelectedCompanyOfficer: (verificationDetails: BusinessVerificationDetails) => CompanyOfficersDetails | undefined;
|
|
10
|
-
export declare const getPaymentDateFromVendorReceiveDate: (vendorReceiveDate: ZeniDate, maxPaymentProcessingDays: number) => ZeniDate;
|
|
11
|
-
export declare const updateRecurringBillDetails: (currentRecurringConfig: RecurringBillConfigLocalData, prevRecurringConfig?: RecurringBillConfigLocalData | undefined, currentInstances?: RecurringBillInstance[] | undefined, currentBillAmount?: number | undefined) => {
|
|
12
|
-
recurringConfig: RecurringBillConfigLocalData;
|
|
13
|
-
recurringInstances: RecurringBillInstance[] | undefined;
|
|
14
|
-
};
|
|
15
|
-
export declare const isRecurringConfigChanged: (recurringBillNewConfig: RecurringBillConfigLocalData, originalRecurringBillConfig: Partial<RecurringBillConfig>, checkApprovalChange: boolean) => boolean;
|
|
16
|
-
export declare const getTotalPayments: (startDate: ZeniDate, endDate: ZeniDate, frequency: RecurringBillFrequency, currentInstance?: RecurringBillInstance | undefined) => number;
|
|
17
|
-
export declare const getEndDate: (startDate: ZeniDate, frequency: RecurringBillFrequency, totalPayments: number, currentInstance?: RecurringBillInstance | undefined) => ZeniDate;
|