@pax2pay/model-banking 0.1.657 → 0.1.658

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 (171) hide show
  1. package/Account/Charge/Fx/index.ts +1 -0
  2. package/Account/Charge/Merchant/index.ts +5 -0
  3. package/Account/Charge/Preset/index.ts +4 -0
  4. package/Account/Charge/index.ts +5 -0
  5. package/Account/Creatable.ts +3 -0
  6. package/Account/Details.ts +11 -0
  7. package/Account/History.ts +7 -0
  8. package/Account/Status.ts +5 -0
  9. package/Account/index.ts +13 -0
  10. package/Acquirer/index.ts +8 -0
  11. package/Balance.ts +6 -0
  12. package/Balances.ts +2 -0
  13. package/Card/Expiry.ts +2 -0
  14. package/Card/Preset.ts +2 -0
  15. package/Card/Restriction/Merchant.ts +2 -0
  16. package/Card/Scheme.ts +2 -0
  17. package/Merchant/index.ts +11 -0
  18. package/Rail/Address/Card.ts +17 -0
  19. package/Rail/Address/Iban.ts +8 -0
  20. package/Rail/Address/PaxGiro.ts +2 -0
  21. package/Rail/Address/Scan.ts +8 -0
  22. package/Rail/Address/index.ts +9 -0
  23. package/Rail/Address/internal.ts +7 -0
  24. package/Supplier/index.ts +2 -0
  25. package/dist/cjs/Account/Charge/Fx/index.d.ts +21 -0
  26. package/dist/cjs/Account/Charge/Fx/index.js +1 -0
  27. package/dist/cjs/Account/Charge/Fx/index.js.map +1 -1
  28. package/dist/cjs/Account/Charge/Merchant/index.d.ts +217 -0
  29. package/dist/cjs/Account/Charge/Merchant/index.js +5 -0
  30. package/dist/cjs/Account/Charge/Merchant/index.js.map +1 -1
  31. package/dist/cjs/Account/Charge/Preset/index.d.ts +22 -0
  32. package/dist/cjs/Account/Charge/Preset/index.js +4 -0
  33. package/dist/cjs/Account/Charge/Preset/index.js.map +1 -1
  34. package/dist/cjs/Account/Charge/index.d.ts +240 -0
  35. package/dist/cjs/Account/Charge/index.js +5 -0
  36. package/dist/cjs/Account/Charge/index.js.map +1 -1
  37. package/dist/cjs/Account/Creatable.d.ts +12 -0
  38. package/dist/cjs/Account/Creatable.js +3 -0
  39. package/dist/cjs/Account/Creatable.js.map +1 -1
  40. package/dist/cjs/Account/Details.d.ts +432 -0
  41. package/dist/cjs/Account/Details.js +11 -0
  42. package/dist/cjs/Account/Details.js.map +1 -1
  43. package/dist/cjs/Account/History.d.ts +25 -0
  44. package/dist/cjs/Account/History.js +7 -0
  45. package/dist/cjs/Account/History.js.map +1 -1
  46. package/dist/cjs/Account/Status.d.ts +9 -0
  47. package/dist/cjs/Account/Status.js +5 -0
  48. package/dist/cjs/Account/Status.js.map +1 -1
  49. package/dist/cjs/Account/index.d.ts +748 -0
  50. package/dist/cjs/Account/index.js +13 -0
  51. package/dist/cjs/Account/index.js.map +1 -1
  52. package/dist/cjs/Acquirer/index.d.ts +8 -0
  53. package/dist/cjs/Acquirer/index.js +8 -0
  54. package/dist/cjs/Acquirer/index.js.map +1 -1
  55. package/dist/cjs/Balance.d.ts +14 -0
  56. package/dist/cjs/Balance.js +6 -0
  57. package/dist/cjs/Balance.js.map +1 -1
  58. package/dist/cjs/Balances.d.ts +189 -0
  59. package/dist/cjs/Balances.js +2 -0
  60. package/dist/cjs/Balances.js.map +1 -1
  61. package/dist/cjs/Card/Expiry.d.ts +2 -0
  62. package/dist/cjs/Card/Expiry.js +2 -0
  63. package/dist/cjs/Card/Expiry.js.map +1 -1
  64. package/dist/cjs/Card/Preset.d.ts +19 -0
  65. package/dist/cjs/Card/Preset.js +2 -0
  66. package/dist/cjs/Card/Preset.js.map +1 -1
  67. package/dist/cjs/Card/Restriction/Merchant.d.ts +192 -0
  68. package/dist/cjs/Card/Restriction/Merchant.js +2 -0
  69. package/dist/cjs/Card/Restriction/Merchant.js.map +1 -1
  70. package/dist/cjs/Card/Scheme.d.ts +6 -0
  71. package/dist/cjs/Card/Scheme.js +2 -0
  72. package/dist/cjs/Card/Scheme.js.map +1 -1
  73. package/dist/cjs/Merchant/index.d.ts +11 -0
  74. package/dist/cjs/Merchant/index.js +11 -0
  75. package/dist/cjs/Merchant/index.js.map +1 -1
  76. package/dist/cjs/Operation/Status.d.ts +1 -1
  77. package/dist/cjs/Rail/Address/Card.d.ts +36 -0
  78. package/dist/cjs/Rail/Address/Card.js +17 -0
  79. package/dist/cjs/Rail/Address/Card.js.map +1 -1
  80. package/dist/cjs/Rail/Address/Iban.d.ts +8 -0
  81. package/dist/cjs/Rail/Address/Iban.js +8 -0
  82. package/dist/cjs/Rail/Address/Iban.js.map +1 -1
  83. package/dist/cjs/Rail/Address/PaxGiro.d.ts +5 -0
  84. package/dist/cjs/Rail/Address/PaxGiro.js +2 -0
  85. package/dist/cjs/Rail/Address/PaxGiro.js.map +1 -1
  86. package/dist/cjs/Rail/Address/Scan.d.ts +8 -0
  87. package/dist/cjs/Rail/Address/Scan.js +8 -0
  88. package/dist/cjs/Rail/Address/Scan.js.map +1 -1
  89. package/dist/cjs/Rail/Address/index.d.ts +55 -0
  90. package/dist/cjs/Rail/Address/index.js +9 -0
  91. package/dist/cjs/Rail/Address/index.js.map +1 -1
  92. package/dist/cjs/Rail/Address/internal.d.ts +7 -0
  93. package/dist/cjs/Rail/Address/internal.js +7 -0
  94. package/dist/cjs/Rail/Address/internal.js.map +1 -1
  95. package/dist/cjs/Supplier/index.d.ts +6 -0
  96. package/dist/cjs/Supplier/index.js +2 -0
  97. package/dist/cjs/Supplier/index.js.map +1 -1
  98. package/dist/mjs/Account/Charge/Fx/index.d.ts +21 -0
  99. package/dist/mjs/Account/Charge/Fx/index.js +1 -0
  100. package/dist/mjs/Account/Charge/Fx/index.js.map +1 -1
  101. package/dist/mjs/Account/Charge/Merchant/index.d.ts +217 -0
  102. package/dist/mjs/Account/Charge/Merchant/index.js +5 -0
  103. package/dist/mjs/Account/Charge/Merchant/index.js.map +1 -1
  104. package/dist/mjs/Account/Charge/Preset/index.d.ts +22 -0
  105. package/dist/mjs/Account/Charge/Preset/index.js +4 -0
  106. package/dist/mjs/Account/Charge/Preset/index.js.map +1 -1
  107. package/dist/mjs/Account/Charge/index.d.ts +240 -0
  108. package/dist/mjs/Account/Charge/index.js +5 -0
  109. package/dist/mjs/Account/Charge/index.js.map +1 -1
  110. package/dist/mjs/Account/Creatable.d.ts +12 -0
  111. package/dist/mjs/Account/Creatable.js +3 -0
  112. package/dist/mjs/Account/Creatable.js.map +1 -1
  113. package/dist/mjs/Account/Details.d.ts +432 -0
  114. package/dist/mjs/Account/Details.js +11 -0
  115. package/dist/mjs/Account/Details.js.map +1 -1
  116. package/dist/mjs/Account/History.d.ts +25 -0
  117. package/dist/mjs/Account/History.js +7 -0
  118. package/dist/mjs/Account/History.js.map +1 -1
  119. package/dist/mjs/Account/Status.d.ts +9 -0
  120. package/dist/mjs/Account/Status.js +5 -0
  121. package/dist/mjs/Account/Status.js.map +1 -1
  122. package/dist/mjs/Account/index.d.ts +748 -0
  123. package/dist/mjs/Account/index.js +13 -0
  124. package/dist/mjs/Account/index.js.map +1 -1
  125. package/dist/mjs/Acquirer/index.d.ts +8 -0
  126. package/dist/mjs/Acquirer/index.js +8 -0
  127. package/dist/mjs/Acquirer/index.js.map +1 -1
  128. package/dist/mjs/Balance.d.ts +14 -0
  129. package/dist/mjs/Balance.js +6 -0
  130. package/dist/mjs/Balance.js.map +1 -1
  131. package/dist/mjs/Balances.d.ts +189 -0
  132. package/dist/mjs/Balances.js +2 -0
  133. package/dist/mjs/Balances.js.map +1 -1
  134. package/dist/mjs/Card/Expiry.d.ts +2 -0
  135. package/dist/mjs/Card/Expiry.js +2 -0
  136. package/dist/mjs/Card/Expiry.js.map +1 -1
  137. package/dist/mjs/Card/Preset.d.ts +19 -0
  138. package/dist/mjs/Card/Preset.js +2 -0
  139. package/dist/mjs/Card/Preset.js.map +1 -1
  140. package/dist/mjs/Card/Restriction/Merchant.d.ts +192 -0
  141. package/dist/mjs/Card/Restriction/Merchant.js +2 -0
  142. package/dist/mjs/Card/Restriction/Merchant.js.map +1 -1
  143. package/dist/mjs/Card/Scheme.d.ts +6 -0
  144. package/dist/mjs/Card/Scheme.js +2 -0
  145. package/dist/mjs/Card/Scheme.js.map +1 -1
  146. package/dist/mjs/Merchant/index.d.ts +11 -0
  147. package/dist/mjs/Merchant/index.js +11 -0
  148. package/dist/mjs/Merchant/index.js.map +1 -1
  149. package/dist/mjs/Operation/Status.d.ts +1 -1
  150. package/dist/mjs/Rail/Address/Card.d.ts +36 -0
  151. package/dist/mjs/Rail/Address/Card.js +17 -0
  152. package/dist/mjs/Rail/Address/Card.js.map +1 -1
  153. package/dist/mjs/Rail/Address/Iban.d.ts +8 -0
  154. package/dist/mjs/Rail/Address/Iban.js +8 -0
  155. package/dist/mjs/Rail/Address/Iban.js.map +1 -1
  156. package/dist/mjs/Rail/Address/PaxGiro.d.ts +5 -0
  157. package/dist/mjs/Rail/Address/PaxGiro.js +2 -0
  158. package/dist/mjs/Rail/Address/PaxGiro.js.map +1 -1
  159. package/dist/mjs/Rail/Address/Scan.d.ts +8 -0
  160. package/dist/mjs/Rail/Address/Scan.js +8 -0
  161. package/dist/mjs/Rail/Address/Scan.js.map +1 -1
  162. package/dist/mjs/Rail/Address/index.d.ts +55 -0
  163. package/dist/mjs/Rail/Address/index.js +9 -0
  164. package/dist/mjs/Rail/Address/index.js.map +1 -1
  165. package/dist/mjs/Rail/Address/internal.d.ts +7 -0
  166. package/dist/mjs/Rail/Address/internal.js +7 -0
  167. package/dist/mjs/Rail/Address/internal.js.map +1 -1
  168. package/dist/mjs/Supplier/index.d.ts +6 -0
  169. package/dist/mjs/Supplier/index.js +2 -0
  170. package/dist/mjs/Supplier/index.js.map +1 -1
  171. package/package.json +1 -1
