@pax2pay/model-banking 0.1.660 → 0.1.661

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 (107) hide show
  1. package/Rail/index.ts +2 -0
  2. package/Transaction/Amount/Charge/index.ts +17 -0
  3. package/Transaction/Amount/index.ts +8 -0
  4. package/Transaction/Creatable.ts +16 -0
  5. package/Transaction/Exchange.ts +7 -0
  6. package/Transaction/Identifier.ts +1 -0
  7. package/Transaction/Incoming.ts +11 -0
  8. package/Transaction/Note.ts +11 -0
  9. package/Transaction/PreTransaction/Authorization.ts +8 -0
  10. package/Transaction/PreTransaction/Base.ts +9 -0
  11. package/Transaction/PreTransaction/Incoming.ts +11 -0
  12. package/Transaction/PreTransaction/Outgoing.ts +3 -2
  13. package/Transaction/PreTransaction/index.ts +2 -0
  14. package/Transaction/Reference.ts +9 -0
  15. package/Transaction/Status.ts +2 -0
  16. package/Transaction/index.ts +33 -0
  17. package/dist/cjs/Rail/index.d.ts +18 -0
  18. package/dist/cjs/Rail/index.js +2 -0
  19. package/dist/cjs/Rail/index.js.map +1 -1
  20. package/dist/cjs/Transaction/Amount/Charge/index.d.ts +479 -0
  21. package/dist/cjs/Transaction/Amount/Charge/index.js +17 -0
  22. package/dist/cjs/Transaction/Amount/Charge/index.js.map +1 -1
  23. package/dist/cjs/Transaction/Amount/index.d.ts +612 -0
  24. package/dist/cjs/Transaction/Amount/index.js +8 -0
  25. package/dist/cjs/Transaction/Amount/index.js.map +1 -1
  26. package/dist/cjs/Transaction/Creatable.d.ts +1191 -0
  27. package/dist/cjs/Transaction/Creatable.js +16 -0
  28. package/dist/cjs/Transaction/Creatable.js.map +1 -1
  29. package/dist/cjs/Transaction/Exchange.d.ts +367 -0
  30. package/dist/cjs/Transaction/Exchange.js +7 -0
  31. package/dist/cjs/Transaction/Exchange.js.map +1 -1
  32. package/dist/cjs/Transaction/Identifier.d.ts +1 -0
  33. package/dist/cjs/Transaction/Identifier.js +1 -0
  34. package/dist/cjs/Transaction/Identifier.js.map +1 -1
  35. package/dist/cjs/Transaction/Note.d.ts +21 -0
  36. package/dist/cjs/Transaction/Note.js +11 -0
  37. package/dist/cjs/Transaction/Note.js.map +1 -1
  38. package/dist/cjs/Transaction/PreTransaction/Authorization.d.ts +583 -0
  39. package/dist/cjs/Transaction/PreTransaction/Authorization.js +8 -0
  40. package/dist/cjs/Transaction/PreTransaction/Authorization.js.map +1 -1
  41. package/dist/cjs/Transaction/PreTransaction/Base.d.ts +611 -0
  42. package/dist/cjs/Transaction/PreTransaction/Base.js +9 -0
  43. package/dist/cjs/Transaction/PreTransaction/Base.js.map +1 -1
  44. package/dist/cjs/Transaction/PreTransaction/Incoming.d.ts +691 -0
  45. package/dist/cjs/Transaction/PreTransaction/Incoming.js +11 -0
  46. package/dist/cjs/Transaction/PreTransaction/Incoming.js.map +1 -1
  47. package/dist/cjs/Transaction/PreTransaction/Outgoing.d.ts +608 -2
  48. package/dist/cjs/Transaction/PreTransaction/Outgoing.js +3 -1
  49. package/dist/cjs/Transaction/PreTransaction/Outgoing.js.map +1 -1
  50. package/dist/cjs/Transaction/PreTransaction/index.d.ts +1877 -0
  51. package/dist/cjs/Transaction/PreTransaction/index.js +2 -0
  52. package/dist/cjs/Transaction/PreTransaction/index.js.map +1 -1
  53. package/dist/cjs/Transaction/Reference.d.ts +13 -0
  54. package/dist/cjs/Transaction/Reference.js +9 -0
  55. package/dist/cjs/Transaction/Reference.js.map +1 -1
  56. package/dist/cjs/Transaction/Status.d.ts +21 -0
  57. package/dist/cjs/Transaction/Status.js +2 -0
  58. package/dist/cjs/Transaction/Status.js.map +1 -1
  59. package/dist/cjs/Transaction/index.d.ts +4153 -0
  60. package/dist/cjs/Transaction/index.js +33 -0
  61. package/dist/cjs/Transaction/index.js.map +1 -1
  62. package/dist/mjs/Rail/index.d.ts +18 -0
  63. package/dist/mjs/Rail/index.js +2 -0
  64. package/dist/mjs/Rail/index.js.map +1 -1
  65. package/dist/mjs/Transaction/Amount/Charge/index.d.ts +479 -0
  66. package/dist/mjs/Transaction/Amount/Charge/index.js +17 -0
  67. package/dist/mjs/Transaction/Amount/Charge/index.js.map +1 -1
  68. package/dist/mjs/Transaction/Amount/index.d.ts +612 -0
  69. package/dist/mjs/Transaction/Amount/index.js +8 -0
  70. package/dist/mjs/Transaction/Amount/index.js.map +1 -1
  71. package/dist/mjs/Transaction/Creatable.d.ts +1191 -0
  72. package/dist/mjs/Transaction/Creatable.js +16 -0
  73. package/dist/mjs/Transaction/Creatable.js.map +1 -1
  74. package/dist/mjs/Transaction/Exchange.d.ts +367 -0
  75. package/dist/mjs/Transaction/Exchange.js +7 -0
  76. package/dist/mjs/Transaction/Exchange.js.map +1 -1
  77. package/dist/mjs/Transaction/Identifier.d.ts +1 -0
  78. package/dist/mjs/Transaction/Identifier.js +1 -0
  79. package/dist/mjs/Transaction/Identifier.js.map +1 -1
  80. package/dist/mjs/Transaction/Note.d.ts +21 -0
  81. package/dist/mjs/Transaction/Note.js +11 -0
  82. package/dist/mjs/Transaction/Note.js.map +1 -1
  83. package/dist/mjs/Transaction/PreTransaction/Authorization.d.ts +583 -0
  84. package/dist/mjs/Transaction/PreTransaction/Authorization.js +8 -0
  85. package/dist/mjs/Transaction/PreTransaction/Authorization.js.map +1 -1
  86. package/dist/mjs/Transaction/PreTransaction/Base.d.ts +611 -0
  87. package/dist/mjs/Transaction/PreTransaction/Base.js +9 -0
  88. package/dist/mjs/Transaction/PreTransaction/Base.js.map +1 -1
  89. package/dist/mjs/Transaction/PreTransaction/Incoming.d.ts +691 -0
  90. package/dist/mjs/Transaction/PreTransaction/Incoming.js +11 -0
  91. package/dist/mjs/Transaction/PreTransaction/Incoming.js.map +1 -1
  92. package/dist/mjs/Transaction/PreTransaction/Outgoing.d.ts +608 -2
  93. package/dist/mjs/Transaction/PreTransaction/Outgoing.js +3 -1
  94. package/dist/mjs/Transaction/PreTransaction/Outgoing.js.map +1 -1
  95. package/dist/mjs/Transaction/PreTransaction/index.d.ts +1877 -0
  96. package/dist/mjs/Transaction/PreTransaction/index.js +2 -0
  97. package/dist/mjs/Transaction/PreTransaction/index.js.map +1 -1
  98. package/dist/mjs/Transaction/Reference.d.ts +13 -0
  99. package/dist/mjs/Transaction/Reference.js +9 -0
  100. package/dist/mjs/Transaction/Reference.js.map +1 -1
  101. package/dist/mjs/Transaction/Status.d.ts +21 -0
  102. package/dist/mjs/Transaction/Status.js +2 -0
  103. package/dist/mjs/Transaction/Status.js.map +1 -1
  104. package/dist/mjs/Transaction/index.d.ts +4153 -0
  105. package/dist/mjs/Transaction/index.js +33 -0
  106. package/dist/mjs/Transaction/index.js.map +1 -1
  107. package/package.json +1 -1
