@zeniai/client-epic-state 5.0.3 → 5.0.4-betaJK1
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/accountRecon/accountReconState.d.ts +1 -1
- package/lib/entity/accountRecon/accountReconState.js +1 -0
- package/lib/esm/entity/accountRecon/accountReconState.js +1 -0
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +2 -0
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.js +1 -0
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +29 -2
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementDocumentAIHelper.js +2 -1
- package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +2 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.js +1 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +29 -2
- package/lib/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementDocumentAIHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementDocumentAIHelper.js +2 -1
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +4 -1
- package/package.json +1 -1
- package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
|
@@ -4,7 +4,7 @@ import { MonthYearPeriod } from '../../commonStateTypes/timePeriod';
|
|
|
4
4
|
import { ZeniDate } from '../../zeniDayJS';
|
|
5
5
|
import { MerchantType, TransactionDirectionType } from '../transaction/stateTypes/reconciliationTransaction';
|
|
6
6
|
import { TransactionType } from '../transaction/stateTypes/transactionType';
|
|
7
|
-
export declare const toRecommendedActionCodeType: (v: string) => "record_expense" | "record_deposit" | "record_transfer" | "record_bill_payment" | "record_cc_payment" | "record_cc_credit";
|
|
7
|
+
export declare const toRecommendedActionCodeType: (v: string) => "record_expense" | "record_deposit" | "record_transfer" | "record_bill_payment" | "record_cc_payment" | "record_cc_credit" | "record_journal_entry";
|
|
8
8
|
export type RecommendedActionCodeType = ReturnType<typeof toRecommendedActionCodeType>;
|
|
9
9
|
export declare const toReconciliationStatusCodeType: (v: string) => "pending" | "failed" | "in_progress" | "save_for_later" | "reconciled" | "reconciled_on_qbo";
|
|
10
10
|
export type ReconciliationStatusCodeType = ReturnType<typeof toReconciliationStatusCodeType>;
|
|
@@ -10,6 +10,7 @@ const RECOMMENDED_ACTION_CODE = [
|
|
|
10
10
|
'record_bill_payment', // Match
|
|
11
11
|
'record_cc_payment', // Categorize
|
|
12
12
|
'record_cc_credit', // Categorize
|
|
13
|
+
'record_journal_entry', // Journal Entry
|
|
13
14
|
];
|
|
14
15
|
const toRecommendedActionCodeType = (v) => (0, stringToUnion_1.stringToUnion)(v, RECOMMENDED_ACTION_CODE);
|
|
15
16
|
exports.toRecommendedActionCodeType = toRecommendedActionCodeType;
|
|
@@ -7,6 +7,7 @@ const RECOMMENDED_ACTION_CODE = [
|
|
|
7
7
|
'record_bill_payment', // Match
|
|
8
8
|
'record_cc_payment', // Categorize
|
|
9
9
|
'record_cc_credit', // Categorize
|
|
10
|
+
'record_journal_entry', // Journal Entry
|
|
10
11
|
];
|
|
11
12
|
export const toRecommendedActionCodeType = (v) => stringToUnion(v, RECOMMENDED_ACTION_CODE);
|
|
12
13
|
const RECONCILIATION_STATUS_CODE = [
|
package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js
CHANGED
|
@@ -2,6 +2,7 @@ import { from, of } from 'rxjs';
|
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { convertToPeriod, toMonthYearPeriodId, } from '../../../../commonStateTypes/timePeriod';
|
|
4
4
|
import { updateAccounts } from '../../../../entity/account/accountReducer';
|
|
5
|
+
import { toRecommendedActionCodeType } from '../../../../entity/accountRecon/accountReconState';
|
|
5
6
|
import { updateAccountRecon } from '../../../../entity/accountRecon/accountReconReducer';
|
|
6
7
|
import { getAccountReconByAccountIdAndSelectedPeriod } from '../../../../entity/accountRecon/accountReconSelector';
|
|
7
8
|
import { updateFiles } from '../../../../entity/file/fileReducer';
|
|
@@ -116,6 +117,7 @@ export const prepareReviewTabLocalData = (transactionsToReview) => {
|
|
|
116
117
|
.recommended_transactions[0].merchant_name,
|
|
117
118
|
}
|
|
118
119
|
: undefined,
|
|
120
|
+
recommendedActionType: toRecommendedActionCodeType(currentTransaction.recommended_action.recommended_actions),
|
|
119
121
|
};
|
|
120
122
|
return {
|
|
121
123
|
...prev,
|
package/lib/esm/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js
CHANGED
|
@@ -30,8 +30,10 @@ export const saveReconciliationReviewEpic = (actions$, state$, zeniAPI) => actio
|
|
|
30
30
|
reconciliationId = reconciliationData?.reconciliationId;
|
|
31
31
|
updatedTransaction = reconciliationData?.transactionsToReview.find((transaction) => transaction.transactionId === transactionId);
|
|
32
32
|
}
|
|
33
|
+
const reviewAction = localData?.recommendedActionType ??
|
|
34
|
+
updatedTransaction?.recommendedAction.action;
|
|
33
35
|
const queryParam = {
|
|
34
|
-
review_action:
|
|
36
|
+
review_action: reviewAction,
|
|
35
37
|
reconciliation_id: reconciliationId ?? '',
|
|
36
38
|
ref_account_id: selectedAccountId,
|
|
37
39
|
ref_account_name: reconciliationData?.account.accountName,
|
|
@@ -41,7 +43,7 @@ export const saveReconciliationReviewEpic = (actions$, state$, zeniAPI) => actio
|
|
|
41
43
|
if (reconciliationData != null &&
|
|
42
44
|
updatedTransaction != null &&
|
|
43
45
|
localData != null) {
|
|
44
|
-
switch (
|
|
46
|
+
switch (reviewAction) {
|
|
45
47
|
case 'record_expense':
|
|
46
48
|
payload = getPayloadForExpenseRecord(updatedTransaction, localData);
|
|
47
49
|
break;
|
|
@@ -63,6 +65,9 @@ export const saveReconciliationReviewEpic = (actions$, state$, zeniAPI) => actio
|
|
|
63
65
|
case 'record_deposit':
|
|
64
66
|
payload = getPayloadForDeposit(updatedTransaction, localData, entityState);
|
|
65
67
|
break;
|
|
68
|
+
case 'record_journal_entry':
|
|
69
|
+
payload = getPayloadForJournalEntry(updatedTransaction, localData);
|
|
70
|
+
break;
|
|
66
71
|
}
|
|
67
72
|
}
|
|
68
73
|
payload = {
|
|
@@ -220,6 +225,28 @@ const getPayloadForBillPayment = (updatedTransaction, linkedTransaction, localDa
|
|
|
220
225
|
vendor_name: linkedTransaction?.merchantName,
|
|
221
226
|
};
|
|
222
227
|
};
|
|
228
|
+
function getPayloadForJournalEntry(updatedTransaction, localData) {
|
|
229
|
+
return {
|
|
230
|
+
transaction_id: updatedTransaction.transactionId,
|
|
231
|
+
transaction_date: updatedTransaction.transactionDate.format(DEFAULT_DATE_FORMAT),
|
|
232
|
+
transaction_memo: updatedTransaction.memo,
|
|
233
|
+
amount: updatedTransaction.amount.amount,
|
|
234
|
+
currency_code: updatedTransaction.amount.currencyCode,
|
|
235
|
+
transaction_direction: updatedTransaction.transactionDirection,
|
|
236
|
+
lines: [
|
|
237
|
+
{
|
|
238
|
+
class_id: localData.jeDebitClassId,
|
|
239
|
+
posting_type: 'Debit',
|
|
240
|
+
amount: updatedTransaction.amount.amount,
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
class_id: localData.jeCreditClassId,
|
|
244
|
+
posting_type: 'Credit',
|
|
245
|
+
amount: updatedTransaction.amount.amount,
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
};
|
|
249
|
+
}
|
|
223
250
|
const getToastMessageSection = (updatedTransaction) => {
|
|
224
251
|
if (updatedTransaction?.recommendedAction.action === 'record_bill_payment') {
|
|
225
252
|
return 'recon_transaction_match';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fetch from 'cross-fetch';
|
|
2
2
|
import { zeniAPI } from '../../../../init';
|
|
3
|
-
export default async function uploadAccountStatementIntoDocumentAI(accountType, fileBlob, authParams) {
|
|
3
|
+
export default async function uploadAccountStatementIntoDocumentAI(accountType, fileBlob, authParams, accountName) {
|
|
4
4
|
let statementUpload;
|
|
5
5
|
const urlEndPoint = `${zeniAPI.apiEndPoints.documentAIMicroServiceBaseUrl}/1.0/processors/statement`;
|
|
6
6
|
const data = new FormData();
|
|
@@ -10,6 +10,7 @@ export default async function uploadAccountStatementIntoDocumentAI(accountType,
|
|
|
10
10
|
? 'reconciliation_card_statement_upload'
|
|
11
11
|
: 'reconciliation_bank_statement_upload',
|
|
12
12
|
purpose_id: 'reconciliation',
|
|
13
|
+
...(accountName != null && { account_name: accountName }),
|
|
13
14
|
});
|
|
14
15
|
data.append('attachment_json_0', attachment_json);
|
|
15
16
|
try {
|
|
@@ -5,6 +5,7 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
7
|
const accountReducer_1 = require("../../../../entity/account/accountReducer");
|
|
8
|
+
const accountReconState_1 = require("../../../../entity/accountRecon/accountReconState");
|
|
8
9
|
const accountReconReducer_1 = require("../../../../entity/accountRecon/accountReconReducer");
|
|
9
10
|
const accountReconSelector_1 = require("../../../../entity/accountRecon/accountReconSelector");
|
|
10
11
|
const fileReducer_1 = require("../../../../entity/file/fileReducer");
|
|
@@ -120,6 +121,7 @@ const prepareReviewTabLocalData = (transactionsToReview) => {
|
|
|
120
121
|
.recommended_transactions[0].merchant_name,
|
|
121
122
|
}
|
|
122
123
|
: undefined,
|
|
124
|
+
recommendedActionType: (0, accountReconState_1.toRecommendedActionCodeType)(currentTransaction.recommended_action.recommended_actions),
|
|
123
125
|
};
|
|
124
126
|
return {
|
|
125
127
|
...prev,
|
|
@@ -33,8 +33,10 @@ const saveReconciliationReviewEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
33
33
|
reconciliationId = reconciliationData?.reconciliationId;
|
|
34
34
|
updatedTransaction = reconciliationData?.transactionsToReview.find((transaction) => transaction.transactionId === transactionId);
|
|
35
35
|
}
|
|
36
|
+
const reviewAction = localData?.recommendedActionType ??
|
|
37
|
+
updatedTransaction?.recommendedAction.action;
|
|
36
38
|
const queryParam = {
|
|
37
|
-
review_action:
|
|
39
|
+
review_action: reviewAction,
|
|
38
40
|
reconciliation_id: reconciliationId ?? '',
|
|
39
41
|
ref_account_id: selectedAccountId,
|
|
40
42
|
ref_account_name: reconciliationData?.account.accountName,
|
|
@@ -44,7 +46,7 @@ const saveReconciliationReviewEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
44
46
|
if (reconciliationData != null &&
|
|
45
47
|
updatedTransaction != null &&
|
|
46
48
|
localData != null) {
|
|
47
|
-
switch (
|
|
49
|
+
switch (reviewAction) {
|
|
48
50
|
case 'record_expense':
|
|
49
51
|
payload = getPayloadForExpenseRecord(updatedTransaction, localData);
|
|
50
52
|
break;
|
|
@@ -66,6 +68,9 @@ const saveReconciliationReviewEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
66
68
|
case 'record_deposit':
|
|
67
69
|
payload = getPayloadForDeposit(updatedTransaction, localData, entityState);
|
|
68
70
|
break;
|
|
71
|
+
case 'record_journal_entry':
|
|
72
|
+
payload = getPayloadForJournalEntry(updatedTransaction, localData);
|
|
73
|
+
break;
|
|
69
74
|
}
|
|
70
75
|
}
|
|
71
76
|
payload = {
|
|
@@ -224,6 +229,28 @@ const getPayloadForBillPayment = (updatedTransaction, linkedTransaction, localDa
|
|
|
224
229
|
vendor_name: linkedTransaction?.merchantName,
|
|
225
230
|
};
|
|
226
231
|
};
|
|
232
|
+
function getPayloadForJournalEntry(updatedTransaction, localData) {
|
|
233
|
+
return {
|
|
234
|
+
transaction_id: updatedTransaction.transactionId,
|
|
235
|
+
transaction_date: updatedTransaction.transactionDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT),
|
|
236
|
+
transaction_memo: updatedTransaction.memo,
|
|
237
|
+
amount: updatedTransaction.amount.amount,
|
|
238
|
+
currency_code: updatedTransaction.amount.currencyCode,
|
|
239
|
+
transaction_direction: updatedTransaction.transactionDirection,
|
|
240
|
+
lines: [
|
|
241
|
+
{
|
|
242
|
+
class_id: localData.jeDebitClassId,
|
|
243
|
+
posting_type: 'Debit',
|
|
244
|
+
amount: updatedTransaction.amount.amount,
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
class_id: localData.jeCreditClassId,
|
|
248
|
+
posting_type: 'Credit',
|
|
249
|
+
amount: updatedTransaction.amount.amount,
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
};
|
|
253
|
+
}
|
|
227
254
|
const getToastMessageSection = (updatedTransaction) => {
|
|
228
255
|
if (updatedTransaction?.recommendedAction.action === 'record_bill_payment') {
|
|
229
256
|
return 'recon_transaction_match';
|
|
@@ -10,4 +10,4 @@ export interface AuthParamsPayload {
|
|
|
10
10
|
zeni_tenant_id: string;
|
|
11
11
|
zeni_user_id: string;
|
|
12
12
|
}
|
|
13
|
-
export default function uploadAccountStatementIntoDocumentAI(accountType: AccountType, fileBlob: Blob, authParams: AuthParams): Promise<UploadStatementDocumentAIPayload | undefined>;
|
|
13
|
+
export default function uploadAccountStatementIntoDocumentAI(accountType: AccountType, fileBlob: Blob, authParams: AuthParams, accountName?: string): Promise<UploadStatementDocumentAIPayload | undefined>;
|
package/lib/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementDocumentAIHelper.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.default = uploadAccountStatementIntoDocumentAI;
|
|
7
7
|
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
8
8
|
const init_1 = require("../../../../init");
|
|
9
|
-
async function uploadAccountStatementIntoDocumentAI(accountType, fileBlob, authParams) {
|
|
9
|
+
async function uploadAccountStatementIntoDocumentAI(accountType, fileBlob, authParams, accountName) {
|
|
10
10
|
let statementUpload;
|
|
11
11
|
const urlEndPoint = `${init_1.zeniAPI.apiEndPoints.documentAIMicroServiceBaseUrl}/1.0/processors/statement`;
|
|
12
12
|
const data = new FormData();
|
|
@@ -16,6 +16,7 @@ async function uploadAccountStatementIntoDocumentAI(accountType, fileBlob, authP
|
|
|
16
16
|
? 'reconciliation_card_statement_upload'
|
|
17
17
|
: 'reconciliation_bank_statement_upload',
|
|
18
18
|
purpose_id: 'reconciliation',
|
|
19
|
+
...(accountName != null && { account_name: accountName }),
|
|
19
20
|
});
|
|
20
21
|
data.append('attachment_json_0', attachment_json);
|
|
21
22
|
try {
|
|
@@ -3,7 +3,7 @@ import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
|
3
3
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
4
4
|
import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
5
5
|
import { ReconciliationAccountSourceType } from '../../../entity/account/accountState';
|
|
6
|
-
import { BankStatusCodeType } from '../../../entity/accountRecon/accountReconState';
|
|
6
|
+
import { BankStatusCodeType, RecommendedActionCodeType } from '../../../entity/accountRecon/accountReconState';
|
|
7
7
|
import { CustomerBase } from '../../../entity/customer/customerState';
|
|
8
8
|
import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
9
9
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
@@ -71,7 +71,10 @@ export interface ReconciliationReviewTabLocalData {
|
|
|
71
71
|
classId?: ID;
|
|
72
72
|
creditCardId?: ID;
|
|
73
73
|
customer?: CustomerBase;
|
|
74
|
+
jeCreditClassId?: ID;
|
|
75
|
+
jeDebitClassId?: ID;
|
|
74
76
|
matchedTransactionId?: ID;
|
|
77
|
+
recommendedActionType?: RecommendedActionCodeType;
|
|
75
78
|
vendor?: VendorBase;
|
|
76
79
|
}
|
|
77
80
|
export interface ExcludeAccountFromReconciliationPayload {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.4-betaJK1",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|