@pax2pay/model-banking 0.1.613 → 0.1.615

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 (227) hide show
  1. package/Amount.ts +0 -6
  2. package/Card/Changeable.ts +0 -13
  3. package/Card/Creatable.ts +0 -28
  4. package/Card/Expiry.ts +0 -14
  5. package/Card/Operation/Authorization.ts +1 -13
  6. package/Card/Operation/Card.ts +0 -14
  7. package/Card/Operation/index.ts +0 -5
  8. package/Card/Preset.ts +0 -5
  9. package/Card/Restriction/Merchant.ts +0 -2
  10. package/Card/Restriction/index.ts +0 -8
  11. package/Card/Restriction/merchants/Merchant.ts +2 -2
  12. package/Card/Scheme.ts +0 -5
  13. package/Card/index.ts +0 -37
  14. package/Client/Transactions/index.ts +0 -21
  15. package/Operation/Changes.ts +6 -0
  16. package/Rail/index.ts +0 -2
  17. package/Realm.ts +0 -5
  18. package/Rule/Base.ts +0 -26
  19. package/Rule/Other.ts +0 -6
  20. package/Rule/type.ts +0 -5
  21. package/Treasury/Snapshot/Account.ts +1 -1
  22. package/Treasury/Snapshot/Check/BankFeedIntegrity.ts +19 -0
  23. package/Treasury/Snapshot/Check/Base.ts +8 -0
  24. package/Treasury/Snapshot/Check/Checks.ts +15 -0
  25. package/Treasury/Snapshot/Check/ExternalReconciliation.ts +9 -0
  26. package/Treasury/Snapshot/Check/InternalReconciliation.ts +9 -0
  27. package/Treasury/Snapshot/Check/LedgerIntegrity.ts +17 -0
  28. package/Treasury/Snapshot/Check/Overdraft.ts +7 -0
  29. package/Treasury/Snapshot/Check/Result.ts +11 -0
  30. package/Treasury/Snapshot/Check/TransactionMatch.ts +9 -0
  31. package/Treasury/Snapshot/Check/UnidentifiedFunds.ts +8 -0
  32. package/Treasury/Snapshot/Check/index.ts +29 -0
  33. package/Treasury/Snapshot/Fiat.ts +0 -2
  34. package/Treasury/Snapshot/index.ts +7 -27
  35. package/dist/cjs/Amount.d.ts +0 -2
  36. package/dist/cjs/Amount.js +0 -3
  37. package/dist/cjs/Amount.js.map +1 -1
  38. package/dist/cjs/Card/Changeable.d.ts +0 -2
  39. package/dist/cjs/Card/Changeable.js +0 -13
  40. package/dist/cjs/Card/Changeable.js.map +1 -1
  41. package/dist/cjs/Card/Creatable.d.ts +0 -2
  42. package/dist/cjs/Card/Creatable.js +0 -28
  43. package/dist/cjs/Card/Creatable.js.map +1 -1
  44. package/dist/cjs/Card/Expiry.d.ts +0 -2
  45. package/dist/cjs/Card/Expiry.js +0 -11
  46. package/dist/cjs/Card/Expiry.js.map +1 -1
  47. package/dist/cjs/Card/Operation/Authorization.d.ts +0 -2
  48. package/dist/cjs/Card/Operation/Authorization.js +0 -12
  49. package/dist/cjs/Card/Operation/Authorization.js.map +1 -1
  50. package/dist/cjs/Card/Operation/Card.d.ts +0 -2
  51. package/dist/cjs/Card/Operation/Card.js +0 -14
  52. package/dist/cjs/Card/Operation/Card.js.map +1 -1
  53. package/dist/cjs/Card/Operation/index.d.ts +0 -2
  54. package/dist/cjs/Card/Operation/index.js +0 -5
  55. package/dist/cjs/Card/Operation/index.js.map +1 -1
  56. package/dist/cjs/Card/Preset.d.ts +0 -2
  57. package/dist/cjs/Card/Preset.js +0 -5
  58. package/dist/cjs/Card/Preset.js.map +1 -1
  59. package/dist/cjs/Card/Restriction/Merchant.d.ts +0 -2
  60. package/dist/cjs/Card/Restriction/Merchant.js +0 -2
  61. package/dist/cjs/Card/Restriction/Merchant.js.map +1 -1
  62. package/dist/cjs/Card/Restriction/index.d.ts +0 -2
  63. package/dist/cjs/Card/Restriction/index.js +0 -8
  64. package/dist/cjs/Card/Restriction/index.js.map +1 -1
  65. package/dist/cjs/Card/Restriction/merchants/Merchant.d.ts +1 -2
  66. package/dist/cjs/Card/Restriction/merchants/Merchant.js +8 -8
  67. package/dist/cjs/Card/Restriction/merchants/Merchant.js.map +1 -1
  68. package/dist/cjs/Card/Scheme.d.ts +0 -2
  69. package/dist/cjs/Card/Scheme.js +0 -5
  70. package/dist/cjs/Card/Scheme.js.map +1 -1
  71. package/dist/cjs/Card/index.d.ts +0 -2
  72. package/dist/cjs/Card/index.js +0 -38
  73. package/dist/cjs/Card/index.js.map +1 -1
  74. package/dist/cjs/Client/Transactions/index.d.ts +0 -16
  75. package/dist/cjs/Client/Transactions/index.js +0 -27
  76. package/dist/cjs/Client/Transactions/index.js.map +1 -1
  77. package/dist/cjs/Operation/Changes.d.ts +1 -0
  78. package/dist/cjs/Operation/Changes.js +4 -0
  79. package/dist/cjs/Operation/Changes.js.map +1 -1
  80. package/dist/cjs/Rail/index.d.ts +0 -2
  81. package/dist/cjs/Rail/index.js +0 -2
  82. package/dist/cjs/Rail/index.js.map +1 -1
  83. package/dist/cjs/Realm.d.ts +0 -2
  84. package/dist/cjs/Realm.js +0 -5
  85. package/dist/cjs/Realm.js.map +1 -1
  86. package/dist/cjs/Rule/Base.d.ts +0 -4
  87. package/dist/cjs/Rule/Base.js +0 -26
  88. package/dist/cjs/Rule/Base.js.map +1 -1
  89. package/dist/cjs/Rule/Other.d.ts +0 -3
  90. package/dist/cjs/Rule/Other.js +0 -6
  91. package/dist/cjs/Rule/Other.js.map +1 -1
  92. package/dist/cjs/Rule/type.js.map +1 -1
  93. package/dist/cjs/Treasury/Snapshot/Account.d.ts +1 -1
  94. package/dist/cjs/Treasury/Snapshot/Check/BankFeedIntegrity.d.ts +25 -0
  95. package/dist/cjs/Treasury/Snapshot/Check/BankFeedIntegrity.js +3 -0
  96. package/dist/cjs/Treasury/Snapshot/Check/BankFeedIntegrity.js.map +1 -0
  97. package/dist/cjs/Treasury/Snapshot/Check/Base.d.ts +7 -0
  98. package/dist/cjs/Treasury/Snapshot/Check/Base.js +3 -0
  99. package/dist/cjs/Treasury/Snapshot/Check/Base.js.map +1 -0
  100. package/dist/cjs/Treasury/Snapshot/Check/Checks.d.ts +6 -0
  101. package/dist/cjs/Treasury/Snapshot/Check/Checks.js +18 -0
  102. package/dist/cjs/Treasury/Snapshot/Check/Checks.js.map +1 -0
  103. package/dist/cjs/Treasury/Snapshot/Check/ExternalReconciliation.d.ts +8 -0
  104. package/dist/cjs/Treasury/Snapshot/Check/ExternalReconciliation.js +3 -0
  105. package/dist/cjs/Treasury/Snapshot/Check/ExternalReconciliation.js.map +1 -0
  106. package/dist/cjs/Treasury/Snapshot/Check/InternalReconciliation.d.ts +8 -0
  107. package/dist/cjs/Treasury/Snapshot/Check/InternalReconciliation.js +3 -0
  108. package/dist/cjs/Treasury/Snapshot/Check/InternalReconciliation.js.map +1 -0
  109. package/dist/cjs/Treasury/Snapshot/Check/LedgerIntegrity.d.ts +24 -0
  110. package/dist/cjs/Treasury/Snapshot/Check/LedgerIntegrity.js +3 -0
  111. package/dist/cjs/Treasury/Snapshot/Check/LedgerIntegrity.js.map +1 -0
  112. package/dist/cjs/Treasury/Snapshot/Check/Overdraft.d.ts +9 -0
  113. package/dist/cjs/Treasury/Snapshot/Check/Overdraft.js +3 -0
  114. package/dist/cjs/Treasury/Snapshot/Check/Overdraft.js.map +1 -0
  115. package/dist/cjs/Treasury/Snapshot/Check/Result.d.ts +5 -0
  116. package/dist/cjs/Treasury/Snapshot/Check/Result.js +16 -0
  117. package/dist/cjs/Treasury/Snapshot/Check/Result.js.map +1 -0
  118. package/dist/cjs/Treasury/Snapshot/Check/TransactionMatch.d.ts +8 -0
  119. package/dist/cjs/Treasury/Snapshot/Check/TransactionMatch.js +3 -0
  120. package/dist/cjs/Treasury/Snapshot/Check/TransactionMatch.js.map +1 -0
  121. package/dist/cjs/Treasury/Snapshot/Check/UnidentifiedFunds.d.ts +7 -0
  122. package/dist/cjs/Treasury/Snapshot/Check/UnidentifiedFunds.js +3 -0
  123. package/dist/cjs/Treasury/Snapshot/Check/UnidentifiedFunds.js.map +1 -0
  124. package/dist/cjs/Treasury/Snapshot/Check/index.d.ts +21 -0
  125. package/dist/cjs/Treasury/Snapshot/Check/index.js +11 -0
  126. package/dist/cjs/Treasury/Snapshot/Check/index.js.map +1 -0
  127. package/dist/cjs/Treasury/Snapshot/Fiat.d.ts +0 -2
  128. package/dist/cjs/Treasury/Snapshot/index.d.ts +6 -8
  129. package/dist/cjs/Treasury/Snapshot/index.js +2 -27
  130. package/dist/cjs/Treasury/Snapshot/index.js.map +1 -1
  131. package/dist/mjs/Amount.d.ts +0 -2
  132. package/dist/mjs/Amount.js +0 -3
  133. package/dist/mjs/Amount.js.map +1 -1
  134. package/dist/mjs/Card/Changeable.d.ts +0 -2
  135. package/dist/mjs/Card/Changeable.js +0 -13
  136. package/dist/mjs/Card/Changeable.js.map +1 -1
  137. package/dist/mjs/Card/Creatable.d.ts +0 -2
  138. package/dist/mjs/Card/Creatable.js +0 -28
  139. package/dist/mjs/Card/Creatable.js.map +1 -1
  140. package/dist/mjs/Card/Expiry.d.ts +0 -2
  141. package/dist/mjs/Card/Expiry.js +0 -11
  142. package/dist/mjs/Card/Expiry.js.map +1 -1
  143. package/dist/mjs/Card/Operation/Authorization.d.ts +0 -2
  144. package/dist/mjs/Card/Operation/Authorization.js +0 -12
  145. package/dist/mjs/Card/Operation/Authorization.js.map +1 -1
  146. package/dist/mjs/Card/Operation/Card.d.ts +0 -2
  147. package/dist/mjs/Card/Operation/Card.js +0 -14
  148. package/dist/mjs/Card/Operation/Card.js.map +1 -1
  149. package/dist/mjs/Card/Operation/index.d.ts +0 -2
  150. package/dist/mjs/Card/Operation/index.js +0 -5
  151. package/dist/mjs/Card/Operation/index.js.map +1 -1
  152. package/dist/mjs/Card/Preset.d.ts +0 -2
  153. package/dist/mjs/Card/Preset.js +0 -5
  154. package/dist/mjs/Card/Preset.js.map +1 -1
  155. package/dist/mjs/Card/Restriction/Merchant.d.ts +0 -2
  156. package/dist/mjs/Card/Restriction/Merchant.js +0 -2
  157. package/dist/mjs/Card/Restriction/Merchant.js.map +1 -1
  158. package/dist/mjs/Card/Restriction/index.d.ts +0 -2
  159. package/dist/mjs/Card/Restriction/index.js +0 -8
  160. package/dist/mjs/Card/Restriction/index.js.map +1 -1
  161. package/dist/mjs/Card/Restriction/merchants/Merchant.d.ts +1 -2
  162. package/dist/mjs/Card/Restriction/merchants/Merchant.js +2 -2
  163. package/dist/mjs/Card/Restriction/merchants/Merchant.js.map +1 -1
  164. package/dist/mjs/Card/Scheme.d.ts +0 -2
  165. package/dist/mjs/Card/Scheme.js +0 -5
  166. package/dist/mjs/Card/Scheme.js.map +1 -1
  167. package/dist/mjs/Card/index.d.ts +0 -2
  168. package/dist/mjs/Card/index.js +0 -38
  169. package/dist/mjs/Card/index.js.map +1 -1
  170. package/dist/mjs/Client/Transactions/index.d.ts +0 -16
  171. package/dist/mjs/Client/Transactions/index.js +0 -27
  172. package/dist/mjs/Client/Transactions/index.js.map +1 -1
  173. package/dist/mjs/Operation/Changes.d.ts +1 -0
  174. package/dist/mjs/Operation/Changes.js +4 -0
  175. package/dist/mjs/Operation/Changes.js.map +1 -1
  176. package/dist/mjs/Rail/index.d.ts +0 -2
  177. package/dist/mjs/Rail/index.js +0 -2
  178. package/dist/mjs/Rail/index.js.map +1 -1
  179. package/dist/mjs/Realm.d.ts +0 -2
  180. package/dist/mjs/Realm.js +0 -5
  181. package/dist/mjs/Realm.js.map +1 -1
  182. package/dist/mjs/Rule/Base.d.ts +0 -4
  183. package/dist/mjs/Rule/Base.js +0 -26
  184. package/dist/mjs/Rule/Base.js.map +1 -1
  185. package/dist/mjs/Rule/Other.d.ts +0 -3
  186. package/dist/mjs/Rule/Other.js +0 -6
  187. package/dist/mjs/Rule/Other.js.map +1 -1
  188. package/dist/mjs/Rule/type.js.map +1 -1
  189. package/dist/mjs/Treasury/Snapshot/Account.d.ts +1 -1
  190. package/dist/mjs/Treasury/Snapshot/Check/BankFeedIntegrity.d.ts +25 -0
  191. package/dist/mjs/Treasury/Snapshot/Check/BankFeedIntegrity.js +2 -0
  192. package/dist/mjs/Treasury/Snapshot/Check/BankFeedIntegrity.js.map +1 -0
  193. package/dist/mjs/Treasury/Snapshot/Check/Base.d.ts +7 -0
  194. package/dist/mjs/Treasury/Snapshot/Check/Base.js +2 -0
  195. package/dist/mjs/Treasury/Snapshot/Check/Base.js.map +1 -0
  196. package/dist/mjs/Treasury/Snapshot/Check/Checks.d.ts +6 -0
  197. package/dist/mjs/Treasury/Snapshot/Check/Checks.js +15 -0
  198. package/dist/mjs/Treasury/Snapshot/Check/Checks.js.map +1 -0
  199. package/dist/mjs/Treasury/Snapshot/Check/ExternalReconciliation.d.ts +8 -0
  200. package/dist/mjs/Treasury/Snapshot/Check/ExternalReconciliation.js +2 -0
  201. package/dist/mjs/Treasury/Snapshot/Check/ExternalReconciliation.js.map +1 -0
  202. package/dist/mjs/Treasury/Snapshot/Check/InternalReconciliation.d.ts +8 -0
  203. package/dist/mjs/Treasury/Snapshot/Check/InternalReconciliation.js +2 -0
  204. package/dist/mjs/Treasury/Snapshot/Check/InternalReconciliation.js.map +1 -0
  205. package/dist/mjs/Treasury/Snapshot/Check/LedgerIntegrity.d.ts +24 -0
  206. package/dist/mjs/Treasury/Snapshot/Check/LedgerIntegrity.js +2 -0
  207. package/dist/mjs/Treasury/Snapshot/Check/LedgerIntegrity.js.map +1 -0
  208. package/dist/mjs/Treasury/Snapshot/Check/Overdraft.d.ts +9 -0
  209. package/dist/mjs/Treasury/Snapshot/Check/Overdraft.js +2 -0
  210. package/dist/mjs/Treasury/Snapshot/Check/Overdraft.js.map +1 -0
  211. package/dist/mjs/Treasury/Snapshot/Check/Result.d.ts +5 -0
  212. package/dist/mjs/Treasury/Snapshot/Check/Result.js +13 -0
  213. package/dist/mjs/Treasury/Snapshot/Check/Result.js.map +1 -0
  214. package/dist/mjs/Treasury/Snapshot/Check/TransactionMatch.d.ts +8 -0
  215. package/dist/mjs/Treasury/Snapshot/Check/TransactionMatch.js +2 -0
  216. package/dist/mjs/Treasury/Snapshot/Check/TransactionMatch.js.map +1 -0
  217. package/dist/mjs/Treasury/Snapshot/Check/UnidentifiedFunds.d.ts +7 -0
  218. package/dist/mjs/Treasury/Snapshot/Check/UnidentifiedFunds.js +2 -0
  219. package/dist/mjs/Treasury/Snapshot/Check/UnidentifiedFunds.js.map +1 -0
  220. package/dist/mjs/Treasury/Snapshot/Check/index.d.ts +21 -0
  221. package/dist/mjs/Treasury/Snapshot/Check/index.js +8 -0
  222. package/dist/mjs/Treasury/Snapshot/Check/index.js.map +1 -0
  223. package/dist/mjs/Treasury/Snapshot/Fiat.d.ts +0 -2
  224. package/dist/mjs/Treasury/Snapshot/index.d.ts +6 -8
  225. package/dist/mjs/Treasury/Snapshot/index.js +2 -27
  226. package/dist/mjs/Treasury/Snapshot/index.js.map +1 -1
  227. package/package.json +1 -6