package/Rail/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { isly } from "isly"
2
+ import { zod } from "../zod"
2
3
  import { Address as RailAddress } from "./Address"
3
4
 
4
5
  export type Rail = (typeof Rail.rails)[number]
@@ -21,5 +22,6 @@ export namespace Rail {
21
22
  "rix-inst",
22
23
  ] as const
23
24
  export const type = isly.string<Rail>(rails)
25
+ export const typeZod = zod.enum(rails)
24
26
  export import Address = RailAddress
25
27
  }
@@ -1,6 +1,7 @@
1
1
  import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
3
  import { Card } from "../../../Card"
4
+ import { zod } from "../../../zod"
4
5
 
5
6
  export interface Charge {
6
7
  merchant?: Charge.Merchant
@@ -18,6 +19,11 @@ export namespace Charge {
18
19
  rate: isly.number(),
19
20
  preset: isly.union(Card.Preset.type, isly.string("default")),
20
21
  })
22
+ export const typeZod = zod.object({
23
+ amount: zod.number(),
24
+ rate: zod.number(),
25
+ preset: zod.union([Card.Preset.typeZod, zod.literal("default")]),
26
+ })
21
27
  }
22
28
  export interface Merchant {
23
29
  amount: number
@@ -36,6 +42,13 @@ export namespace Charge {
36
42
  account: isly.string(),
37
43
  }),
