@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.
Files changed (81) hide show
  1. package/Client/Accounts/History.ts +2 -5
  2. package/Client/Accounts/Rails.ts +2 -5
  3. package/Client/Accounts/index.ts +2 -5
  4. package/Client/Cards.ts +2 -5
  5. package/Client/Exchanges.ts +2 -5
  6. package/Client/Operations.ts +2 -5
  7. package/Client/Organizations/Groups.ts +2 -5
  8. package/Client/Organizations/index.ts +2 -5
  9. package/Client/Processor/Tpl.ts +22 -0
  10. package/Client/Processor/index.ts +9 -0
  11. package/Client/Reports.ts +2 -5
  12. package/Client/Transactions/Notes.ts +2 -5
  13. package/Client/Transactions/index.ts +2 -5
  14. package/Client/Version.ts +2 -6
  15. package/Client/index.ts +40 -31
  16. package/dist/Client/Accounts/History.d.ts +2 -2
  17. package/dist/Client/Accounts/History.js +2 -3
  18. package/dist/Client/Accounts/History.js.map +1 -1
  19. package/dist/Client/Accounts/Rails.d.ts +2 -2
  20. package/dist/Client/Accounts/Rails.js +2 -3
  21. package/dist/Client/Accounts/Rails.js.map +1 -1
  22. package/dist/Client/Accounts/index.d.ts +2 -2
  23. package/dist/Client/Accounts/index.js +2 -3
  24. package/dist/Client/Accounts/index.js.map +1 -1
  25. package/dist/Client/Cards.d.ts +2 -2
  26. package/dist/Client/Cards.js +2 -3
  27. package/dist/Client/Cards.js.map +1 -1
  28. package/dist/Client/Exchanges.d.ts +2 -2
  29. package/dist/Client/Exchanges.js +2 -3
  30. package/dist/Client/Exchanges.js.map +1 -1
  31. package/dist/Client/Operations.d.ts +2 -2
  32. package/dist/Client/Operations.js +2 -3
  33. package/dist/Client/Operations.js.map +1 -1
  34. package/dist/Client/Organizations/Groups.d.ts +2 -2
  35. package/dist/Client/Organizations/Groups.js +2 -3
  36. package/dist/Client/Organizations/Groups.js.map +1 -1
  37. package/dist/Client/Organizations/index.d.ts +2 -2
  38. package/dist/Client/Organizations/index.js +2 -3
  39. package/dist/Client/Organizations/index.js.map +1 -1
  40. package/dist/Client/Processor/Tpl.d.ts +12 -0
  41. package/dist/Client/Processor/Tpl.js +10 -0
  42. package/dist/Client/Processor/Tpl.js.map +1 -0
  43. package/dist/Client/Processor/index.d.ts +7 -0
  44. package/dist/Client/Processor/index.js +8 -0
  45. package/dist/Client/Processor/index.js.map +1 -0
  46. package/dist/Client/Reports.d.ts +2 -2
  47. package/dist/Client/Reports.js +2 -3
  48. package/dist/Client/Reports.js.map +1 -1
  49. package/dist/Client/Transactions/Notes.d.ts +2 -2
  50. package/dist/Client/Transactions/Notes.js +2 -3
  51. package/dist/Client/Transactions/Notes.js.map +1 -1
  52. package/dist/Client/Transactions/index.d.ts +2 -2
  53. package/dist/Client/Transactions/index.js +2 -3
  54. package/dist/Client/Transactions/index.js.map +1 -1
  55. package/dist/Client/Version.d.ts +2 -3
  56. package/dist/Client/Version.js +2 -3
  57. package/dist/Client/Version.js.map +1 -1
  58. package/dist/Client/index.d.ts +11 -7
  59. package/dist/Client/index.js +22 -10
  60. package/dist/Client/index.js.map +1 -1
  61. package/dist/reports/visa/Data/Country.d.ts +1 -0
  62. package/dist/reports/visa/Data/Country.js +13 -0
  63. package/dist/reports/visa/Data/Country.js.map +1 -1
  64. package/dist/reports/visa/Data/Monthly.d.ts +2 -0
  65. package/dist/reports/visa/Data/Monthly.js +17 -5
  66. package/dist/reports/visa/Data/Monthly.js.map +1 -1
  67. package/dist/reports/visa/Data/NonMonthly.d.ts +2 -1
  68. package/dist/reports/visa/Data/NonMonthly.js +18 -7
  69. package/dist/reports/visa/Data/NonMonthly.js.map +1 -1
  70. package/dist/reports/visa/Data/Regional.d.ts +1 -0
  71. package/dist/reports/visa/Data/Regional.js +7 -0
  72. package/dist/reports/visa/Data/Regional.js.map +1 -1
  73. package/dist/reports/visa/Data/index.d.ts +3 -2
  74. package/dist/reports/visa/Data/index.js +10 -1
  75. package/dist/reports/visa/Data/index.js.map +1 -1
  76. package/package.json +1 -5
  77. package/reports/visa/Data/Country.ts +12 -0
  78. package/reports/visa/Data/Monthly.ts +20 -5
  79. package/reports/visa/Data/NonMonthly.ts +15 -6
  80. package/reports/visa/Data/Regional.ts +6 -0
  81. 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 const empty: NonMonthly = {
15
- "Number of Accounts - International Enabled": {},
16
- "Payments Transactions Declined for Insufficient Funds - Number": {},
17
- "Total Number of Accounts": {},
18
- "Total Number of Active Cards": {},
19
- "Total Number of Cards": {},
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 type Data = {
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"))