package/Amount.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  import { isoly } from "isoly"
2
- import { isoly as isoly2 } from "isoly2"
3
2
  import { isly } from "isly"
4
- import { isly as isly2 } from "isly2"
5
3
  import { Amounts } from "./Amounts"
6
4
 
7
5
  export type Amount = [isoly.Currency, number]
@@ -11,8 +9,4 @@ export namespace Amount {
11
9
  return !amount ? {} : Object.fromEntries<number>([amount])
12
10
  }
13
11
  export const type = isly.tuple<Amount>(isly.string(isoly.Currency.values), isly.number())
14
- export const type2 = isly2.tuple<Amount>(
15
- isoly2.Currency.type,
16
- isly2.number().rename("Amount").describe("Amount in a specified currency.")
17
- )
18
12
  }
@@ -1,7 +1,5 @@
1
1
  import { isoly } from "isoly"
2
- import { isoly as isoly2 } from "isoly2"
3
2
  import { isly } from "isly"
4
- import { isly as isly2 } from "isly2"
5
3
  import { Amount } from "../Amount"
6
4
  import { Meta } from "./Meta"
7
5
 
@@ -15,15 +13,4 @@ export namespace Changeable {
15
13
  limit: isly.tuple(isly.fromIs("isoly.Currency", isoly.Currency.is), isly.number()).optional(),
16
14
  meta: isly.fromIs("Card.Meta", Meta.is).optional(),
17
15
  })