38
44
  })
45
+ export const typeZod = zod.object({
46
+ amount: zod.number(),
47
+ rate: zod.number(),
48
+ merchant: Card.Restriction.Merchant.typeZod,
49
+ preset: zod.union([Card.Preset.typeZod, zod.literal("default")]),
50
+ destination: zod.object({ account: zod.string() }),
51
+ })
39
52
  }
40
53
  export function total(currency: isoly.Currency, charges: Charge): number {
41
54
  return isoly.Currency.add(currency, charges.fx?.amount ?? 0, charges.merchant?.amount ?? 0)
@@ -44,4 +57,8 @@ export namespace Charge {
44
57
  merchant: Charge.Merchant.type.optional(),
45
58
  fx: Charge.Fx.type.optional(),
46
59
  })
60
+ export const typeZod = zod.object({
61
+ merchant: Charge.Merchant.typeZod.optional(),
62
+ fx: Charge.Fx.typeZod.optional(),
63
+ })
47
64
  }
@@ -1,5 +1,6 @@
1
1
  import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
+ import { zod } from "../../zod"
3
4
  import { Exchange } from "../Exchange"
4
5
  import { Charge as AmountCharge } from "./Charge"
5
6
 
@@ -19,6 +20,13 @@ export namespace Amount {
19
20
  total: isly.number(),
20
21
  exchange: Exchange.type.optional(),
21
22
  })
23
+ export const typeZod = zod.object({
24
+ original: zod.number(),
25
+ charge: zod.number(),
26
+ charges: Amount.Charge.typeZod.optional(),
27
+ total: zod.number(),
28
+ exchange: Exchange.typeZod.optional(),
29
+ })
22
30
  export function change(
23
31
  currency: isoly.Currency,
24
32
  amount: Amount,
@@ -3,6 +3,7 @@ import { isly } from "isly"
3
3
  import { Account } from "../Account"
4
4
  import { Preset } from "../Card/Preset"
5
5
  import { Rail } from "../Rail"
6
+ import { zod } from "../zod"
6
7
  import { Amount } from "./Amount"
7
8
  import { Exchange } from "./Exchange"
8
9
 
@@ -24,6 +25,14 @@ export namespace Creatable {
24
25
  exchange: Exchange.type.optional(),
25
26
  reference: isly.object<{ reference?: string }>({ reference: isly.string().optional() }).optional(),
26
27
  })
28
+ export const typeZod = zod.object({
29
+ counterpart: Rail.Address.typeZod,
30
+ currency: zod.enum(isoly.Currency.values),
31
+ amount: zod.number(),
32
+ description: zod.string(),
33
+ exchange: Exchange.typeZod.optional(),
34
+ reference: zod.object({ reference: zod.string().optional() }).optional(),
35
+ })
27
36
  export interface CardTransaction extends Creatable {
28
37
  account: Pick<Rail.Address.Card, "id" | "type">
29
38
  accountId: string
@@ -39,6 +48,13 @@ export namespace Creatable {
39
48
  reference: isly.object<{ reference: string }>({ reference: isly.string() }),
40
49
  approvalCode: isly.string().optional(),
41
50
  })
