@pax2pay/model-banking 0.1.466 → 0.1.468
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/Client/Accounts/History.ts +2 -5
- package/Client/Accounts/Rails.ts +2 -5
- package/Client/Accounts/index.ts +2 -5
- package/Client/Cards.ts +2 -5
- package/Client/Exchanges.ts +2 -5
- package/Client/Operations.ts +2 -5
- package/Client/Organizations/Groups.ts +2 -5
- package/Client/Organizations/index.ts +2 -5
- package/Client/Processor/Tpl.ts +22 -0
- package/Client/Processor/index.ts +9 -0
- package/Client/Reports.ts +2 -5
- package/Client/Transactions/Notes.ts +2 -5
- package/Client/Transactions/index.ts +2 -5
- package/Client/Version.ts +2 -6
- package/Client/index.ts +40 -31
- package/dist/Client/Accounts/History.d.ts +2 -2
- package/dist/Client/Accounts/History.js +2 -3
- package/dist/Client/Accounts/History.js.map +1 -1
- package/dist/Client/Accounts/Rails.d.ts +2 -2
- package/dist/Client/Accounts/Rails.js +2 -3
- package/dist/Client/Accounts/Rails.js.map +1 -1
- package/dist/Client/Accounts/index.d.ts +2 -2
- package/dist/Client/Accounts/index.js +2 -3
- package/dist/Client/Accounts/index.js.map +1 -1
- package/dist/Client/Cards.d.ts +2 -2
- package/dist/Client/Cards.js +2 -3
- package/dist/Client/Cards.js.map +1 -1
- package/dist/Client/Exchanges.d.ts +2 -2
- package/dist/Client/Exchanges.js +2 -3
- package/dist/Client/Exchanges.js.map +1 -1
- package/dist/Client/Operations.d.ts +2 -2
- package/dist/Client/Operations.js +2 -3
- package/dist/Client/Operations.js.map +1 -1
- package/dist/Client/Organizations/Groups.d.ts +2 -2
- package/dist/Client/Organizations/Groups.js +2 -3
- package/dist/Client/Organizations/Groups.js.map +1 -1
- package/dist/Client/Organizations/index.d.ts +2 -2
- package/dist/Client/Organizations/index.js +2 -3
- package/dist/Client/Organizations/index.js.map +1 -1
- package/dist/Client/Processor/Tpl.d.ts +12 -0
- package/dist/Client/Processor/Tpl.js +10 -0
- package/dist/Client/Processor/Tpl.js.map +1 -0
- package/dist/Client/Processor/index.d.ts +7 -0
- package/dist/Client/Processor/index.js +8 -0
- package/dist/Client/Processor/index.js.map +1 -0
- package/dist/Client/Reports.d.ts +2 -2
- package/dist/Client/Reports.js +2 -3
- package/dist/Client/Reports.js.map +1 -1
- package/dist/Client/Transactions/Notes.d.ts +2 -2
- package/dist/Client/Transactions/Notes.js +2 -3
- package/dist/Client/Transactions/Notes.js.map +1 -1
- package/dist/Client/Transactions/index.d.ts +2 -2
- package/dist/Client/Transactions/index.js +2 -3
- package/dist/Client/Transactions/index.js.map +1 -1
- package/dist/Client/Version.d.ts +2 -3
- package/dist/Client/Version.js +2 -3
- package/dist/Client/Version.js.map +1 -1
- package/dist/Client/index.d.ts +11 -7
- package/dist/Client/index.js +22 -10
- package/dist/Client/index.js.map +1 -1
- package/dist/reports/visa/Data/Country.d.ts +1 -0
- package/dist/reports/visa/Data/Country.js +13 -0
- package/dist/reports/visa/Data/Country.js.map +1 -1
- package/dist/reports/visa/Data/Monthly.d.ts +2 -0
- package/dist/reports/visa/Data/Monthly.js +17 -5
- package/dist/reports/visa/Data/Monthly.js.map +1 -1
- package/dist/reports/visa/Data/NonMonthly.d.ts +2 -1
- package/dist/reports/visa/Data/NonMonthly.js +18 -7
- package/dist/reports/visa/Data/NonMonthly.js.map +1 -1
- package/dist/reports/visa/Data/Regional.d.ts +1 -0
- package/dist/reports/visa/Data/Regional.js +7 -0
- package/dist/reports/visa/Data/Regional.js.map +1 -1
- package/dist/reports/visa/Data/index.d.ts +3 -2
- package/dist/reports/visa/Data/index.js +10 -1
- package/dist/reports/visa/Data/index.js.map +1 -1
- package/package.json +1 -5
- package/reports/visa/Data/Country.ts +12 -0
- package/reports/visa/Data/Monthly.ts +20 -5
- package/reports/visa/Data/NonMonthly.ts +15 -6
- package/reports/visa/Data/Regional.ts +6 -0
- package/reports/visa/Data/index.ts +10 -2
|
@@ -16,12 +16,11 @@ export namespace Monthly {
|
|
|
16
16
|
const month = isoly.DateTime.getMonth(transaction.transacted ?? transaction.posted)
|
|
17
17
|
return (((month - 1) % 3) + 1) as Monthly.Month
|
|
18
18
|
}
|
|
19
|
+
export function empty(): Monthly {
|
|
20
|
+
return { "1": { count: {}, volume: {} }, "2": { count: {}, volume: {} }, "3": { count: {}, volume: {} } }
|
|
21
|
+
}
|
|
19
22
|
export function update(previous: Monthly | undefined, transaction: Transaction.CardTransaction): Monthly {
|
|
20
|
-
const result: Monthly = previous ??
|
|
21
|
-
"1": { count: {}, volume: {} },
|
|
22
|
-
"2": { count: {}, volume: {} },
|
|
23
|
-
"3": { count: {}, volume: {} },
|
|
24
|
-
}
|
|
23
|
+
const result: Monthly = previous ?? empty()
|
|
25
24
|
if (transaction.direction == "outbound" && transaction.status == "finalized") {
|
|
26
25
|
const month = getMonth(transaction)
|
|
27
26
|
result[month].count[transaction.account.iin as Iin] =
|
|
@@ -42,4 +41,20 @@ export namespace Monthly {
|
|
|
42
41
|
}
|
|
43
42
|
return result
|
|
44
43
|
}
|
|
44
|
+
export function merge(previous: Monthly | undefined, addition: Monthly | undefined): Monthly {
|
|
45
|
+
const result: Monthly = empty()
|
|
46
|
+
previous ??= empty()
|
|
47
|
+
addition ??= empty()
|
|
48
|
+
for (const month of Monthly.Month.values)
|
|
49
|
+
for (const iin of Iin.values) {
|
|
50
|
+
result[month].count[iin] = (previous[month].count[iin] ?? 0) + (addition[month].count[iin] ?? 0)
|
|
51
|
+
result[month].volume[iin] = isoly.Currency.add(
|
|
52
|
+
"GBP",
|
|
53
|
+
previous[month].volume[iin] ?? 0,
|
|
54
|
+
addition[month].volume[iin] ?? 0
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return result
|
|
59
|
+
}
|
|
45
60
|
}
|
|
@@ -11,12 +11,14 @@ export type NonMonthly = Record<
|
|
|
11
11
|
Partial<Record<Iin, number>>
|
|
12
12
|
>
|
|
13
13
|
export namespace NonMonthly {
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
export function empty(): NonMonthly {
|
|
15
|
+
return {
|
|
16
|
+
"Number of Accounts - International Enabled": {},
|
|
17
|
+
"Payments Transactions Declined for Insufficient Funds - Number": {},
|
|
18
|
+
"Total Number of Accounts": {},
|
|
19
|
+
"Total Number of Active Cards": {},
|
|
20
|
+
"Total Number of Cards": {},
|
|
21
|
+
}
|
|
20
22
|
}
|
|
21
23
|
export function update(previous: NonMonthly, transaction: Transaction.CardTransaction): NonMonthly {
|
|
22
24
|
const result = previous
|
|
@@ -33,4 +35,11 @@ export namespace NonMonthly {
|
|
|
33
35
|
result += "\n"
|
|
34
36
|
return result
|
|
35
37
|
}
|
|
38
|
+
export function merge(previous: NonMonthly, addition: NonMonthly): NonMonthly {
|
|
39
|
+
const result: NonMonthly = empty()
|
|
40
|
+
for (const key of Object.keys(result) as (keyof NonMonthly)[])
|
|
41
|
+
for (const iin of Iin.values)
|
|
42
|
+
result[key][iin] = (previous[key]?.[iin] ?? 0) + (addition[key]?.[iin] ?? 0)
|
|
43
|
+
return result
|
|
44
|
+
}
|
|
36
45
|
}
|
|
@@ -11,6 +11,12 @@ export namespace Regional {
|
|
|
11
11
|
result[region] = Monthly.update(result[region], transaction)
|
|
12
12
|
return result
|
|
13
13
|
}
|
|
14
|
+
export function merge(previous: Regional, addition: Regional): Regional {
|
|
15
|
+
const result: Regional = {}
|
|
16
|
+
for (const region of Region.values)
|
|
17
|
+
result[region] = Monthly.merge(previous[region], addition[region])
|
|
18
|
+
return result
|
|
19
|
+
}
|
|
14
20
|
export function toCsvRow(regional: Regional, row: string): string {
|
|
15
21
|
let result = ""
|
|
16
22
|
const region = Region.fromRow(row)
|
|
@@ -5,7 +5,7 @@ import { Iin as DataIin } from "./Iin"
|
|
|
5
5
|
import { NonMonthly } from "./NonMonthly"
|
|
6
6
|
import { Regional } from "./Regional"
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export interface Data {
|
|
9
9
|
regional: Regional
|
|
10
10
|
nonMonthly: NonMonthly
|
|
11
11
|
country: Data.Country
|
|
@@ -14,7 +14,7 @@ export namespace Data {
|
|
|
14
14
|
export import Iin = DataIin
|
|
15
15
|
export import Country = DataCountry
|
|
16
16
|
export function create(transactions: Transaction.CardTransaction[]): Data {
|
|
17
|
-
const result: Data = { regional: {}, nonMonthly: NonMonthly.empty, country: {} }
|
|
17
|
+
const result: Data = { regional: {}, nonMonthly: NonMonthly.empty(), country: {} }
|
|
18
18
|
for (const transaction of transactions) {
|
|
19
19
|
result.nonMonthly = NonMonthly.update(result.nonMonthly, transaction)
|
|
20
20
|
result.regional = Regional.update(result.regional, transaction)
|
|
@@ -22,6 +22,14 @@ export namespace Data {
|
|
|
22
22
|
}
|
|
23
23
|
return result
|
|
24
24
|
}
|
|
25
|
+
export function merge(previous: Data, addition: Data): Data {
|
|
26
|
+
const result: Data = {
|
|
27
|
+
regional: Regional.merge(previous.regional, addition.regional),
|
|
28
|
+
nonMonthly: NonMonthly.merge(previous.nonMonthly, addition.nonMonthly),
|
|
29
|
+
country: Data.Country.merge(previous.country, addition.country),
|
|
30
|
+
}
|
|
31
|
+
return result
|
|
32
|
+
}
|
|
25
33
|
export function toCsv(data: Data, row: rows.NonZero): string {
|
|
26
34
|
let result: string
|
|
27
35
|
if (row.endsWith("Month x"))
|