@@ -8,6 +8,7 @@ export type Fx = Preset
8
8
 
9
9
  export namespace Fx {
10
10
  export const type = Preset.type
11
+ export const typeZod = Preset.typeZod
11
12
  export function evaluate(
12
13
  charge: Fx,
13
14
  currency: isoly.Currency,
@@ -3,6 +3,7 @@ import { isly } from "isly"
3
3
  import { Card } from "../../../Card"
4
4
  import { Rail } from "../../../Rail"
5
5
  import { Amount } from "../../../Transaction/Amount"
6
+ import { zod } from "../../../zod"
6
7
  import { Preset } from "../Preset"
7
8
 
8
9
  export interface Merchant {
@@ -16,6 +17,10 @@ export namespace Merchant {
16
17
  }),
17
18
  merchants: isly.record<Card.Restriction.Merchant, Preset>(Card.Restriction.Merchant.type, Preset.type),
18
19
  })
20
+ export const typeZod = zod.object({
21
+ destination: zod.object({ account: zod.string() }),
22
+ merchants: zod.partialRecord(Card.Restriction.Merchant.typeZod, Preset.typeZod),
23
+ })
19
24
 
20
25
  export function evaluate(
21
26
  charge: Merchant,
@@ -1,5 +1,6 @@
1
1
  import { isly } from "isly"
2
2
  import { Card } from "../../../Card"
3
+ import { zod } from "../../../zod"
3
4
 
4
5
  export type Preset = Partial<Record<Card.Preset, number>> & {
5
6
  default: number
@@ -12,4 +13,7 @@ export namespace Preset {
12
13
  return defaultType.is(value) && recordType.is((({ default: _, ...rest }) => rest)(value))
13
14
  }
14
15
  export const type = isly.fromIs("Preset", is)
16
+ export const typeZod = zod
17
+ .partialRecord(zod.enum([...Card.Preset.names, "default"]), zod.number())
18
+ .and(zod.object({ default: zod.number() }))
15
19
  }
@@ -3,6 +3,7 @@ import { isly } from "isly"
3
3
  import type { Card } from "../../Card"
4
4
  import type { Rail } from "../../Rail"
5
5
  import type { Transaction } from "../../Transaction"
6
+ import { zod } from "../../zod"
6
7
  import { Fx as ChargeFx } from "./Fx"
7
8
  import { Merchant as ChargeMerchant } from "./Merchant"
8
9
 
@@ -11,6 +12,10 @@ export namespace Charge {
11
12
  export import Merchant = ChargeMerchant
12
13
  export import Fx = ChargeFx
13
14
  export const type = isly.object<Charge>({ merchant: ChargeMerchant.type.optional(), fx: ChargeFx.type.optional() })
15
+ export const typeZod = zod.object({
16
+ merchant: ChargeMerchant.typeZod.optional(),
17
+ fx: ChargeFx.typeZod.optional(),
18
+ })
14
19
  export function evaluate(
15
20
  counterpart: Rail.Address.Card.Counterpart,
16
21
  currency: isoly.Currency,
@@ -1,5 +1,6 @@
1
1
  import { DurableObjectLocationHint } from "@cloudflare/workers-types" // TODO: REMOVE
2
2
  import { isly } from "isly"
3
+ import { zod } from "../zod"
3
4
 
4
5
  export interface Creatable {
5
6
  name: string
@@ -14,6 +15,8 @@ export namespace Creatable {
14
15
  }
15
16
  // All location hints: ["wnam", "enam", "sam", "weur", "eeur", "apac", "oc", "afr", "me"]
16
17
  export const type = isly.string(values)
18
+ export const typeZod = zod.enum(values)
17
19
  }
18
20
  export const type = isly.object<Creatable>({ name: isly.string(), location: Location.type.optional() })
21
+ export const typeZod = zod.object({ name: zod.string(), location: Location.typeZod.optional() })
19
22
  }
@@ -2,6 +2,7 @@ import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
3
  import { Rail } from "../Rail"
4
4
  import { Supplier } from "../Supplier"
5
+ import { zod } from "../zod"
5
6
 
6
7
  export interface Details {
7
8
  supplier: Supplier
@@ -16,6 +17,12 @@ export namespace Details {
16
17
  reference: isly.string().optional(),
17
18
  addresses: Rail.Address.type.array(),
18
19
  })
20
+ export const typeZod = zod.object({
21
+ supplier: Supplier.typeZod,
22
+ currencies: zod.array(zod.enum(isoly.Currency.values)),
23
+ reference: zod.string().optional(),
24
+ addresses: zod.array(Rail.Address.typeZod),
25
+ })
19
26
  export interface Creatable {
20
27
  supplier: Supplier
21
28
  currency: isoly.Currency
@@ -25,5 +32,9 @@ export namespace Details {
25
32
  supplier: Supplier.type,
26
33
  currency: isly.string(isoly.Currency.values),
27
34
  })
35
+ export const typeZod = zod.object({
36
+ supplier: Supplier.typeZod,
37
+ currency: zod.enum(isoly.Currency.values),
38
+ })
28
39
  }
29
40
  }