51
+ export const typeZod = Creatable.typeZod.extend({
52
+ account: Rail.Address.Card.typeZod.pick({ id: true, type: true }),
53
+ accountId: zod.string(),
54
+ counterpart: Rail.Address.Card.Counterpart.typeZod,
55
+ reference: zod.object({ reference: zod.string() }),
56
+ approvalCode: zod.string().optional(),
57
+ })
42
58
  export function charge(creatable: CardTransaction, preset: Preset, charges?: Account.Charge): Amount.Charge {
43
59
  return Account.Charge.evaluate(
44
60
  creatable.counterpart,
@@ -1,5 +1,6 @@
1
1
  import { isly } from "isly"
2
2
  import { Amount } from "../Amount"
3
+ import { zod } from "../zod"
3
4
 
4
5
  export interface Exchange {
5
6
  rate: number
@@ -14,4 +15,10 @@ export namespace Exchange {
14
15
  from: Amount.type.optional(),
15
16
  quote: isly.string().optional(),
16
17
  })
18
+ export const typeZod = zod.object({
19
+ rate: zod.number(),
20
+ to: Amount.typeZod.optional(),
21
+ from: Amount.typeZod.optional(),
22
+ quote: zod.string().optional(),
23
+ })
17
24
  }
@@ -4,6 +4,7 @@ import { Identifier as Pax2PayIdentifier } from "../Identifier"
4
4
  export type Identifier = Pax2PayIdentifier
5
5
  export namespace Identifier {
6
6
  export const type = Pax2PayIdentifier.type
7
+ export const typeZod = Pax2PayIdentifier.typeZod
7
8
  export function generate(): string {
8
9
  //This function will stop working 4199-11-24T01:22:57.664Z
9
10
  //Then we need to replace "zzy" instead
@@ -1,6 +1,7 @@
1
1
  import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
3
  import { Rail } from "../Rail"
4
+ import { zod } from "../zod"
4
5
  import { Reference as TransactionReference } from "./Reference"
5
6
 
6
7
  export interface Incoming {
@@ -24,4 +25,14 @@ export namespace Incoming {
24
25
  rail: Rail.type.optional(),
25
26
  reference: TransactionReference.type.optional(),
26
27
  })
28
+ export const typeZod = zod.object({
29
+ account: Rail.Address.typeZod,
30
+ counterpart: Rail.Address.typeZod,
31
+ currency: zod.enum(isoly.Currency.values),
32
+ amount: zod.number(),
33
+ description: zod.string(),
34
+ posted: zod.string(),
35
+ rail: Rail.typeZod.optional(),
36
+ reference: TransactionReference.typeZod.optional(),
37
+ })
27
38
  }
@@ -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 Note extends Note.Creatable {
5
6
  author: string
@@ -32,9 +33,19 @@ export namespace Note {
32
33
  flags: isly.string().array().optional(),
33
34
  rule: isly.any().optional(),
34
35
  })
36
+ export const typeZod = zod.object({
37
+ text: zod.string().optional(),
38
+ action: zod.enum(["approve", "reject"]).optional(),
39
+ flags: zod.array(zod.string()).optional(),
40
+ rule: zod.any().optional(),
41
+ })
35
42
  }
36
43
  export const type = Creatable.type.extend<Note>({
37
44
  author: isly.string(),
38
45
  created: isly.string(),
39
46
  })
47
+ export const typeZod = Creatable.typeZod.extend({
48
+ author: zod.string(),
49
+ created: zod.string().refine(isoly.DateTime.is),
50
+ })
40
51
  }
@@ -1,5 +1,6 @@
1
1
  import { isly } from "isly"
2
2
  import { Rail } from "../../Rail"
3
+ import { zod } from "../../zod"
3
4
  import { Base } from "./Base"
4
5
 
5
6
  export interface Authorization extends Base {
@@ -17,4 +18,11 @@ export namespace Authorization {
17
18
  reference: isly.object<{ reference: string }>({ reference: isly.string() }),
18
19
  approvalCode: isly.string().optional(),
19
20
  })