18
- export const type2: isly2.Object<Changeable> = isly2
19
- .object<Changeable>({
20
- limit: isly2
21
- .tuple(isoly2.Currency.type, isly2.number())
22
- .optional()
23
- .rename("Limit")
24
- .describe("The new limit of the card."),
25
- meta: isly2.from("Card.Meta", Meta.is).optional().rename("Meta").describe("The new meta data of the card."),
26
- })
27
- .rename("Changeable")
28
- .describe("Changeable card properties.")
29
16
  }
package/Card/Creatable.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  import { isoly } from "isoly"
2
- import { isoly as isoly2 } from "isoly2"
3
2
  import { isly } from "isly"
4
- import { isly as isly2 } from "isly2"
5
3
  import { Amount } from "../Amount"
6
4
  import type { Rule } from "../Rule"
7
5
  import { type as ruleType } from "../Rule/type"
@@ -37,30 +35,4 @@ export namespace Creatable {
37
35
  key: isly.string().optional(),
38
36
  restricted: isly.object<Required<Creatable>["restricted"]>({ to: Restriction.type.optional() }).optional(),
39
37
  })
40
- export const type2 = isly2.object<Creatable>({
41
- account: isly2.string().rename("Account").describe("The account id the card was created on."),
42
- number: isly2.string().optional().rename("Number").describe("The card identifier of the user of the api."),
43
- preset: Preset.type2,
44
- details: isly2
45
- .object({ expiry: Expiry.type2, holder: isly2.string() })
46
- .rename("Details")
47
- .describe("The card details, the information that will be displayed on the card."),
48
- limit: isly2
49
- .tuple(isoly2.Currency.type, isly2.number().rename("Amount").describe("Amount in a specified currency."))
50
- .rename("Limit")
51
- .describe("Maximum amount that can be spent on the card."),
52
- rules: isly2
53
- .from("Rule", ruleType.is)
54
- .array()
55
- .optional()
56
- .rename("Rules")
57
- .describe("Card rules that applies to authorizations made with the card."),
58
- meta: isly2.from("Meta", Meta.is).optional(),
59
- key: isly2.string().optional(),
60
- restricted: isly2
61
- .object<Required<Creatable>["restricted"]>({ to: Restriction.type2.optional() })
62
- .optional()
63
- .rename("Restrictions")
64
- .describe("Set of restrictions that apply to the card."),
65
- })
66
38
  }
