@zeniai/client-epic-state 4.19.90-betaSS2 → 4.19.90-betaSS4
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/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -36
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +10 -49
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -2
- package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +1 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +1 -2
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -15
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +7 -3
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +3 -1
- package/lib/entity/reimbursement/reimbursementPayload.d.ts +2 -0
- package/lib/entity/reimbursement/reimbursementPayload.js +7 -0
- package/lib/entity/reimbursement/reimbursementState.d.ts +2 -0
- package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +0 -3
- package/lib/entity/transaction/payloadTypes/transactionPayload.js +0 -11
- package/lib/entity/transaction/stateTypes/transaction.d.ts +0 -3
- package/lib/entity/transaction/transactionReducer.js +3 -2
- package/lib/entity/transaction/transactionSelector.d.ts +2 -2
- package/lib/entity/transaction/transactionState.d.ts +3 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +10 -49
- package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +3 -3
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +1 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +1 -0
- package/lib/esm/entity/reimbursement/reimbursementPayload.js +7 -0
- package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +0 -11
- package/lib/esm/entity/transaction/transactionReducer.js +3 -2
- package/lib/esm/index.js +5 -6
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +5 -29
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +3 -50
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +1 -17
- package/lib/esm/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsEpic.js +2 -7
- package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +2 -7
- package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +0 -10
- package/lib/esm/view/spendManagement/billPay/billList/billListState.js +0 -1
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +0 -1
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +0 -2
- package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +0 -12
- package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListState.js +0 -1
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
- package/lib/index.d.ts +6 -7
- package/lib/index.js +33 -35
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +13 -13
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +5 -29
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +0 -2
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +3 -50
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +0 -5
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +0 -19
- package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsEpic.js +2 -7
- package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.d.ts +4 -4
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +1 -6
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListSelector.js +0 -10
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListState.js +0 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +0 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +0 -2
- package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +0 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +0 -12
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.js +0 -1
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
- package/package.json +1 -1
|
@@ -36,6 +36,6 @@ export interface ChargeCardTransactionState {
|
|
|
36
36
|
}
|
|
37
37
|
export declare const toCardTransactionTypeCode: (v: string) => "expense" | "credit_card_credit" | "transfer" | "purchase";
|
|
38
38
|
export type ChargeCardTransactionTypeCode = ReturnType<typeof toCardTransactionTypeCode>;
|
|
39
|
-
export declare const toCardTransactionStatusCode: (v: string) => "paid" | "
|
|
39
|
+
export declare const toCardTransactionStatusCode: (v: string) => "paid" | "canceled" | "authorized" | "declined";
|
|
40
40
|
export type ChargeCardTransactionStatusCode = ReturnType<typeof toCardTransactionStatusCode>;
|
|
41
41
|
export {};
|
|
@@ -13,39 +13,6 @@ export interface JEScheduleOtherAttributesPayload {
|
|
|
13
13
|
asset_id?: string | null;
|
|
14
14
|
starting_balance?: number | null;
|
|
15
15
|
}
|
|
16
|
-
export interface JEScheduleAISummaryFieldPayload {
|
|
17
|
-
confidence: number;
|
|
18
|
-
reasoning: string;
|
|
19
|
-
predicted_value?: number | string;
|
|
20
|
-
}
|
|
21
|
-
export interface JEScheduleAISummariesPayload {
|
|
22
|
-
credit_account?: JEScheduleAISummaryFieldPayload;
|
|
23
|
-
credit_accounting_class?: JEScheduleAISummaryFieldPayload;
|
|
24
|
-
debit_account?: JEScheduleAISummaryFieldPayload;
|
|
25
|
-
debit_accounting_class?: JEScheduleAISummaryFieldPayload;
|
|
26
|
-
period?: JEScheduleAISummaryFieldPayload;
|
|
27
|
-
posting_date?: JEScheduleAISummaryFieldPayload;
|
|
28
|
-
}
|
|
29
|
-
export interface JEScheduleRecommendationsPayload {
|
|
30
|
-
amortization_days?: number | null;
|
|
31
|
-
amortization_months_estimate?: number | null;
|
|
32
|
-
credit_account_confidence?: number;
|
|
33
|
-
credit_account_id?: string | null;
|
|
34
|
-
credit_accounting_class_id?: string | null;
|
|
35
|
-
credit_class_confidence?: number;
|
|
36
|
-
debit_account_confidence?: number;
|
|
37
|
-
debit_account_id?: string | null;
|
|
38
|
-
debit_accounting_class_id?: string | null;
|
|
39
|
-
debit_class_confidence?: number;
|
|
40
|
-
end_date?: string | null;
|
|
41
|
-
je_schedule_type?: string | null;
|
|
42
|
-
period?: number | null;
|
|
43
|
-
period_confidence?: number;
|
|
44
|
-
posting_date?: string | null;
|
|
45
|
-
similar_transactions?: unknown[];
|
|
46
|
-
start_date?: string | null;
|
|
47
|
-
starting_month?: string | null;
|
|
48
|
-
}
|
|
49
16
|
export interface JEScheduledTransactionPayload {
|
|
50
17
|
balance: number | null;
|
|
51
18
|
base_transaction: ScheduleTransactionPayload;
|
|
@@ -68,9 +35,7 @@ export interface JEScheduledTransactionPayload {
|
|
|
68
35
|
status: StatusCodeWithLabelPayload;
|
|
69
36
|
updated_by: UserPayload;
|
|
70
37
|
vendor: VendorPayload;
|
|
71
|
-
ai_summaries?: JEScheduleAISummariesPayload;
|
|
72
38
|
end_date?: string | null;
|
|
73
|
-
recommendations?: JEScheduleRecommendationsPayload;
|
|
74
39
|
updated_at?: string | null;
|
|
75
40
|
}
|
|
76
41
|
export interface JEAccruedScheduledTransactionPayload extends Omit<JEScheduledTransactionPayload, 'base_transaction' | 'je_schedule_id' | 'je_schedule_type'> {
|
|
@@ -106,7 +71,7 @@ export declare function toScheduledJournalEntryState(payload: ScheduledJournalEn
|
|
|
106
71
|
export declare function toJEAccountPayload(payload: JEScheduledTransactionPayload | JEAccruedScheduledTransactionPayload, type: TransactionCategory): AccountPayload | undefined;
|
|
107
72
|
export declare function toJEAccruedAccountPayload(payload: JEScheduledTransactionPayload | JEAccruedScheduledTransactionPayload, type: TransactionCategory): AccountPayload | undefined;
|
|
108
73
|
export declare function toJEClassPayload(payload: JEScheduledTransactionPayload | JEAccruedScheduledTransactionPayload, type: TransactionCategory): ClassBasePayload | undefined;
|
|
109
|
-
export declare function
|
|
74
|
+
export declare function getJEScheduleTransactionDetailKeyPayload(payload: ScheduleTransactionPayload): JEScheduleTransactionKey;
|
|
110
75
|
export declare function getJEScheduleKey(payload: JEAccruedScheduledTransactionPayload): JEScheduleKey;
|
|
111
76
|
export declare function toJEScheduledTransaction(payload: JEScheduledTransactionPayload): JEScheduledTransactionState;
|
|
112
77
|
export declare function toJEAccruedScheduledTransaction(payload: JEAccruedScheduledTransactionPayload): JEAccruedScheduledTransactionState;
|
|
@@ -4,13 +4,12 @@ exports.toScheduledJournalEntryState = toScheduledJournalEntryState;
|
|
|
4
4
|
exports.toJEAccountPayload = toJEAccountPayload;
|
|
5
5
|
exports.toJEAccruedAccountPayload = toJEAccruedAccountPayload;
|
|
6
6
|
exports.toJEClassPayload = toJEClassPayload;
|
|
7
|
-
exports.
|
|
7
|
+
exports.getJEScheduleTransactionDetailKeyPayload = getJEScheduleTransactionDetailKeyPayload;
|
|
8
8
|
exports.getJEScheduleKey = getJEScheduleKey;
|
|
9
9
|
exports.toJEScheduledTransaction = toJEScheduledTransaction;
|
|
10
10
|
exports.toJEAccruedScheduledTransaction = toJEAccruedScheduledTransaction;
|
|
11
11
|
const amount_1 = require("../../commonStateTypes/amount");
|
|
12
12
|
const timePeriod_1 = require("../../commonStateTypes/timePeriod");
|
|
13
|
-
const transactionDetailState_1 = require("../../view/transactionDetail/transactionDetailState");
|
|
14
13
|
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
15
14
|
const transactionIDPayload_1 = require("../transaction/payloadTypes/transactionIDPayload");
|
|
16
15
|
const jeScheduleHelper_1 = require("./jeScheduleHelper");
|
|
@@ -132,9 +131,12 @@ function toJEClassPayload(payload, type) {
|
|
|
132
131
|
: undefined;
|
|
133
132
|
}
|
|
134
133
|
}
|
|
135
|
-
function
|
|
134
|
+
function getJEScheduleTransactionDetailKeyPayload(payload) {
|
|
136
135
|
const transactionId = (0, transactionIDPayload_1.toTransactionID)(payload);
|
|
137
|
-
return (0,
|
|
136
|
+
return (0, jeSchedulesTypes_1.getJEScheduleTransactionKey)({
|
|
137
|
+
...transactionId,
|
|
138
|
+
lineId: payload.line_id,
|
|
139
|
+
});
|
|
138
140
|
}
|
|
139
141
|
function getJEScheduleKey(payload) {
|
|
140
142
|
return (0, jeScheduleHelper_1.generateJEScheduleKey)(payload);
|
|
@@ -144,49 +146,6 @@ function toJEScheduleOtherAttributes(payload) {
|
|
|
144
146
|
assetId: payload.asset_id ?? undefined,
|
|
145
147
|
};
|
|
146
148
|
}
|
|
147
|
-
function toJEScheduleAIRecommendations(payload) {
|
|
148
|
-
if (payload == null) {
|
|
149
|
-
return undefined;
|
|
150
|
-
}
|
|
151
|
-
const result = {};
|
|
152
|
-
if (payload.debit_account != null) {
|
|
153
|
-
result.debitAccount = {
|
|
154
|
-
confidence: payload.debit_account.confidence,
|
|
155
|
-
reasoning: payload.debit_account.reasoning,
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
if (payload.credit_account != null) {
|
|
159
|
-
result.creditAccount = {
|
|
160
|
-
confidence: payload.credit_account.confidence,
|
|
161
|
-
reasoning: payload.credit_account.reasoning,
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
if (payload.debit_accounting_class != null) {
|
|
165
|
-
result.debitClass = {
|
|
166
|
-
confidence: payload.debit_accounting_class.confidence,
|
|
167
|
-
reasoning: payload.debit_accounting_class.reasoning,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
if (payload.credit_accounting_class != null) {
|
|
171
|
-
result.creditClass = {
|
|
172
|
-
confidence: payload.credit_accounting_class.confidence,
|
|
173
|
-
reasoning: payload.credit_accounting_class.reasoning,
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
if (payload.period != null) {
|
|
177
|
-
result.period = {
|
|
178
|
-
confidence: payload.period.confidence,
|
|
179
|
-
reasoning: payload.period.reasoning,
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
if (payload.posting_date != null) {
|
|
183
|
-
result.postingDate = {
|
|
184
|
-
confidence: payload.posting_date.confidence,
|
|
185
|
-
reasoning: payload.posting_date.reasoning,
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
return Object.keys(result).length > 0 ? result : undefined;
|
|
189
|
-
}
|
|
190
149
|
function toJEScheduledTransaction(payload) {
|
|
191
150
|
return {
|
|
192
151
|
jeScheduleId: payload.je_schedule_id ?? undefined,
|
|
@@ -198,7 +157,10 @@ function toJEScheduledTransaction(payload) {
|
|
|
198
157
|
label: payload.status.label,
|
|
199
158
|
},
|
|
200
159
|
vendorId: payload.vendor.vendor_id,
|
|
201
|
-
baseTransaction:
|
|
160
|
+
baseTransaction: (0, jeSchedulesTypes_1.getJEScheduleTransactionKey)({
|
|
161
|
+
...(0, transactionIDPayload_1.toTransactionID)(payload.base_transaction),
|
|
162
|
+
lineId: payload.base_transaction.line_id,
|
|
163
|
+
}),
|
|
202
164
|
startDate: payload.start_date != null ? (0, zeniDayJS_1.date)(payload.start_date) : undefined,
|
|
203
165
|
endDate: payload.end_date != null ? (0, zeniDayJS_1.date)(payload.end_date) : undefined,
|
|
204
166
|
period: payload.period != null ? Number(payload.period) : undefined,
|
|
@@ -228,7 +190,6 @@ function toJEScheduledTransaction(payload) {
|
|
|
228
190
|
? toJEScheduleOtherAttributes(payload.other_attributes)
|
|
229
191
|
: {},
|
|
230
192
|
scheduledJournalEntry: [],
|
|
231
|
-
aiRecommendations: toJEScheduleAIRecommendations(payload.ai_summaries),
|
|
232
193
|
};
|
|
233
194
|
}
|
|
234
195
|
function toJEAccruedScheduledTransaction(payload) {
|
|
@@ -18,8 +18,8 @@ export declare const updateJESchedules: import("@reduxjs/toolkit").ActionCreator
|
|
|
18
18
|
jeSchedulesPayload: JEAccruedScheduledTransactionPayload[];
|
|
19
19
|
scheduledJEntriesPayload: ScheduledJournalEntryPayload[] | undefined;
|
|
20
20
|
updateType: UpdateType;
|
|
21
|
-
}, "jeSchedules/updateAccruedJESchedulesDetails", never, never>, deleteJESchedulesDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleTransactionKey: `${string}
|
|
22
|
-
jeScheduleTransactionKey: `${string}
|
|
21
|
+
}, "jeSchedules/updateAccruedJESchedulesDetails", never, never>, deleteJESchedulesDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleTransactionKey: `${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`], {
|
|
22
|
+
jeScheduleTransactionKey: `${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`;
|
|
23
23
|
}, "jeSchedules/deleteJESchedulesDetails", never, never>, deleteAccruedJESchedulesDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[JEScheduleKey: `${string}_${string}`], {
|
|
24
24
|
JEScheduleKey: `${string}_${string}`;
|
|
25
25
|
}, "jeSchedules/deleteAccruedJESchedulesDetails", never, never>, clearAllAccruedJESchedules: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"jeSchedules/clearAllAccruedJESchedules">, clearAllJEScheduleTransactions: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"jeSchedules/clearAllJEScheduleTransactions">;
|
|
@@ -42,7 +42,7 @@ const jeSchedules = (0, toolkit_1.createSlice)({
|
|
|
42
42
|
},
|
|
43
43
|
updateJEScheduledTransaction: (draft, action) => {
|
|
44
44
|
action.payload.jeSchedulesTransactionsPayload.forEach((schedule) => {
|
|
45
|
-
doUpdateJEScheduledTransaction(draft.schedulesByTransactionKey, (0, jeSchedulesPayload_1.
|
|
45
|
+
doUpdateJEScheduledTransaction(draft.schedulesByTransactionKey, (0, jeSchedulesPayload_1.getJEScheduleTransactionDetailKeyPayload)(schedule.base_transaction), schedule, 'merge');
|
|
46
46
|
});
|
|
47
47
|
},
|
|
48
48
|
updateAccruedJEScheduledTransaction: (draft, action) => {
|
|
@@ -84,7 +84,7 @@ const jeSchedules = (0, toolkit_1.createSlice)({
|
|
|
84
84
|
if (jeSchedulesPayload.length > 0) {
|
|
85
85
|
jeSchedulesPayload.forEach((jeSchedulePayload) => {
|
|
86
86
|
const transactionKey = jeSchedulePayload.base_transaction;
|
|
87
|
-
doUpdateScheduledDetailTransaction(draft.schedulesByTransactionKey, (0, jeSchedulesPayload_1.
|
|
87
|
+
doUpdateScheduledDetailTransaction(draft.schedulesByTransactionKey, (0, jeSchedulesPayload_1.getJEScheduleTransactionDetailKeyPayload)(transactionKey), jeSchedulePayload, action.payload.scheduledJEntriesPayload ?? [], updateType);
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
},
|
|
@@ -9,7 +9,7 @@ import { ScheduleTransaction } from '../transaction/stateTypes/scheduleTransacti
|
|
|
9
9
|
import { TransactionID } from '../transaction/stateTypes/transaction';
|
|
10
10
|
import { User } from '../user/userState';
|
|
11
11
|
import { Vendor } from '../vendor/vendorState';
|
|
12
|
-
import {
|
|
12
|
+
import { JEScheduleOtherAttributes, ScheduleJournalStatusCode, ScheduleStatus } from './jeSchedulesState';
|
|
13
13
|
import { JEScheduleKey, JEScheduleTransactionKey, JournalEntryErrorCodeType, ScheduleTypes } from './jeSchedulesTypes';
|
|
14
14
|
export interface ScheduledJournalEntry {
|
|
15
15
|
error: JournalEntryErrorCodeType[];
|
|
@@ -59,7 +59,6 @@ export interface JEScheduledTransaction {
|
|
|
59
59
|
scheduledJournalEntry: ScheduledJournalEntry[];
|
|
60
60
|
status: ScheduleStatus;
|
|
61
61
|
vendor: Vendor;
|
|
62
|
-
aiRecommendations?: JEScheduleAIRecommendations;
|
|
63
62
|
balanceAsOfToday?: Amount;
|
|
64
63
|
dayOfPostingDate?: ScheduleDaysOfMonth;
|
|
65
64
|
endDate?: ZeniDate;
|
|
@@ -77,7 +77,7 @@ exports.getJEAccruedScheduleByJEScheduleKey = getJEAccruedScheduleByJEScheduleKe
|
|
|
77
77
|
const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransactionKey, state) => {
|
|
78
78
|
const { jeSchedulesState, vendorState, accountState, userState, classState, transactionState, } = state;
|
|
79
79
|
const jeScheduleTransactionState = (0, get_1.default)(jeSchedulesState.schedulesByTransactionKey, jeScheduleTransactionKey);
|
|
80
|
-
const { period, updatedByUserID: updatedBy, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType,
|
|
80
|
+
const { period, updatedByUserID: updatedBy, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType, } = jeScheduleTransactionState;
|
|
81
81
|
const vendorDetails = (0, vendorSelector_1.getVendorByVendorId)(vendorState, vendorId);
|
|
82
82
|
if (vendorDetails == null) {
|
|
83
83
|
throw new Error(`Vendor with ${vendorId} doesn't exist`);
|
|
@@ -134,7 +134,6 @@ const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransacti
|
|
|
134
134
|
account: accountDebit,
|
|
135
135
|
},
|
|
136
136
|
scheduledJournalEntry,
|
|
137
|
-
aiRecommendations,
|
|
138
137
|
};
|
|
139
138
|
};
|
|
140
139
|
exports.getJEScheduledTransactionByJEScheduleTransactionKey = getJEScheduledTransactionByJEScheduleTransactionKey;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Amount } from '../../commonStateTypes/amount';
|
|
2
2
|
import { ID } from '../../commonStateTypes/common';
|
|
3
3
|
import { ScheduleDaysOfMonth } from '../../commonStateTypes/timePeriod';
|
|
4
|
-
import { TransactionDetailKey } from '../../view/transactionDetail/transactionDetailState';
|
|
5
4
|
import { ZeniDate } from '../../zeniDayJS';
|
|
6
5
|
import { TransactionID } from '../transaction/stateTypes/transaction';
|
|
7
6
|
import { JEScheduleKey, JEScheduleTransactionKey, JournalEntryErrorCodeType, ScheduleJournalEntryStatusCodeType, ScheduleStatusCodeType, ScheduleTypes } from './jeSchedulesTypes';
|
|
@@ -13,18 +12,6 @@ export interface ScheduleJournalStatusCode {
|
|
|
13
12
|
code: ScheduleJournalEntryStatusCodeType;
|
|
14
13
|
label: string;
|
|
15
14
|
}
|
|
16
|
-
export interface JEScheduleFieldRecommendation {
|
|
17
|
-
confidence: number;
|
|
18
|
-
reasoning: string;
|
|
19
|
-
}
|
|
20
|
-
export interface JEScheduleAIRecommendations {
|
|
21
|
-
creditAccount?: JEScheduleFieldRecommendation;
|
|
22
|
-
creditClass?: JEScheduleFieldRecommendation;
|
|
23
|
-
debitAccount?: JEScheduleFieldRecommendation;
|
|
24
|
-
debitClass?: JEScheduleFieldRecommendation;
|
|
25
|
-
period?: JEScheduleFieldRecommendation;
|
|
26
|
-
postingDate?: JEScheduleFieldRecommendation;
|
|
27
|
-
}
|
|
28
15
|
export interface JEScheduleOtherAttributes {
|
|
29
16
|
assetId?: string;
|
|
30
17
|
startingBalance?: Amount;
|
|
@@ -54,7 +41,7 @@ export interface ScheduledJournalEntryState {
|
|
|
54
41
|
updateTime?: ZeniDate;
|
|
55
42
|
}
|
|
56
43
|
export interface JEScheduledTransactionState {
|
|
57
|
-
baseTransaction:
|
|
44
|
+
baseTransaction: JEScheduleTransactionKey;
|
|
58
45
|
currencyCode: string;
|
|
59
46
|
currencySymbol: string;
|
|
60
47
|
jeCredit: {
|
|
@@ -69,7 +56,6 @@ export interface JEScheduledTransactionState {
|
|
|
69
56
|
scheduledJournalEntry: ScheduledJournalEntryState[];
|
|
70
57
|
status: ScheduleStatus;
|
|
71
58
|
vendorId: ID;
|
|
72
|
-
aiRecommendations?: JEScheduleAIRecommendations;
|
|
73
59
|
balanceAsOfToday?: number;
|
|
74
60
|
dayOfPostingDate?: ScheduleDaysOfMonth;
|
|
75
61
|
endDate?: ZeniDate;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TransactionID } from '../transaction/stateTypes/transaction';
|
|
2
2
|
import { generateJEScheduleKey } from './jeScheduleHelper';
|
|
3
|
-
export
|
|
3
|
+
export interface ScheduleTransactionID extends TransactionID {
|
|
4
|
+
lineId: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const getJEScheduleTransactionKey: (scheduleTransactionId: ScheduleTransactionID) => `${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`;
|
|
7
|
+
export type JEScheduleTransactionKey = ReturnType<typeof getJEScheduleTransactionKey>;
|
|
4
8
|
export type JEScheduleKey = ReturnType<typeof generateJEScheduleKey>;
|
|
5
9
|
export declare const ALL_SCHEDULES_TYPES: readonly ["prepaid_expenses", "fixed_assets", "accrued_expenses", "deferred_revenue"];
|
|
6
10
|
export declare const toScheduleTypesType: (v: string) => "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
|
|
7
11
|
export type ScheduleTypes = ReturnType<typeof toScheduleTypesType>;
|
|
8
12
|
export declare const toScheduleTypesTypeStrict: (v?: string) => "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue" | undefined;
|
|
9
|
-
export declare const toScheduleJournalEntryStatusCodeType: (v: string) => "pending" | "posted" | "
|
|
13
|
+
export declare const toScheduleJournalEntryStatusCodeType: (v: string) => "pending" | "posted" | "unknown" | "canceled" | "recorded";
|
|
10
14
|
export type ScheduleJournalEntryStatusCodeType = ReturnType<typeof toScheduleJournalEntryStatusCodeType>;
|
|
11
15
|
export declare const toScheduleStatusCodeType: (v: string) => "draft" | "completed" | "new" | "ongoing" | "marked_as_completed";
|
|
12
16
|
export type ScheduleStatusCodeType = ReturnType<typeof toScheduleStatusCodeType>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toJournalEntryErrorCodeType = exports.toScheduleStatusCodeType = exports.toScheduleJournalEntryStatusCodeType = exports.toScheduleTypesTypeStrict = exports.toScheduleTypesType = exports.ALL_SCHEDULES_TYPES = void 0;
|
|
3
|
+
exports.toJournalEntryErrorCodeType = exports.toScheduleStatusCodeType = exports.toScheduleJournalEntryStatusCodeType = exports.toScheduleTypesTypeStrict = exports.toScheduleTypesType = exports.ALL_SCHEDULES_TYPES = exports.getJEScheduleTransactionKey = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
5
|
+
const getJEScheduleTransactionKey = (scheduleTransactionId) => `${scheduleTransactionId.id}_${scheduleTransactionId.type}_${scheduleTransactionId.lineId}`;
|
|
6
|
+
exports.getJEScheduleTransactionKey = getJEScheduleTransactionKey;
|
|
5
7
|
exports.ALL_SCHEDULES_TYPES = [
|
|
6
8
|
'prepaid_expenses',
|
|
7
9
|
'fixed_assets',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { URLPayload } from '../../commonPayloadTypes/urlPayload';
|
|
2
2
|
import { SegregatedReimbursementLineWithRecommendation } from '../../view/spendManagement/reimbursement/editRemiView/editRemiViewState';
|
|
3
3
|
import { AccountBasePayload } from '../account/accountPayload';
|
|
4
|
+
import { CustomerBasePayload } from '../customer/customerPayload';
|
|
4
5
|
import { BillAccountPayload, BillPaymentMethodPayload, BillPaymentStatusPayload, BillStagePayload, BillStatusPayload, BulkOperationDetailPayload, DeletionInfoPayload } from '../billPay/billTransaction/billTransactionPayload';
|
|
5
6
|
import { ClassBasePayload } from '../class/classPayload';
|
|
6
7
|
import { MerchantBasePayload } from '../merchant/merchantPayload';
|
|
@@ -68,6 +69,7 @@ interface ReimbursementTypePayload {
|
|
|
68
69
|
export interface LineDetailPayload {
|
|
69
70
|
class: ClassBasePayload;
|
|
70
71
|
account?: AccountBasePayload;
|
|
72
|
+
customer?: CustomerBasePayload;
|
|
71
73
|
}
|
|
72
74
|
interface ReimbursementInfoPayload {
|
|
73
75
|
actual_deposit_date: string | null;
|
|
@@ -6,6 +6,7 @@ const amount_1 = require("../../commonStateTypes/amount");
|
|
|
6
6
|
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
7
7
|
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
8
8
|
const accountPayload_1 = require("../account/accountPayload");
|
|
9
|
+
const customerPayload_1 = require("../customer/customerPayload");
|
|
9
10
|
const billTransactionPayload_1 = require("../billPay/billTransaction/billTransactionPayload");
|
|
10
11
|
const classPayload_1 = require("../class/classPayload");
|
|
11
12
|
const merchantPayload_1 = require("../merchant/merchantPayload");
|
|
@@ -171,6 +172,9 @@ const toLineDetailPayload = (lineDetail) => ({
|
|
|
171
172
|
account: lineDetail.account != null
|
|
172
173
|
? (0, accountPayload_1.toAccountPayload)(lineDetail.account)
|
|
173
174
|
: undefined,
|
|
175
|
+
customer: lineDetail.customer != null
|
|
176
|
+
? (0, customerPayload_1.toCustomerBasePayload)(undefined, lineDetail.customer)
|
|
177
|
+
: undefined,
|
|
174
178
|
});
|
|
175
179
|
exports.toLineDetailPayload = toLineDetailPayload;
|
|
176
180
|
const toLineDetail = (payload) => ({
|
|
@@ -180,6 +184,9 @@ const toLineDetail = (payload) => ({
|
|
|
180
184
|
account: payload.account?.account_id != null
|
|
181
185
|
? (0, accountPayload_1.mapAccountBasePayloadToAccountBase)(payload.account)
|
|
182
186
|
: undefined,
|
|
187
|
+
customer: payload.customer?.customer_id != null
|
|
188
|
+
? (0, customerPayload_1.toCustomerBase)(payload.customer, false)
|
|
189
|
+
: undefined,
|
|
183
190
|
});
|
|
184
191
|
const toDistanceMilage = (payload) => ({
|
|
185
192
|
unit: payload.unit,
|
|
@@ -6,6 +6,7 @@ import { ZeniUrl as Url } from '../../zeniUrl';
|
|
|
6
6
|
import { AccountBase } from '../account/accountState';
|
|
7
7
|
import { BillPaymentStatus, BillStage, BillStatus, BulkProcessingDetail, DeletionInfo } from '../billPay/billTransaction/billTransactionState';
|
|
8
8
|
import { ClassBase } from '../class/classState';
|
|
9
|
+
import { CustomerBase } from '../customer/customerState';
|
|
9
10
|
import { MerchantBase } from '../merchant/merchant';
|
|
10
11
|
import { Attachment } from '../transaction/stateTypes/attachment';
|
|
11
12
|
import { ReimbursementTransactionType } from './reimbursementPayload';
|
|
@@ -58,6 +59,7 @@ export interface DistanceMilage {
|
|
|
58
59
|
export interface LineDetail {
|
|
59
60
|
account?: AccountBase;
|
|
60
61
|
class?: ClassBase;
|
|
62
|
+
customer?: CustomerBase;
|
|
61
63
|
}
|
|
62
64
|
export interface ReimbursementInfo {
|
|
63
65
|
billPaymentMethodType: RemiPaymentMethod;
|
|
@@ -33,9 +33,6 @@ export interface TransactionPayload extends TransactionIDPayload, AccountBasePay
|
|
|
33
33
|
recipient_total_amount?: number;
|
|
34
34
|
recommendations?: RecommendationPayload[];
|
|
35
35
|
sync_token?: string;
|
|
36
|
-
target_account_id?: string | null;
|
|
37
|
-
target_account_integration_id?: string | null;
|
|
38
|
-
target_account_name?: string | null;
|
|
39
36
|
total_amount?: number;
|
|
40
37
|
transaction_type_name?: string;
|
|
41
38
|
transaction_update_time?: string;
|
|
@@ -65,17 +65,6 @@ const toTransaction = (payload) => {
|
|
|
65
65
|
...(payload.customer_name !== null && payload.customer_name !== ''
|
|
66
66
|
? { customerName: payload.customer_name }
|
|
67
67
|
: {}),
|
|
68
|
-
...(payload.target_account_id !== null && payload.target_account_id !== ''
|
|
69
|
-
? { targetAccountId: payload.target_account_id }
|
|
70
|
-
: {}),
|
|
71
|
-
...(payload.target_account_integration_id !== null &&
|
|
72
|
-
payload.target_account_integration_id !== ''
|
|
73
|
-
? { targetAccountIntegrationId: payload.target_account_integration_id }
|
|
74
|
-
: {}),
|
|
75
|
-
...(payload.target_account_name !== null &&
|
|
76
|
-
payload.target_account_name !== ''
|
|
77
|
-
? { targetAccountName: payload.target_account_name }
|
|
78
|
-
: {}),
|
|
79
68
|
linkedTransactions: payload.linked_transactions?.map((transactionIDPayload) => (0, transactionIDPayload_1.toTransactionID)(transactionIDPayload)),
|
|
80
69
|
lines: payload?.lines?.map((linePayload) => (0, transactionLinePayload_1.toLine)(linePayload, amount, recipientAmount)),
|
|
81
70
|
account: payloadHasAccountInfo(payload)
|
|
@@ -40,9 +40,6 @@ export interface Transaction extends BaseTransaction {
|
|
|
40
40
|
qboId?: string;
|
|
41
41
|
recommendations?: RecommendationByLineId;
|
|
42
42
|
syncToken?: string;
|
|
43
|
-
targetAccountId?: ID;
|
|
44
|
-
targetAccountIntegrationId?: string;
|
|
45
|
-
targetAccountName?: string;
|
|
46
43
|
updateTime?: ZeniDate;
|
|
47
44
|
vendorId?: ID;
|
|
48
45
|
vendorName?: string;
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.clearAllTransactions = exports.updateTransactionIsMiscategorized = exports.removeTransactionAttachment = exports.removeTransactionCategorization = exports.removeTransaction = exports.updateMultipleReconcileTransactions = exports.updateReconcileTransactions = exports.updateScheduleTransactions = exports.updateTransaction = exports.updateTransactions = exports.initialState = void 0;
|
|
8
8
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
9
9
|
const assignWith_1 = __importDefault(require("lodash/assignWith"));
|
|
10
|
-
const
|
|
10
|
+
const jeSchedulesTypes_1 = require("../jeSchedules/jeSchedulesTypes");
|
|
11
11
|
const reconciliationTransactionPayloads_1 = require("./payloadTypes/reconciliationTransactionPayloads");
|
|
12
12
|
const scheduleTransactionPayload_1 = require("./payloadTypes/scheduleTransactionPayload");
|
|
13
13
|
const transactionType_1 = require("./stateTypes/transactionType");
|
|
@@ -75,9 +75,10 @@ const transaction = (0, toolkit_1.createSlice)({
|
|
|
75
75
|
updateScheduleTransactions: {
|
|
76
76
|
reducer(draft, action) {
|
|
77
77
|
action.payload.transactionsPayload.forEach((value) => {
|
|
78
|
-
const id = (0,
|
|
78
|
+
const id = (0, jeSchedulesTypes_1.getJEScheduleTransactionKey)({
|
|
79
79
|
id: value.transaction_id,
|
|
80
80
|
type: (0, transactionType_1.toTransactionType)(value.transaction_type),
|
|
81
|
+
lineId: value.line_id,
|
|
81
82
|
});
|
|
82
83
|
doUpdateScheduleTransaction(draft.scheduleTransactionById, id, value, action.payload.currencyCode, action.payload.currencySymbol, action.meta.updateType);
|
|
83
84
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import {
|
|
2
|
+
import { JEScheduleTransactionKey } from '../jeSchedules/jeSchedulesTypes';
|
|
3
3
|
import { MatchedTransaction } from './stateTypes/reconciliationTransaction';
|
|
4
4
|
import { ScheduleTransaction } from './stateTypes/scheduleTransaction';
|
|
5
5
|
import { SupportedTransaction, TransactionState } from './transactionState';
|
|
6
|
-
export declare function getScheduleTransactionById(transactionState: TransactionState, transactionId:
|
|
6
|
+
export declare function getScheduleTransactionById(transactionState: TransactionState, transactionId: JEScheduleTransactionKey): ScheduleTransaction | undefined;
|
|
7
7
|
export declare function getSupportedTransactionById(transactionState: TransactionState, transactionId: ID): SupportedTransaction | undefined;
|
|
8
8
|
export declare function getSupportedTransactionsByIds(transactionState: TransactionState, transactionIds: ID[]): SupportedTransaction[];
|
|
9
9
|
export declare function getMatchedTransactionById(transactionState: TransactionState, transactionId: ID): MatchedTransaction | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { TransactionDetailKey
|
|
2
|
+
import { TransactionDetailKey } from '../../view/transactionDetail/transactionDetailState';
|
|
3
|
+
import { JEScheduleTransactionKey } from '../jeSchedules/jeSchedulesTypes';
|
|
3
4
|
import { CustomerTransactionPayload } from './payloadTypes/customerTransactionPayload';
|
|
4
5
|
import { TransactionPayload } from './payloadTypes/transactionPayload';
|
|
5
6
|
import { VendorTransactionPayload, VendorTransactionWithCustomerPayload } from './payloadTypes/vendorTransactionPayload';
|
|
@@ -14,6 +15,6 @@ export type SupportedTransactionPayload = TransactionPayload | CustomerTransacti
|
|
|
14
15
|
export type AllSupportedTransactions = SupportedTransaction | undefined;
|
|
15
16
|
export interface TransactionState {
|
|
16
17
|
reconcileTransactionById: Record<ID, MatchedTransaction>;
|
|
17
|
-
scheduleTransactionById: Record<
|
|
18
|
+
scheduleTransactionById: Record<JEScheduleTransactionKey, ScheduleTransaction>;
|
|
18
19
|
transactionById: Record<ID | TransactionDetailKey, SupportedTransaction | undefined>;
|
|
19
20
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { toAmount } from '../../commonStateTypes/amount';
|
|
2
2
|
import { LAST_SCHEDULE_DAY_OF_MONTH, MAX_SCHEDULE_DAY_OF_MONTH, MIN_SCHEDULE_DAY_OF_MONTH, toScheduleDaysOfMonth, } from '../../commonStateTypes/timePeriod';
|
|
3
|
-
import { getZeniTransactionDetailKey } from '../../view/transactionDetail/transactionDetailState';
|
|
4
3
|
import { date } from '../../zeniDayJS';
|
|
5
4
|
import { toTransactionID, } from '../transaction/payloadTypes/transactionIDPayload';
|
|
6
5
|
import { generateJEScheduleKey } from './jeScheduleHelper';
|
|
7
|
-
import { toJournalEntryErrorCodeType, toScheduleJournalEntryStatusCodeType, toScheduleStatusCodeType, toScheduleTypesTypeStrict, } from './jeSchedulesTypes';
|
|
6
|
+
import { getJEScheduleTransactionKey, toJournalEntryErrorCodeType, toScheduleJournalEntryStatusCodeType, toScheduleStatusCodeType, toScheduleTypesTypeStrict, } from './jeSchedulesTypes';
|
|
8
7
|
export function toScheduledJournalEntryState(payload, currency_code, currency_symbol) {
|
|
9
8
|
return {
|
|
10
9
|
status: {
|
|
@@ -122,9 +121,12 @@ export function toJEClassPayload(payload, type) {
|
|
|
122
121
|
: undefined;
|
|
123
122
|
}
|
|
124
123
|
}
|
|
125
|
-
export function
|
|
124
|
+
export function getJEScheduleTransactionDetailKeyPayload(payload) {
|
|
126
125
|
const transactionId = toTransactionID(payload);
|
|
127
|
-
return
|
|
126
|
+
return getJEScheduleTransactionKey({
|
|
127
|
+
...transactionId,
|
|
128
|
+
lineId: payload.line_id,
|
|
129
|
+
});
|
|
128
130
|
}
|
|
129
131
|
export function getJEScheduleKey(payload) {
|
|
130
132
|
return generateJEScheduleKey(payload);
|
|
@@ -134,49 +136,6 @@ function toJEScheduleOtherAttributes(payload) {
|
|
|
134
136
|
assetId: payload.asset_id ?? undefined,
|
|
135
137
|
};
|
|
136
138
|
}
|
|
137
|
-
function toJEScheduleAIRecommendations(payload) {
|
|
138
|
-
if (payload == null) {
|
|
139
|
-
return undefined;
|
|
140
|
-
}
|
|
141
|
-
const result = {};
|
|
142
|
-
if (payload.debit_account != null) {
|
|
143
|
-
result.debitAccount = {
|
|
144
|
-
confidence: payload.debit_account.confidence,
|
|
145
|
-
reasoning: payload.debit_account.reasoning,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
if (payload.credit_account != null) {
|
|
149
|
-
result.creditAccount = {
|
|
150
|
-
confidence: payload.credit_account.confidence,
|
|
151
|
-
reasoning: payload.credit_account.reasoning,
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
if (payload.debit_accounting_class != null) {
|
|
155
|
-
result.debitClass = {
|
|
156
|
-
confidence: payload.debit_accounting_class.confidence,
|
|
157
|
-
reasoning: payload.debit_accounting_class.reasoning,
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
if (payload.credit_accounting_class != null) {
|
|
161
|
-
result.creditClass = {
|
|
162
|
-
confidence: payload.credit_accounting_class.confidence,
|
|
163
|
-
reasoning: payload.credit_accounting_class.reasoning,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
if (payload.period != null) {
|
|
167
|
-
result.period = {
|
|
168
|
-
confidence: payload.period.confidence,
|
|
169
|
-
reasoning: payload.period.reasoning,
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
if (payload.posting_date != null) {
|
|
173
|
-
result.postingDate = {
|
|
174
|
-
confidence: payload.posting_date.confidence,
|
|
175
|
-
reasoning: payload.posting_date.reasoning,
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
return Object.keys(result).length > 0 ? result : undefined;
|
|
179
|
-
}
|
|
180
139
|
export function toJEScheduledTransaction(payload) {
|
|
181
140
|
return {
|
|
182
141
|
jeScheduleId: payload.je_schedule_id ?? undefined,
|
|
@@ -188,7 +147,10 @@ export function toJEScheduledTransaction(payload) {
|
|
|
188
147
|
label: payload.status.label,
|
|
189
148
|
},
|
|
190
149
|
vendorId: payload.vendor.vendor_id,
|
|
191
|
-
baseTransaction:
|
|
150
|
+
baseTransaction: getJEScheduleTransactionKey({
|
|
151
|
+
...toTransactionID(payload.base_transaction),
|
|
152
|
+
lineId: payload.base_transaction.line_id,
|
|
153
|
+
}),
|
|
192
154
|
startDate: payload.start_date != null ? date(payload.start_date) : undefined,
|
|
193
155
|
endDate: payload.end_date != null ? date(payload.end_date) : undefined,
|
|
194
156
|
period: payload.period != null ? Number(payload.period) : undefined,
|
|
@@ -218,7 +180,6 @@ export function toJEScheduledTransaction(payload) {
|
|
|
218
180
|
? toJEScheduleOtherAttributes(payload.other_attributes)
|
|
219
181
|
: {},
|
|
220
182
|
scheduledJournalEntry: [],
|
|
221
|
-
aiRecommendations: toJEScheduleAIRecommendations(payload.ai_summaries),
|
|
222
183
|
};
|
|
223
184
|
}
|
|
224
185
|
export function toJEAccruedScheduledTransaction(payload) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
2
|
import assignWith from 'lodash/assignWith';
|
|
3
|
-
import { getJEScheduleKey,
|
|
3
|
+
import { getJEScheduleKey, getJEScheduleTransactionDetailKeyPayload, toJEAccruedScheduledTransaction, toJEScheduledTransaction, toScheduledJournalEntryState, } from './jeSchedulesPayload';
|
|
4
4
|
export const initialState = {
|
|
5
5
|
schedulesByTransactionKey: {},
|
|
6
6
|
schedulesByAccruedJEScheduleKey: {},
|
|
@@ -35,7 +35,7 @@ const jeSchedules = createSlice({
|
|
|
35
35
|
},
|
|
36
36
|
updateJEScheduledTransaction: (draft, action) => {
|
|
37
37
|
action.payload.jeSchedulesTransactionsPayload.forEach((schedule) => {
|
|
38
|
-
doUpdateJEScheduledTransaction(draft.schedulesByTransactionKey,
|
|
38
|
+
doUpdateJEScheduledTransaction(draft.schedulesByTransactionKey, getJEScheduleTransactionDetailKeyPayload(schedule.base_transaction), schedule, 'merge');
|
|
39
39
|
});
|
|
40
40
|
},
|
|
41
41
|
updateAccruedJEScheduledTransaction: (draft, action) => {
|
|
@@ -77,7 +77,7 @@ const jeSchedules = createSlice({
|
|
|
77
77
|
if (jeSchedulesPayload.length > 0) {
|
|
78
78
|
jeSchedulesPayload.forEach((jeSchedulePayload) => {
|
|
79
79
|
const transactionKey = jeSchedulePayload.base_transaction;
|
|
80
|
-
doUpdateScheduledDetailTransaction(draft.schedulesByTransactionKey,
|
|
80
|
+
doUpdateScheduledDetailTransaction(draft.schedulesByTransactionKey, getJEScheduleTransactionDetailKeyPayload(transactionKey), jeSchedulePayload, action.payload.scheduledJEntriesPayload ?? [], updateType);
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
},
|
|
@@ -70,7 +70,7 @@ export const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
|
|
|
70
70
|
export const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransactionKey, state) => {
|
|
71
71
|
const { jeSchedulesState, vendorState, accountState, userState, classState, transactionState, } = state;
|
|
72
72
|
const jeScheduleTransactionState = recordGet(jeSchedulesState.schedulesByTransactionKey, jeScheduleTransactionKey);
|
|
73
|
-
const { period, updatedByUserID: updatedBy, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType,
|
|
73
|
+
const { period, updatedByUserID: updatedBy, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType, } = jeScheduleTransactionState;
|
|
74
74
|
const vendorDetails = getVendorByVendorId(vendorState, vendorId);
|
|
75
75
|
if (vendorDetails == null) {
|
|
76
76
|
throw new Error(`Vendor with ${vendorId} doesn't exist`);
|
|
@@ -127,6 +127,5 @@ export const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTr
|
|
|
127
127
|
account: accountDebit,
|
|
128
128
|
},
|
|
129
129
|
scheduledJournalEntry,
|
|
130
|
-
aiRecommendations,
|
|
131
130
|
};
|
|
132
131
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { stringToUnion, stringToUnionStrict, } from '../../commonStateTypes/stringToUnion';
|
|
2
|
+
export const getJEScheduleTransactionKey = (scheduleTransactionId) => `${scheduleTransactionId.id}_${scheduleTransactionId.type}_${scheduleTransactionId.lineId}`;
|
|
2
3
|
export const ALL_SCHEDULES_TYPES = [
|
|
3
4
|
'prepaid_expenses',
|
|
4
5
|
'fixed_assets',
|