21
+ export const typeZod = Base.typeZod.extend({
22
+ type: zod.literal("authorization"),
23
+ account: Rail.Address.Card.typeZod.pick({ id: true, type: true }),
24
+ counterpart: Rail.Address.Card.Counterpart.typeZod,
25
+ reference: zod.object({ reference: zod.string() }),
26
+ approvalCode: zod.string().optional(),
27
+ })
20
28
  }
@@ -1,6 +1,7 @@
1
1
  import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
3
  import { Rail } from "../../Rail"
4
+ import { zod } from "../../zod"
4
5
  import { Exchange } from "../Exchange"
5
6
 
6
7
  export interface Base {
@@ -20,4 +21,12 @@ export namespace Base {
20
21
  description: isly.string(),
21
22
  exchange: Exchange.type.optional(),
22
23
  })
24
+ export const typeZod = zod.object({
25
+ type: zod.enum(["outgoing", "incoming", "authorization"]),
26
+ counterpart: Rail.Address.typeZod,
27
+ currency: zod.enum(isoly.Currency.values),
28
+ amount: zod.number(),
29
+ description: zod.string(),
30
+ exchange: Exchange.typeZod.optional(),
31
+ })
23
32
  }
@@ -2,6 +2,7 @@ import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
3
  import { Rail } from "../../Rail"
4
4
  import { Settlement } from "../../Settlement"
5
+ import { zod } from "../../zod"
5
6
  import { Reference as TransactionReference } from "../Reference"
6
7
  import { Base } from "./Base"
7
8
 
@@ -26,6 +27,16 @@ export namespace Incoming {
26
27
  rail: Rail.type.optional(),
27
28
  reference: TransactionReference.type.optional(),
28
29
  })
30
+ export const typeZod = Base.typeZod.extend({
31
+ type: zod.literal("incoming"),
32
+ account: Rail.Address.typeZod,
33
+ currency: zod.enum(isoly.Currency.values),
34
+ amount: zod.number(),
35
+ description: zod.string(),
36
+ posted: zod.string(),
37
+ rail: Rail.typeZod.optional(),
38
+ reference: TransactionReference.typeZod.optional(),
39
+ })
29
40
  export function fromRefund(entry: Settlement.Entry.Creatable.Refund, card: Rail.Address.Card): Incoming {
30
41
  const [currency, amount] = entry.amount
31
42
  return {
@@ -1,8 +1,9 @@
1
- import type { Base } from "./Base"
1
+ import { zod } from "../../zod"
2
+ import { Base } from "./Base"
2
3
 
3
4
  export interface Outgoing extends Base {
4
5
  type: "outgoing"
5
6
  }
6
7
  export namespace Outgoing {
7
- export const dummy = true
8
+ export const typeZod = Base.typeZod.extend({ type: zod.literal("outgoing") })
8
9
  }
@@ -1,4 +1,5 @@
1
1
  import { Rail } from "../../Rail"
2
+ import { zod } from "../../zod"
2
3
  import { Authorization as PreTransactionAuthorization } from "./Authorization"
3
4
  import { Incoming as PreTransactionIncoming } from "./Incoming"
4
5
  import { Outgoing as PreTransactionOutgoing } from "./Outgoing"
@@ -13,4 +14,5 @@ export namespace PreTransaction {
13
14
  export import Authorization = PreTransactionAuthorization
14
15
  export import Incoming = PreTransactionIncoming
15
16
  export import Outgoing = PreTransactionOutgoing
17
+ export const typeZod = zod.union([Outgoing.typeZod, Authorization.typeZod, Incoming.typeZod])
16
18
  }
@@ -1,5 +1,6 @@
1
1
  import { isly } from "isly"
2
2
  import { Supplier } from "../Supplier"
3
+ import { zod } from "../zod"
3
4
 
4
5
  export interface Reference {
5
6
  supplier?: Supplier
@@ -19,4 +20,12 @@ export namespace Reference {
19
20
  instruction: isly.string().optional(),
20
21
  network: isly.string().optional(),
21
22
  })
23
+ export const typeZod = zod.object({
24
+ supplier: Supplier.typeZod.optional(),
25
+ reference: zod.string().optional(),
26
+ returnId: zod.string().optional(),
27
+ endToEndId: zod.string().optional(),
28
+ instruction: zod.string().optional(),
29
+ network: zod.string().optional(),
30
+ })
22
31
  }
@@ -1,4 +1,5 @@
1
1
  import { isly } from "isly"
2
+ import { zod } from "../zod"
2
3
 
3
4
  export type Status = Status.Success | [Status.Fail, Status.Reason]
4
5
  export namespace Status {
@@ -27,4 +28,5 @@ export namespace Status {
27
28
  Success,
28
29
  isly.tuple<[Fail, Status.Reason]>(Fail, Reason)
29
30
  )
31
+ export const typeZod = zod.union([zod.enum(successes), zod.tuple([zod.enum(failures), zod.enum(reasons)])])
30
32
  }
@@ -7,6 +7,7 @@ import { Rail } from "../Rail"
7
7
  import { Report } from "../Report"
8
8
  import type { Rule } from "../Rule"
9
9
  import { Settlement } from "../Settlement"
10
+ import { zod } from "../zod"
10
11
  import { Amount as TransactionAmount } from "./Amount"
11
12
  import { Creatable as TransactionCreatable } from "./Creatable"
12
13
  import { Exchange as TransactionExchange } from "./Exchange"
@@ -85,6 +86,32 @@ export namespace Transaction {
85
86
  risk: isly.number().optional(),
86
87
  state: isly.any().optional(),
87
88
  })