@@ -1,5 +1,6 @@
1
1
  import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
+ import { zod } from "../zod"
3
4
 
4
5
  export type History = {
5
6
  timestamp: isoly.DateTime
@@ -21,10 +22,16 @@ export namespace History {
21
22
  "listeners",
22
23
  ] as const
23
24
  export const type = isly.string<Property>(values)
25
+ export const typeZod = zod.enum(values)
24
26
  }
25
27
  export const type = isly.object<History>({
26
28
  timestamp: isly.fromIs("isoly.DateTime", isoly.DateTime.is),
27
29
  property: Property.type,
28
30
  to: isly.any().optional(),
29
31
  })
32
+ export const typeZod = zod.object({
33
+ timestamp: zod.string().refine(isoly.DateTime.is),
34
+ property: Property.typeZod,
35
+ to: zod.any().optional(),
36
+ })
30
37
  }
package/Account/Status.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { isly } from "isly"
2
+ import { zod } from "../zod"
2
3
 
3
4
  export type Status = {
4
5
  mode: Status.Mode
@@ -17,4 +18,8 @@ export namespace Status {
17
18
  mode: isly.string<Mode>(Mode.values),
18
19
  reason: isly.string().optional(),
19
20
  })
21
+ export const typeZod = zod.object({
22
+ mode: zod.enum(Mode.values),
23
+ reason: zod.string().optional(),
24
+ })
20
25
  }
