@zeniai/client-epic-state 4.19.97 → 4.19.98
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/esm/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js
CHANGED
|
@@ -4,6 +4,7 @@ import { DEFAULT_DATE_FORMAT } from '../../../../commonStateTypes/fiscalYearHelp
|
|
|
4
4
|
import { addTransactionToReconcileList, excludeReconReviewTransaction, } from '../../../../entity/accountRecon/accountReconReducer';
|
|
5
5
|
import { getAccountReconByAccountIdAndSelectedPeriod, } from '../../../../entity/accountRecon/accountReconSelector';
|
|
6
6
|
import { toAccountReconKey, } from '../../../../entity/accountRecon/accountReconState';
|
|
7
|
+
import { getEntityByEntityIDs } from '../../../../entity/genericEntity/entitySelector';
|
|
7
8
|
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
8
9
|
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
9
10
|
import { updateMultipleReconcileTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
@@ -12,6 +13,7 @@ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePay
|
|
|
12
13
|
import { saveReconciliationReview, updateReconcileTabLocalData, updateSaveReconciliationReviewFetchStatus, } from '../../reducers/reconciliationViewReducer';
|
|
13
14
|
export const saveReconciliationReviewEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(saveReconciliationReview.match), mergeMap((action) => {
|
|
14
15
|
const state = state$.value;
|
|
16
|
+
const entityState = state.entityState;
|
|
15
17
|
const { transactionId } = action.payload;
|
|
16
18
|
const localData = state.expenseAutomationReconciliationViewState.reconTabsState.review
|
|
17
19
|
.localData[transactionId];
|
|
@@ -59,7 +61,7 @@ export const saveReconciliationReviewEpic = (actions$, state$, zeniAPI) => actio
|
|
|
59
61
|
payload = getPayloadForCCPayment(updatedTransaction, localData, reconciliationData?.account.accountType);
|
|
60
62
|
break;
|
|
61
63
|
case 'record_deposit':
|
|
62
|
-
payload = getPayloadForDeposit(updatedTransaction, localData);
|
|
64
|
+
payload = getPayloadForDeposit(updatedTransaction, localData, entityState);
|
|
63
65
|
break;
|
|
64
66
|
}
|
|
65
67
|
}
|
|
@@ -159,7 +161,10 @@ function getPayloadForExpenseRecord(updatedTransaction, localData) {
|
|
|
159
161
|
currency_code: updatedTransaction.amount.currencyCode,
|
|
160
162
|
};
|
|
161
163
|
}
|
|
162
|
-
function getPayloadForDeposit(updatedTransaction, localData) {
|
|
164
|
+
function getPayloadForDeposit(updatedTransaction, localData, entityState) {
|
|
165
|
+
const customerZeniId = localData.customer?.id != null
|
|
166
|
+
? getEntityByEntityIDs(entityState, [localData.customer?.id])[0]?.zeniId
|
|
167
|
+
: undefined;
|
|
163
168
|
return {
|
|
164
169
|
amount: updatedTransaction.amount.amount,
|
|
165
170
|
transaction_memo: updatedTransaction.memo,
|
|
@@ -167,7 +172,7 @@ function getPayloadForDeposit(updatedTransaction, localData) {
|
|
|
167
172
|
transaction_date: updatedTransaction.transactionDate.format(DEFAULT_DATE_FORMAT),
|
|
168
173
|
transaction_direction: updatedTransaction.transactionDirection,
|
|
169
174
|
transaction_id: updatedTransaction.transactionId,
|
|
170
|
-
customer_id:
|
|
175
|
+
customer_id: customerZeniId,
|
|
171
176
|
customer_name: localData.customer?.name,
|
|
172
177
|
account_id: localData.categoryId,
|
|
173
178
|
accounting_class_id: localData.classId,
|