89
+ export const typeZod = zod.object({
90
+ counterpart: Rail.Address.typeZod,
91
+ currency: zod.enum(isoly.Currency.values),
92
+ amount: Amount.typeZod,
93
+ description: zod.string(),
94
+ organization: zod.string(),
95
+ accountId: zod.string(),
96
+ accountName: zod.string().optional(),
97
+ account: Rail.Address.typeZod,
98
+ type: zod.enum(types).optional(),
99
+ direction: zod.enum(directions).optional(),
100
+ id: Identifier.typeZod,
101
+ reference: Reference.typeZod.optional(),
102
+ posted: zod.string().refine(isoly.DateTime.is),
103
+ transacted: zod.string().refine(isoly.DateTime.is).optional(),
104
+ by: zod.string().optional(),
105
+ balance: zod.object({ actual: zod.number(), available: zod.number(), reserved: zod.number() }),
106
+ operations: zod.array(Operation.typeZod).optional(),
107
+ status: Status.typeZod,
108
+ rail: Rail.typeZod.optional(),
109
+ flags: zod.array(zod.string()),
110
+ oldFlags: zod.array(zod.string()),
111
+ notes: zod.array(Note.typeZod),
112
+ risk: zod.number().optional(),
113
+ state: zod.any().optional(),
114
+ })
88
115
  export function amountFromOperations(transaction: Transaction, operations: Operation[]): Amount {
89
116
  const changes = Operation.sum(operations)
90
117
  const reserved = isoly.Currency.add(
@@ -105,6 +132,7 @@ export namespace Transaction {
105
132
  }
106
133
  export namespace Legacy {
107
134
  export const type = Transaction.type.omit<"amount">(["amount"]).extend<Legacy>({ amount: isly.number() })
135
+ export const typeZod = Transaction.typeZod.omit({ amount: true }).extend({ amount: zod.number() })
108
136
  }
109
137
  export function fromLegacy(transaction: Transaction | Legacy): Transaction {
110
138
  return {
@@ -131,6 +159,7 @@ export namespace Transaction {
131
159
  export type Event = Omit<Transaction, "state">
132
160
  export namespace Event {
133
161
  export const type = Transaction.type.omit(["state"])
162
+ export const typeZod = Transaction.typeZod.omit({ state: true })
134
163
 
135
164
  export function from(transaction: Transaction): Event {
136
165
  return (({ state, ...event }) => event)(transaction)
@@ -384,5 +413,9 @@ export namespace Transaction {
384
413
  account: Rail.Address.Card.type,
385
414
  counterpart: Rail.Address.Card.Counterpart.type,
386
415
  })
416
+ export const typeZod = Transaction.typeZod.omit({ account: true, counterpart: true }).extend({
417
+ account: Rail.Address.Card.typeZod,
418
+ counterpart: Rail.Address.Card.Counterpart.typeZod,
419
+ })
387
420
  }
388
421
  }
@@ -1,8 +1,26 @@
1
1
  import { isly } from "isly";
2
+ import { zod } from "../zod";
2
3
  import { Address as RailAddress } from "./Address";
3
4
  export type Rail = (typeof Rail.rails)[number];
4
5
  export declare namespace Rail {
5
6
  const rails: readonly ["internal", "paxgiro", "paxgiro-credit", "mastercard", "diners", "visa", "fasterpayments", "chaps", "bacs", "transfer", "credit", "sepa", "sepa-instant", "rix-rtgs", "rix-inst"];
6
7
  const type: isly.Type<"paxgiro" | "mastercard" | "diners" | "visa" | "internal" | "transfer" | "paxgiro-credit" | "fasterpayments" | "chaps" | "bacs" | "credit" | "sepa" | "sepa-instant" | "rix-rtgs" | "rix-inst">;
8
+ const typeZod: zod.ZodEnum<{
9
+ paxgiro: "paxgiro";
10
+ mastercard: "mastercard";
11
+ diners: "diners";
12
+ visa: "visa";
13
+ internal: "internal";
14
+ transfer: "transfer";
15
+ "paxgiro-credit": "paxgiro-credit";
16
+ fasterpayments: "fasterpayments";
17
+ chaps: "chaps";
18
+ bacs: "bacs";
19
+ credit: "credit";
20
+ sepa: "sepa";
21
+ "sepa-instant": "sepa-instant";
22
+ "rix-rtgs": "rix-rtgs";
23
+ "rix-inst": "rix-inst";
24
+ }>;
7
25
  export import Address = RailAddress;
8
26
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Rail = void 0;
4
4
  const isly_1 = require("isly");
5
+ const zod_1 = require("../zod");
5
6
  const Address_1 = require("./Address");
6
7
  var Rail;
7
8
  (function (Rail) {
@@ -23,6 +24,7 @@ var Rail;
23
24
  "rix-inst",
24
25
  ];
25
26
  Rail.type = isly_1.isly.string(Rail.rails);
27
+ Rail.typeZod = zod_1.zod.enum(Rail.rails);
26
28
  Rail.Address = Address_1.Address;
27
29
  })(Rail || (exports.Rail = Rail = {}));
28
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../Rail/index.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;AAC3B,uCAAkD;AAGlD,IAAiB,IAAI,CAoBpB;AApBD,WAAiB,IAAI;IACP,UAAK,GAAG;QACpB,UAAU;QACV,SAAS;QACT,gBAAgB;QAChB,YAAY;QACZ,QAAQ;QACR,MAAM;QACN,gBAAgB;QAChB,OAAO;QACP,MAAM;QACN,UAAU;QACV,QAAQ;QACR,MAAM;QACN,cAAc;QACd,UAAU;QACV,UAAU;KACD,CAAA;IACG,SAAI,GAAG,WAAI,CAAC,MAAM,CAAO,KAAA,KAAK,CAAC,CAAA;IAC9B,YAAO,GAAG,iBAAW,CAAA;AACpC,CAAC,EApBgB,IAAI,oBAAJ,IAAI,QAoBpB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../Rail/index.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;AAC3B,gCAA4B;AAC5B,uCAAkD;AAGlD,IAAiB,IAAI,CAqBpB;AArBD,WAAiB,IAAI;IACP,UAAK,GAAG;QACpB,UAAU;QACV,SAAS;QACT,gBAAgB;QAChB,YAAY;QACZ,QAAQ;QACR,MAAM;QACN,gBAAgB;QAChB,OAAO;QACP,MAAM;QACN,UAAU;QACV,QAAQ;QACR,MAAM;QACN,cAAc;QACd,UAAU;QACV,UAAU;KACD,CAAA;IACG,SAAI,GAAG,WAAI,CAAC,MAAM,CAAO,KAAA,KAAK,CAAC,CAAA;IAC/B,YAAO,GAAG,SAAG,CAAC,IAAI,CAAC,KAAA,KAAK,CAAC,CAAA;IACxB,YAAO,GAAG,iBAAW,CAAA;AACpC,CAAC,EArBgB,IAAI,oBAAJ,IAAI,QAqBpB"}