package/Account/index.ts CHANGED
@@ -4,6 +4,7 @@ import { isly } from "isly"
4
4
  import { Balances } from "../Balances"
5
5
  import { Rail } from "../Rail"
6
6
  import { Rule } from "../Rule"
7
+ import { zod } from "../zod"
7
8
  import { Charge as AccountCharge } from "./Charge"
8
9
  import { Creatable as AccountCreatable } from "./Creatable"
9
10
  import { Details as AccountDetails } from "./Details"
@@ -42,6 +43,18 @@ export namespace Account {
42
43
  status: AccountStatus.type,
43
44
  type: Type.type,
44
45
  })
46
+ export const typeZod = Creatable.typeZod.extend({
47
+ id: zod.string(),
48
+ created: zod.string().refine(isoly.DateTime.is),
49
+ organization: zod.string(),
50
+ balances: Balances.typeZod,
51
+ rails: zod.array(Rail.Address.typeZod),
52
+ details: Details.typeZod.optional(),
53
+ charges: AccountCharge.typeZod.optional(),
54
+ rules: zod.array(zod.never()).optional(),
55
+ status: AccountStatus.typeZod,
56
+ type: Type.typeZod,
57
+ })
45
58
  export function isIdentifier(value: cryptly.Identifier | any): value is cryptly.Identifier {
46
59
  return cryptly.Identifier.is(value, 8)
47
60
  }