package/Card/Expiry.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
- import { isly as isly2 } from "isly2"
4
3
 
5
4
  const year = [23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40] as const
6
5
  type Year = (typeof year)[number]
@@ -11,19 +10,6 @@ type Month = (typeof month)[number]
11
10
  export type Expiry = [Year, Month]
12
11
  export namespace Expiry {
13
12
  export const type = isly.tuple<Expiry>(isly.number([...year]), isly.number([...month])) // Deconstructing to remove readonly.
14
- export const type2: isly2.Tuple<Expiry> = isly2
15
- .tuple<Expiry>(
16
- isly2
17
- .number("value", ...year)
18
- .rename("Year")
19
- .describe("Year of expiry."),
20
- isly2
21
- .number("value", ...month)
22
- .rename("Month")
23
- .describe("Month of expiry.")
24
- )
25
- .rename("Expiry")
26
- .describe("The year and month the card is valid ([yy, mm]).")
27
13
  export function toDateTime(expiry: Expiry): isoly.DateTime {
28
14
  return isoly.DateTime.nextMonth(
29
15
  "20" + expiry[0].toString() + "-" + expiry[1].toString().padStart(2, "0") + "-01T00:00:01.000Z"
@@ -1,7 +1,6 @@
1
1
  import { isoly } from "isoly"
2
- import { isoly as isoly2 } from "isoly2"
3
2
  import { isly } from "isly"
4
- import { isly as isly2 } from "isly2"
3
+
5
4
  export interface Authorization {
6
5
  type: "authorization"
7
6
  id: string
@@ -9,7 +8,6 @@ export interface Authorization {
9
8
  reason?: string
10
9
  created: isoly.DateTime
11
10
  }
12
-
13
11
  export namespace Authorization {
14
12
  export const statuses = ["created", "confirmed", "refunded", "captured", "cancelled"] as const
15
13
  export type Status = (typeof statuses)[number]
@@ -20,14 +18,4 @@ export namespace Authorization {
20
18
  reason: isly.string().optional(),
21
19
  created: isly.fromIs("isoly.DateTime", isoly.DateTime.is),
22
20
  })
23
- export const type2 = isly2.object<Authorization>({
24
- type: isly2.string("value", "authorization").rename("Operation.Type").describe("Type of operation."),
25
- id: isly2.string().rename("Id").describe("The id of the operation."),
26
- status: isly2
27
- .string("value", ...statuses)
28
- .rename("Status")
29
- .describe("The updated status of the operation."),
30
- reason: isly2.string().optional().rename("Reason").describe("The reason for the status change."),
31
- created: isoly2.DateTime.type.describe("The time of the operation."),
32
- })
33
21
  }
@@ -1,7 +1,5 @@
1
1
  import { isoly } from "isoly"
2
- import { isoly as isoly2 } from "isoly2"
3
2
  import { isly } from "isly"
4
- import { isly as isly2 } from "isly2"
5
3
  import { Changeable } from "../Changeable"
6
4
 
7
5
  export interface Card {
@@ -20,16 +18,4 @@ export namespace Card {
20
18
  from: Changeable.type.optional(),
21
19
  created: isly.fromIs("isoly.DateTime", isoly.DateTime.is),
22
20
  })
23
- export const type2: isly2.Object<Card> = isly2
24
- .object<Card>({
25
- type: isly2.string("value", "card").rename("Type").describe("Type of operation."),
26
- status: isly2
27
- .string("value", ...statuses)
28
- .rename("Status")
29
- .describe("The updated status of the card."),
30
- from: Changeable.type2.optional(),
31
- created: isoly2.DateTime.type.rename("Created").describe("The time of the operation."),
32
- })
33
- .describe("A card operation.")
34
- .rename("Operation.Card")
35
21
  }
@@ -1,6 +1,5 @@
1
1
  import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
- import { isly as isly2 } from "isly2"
4
3
  import { Authorization } from "../../Authorization"
5
4
  import { Entry } from "../../Settlement/Entry"
6
5
  import { Authorization as OperationAuthorization } from "./Authorization"
@@ -28,8 +27,4 @@ export namespace Operation {
28
27
  }
29
28
  }
30
29
  export const type = isly.union(Card.type, OperationAuthorization.type)
31
- export const type2: isly2.Union<Operation> = isly2
32
- .union<Operation>(Card.type2, OperationAuthorization.type2)
33
- .rename("Operation")
34
- .describe("An operation performed on a card.")
35
30
  }
