@zeniai/client-epic-state 5.2.11-betaAM5 → 5.2.11-betaAM6
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.
|
@@ -5,8 +5,31 @@ export function toServiceMonthFromPeriod(period) {
|
|
|
5
5
|
}
|
|
6
6
|
const DEFAULT_CURRENCY_CODE = 'USD';
|
|
7
7
|
const DEFAULT_CURRENCY_SYMBOL = '$';
|
|
8
|
+
function resolveMatchSearchAmount(payload) {
|
|
9
|
+
const raw = payload.total_amount ?? payload.amount;
|
|
10
|
+
if (typeof raw === 'number' && Number.isFinite(raw)) {
|
|
11
|
+
return raw;
|
|
12
|
+
}
|
|
13
|
+
if (typeof raw === 'string' && raw !== '') {
|
|
14
|
+
const parsed = Number(raw);
|
|
15
|
+
if (Number.isFinite(parsed)) {
|
|
16
|
+
return parsed;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
function resolveMatchSearchCurrencySymbol(payload, currencyCode) {
|
|
22
|
+
if (payload.currency_symbol != null && payload.currency_symbol !== '') {
|
|
23
|
+
return payload.currency_symbol;
|
|
24
|
+
}
|
|
25
|
+
return currencyCode === DEFAULT_CURRENCY_CODE
|
|
26
|
+
? DEFAULT_CURRENCY_SYMBOL
|
|
27
|
+
: currencyCode;
|
|
28
|
+
}
|
|
8
29
|
export function toActualMatchingTransactionSearchResult(payload) {
|
|
9
|
-
const currencyCode = payload.currency_code
|
|
30
|
+
const currencyCode = payload.currency_code != null && payload.currency_code !== ''
|
|
31
|
+
? payload.currency_code
|
|
32
|
+
: DEFAULT_CURRENCY_CODE;
|
|
10
33
|
return {
|
|
11
34
|
transactionId: payload.transaction_id,
|
|
12
35
|
transactionIntegrationId: payload.transaction_integration_id,
|
|
@@ -14,7 +37,7 @@ export function toActualMatchingTransactionSearchResult(payload) {
|
|
|
14
37
|
lineId: payload.line_id,
|
|
15
38
|
vendorId: payload.vendor_id ?? undefined,
|
|
16
39
|
vendorName: payload.vendor_name ?? '',
|
|
17
|
-
amount: payload
|
|
40
|
+
amount: resolveMatchSearchAmount(payload),
|
|
18
41
|
transactionDate: payload.transaction_date,
|
|
19
42
|
accountId: payload.account_id ?? undefined,
|
|
20
43
|
accountName: payload.account_name ?? undefined,
|
|
@@ -22,10 +45,7 @@ export function toActualMatchingTransactionSearchResult(payload) {
|
|
|
22
45
|
accountingClassId: payload.accounting_class_id ?? undefined,
|
|
23
46
|
accountingClassName: payload.accounting_class_name ?? undefined,
|
|
24
47
|
currencyCode,
|
|
25
|
-
currencySymbol: payload
|
|
26
|
-
(currencyCode === DEFAULT_CURRENCY_CODE
|
|
27
|
-
? DEFAULT_CURRENCY_SYMBOL
|
|
28
|
-
: currencyCode),
|
|
48
|
+
currencySymbol: resolveMatchSearchCurrencySymbol(payload, currencyCode),
|
|
29
49
|
transactionMemo: payload.transaction_memo ?? undefined,
|
|
30
50
|
transactionDescription: payload.transaction_description ?? undefined,
|
|
31
51
|
transactionTypeName: payload.transaction_type_name ?? undefined,
|
|
@@ -25,7 +25,6 @@ export interface MatchTransactionSearchQueryPayload {
|
|
|
25
25
|
}
|
|
26
26
|
export interface MatchTransactionSearchResultPayload {
|
|
27
27
|
line_id: string;
|
|
28
|
-
total_amount: number;
|
|
29
28
|
transaction_date: string;
|
|
30
29
|
transaction_id: ID;
|
|
31
30
|
transaction_integration_id: string;
|
|
@@ -35,8 +34,10 @@ export interface MatchTransactionSearchResultPayload {
|
|
|
35
34
|
account_name?: string | null;
|
|
36
35
|
accounting_class_id?: ID | null;
|
|
37
36
|
accounting_class_name?: string | null;
|
|
37
|
+
amount?: number | null;
|
|
38
38
|
currency_code?: string | null;
|
|
39
39
|
currency_symbol?: string | null;
|
|
40
|
+
total_amount?: number | null;
|
|
40
41
|
transaction_description?: string | null;
|
|
41
42
|
transaction_memo?: string | null;
|
|
42
43
|
transaction_type_name?: string | null;
|
|
@@ -10,8 +10,31 @@ function toServiceMonthFromPeriod(period) {
|
|
|
10
10
|
}
|
|
11
11
|
const DEFAULT_CURRENCY_CODE = 'USD';
|
|
12
12
|
const DEFAULT_CURRENCY_SYMBOL = '$';
|
|
13
|
+
function resolveMatchSearchAmount(payload) {
|
|
14
|
+
const raw = payload.total_amount ?? payload.amount;
|
|
15
|
+
if (typeof raw === 'number' && Number.isFinite(raw)) {
|
|
16
|
+
return raw;
|
|
17
|
+
}
|
|
18
|
+
if (typeof raw === 'string' && raw !== '') {
|
|
19
|
+
const parsed = Number(raw);
|
|
20
|
+
if (Number.isFinite(parsed)) {
|
|
21
|
+
return parsed;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return 0;
|
|
25
|
+
}
|
|
26
|
+
function resolveMatchSearchCurrencySymbol(payload, currencyCode) {
|
|
27
|
+
if (payload.currency_symbol != null && payload.currency_symbol !== '') {
|
|
28
|
+
return payload.currency_symbol;
|
|
29
|
+
}
|
|
30
|
+
return currencyCode === DEFAULT_CURRENCY_CODE
|
|
31
|
+
? DEFAULT_CURRENCY_SYMBOL
|
|
32
|
+
: currencyCode;
|
|
33
|
+
}
|
|
13
34
|
function toActualMatchingTransactionSearchResult(payload) {
|
|
14
|
-
const currencyCode = payload.currency_code
|
|
35
|
+
const currencyCode = payload.currency_code != null && payload.currency_code !== ''
|
|
36
|
+
? payload.currency_code
|
|
37
|
+
: DEFAULT_CURRENCY_CODE;
|
|
15
38
|
return {
|
|
16
39
|
transactionId: payload.transaction_id,
|
|
17
40
|
transactionIntegrationId: payload.transaction_integration_id,
|
|
@@ -19,7 +42,7 @@ function toActualMatchingTransactionSearchResult(payload) {
|
|
|
19
42
|
lineId: payload.line_id,
|
|
20
43
|
vendorId: payload.vendor_id ?? undefined,
|
|
21
44
|
vendorName: payload.vendor_name ?? '',
|
|
22
|
-
amount: payload
|
|
45
|
+
amount: resolveMatchSearchAmount(payload),
|
|
23
46
|
transactionDate: payload.transaction_date,
|
|
24
47
|
accountId: payload.account_id ?? undefined,
|
|
25
48
|
accountName: payload.account_name ?? undefined,
|
|
@@ -27,10 +50,7 @@ function toActualMatchingTransactionSearchResult(payload) {
|
|
|
27
50
|
accountingClassId: payload.accounting_class_id ?? undefined,
|
|
28
51
|
accountingClassName: payload.accounting_class_name ?? undefined,
|
|
29
52
|
currencyCode,
|
|
30
|
-
currencySymbol: payload
|
|
31
|
-
(currencyCode === DEFAULT_CURRENCY_CODE
|
|
32
|
-
? DEFAULT_CURRENCY_SYMBOL
|
|
33
|
-
: currencyCode),
|
|
53
|
+
currencySymbol: resolveMatchSearchCurrencySymbol(payload, currencyCode),
|
|
34
54
|
transactionMemo: payload.transaction_memo ?? undefined,
|
|
35
55
|
transactionDescription: payload.transaction_description ?? undefined,
|
|
36
56
|
transactionTypeName: payload.transaction_type_name ?? undefined,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.2.11-
|
|
3
|
+
"version": "5.2.11-betaAM6",
|
|
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",
|