package/Acquirer/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
+ import { zod } from "../zod"
3
4
 
4
5
  export interface Acquirer {
5
6
  id: string
@@ -16,4 +17,11 @@ export namespace Acquirer {
16
17
  retrievalReferenceNumber: isly.string().optional(),
17
18
  systemTraceAuditNumber: isly.string().optional(),
18
19
  })
20
+ export const typeZod = zod.object({
21
+ id: zod.string(),
22
+ number: zod.string(),
23
+ country: zod.string().refine(isoly.CountryCode.Alpha2.is).optional(),
24
+ retrievalReferenceNumber: zod.string().optional(),
25
+ systemTraceAuditNumber: zod.string().optional(),
26
+ })
19
27
  }
package/Balance.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
3
  import { Amount } from "./Amount"
4
+ import { zod } from "./zod"
4
5
 
5
6
  export type Balance = { available?: number; reserved?: Balance.Reserved }
6
7
  export namespace Balance {
@@ -8,12 +9,17 @@ export namespace Balance {
8
9
  export namespace Reserve {
9
10
  export const values = ["incoming", "outgoing", "buffer"] as const
10
11
  export const type = isly.string<Reserve>(values)
12
+ export const typeZod = zod.enum(values)
11
13
  }
12
14
  export type Reserved = Partial<Record<Balance.Reserve, number>>
13
15
  export const type = isly.object<Balance>({
14
16
  available: isly.number().optional(),
15
17
  reserved: isly.record<Reserved>(Balance.Reserve.type, isly.number().optional()).optional(),
16
18
  })
19
+ export const typeZod = zod.object({
20
+ available: zod.number().optional(),
21
+ reserved: zod.partialRecord(Balance.Reserve.typeZod, zod.number().optional()).optional(),
22
+ })
17
23
  export type Legacy = Partial<Record<Legacy.Entry, number>>
18
24
  export namespace Legacy {
19
25
  export type Entry = (typeof Entry.values)[number]
package/Balances.ts CHANGED
@@ -2,12 +2,14 @@ import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
3
  import { Amounts } from "./Amounts"
4
4
  import { Balance as BalancesBalance } from "./Balance"
5
+ import { zod } from "./zod"
5
6
 
6
7
  export type Balances = Partial<Record<isoly.Currency, Balances.Balance.Extended>>
7
8
 
8
9
  export namespace Balances {
9
10
  export import Balance = BalancesBalance
10
11
  export const type = isly.record<Balances>(isly.fromIs("isoly.Currency", isoly.Currency.is), Balances.Balance.type)
12
+ export const typeZod = zod.partialRecord(zod.enum(isoly.Currency.values), Balances.Balance.typeZod)
11
13
  export function update(balances: Balances): Balances {
12
14
  const result: Balances = {}
13
15
  for (const [currency, balance] of Object.entries(balances)) {
package/Card/Expiry.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
+ import { zod } from "../zod"
3
4
 
4
5
  const year = [23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40] as const
5
6
  type Year = (typeof year)[number]
@@ -10,6 +11,7 @@ type Month = (typeof month)[number]
10
11
  export type Expiry = [Year, Month]
11
12
  export namespace Expiry {
12
13
  export const type = isly.tuple<Expiry>(isly.number([...year]), isly.number([...month])) // Deconstructing to remove readonly.
14
+ export const typeZod = zod.tuple([zod.literal([...year]), zod.literal([...month])])
13
15
  export function toDateTime(expiry: Expiry): isoly.DateTime {
14
16
  return isoly.DateTime.nextMonth(
15
17
  "20" + expiry[0].toString() + "-" + expiry[1].toString().padStart(2, "0") + "-01T00:00:01.000Z"
package/Card/Preset.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { isly } from "isly"
2
2
  import { Realm } from "../Realm"
3
+ import { zod } from "../zod"
3
4
  import { Stack } from "./Stack"
4
5
 
5
6
  export type Preset = (typeof Preset.names)[number]
@@ -25,6 +26,7 @@ export namespace Preset {
25
26
  "test-diners-175",
26
27
  ] as const
27
28
  export const type = isly.string<Preset>(names)
29
+ export const typeZod = zod.enum(names)
28
30
  export const forRealm: Record<Realm, Preset[]> = {
29
31
  test: ["test-pg-150", "test-pg-200", "test-ta-mc-200", "test-ta-pg-200", "test-ta-pg-bc-200", "test-diners-175"],
30
32
  uk: [
@@ -1,6 +1,7 @@
1
1
  import { isly } from "isly"
2
2
  import { typedly } from "typedly"
3
3
  import { Rail } from "../../Rail"
4
+ import { zod } from "../../zod"
4
5
  import { merchants } from "./merchants"
5
6
  import { Merchant as Attribute } from "./merchants/Merchant"
6
7
 
@@ -8,6 +9,7 @@ export type Merchant = (typeof Merchant.values)[number]
8
9
  export namespace Merchant {
9
10
  export const values = typedly.Object.keys(merchants)
10
11
  export const type = isly.string<Merchant>(values)
12
+ export const typeZod = zod.enum(values)
11
13
  export function check(merchant: Merchant, counterpart: Rail.Address.Card.Counterpart): boolean {
12
14
  const attribute: Attribute = merchants[merchant]
13
15
  let result: boolean
package/Card/Scheme.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import { isly } from "isly"
2
+ import { zod } from "../zod"
2
3
 
3
4
  export type Scheme = (typeof Scheme.schemes)[number]
4
5
  export namespace Scheme {
5
6
  export const schemes = ["mastercard", "diners", "visa"] as const
6
7
  export const type = isly.string<Scheme>(schemes)
8
+ export const typeZod = zod.enum(schemes)
7
9
  }
package/Merchant/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
+ import { zod } from "../zod"
3
4
  import { Category as MerchantCategory } from "./Category"
4
5
 
5
6
  export interface Merchant {
@@ -24,4 +25,14 @@ export namespace Merchant {
24
25
  state: isly.string().optional(),
25
26
  country: isly.string(),
26
27
  })
28
+ export const typeZod = zod.object({
29
+ name: zod.string(),
30
+ id: zod.string(),
31
+ category: zod.string(),
32
+ address: zod.string(),
33
+ city: zod.string(),
34
+ zip: zod.string(),
35
+ state: zod.string().optional(),
36
+ country: zod.string(),
37
+ })
27
38
  }
@@ -3,6 +3,7 @@ import { Acquirer } from "../../Acquirer"
3
3
  import { Card as ModelCard } from "../../Card"
4
4
  import { Merchant } from "../../Merchant"
5
5
  import type { Rule } from "../../Rule"
6
+ import { zod } from "../../zod"
6
7
 
7
8
  export interface Card {
8
9
  type: "card"
@@ -28,6 +29,13 @@ namespace CardCounterpart {
28
29
  present: isly.boolean().optional(),
29
30
  approvalCode: isly.string().optional(),
30
31
  })
32
+ export const typeZod = zod.object({
33
+ type: zod.literal("card"),
34
+ acquirer: Acquirer.typeZod,
35
+ merchant: Merchant.typeZod,
36
+ present: zod.boolean().optional(),
37
+ approvalCode: zod.string().optional(),
38
+ })
31
39
  }
32
40
  export namespace Card {
33
41
  export const currencies = ["EUR", "GBP", "SEK", "USD"] as const
@@ -40,6 +48,15 @@ export namespace Card {
40
48
  expiry: ModelCard.Expiry.type,
41
49
  holder: isly.string(),
42
50
  })
51
+ export const typeZod = zod.object({
52
+ type: zod.literal("card"),
53
+ scheme: ModelCard.Scheme.typeZod,
54
+ id: zod.string(),
55
+ iin: zod.string(),
56
+ last4: zod.string(),
57
+ expiry: ModelCard.Expiry.typeZod,
58
+ holder: zod.string(),
59
+ })
43
60
 
44
61
  export function from(card: ModelCard | Rule.State.Card): Card {
45
62
  return {
@@ -1,4 +1,5 @@
1
1
  import { isly } from "isly"
2
+ import { zod } from "../../zod"
2
3
 
3
4
  export interface Iban {
4
5
  type: "iban"
@@ -17,4 +18,11 @@ export namespace Iban {
17
18
  institution: isly.string().optional(),
18
19
  transactor: isly.string().optional(),
19
20
  })
21
+ export const typeZod = zod.object({
22
+ type: zod.literal("iban"),
23
+ iban: zod.string(),
24
+ holder: zod.string(),
25
+ institution: zod.string().optional(),
26
+ transactor: zod.string().optional(),
27
+ })
20
28
  }
@@ -1,5 +1,6 @@
1
1
  import { cryptly } from "cryptly"
2
2
  import { isly } from "isly"
3
+ import { zod } from "../../zod"
3
4
 
4
5
  export interface PaxGiro {
5
6
  type: "paxgiro"
@@ -8,4 +9,5 @@ export interface PaxGiro {
8
9
  export namespace PaxGiro {
9
10
  export const currencies = ["EUR", "GBP", "SEK", "USD"] as const
10
11
  export const type = isly.object<PaxGiro>({ type: isly.string("paxgiro"), identifier: isly.string() })
12
+ export const typeZod = zod.object({ type: zod.literal("paxgiro"), identifier: zod.string() })
11
13
  }
@@ -1,4 +1,5 @@
1
1
  import { isly } from "isly"
2
+ import { zod } from "../../zod"
2
3
  import { Iban } from "./Iban"
3
4
 
4
5
  //SCAN: Sort Code Account Number
@@ -27,4 +28,11 @@ export namespace Scan {
27
28
  holder: isly.string(),
28
29
  institution: isly.string().optional(),
29
30
  })
31
+ export const typeZod = zod.object({
32
+ type: zod.literal("scan"),
33
+ sort: zod.string(),
34
+ account: zod.string(),
35
+ holder: zod.string(),
36
+ institution: zod.string().optional(),
37
+ })
30
38
  }
@@ -1,5 +1,6 @@
1
1
  import { isly } from "isly"
2
2
  import { Realm } from "../../Realm"
3
+ import { zod } from "../../zod"
3
4
  import { Card as AddressCard } from "./Card"
4
5
  import { Iban as AddressIban } from "./Iban"
5
6
  import { Internal as AddressInternal } from "./internal"
@@ -85,6 +86,14 @@ export namespace Address {
85
86
  AddressPaxGiro.type,
86
87
  AddressScan.type
87
88
  )
89
+ export const typeZod = zod.union([
90
+ AddressCard.typeZod,
91
+ AddressCard.Counterpart.typeZod,
92
+ AddressIban.typeZod,
93
+ AddressInternal.typeZod,
94
+ AddressPaxGiro.typeZod,
95
+ AddressScan.typeZod,
96
+ ])
88
97
 
89
98
  export import PaxGiro = AddressPaxGiro
90
99
  export import Iban = AddressIban
@@ -2,6 +2,7 @@ import { cryptly } from "cryptly"
2
2
  import { isly } from "isly"
3
3
  import { Operation } from "../../Operation"
4
4
  import { Realm } from "../../Realm"
5
+ import { zod } from "../../zod"
5
6
 
6
7
  export interface Internal {
7
8
  type: "internal"
@@ -17,6 +18,12 @@ export namespace Internal {
17
18
  identifier: isly.union(isly.fromIs("Identifier", cryptly.Identifier.is), Operation.Changes.Entry.type),
18
19
  organization: isly.string().optional(),
19
20
  })
21
+ export const typeZod = zod.object({
22
+ type: zod.literal("internal"),
23
+ name: zod.string().optional(),
24
+ identifier: zod.string(),
25
+ organization: zod.string().optional(),
26
+ })
20
27
 
21
28
  export function toLink(internal: Internal, realm: Realm): string {
22
29
  return `${realm}-internal-${internal.identifier}`
package/Supplier/index.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
3
  import { Realm } from "../Realm"
4
+ import { zod } from "../zod"
4
5
 
5
6
  export type Supplier = (typeof Supplier.names)[number]
6
7
  export namespace Supplier {
7
8
  export const names = ["paxgiro", "clearbank", "bankingcircle"] as const
8
9
  export const type = isly.string<Supplier>(names)
10
+ export const typeZod = zod.enum(names)
9
11
  export const decommissioned = ["clearbank"] as const
10
12
  export type Decommissioned = (typeof decommissioned)[number]
11
13
  export function isDecommissioned(supplier: Supplier | any): supplier is Decommissioned {
@@ -6,5 +6,26 @@ import { Preset } from "../Preset";
6
6
  export type Fx = Preset;
7
7
  export declare namespace Fx {
8
8
  const type: import("isly/dist/cjs/Type").Type<Preset>;
9
+ const typeZod: import("zod").ZodIntersection<import("zod").ZodRecord<import("zod").ZodEnum<{
10
+ default: "default";
11
+ "p2p-diners-175": "p2p-diners-175";
12
+ "p2p-diners-200": "p2p-diners-200";
13
+ "p2p-mc-200": "p2p-mc-200";
14
+ "p2p-visa-bid-115": "p2p-visa-bid-115";
15
+ "p2p-visa-bp-140": "p2p-visa-bp-140";
16
+ "p2p-visa-cdd-185": "p2p-visa-cdd-185";
17
+ "p2p-visa-idx-140": "p2p-visa-idx-140";
18
+ "p2p-visa-idx-160": "p2p-visa-idx-160";
19
+ "p2p-visa-idx-200": "p2p-visa-idx-200";
20
+ "p2p-diners-tsa-175": "p2p-diners-tsa-175";
21
+ "test-pg-150": "test-pg-150";
22
+ "test-pg-200": "test-pg-200";
23
+ "test-ta-mc-200": "test-ta-mc-200";
24
+ "test-ta-pg-200": "test-ta-pg-200";
25
+ "test-ta-pg-bc-200": "test-ta-pg-bc-200";
26
+ "test-diners-175": "test-diners-175";
27
+ }> & import("zod/v4/core/schemas.cjs").$partial, import("zod").ZodNumber>, import("zod").ZodObject<{
28
+ default: import("zod").ZodNumber;
29
+ }, import("zod/v4/core/schemas.cjs").$strip>>;
9
30
  function evaluate(charge: Fx, currency: isoly.Currency, amount: number, preset?: Card.Preset, exchange?: Exchange): Amount.Charge.Fx | undefined;
10
31
  }
@@ -6,6 +6,7 @@ const Preset_1 = require("../Preset");
6
6
  var Fx;
7
7
  (function (Fx) {
8
8
  Fx.type = Preset_1.Preset.type;
9
+ Fx.typeZod = Preset_1.Preset.typeZod;
9
10
  function evaluate(charge, currency, amount, preset, exchange) {
10
11
  let result;
11
12
  const chargePreset = preset && charge[preset] ? preset : "default";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../Account/Charge/Fx/index.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAI7B,sCAAkC;AAIlC,IAAiB,EAAE,CAqBlB;AArBD,WAAiB,EAAE;IACL,OAAI,GAAG,eAAM,CAAC,IAAI,CAAA;IAC/B,SAAgB,QAAQ,CACvB,MAAU,EACV,QAAwB,EACxB,MAAc,EACd,MAAoB,EACpB,QAAmB;QAEnB,IAAI,MAAoC,CAAA;QACxC,MAAM,YAAY,GAAG,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;QAClE,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;QAC5C,IAAI,QAAQ,EAAE,CAAC;YACd,MAAM,GAAG;gBACR,MAAM,EAAE,YAAY;gBACpB,IAAI,EAAE,UAAU;gBAChB,MAAM,EAAE,CAAC,aAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC;aAC9D,CAAA;QACF,CAAC;QACD,OAAO,MAAM,CAAA;IACd,CAAC;IAlBe,WAAQ,WAkBvB,CAAA;AACF,CAAC,EArBgB,EAAE,kBAAF,EAAE,QAqBlB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../Account/Charge/Fx/index.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAI7B,sCAAkC;AAIlC,IAAiB,EAAE,CAsBlB;AAtBD,WAAiB,EAAE;IACL,OAAI,GAAG,eAAM,CAAC,IAAI,CAAA;IAClB,UAAO,GAAG,eAAM,CAAC,OAAO,CAAA;IACrC,SAAgB,QAAQ,CACvB,MAAU,EACV,QAAwB,EACxB,MAAc,EACd,MAAoB,EACpB,QAAmB;QAEnB,IAAI,MAAoC,CAAA;QACxC,MAAM,YAAY,GAAG,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;QAClE,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;QAC5C,IAAI,QAAQ,EAAE,CAAC;YACd,MAAM,GAAG;gBACR,MAAM,EAAE,YAAY;gBACpB,IAAI,EAAE,UAAU;gBAChB,MAAM,EAAE,CAAC,aAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC;aAC9D,CAAA;QACF,CAAC;QACD,OAAO,MAAM,CAAA;IACd,CAAC;IAlBe,WAAQ,WAkBvB,CAAA;AACF,CAAC,EAtBgB,EAAE,kBAAF,EAAE,QAsBlB"}