package/Card/Preset.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { isly } from "isly"
2
- import { isly as isly2 } from "isly2"
3
2
  import { Realm } from "../Realm"
4
3
  import { Stack } from "./Stack"
5
4
 
@@ -25,10 +24,6 @@ export namespace Preset {
25
24
  "test-diners-175",
26
25
  ] as const
27
26
  export const type = isly.string<Preset>(names)
28
- export const type2 = isly2
29
- .string<Preset>("value", ...names)
30
- .rename("Preset")
31
- .describe("Card configuration (iin/scheme/interchange).")
32
27
  export const forRealm: Record<Realm, Preset[]> = {
33
28
  test: ["test-pg-150", "test-pg-200", "test-ta-mc-200", "test-ta-pg-200", "test-ta-pg-bc-200", "test-diners-175"],
34
29
  uk: [
@@ -1,5 +1,4 @@
1
1
  import { isly } from "isly"
2
- import { isly as isly2 } from "isly2"
3
2
  import { typedly } from "typedly"
4
3
  import { Rail } from "../../Rail"
5
4
  import { merchants } from "./merchants"
@@ -9,7 +8,6 @@ export type Merchant = (typeof Merchant.values)[number]
9
8
  export namespace Merchant {
10
9
  export const values = typedly.Object.keys(merchants)
11
10
  export const type = isly.string<Merchant>(values)
12
- export const type2 = isly2.string<Merchant>("value", ...values)
13
11
  export function check(merchant: Merchant, counterpart: Rail.Address.Card.Counterpart): boolean {
14
12
  const attribute: Attribute = merchants[merchant]
15
13
  let result: boolean
@@ -1,5 +1,4 @@
1
1
  import { isly } from "isly"
2
- import { isly as isly2 } from "isly2"
3
2
  import type { Transaction } from "../../Transaction"
4
3
  import { Merchant as RestrictionsMerchant } from "./Merchant"
5
4
 
@@ -9,13 +8,6 @@ export interface Restriction {
9
8
  export namespace Restriction {
10
9
  export import Merchant = RestrictionsMerchant
11
10
  export const type = isly.object<Restriction>({ merchants: Merchant.type.array().optional() })
12
- export const type2 = isly2.object<Restriction>({
13
- merchants: Merchant.type2
14
- .array()
15
- .optional()
16
- .rename("Merchants")
17
- .describe("List of merchants that the card can be used with."),
18
- })
19
11
  export function check(
20
12
  restrictions: Restriction,
21
13
  transaction: Transaction.Creatable.CardTransaction | Transaction.PreTransaction.Authorization
@@ -1,4 +1,4 @@
1
- import { isly } from "isly2"
1
+ import { isly } from "isly"
2
2
 
3
3
  export interface Merchant {
4
4
  name: string
@@ -23,6 +23,6 @@ export namespace Merchant {
23
23
  startsWith: value.startsWith && (Array.isArray(value.startsWith) ? value.startsWith : [value.startsWith]),
24
24
  contains: value.contains && (Array.isArray(value.contains) ? value.contains : [value.contains]),
25
25
  }
26
- return type.prune(result)
26
+ return type.get(result)
27
27
  }
28
28
  }
package/Card/Scheme.ts CHANGED
@@ -1,12 +1,7 @@
1
1
  import { isly } from "isly"
2
- import { isly as isly2 } from "isly2"
3
2
 
4
3
  export type Scheme = (typeof Scheme.schemes)[number]
5
4
  export namespace Scheme {
6
5
  export const schemes = ["mastercard", "diners", "visa"] as const
7
6
  export const type = isly.string<Scheme>(schemes)
8
- export const type2 = isly2
9
- .string<Scheme>("value", ...schemes)
10
- .rename("Scheme")
11
- .describe("Card scheme.")
12
7
  }
package/Card/index.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
- import { isly as isly2 } from "isly2"
4
3
  import { Amount } from "../Amount"
5
4
  import { Realm } from "../Realm"
6
5
  import { Report } from "../Report"
@@ -76,42 +75,6 @@ export namespace Card {
76
75
  meta: isly.fromIs("Card.Meta", CardMeta.is).optional(),
77
76
  restricted: isly.object<Required<Card>["restricted"]>({ to: CardRestriction.type.optional() }).optional(),
78
77
  })
79
- export const type2: isly2.Object<Card> = isly2
80
- .object<Card>({
81
- id: isly2.string().rename("Id").describe("Unique 16 character base 64 identifier."),
82
- number: isly2.string().optional().rename("Number").describe("Api users identifier."),
83
- created: isly2.string().rename("Created").describe("Date and time of creation."),
84
- organization: isly2.string().rename("Organization").describe("Organization code."),
85
- realm: Realm.type2,
86
- account: isly2.string().rename("Account").describe("Account identifier."),
87
- preset: CardPreset.type2,
88
- scheme: CardScheme.type2,
89
- reference: isly2.string().rename("Reference").describe("Reference to external system."),
90
- details: isly2.object<Card["details"]>({
91
- iin: isly2.string().rename("Iin").describe("First 6-8 numbers of the pan."),
92
- last4: isly2.string().rename("Last4").describe("Last four digits of pan."),
93
- expiry: CardExpiry.type2,
94
- holder: isly2.string().rename("Holder").describe("Card holder name."),
95
- token: isly2.string().optional().rename("Token").describe("Encrypted token of the card."),
96
- }),
97
- limit: Amount.type2.rename("Limit").describe("Maximum amount that can be spent on the card."),
98
- spent: Amount.type2.rename("Spent").describe("Amount spent on the card."),
99
- status: isly2.string("value", ["active", "cancelled"]).rename("Status").describe("Current card status."),
100
- history: CardOperation.type2.array().rename("History").describe("Card operation history."),
101
- rules: isly2
102
- .from("Rule", ruleType.is)
103
- .array()
104
- .rename("Rules")
105
- .describe("Card rules that applies to authorizations made with the card."),
106
- meta: isly2.from("Card.Meta", CardMeta.is).optional().rename("Meta").describe("Additional card information."),
107
- restricted: isly2
108
- .object<Required<Card>["restricted"]>({ to: CardRestriction.type2.optional() })
109
- .optional()
110
- .rename("Restrictions")
111
- .describe("Set of restrictions that apply to the card."),
112
- })
113
- .rename("Card")
114
- .describe("Card information.")
115
78
  const csvMap: Record<string, (card: Card) => string | number | undefined> = {
116
79
  id: card => card.id,
117
80
  created: card => readableDate(card.created),
@@ -1,7 +1,6 @@
1
1
  import { gracely } from "gracely"
2
2
  import { isoly } from "isoly"
3
3
  import { http } from "cloudly-http"
4
- import { isly } from "isly2"
5
4
  import { Card } from "../../Card"
6
5
  import { Operation } from "../../Operation"
7
6
  import { Rail } from "../../Rail"
@@ -62,24 +61,4 @@ export namespace Transactions {
62
61
  rail?: Rail
63
62
  type?: Transaction.Types
64
63
  }
65
- export namespace Query {
66
- export const type = isly.object({
67
- id: isly.string().optional(),
68
- account: isly.string().optional(),
69
- limit: isly.number().optional(),
70
- cursor: isly.string().optional(),
71
- start: isly.string().optional(),
72
- end: isly.string().optional(),
73
- currency: isly.string().optional(),
74
- organization: isly.string().optional(),
75
- rail: Rail.type2.optional(),
76
- type: isly.string("value", ...Transaction.types).optional(),
77
- })
78
- export function parse(query: string | http.Request["search"]): Query {
79
- if (typeof query == "string") {
80
- query = query ? http.Search.parse(query.replace("?", "")) : {}
81
- } // search.parse does not support empty string
82
- return type.prune(query) ?? {}
83
- }
84
- }
85
64
  }
@@ -6,6 +6,12 @@ import { Change } from "./Change"
6
6
 
7
7
  export type Changes = Partial<Record<Changes.Entry.Balance, Change>>
8
8
  export namespace Changes {
9
+ export function balance(currency: isoly.Currency, changes: Changes): number {
10
+ return [changes.available, changes["reserved-incoming"], changes["reserved-outgoing"]].reduce(
11
+ (r, change) => isoly.Currency.add(currency, r, (change?.type == "subtract" ? -1 : 1) * (change?.amount ?? 0)),
12
+ 0
13
+ )
14
+ }
9
15
  export function available(changes: MaybeLegacy, currency: isoly.Currency, legacy: boolean = false): number {
10
16
  return legacy
11
17
  ? Object.entries(changes).reduce(
package/Rail/index.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { isly } from "isly"
2
- import { isly as isly2 } from "isly2"
3
2
  import { Address as RailAddress } from "./Address"
4
3
 
5
4
  export type Rail = (typeof Rail.rails)[number]
@@ -18,6 +17,5 @@ export namespace Rail {
18
17
  "credit",
19
18
  ] as const
20
19
  export const type = isly.string<Rail>(rails)
21
- export const type2 = isly2.string<Rail>("value", ...rails)
22
20
  export import Address = RailAddress
23
21
  }
package/Realm.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
- import { isly as isly2 } from "isly2"
4
3
  import { Supplier as modelSupplier } from "./Supplier"
5
4
  import { zod } from "./zod"
6
5
 
@@ -10,10 +9,6 @@ export namespace Realm {
10
9
  export const realms = ["test", "uk", "eea"] as const
11
10
  export const type = isly.string<Realm>(realms)
12
11
  export const typeZod = zod.enum(realms)
13
- export const type2 = isly2
14
- .string<Realm>("value", ...realms)
15
- .rename("Realm")
16
- .describe("Financial jurisdiction.")
17
12
  export function toString(): string {
18
13
  return realms.toString().replaceAll(",", ", ") + "."
19
14
  }
package/Rule/Base.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { isly } from "isly"
2
- import { isly as isly2 } from "isly2"
3
2
  import { Preset } from "../Card/Preset"
4
3
 
5
4
  export interface Base {
@@ -18,10 +17,6 @@ export namespace Base {
18
17
  export namespace Kind {
19
18
  export const values = ["authorization", "outbound", "inbound", "capture", "refund"] as const
20
19
  export const type = isly.string<Kind>(values)
21
- export const type2 = isly2
22
- .string<Kind>("value", ...values)
23
- .rename("Kind")
24
- .describe("The type of the rule.")
25
20
  export function is(kind: Kind, rule: Base, groups: string[] | undefined, preset: Preset | undefined): boolean {
26
21
  const applyRuleForGroup =
27
22
  !rule.groups || rule.groups.some(ruleGroup => groups?.some(organizationGroup => organizationGroup == ruleGroup))
@@ -33,10 +28,6 @@ export namespace Base {
33
28
  export namespace Category {
34
29
  export const values = ["fincrime", "product", "customer"] as const
35
30
  export const type = isly.string<Category>(values)
36
- export const type2 = isly2
37
- .string<Category>("value", ...values)
38
- .rename("Category")
39
- .describe("The category of the rule.")
40
31
  }
41
32
  export const type = isly.object<Base>({
42
33
  code: isly.string(/^[a-z0-9\-_]+$/),
@@ -49,21 +40,4 @@ export namespace Base {
49
40
  groups: isly.string().array().optional(),
50
41
  presets: Preset.type.array().optional(),
51
42
  })
52
- export const type2 = isly2.object<Base>({
53
- code: isly2
54
- .string("value", /^[a-z0-9\-_]+$/)
55
- .rename("Code")
56
- .describe("The unique identifier of the rule."),
57
- name: isly2.string().rename("Name").describe("The name of the rule."),
58
- description: isly2.string().rename("Description").describe("The description of the rule."),
59
- type: Kind.type2,
60
- category: Category.type2,
61
- condition: isly2
62
- .string()
63
- .rename("Condition")
64
- .describe("The condition to evaluate, determines if the action is applied or not."),
65
- flags: isly2.string().array().rename("Flags").describe("The flags to set when the rule is applied."),
66
- groups: isly2.string().array().optional().rename("Groups").describe("The groups the rule applies to."),
67
- presets: Preset.type2.array().optional().rename("Presets").describe("The presets the rule applies to."),
68
- })
69
43
  }
package/Rule/Other.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
- import { isly as isly2 } from "isly2"
4
3
  import type { Note } from "../Transaction/Note"
5
4
  import { Base } from "./Base"
6
5
  import { control } from "./control"
@@ -14,13 +13,8 @@ export namespace Other {
14
13
  export namespace Action {
15
14
  export const values = ["review", "reject", "flag"] as const
16
15
  export const type = isly.string<Action>(values)
17
- export const type2 = isly2
18
- .string<Action>("value", ...values)
19
- .rename("Action")
20
- .describe("The action to take when the rule is applied.")
21
16
  }
22
17
  export const type = Base.type.extend<Other>({ action: Action.type })
23
- export const type2: isly2.Object<Other> = Base.type2.extend<Other>({ action: Action.type2 })
24
18
  export function evaluate(
25
19
  rules: Other[],
26
20
  state: State
package/Rule/type.ts CHANGED
@@ -1,8 +1,3 @@
1
- // import { isly as isly2 } from "isly2"
2
1
  import { Other } from "./Other"
3
2
 
4
3
  export const type = Other.type
5
- // TODO: Implement type2
6
- // export const type2 = isly2
7
- // .union<Rule, Other, Score, Charge.Api, Reserve>(Other.type2, Score.type2, Charge.Api.type2, Reserve.type2)
8
- // .describe("Changes what how the rules is applied.")
@@ -9,7 +9,7 @@ export interface Account {
9
9
  reference: string
10
10
  description?: string
11
11
  currency: isoly.Currency
12
- opening: Account.Opening
12
+ opening?: Account.Opening
13
13
  closing: Account.Closing
14
14
  delta: Account.Delta
15
15
  warnings?: Warning.Snapshot[]
@@ -0,0 +1,19 @@
1
+ import { isoly } from "isoly"
2
+ import { Base } from "./Base"
3
+ import { Result } from "./Result"
4
+
5
+ export interface BankFeedIntegrity extends Base {
6
+ check: "bank feed integrity"
7
+ accounts: {
8
+ code: string
9
+ reference: string
10
+ supplier: string
11
+ opening?: { at: isoly.DateTime; balance: number }
12
+ transaction?: { balance: number }
13
+ closing: { at: isoly.DateTime; balance: number }
14
+ timestamp: string
15
+ result: Result
16
+ }[]
17
+ }
18
+
19
+ export namespace BankFeedIntegrity {}
@@ -0,0 +1,8 @@
1
+ import { Checks } from "./Checks"
2
+ import { Result } from "./Result"
3
+
4
+ export interface Base {
5
+ check: Checks
6
+ result: Result
7
+ }
8
+ export namespace Base {}
@@ -0,0 +1,15 @@
1
+ import { isly } from "isly"
2
+
3
+ export type Checks = (typeof Checks.value)[number]
4
+ export namespace Checks {
5
+ export const value = [
6
+ "bank feed integrity", // Proves Bank Prev Balance + Bank Txns = Bank Current Balance
7
+ "external reconciliation", // Proves Internal Safeguard Mirror matches Actual Bank Balance
8
+ "internal reconciliation", // Proves Total E-Money Liabilities match Internal Safeguard Mirror
9
+ "ledger integrity", // Proves Opening Balance + Operations = Closing Balance
10
+ "overdraft", // Warns if any customer accounts fall below zero
11
+ "transaction match", // Proves all external bank txns have a 1:1 internal ledger txn
12
+ "unidentified funds", // Flags any received money not yet assigned to a customer
13
+ ] as const
14
+ export const type = isly.string(value)
15
+ }
@@ -0,0 +1,9 @@
1
+ import { Base } from "./Base"
2
+
3
+ export interface ExternalReconciliation extends Base {
4
+ check: "external reconciliation"
5
+ counterbalance: number
6
+ fiat: number
7
+ discrepancy: number
8
+ }
9
+ export namespace ExternalReconciliation {}
@@ -0,0 +1,9 @@
1
+ import { Base as ResultBase } from "./Base"
2
+
3
+ export interface InternalReconciliation extends ResultBase {
4
+ check: "internal reconciliation"
5
+ counterbalance: number
6
+ emoney: number
7
+ discrepancy: number
8
+ }
9
+ export namespace InternalReconciliation {}
@@ -0,0 +1,17 @@
1
+ import { isoly } from "isoly"
2
+ import { Base } from "./Base"
3
+ import { Result } from "./Result"
4
+
5
+ export interface LedgerIntegrity extends Base {
6
+ check: "ledger integrity"
7
+ accounts: {
8
+ id: string
9
+ organization: string
10
+ timestamp: string
11
+ opening?: { at: isoly.DateTime; balance: number }
12
+ ledger?: { change: number }
13
+ closing: { at: isoly.DateTime; balance: number }
14
+ result: Result
15
+ }[]
16
+ }
17
+ export namespace LedgerIntegrity {}
@@ -0,0 +1,7 @@
1
+ import { Base } from "./Base"
2
+
3
+ export interface Overdraft extends Base {
4
+ check: "overdraft"
5
+ overdrafts: { account: string; balance: number }[]
6
+ }
7
+ export namespace Overdraft {}
@@ -0,0 +1,11 @@
1
+ export type Result = "passed" | "failed" | "incomplete"
2
+ export namespace Result {
3
+ export const precedence: Record<Result, number> = {
4
+ failed: 3,
5
+ incomplete: 2,
6
+ passed: 1,
7
+ }
8
+ export function aggregate(results: Result[]): Result {
9
+ return results.reduce((r, e) => (precedence[e] > precedence[r] ? e : r), "passed")
10
+ }
11
+ }
@@ -0,0 +1,9 @@
1
+ import { Base } from "./Base"
2
+
3
+ export interface TransactionMatch extends Base {
4
+ check: "transaction match"
5
+ total: number
6
+ matched: number
7
+ unmatched: string[]
8
+ }
9
+ export namespace TransactionMatch {}
@@ -0,0 +1,8 @@
1
+ import { Base as ResultBase } from "./Base"
2
+
3
+ export interface UnidentifiedFunds extends ResultBase {
4
+ check: "unidentified funds"
5
+ account: string
6
+ balance: number
7
+ }
8
+ export namespace UnidentifiedFunds {}
@@ -0,0 +1,29 @@
1
+ import { BankFeedIntegrity as CheckBankFeedIntegrity } from "./BankFeedIntegrity"
2
+ import { Checks as CheckChecks } from "./Checks"
3
+ import { ExternalReconciliation as CheckExternalReconciliation } from "./ExternalReconciliation"
4
+ import { InternalReconciliation as CheckInternalReconciliation } from "./InternalReconciliation"
5
+ import { LedgerIntegrity as CheckLedgerIntegrity } from "./LedgerIntegrity"
6
+ import { Overdraft as CheckOverdraft } from "./Overdraft"
7
+ import { Result as CheckResult } from "./Result"
8
+ import { TransactionMatch as CheckTransactionMatch } from "./TransactionMatch"
9
+ import { UnidentifiedFunds as CheckUnidentifiedFunds } from "./UnidentifiedFunds"
10
+
11
+ export type Check =
12
+ | Check.BankFeedIntegrity
13
+ | Check.ExternalReconciliation
14
+ | Check.InternalReconciliation
15
+ | Check.LedgerIntegrity
16
+ | Check.Overdraft
17
+ | Check.TransactionMatch
18
+ | Check.UnidentifiedFunds
19
+ export namespace Check {
20
+ export import Result = CheckResult
21
+ export import Checks = CheckChecks
22
+ export type BankFeedIntegrity = CheckBankFeedIntegrity
23
+ export type ExternalReconciliation = CheckExternalReconciliation
24
+ export type InternalReconciliation = CheckInternalReconciliation
25
+ export type LedgerIntegrity = CheckLedgerIntegrity
26
+ export type Overdraft = CheckOverdraft
27
+ export type TransactionMatch = CheckTransactionMatch
28
+ export type UnidentifiedFunds = CheckUnidentifiedFunds
29
+ }
@@ -1,6 +1,5 @@
1
1
  import { isoly } from "isoly"
2
2
  import { Supplier } from "../../Supplier"
3
- import { Warning } from "../../Warning"
4
3
  import { Balance } from "../Balance"
5
4
 
6
5
  export interface Fiat {
@@ -9,7 +8,6 @@ export interface Fiat {
9
8
  timestamp: isoly.DateTime
10
9
  type: "safeguarded" | "unsafe" | "other" | "buffer"
11
10
  balances: Balance
12
- warnings?: Warning.Snapshot[]
13
11
  conditions?: { minimum?: Balance }
14
12
  label?: string
15
13
  reference: string