@pax2pay/model-banking 0.1.656 → 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.
- package/Account/Charge/Fx/index.ts +1 -0
- package/Account/Charge/Merchant/index.ts +5 -0
- package/Account/Charge/Preset/index.ts +4 -0
- package/Account/Charge/index.ts +5 -0
- package/Account/Creatable.ts +3 -0
- package/Account/Details.ts +11 -0
- package/Account/History.ts +7 -0
- package/Account/Status.ts +5 -0
- package/Account/index.ts +13 -0
- package/Acquirer/index.ts +8 -0
- package/Balance.ts +18 -4
- package/Balances.ts +2 -0
- package/Card/Expiry.ts +2 -0
- package/Card/Preset.ts +2 -0
- package/Card/Restriction/Merchant.ts +2 -0
- package/Card/Scheme.ts +2 -0
- package/Merchant/index.ts +11 -0
- package/Quarter.ts +1 -1
- package/Rail/Address/Card.ts +17 -0
- package/Rail/Address/Iban.ts +8 -0
- package/Rail/Address/PaxGiro.ts +2 -0
- package/Rail/Address/Scan.ts +8 -0
- package/Rail/Address/index.ts +10 -1
- package/Rail/Address/internal.ts +7 -0
- package/Supplier/index.ts +2 -0
- package/Treasury/Snapshot/funding.ts +2 -2
- package/dist/cjs/Account/Charge/Fx/index.d.ts +21 -0
- package/dist/cjs/Account/Charge/Fx/index.js +1 -0
- package/dist/cjs/Account/Charge/Fx/index.js.map +1 -1
- package/dist/cjs/Account/Charge/Merchant/index.d.ts +217 -0
- package/dist/cjs/Account/Charge/Merchant/index.js +5 -0
- package/dist/cjs/Account/Charge/Merchant/index.js.map +1 -1
- package/dist/cjs/Account/Charge/Preset/index.d.ts +22 -0
- package/dist/cjs/Account/Charge/Preset/index.js +4 -0
- package/dist/cjs/Account/Charge/Preset/index.js.map +1 -1
- package/dist/cjs/Account/Charge/index.d.ts +240 -0
- package/dist/cjs/Account/Charge/index.js +5 -0
- package/dist/cjs/Account/Charge/index.js.map +1 -1
- package/dist/cjs/Account/Creatable.d.ts +12 -0
- package/dist/cjs/Account/Creatable.js +3 -0
- package/dist/cjs/Account/Creatable.js.map +1 -1
- package/dist/cjs/Account/Details.d.ts +432 -0
- package/dist/cjs/Account/Details.js +11 -0
- package/dist/cjs/Account/Details.js.map +1 -1
- package/dist/cjs/Account/History.d.ts +25 -0
- package/dist/cjs/Account/History.js +7 -0
- package/dist/cjs/Account/History.js.map +1 -1
- package/dist/cjs/Account/Status.d.ts +9 -0
- package/dist/cjs/Account/Status.js +5 -0
- package/dist/cjs/Account/Status.js.map +1 -1
- package/dist/cjs/Account/index.d.ts +748 -0
- package/dist/cjs/Account/index.js +13 -0
- package/dist/cjs/Account/index.js.map +1 -1
- package/dist/cjs/Acquirer/index.d.ts +8 -0
- package/dist/cjs/Acquirer/index.js +8 -0
- package/dist/cjs/Acquirer/index.js.map +1 -1
- package/dist/cjs/Balance.d.ts +14 -0
- package/dist/cjs/Balance.js +6 -0
- package/dist/cjs/Balance.js.map +1 -1
- package/dist/cjs/Balances.d.ts +189 -0
- package/dist/cjs/Balances.js +2 -0
- package/dist/cjs/Balances.js.map +1 -1
- package/dist/cjs/Card/Expiry.d.ts +2 -0
- package/dist/cjs/Card/Expiry.js +2 -0
- package/dist/cjs/Card/Expiry.js.map +1 -1
- package/dist/cjs/Card/Preset.d.ts +19 -0
- package/dist/cjs/Card/Preset.js +2 -0
- package/dist/cjs/Card/Preset.js.map +1 -1
- package/dist/cjs/Card/Restriction/Merchant.d.ts +192 -0
- package/dist/cjs/Card/Restriction/Merchant.js +2 -0
- package/dist/cjs/Card/Restriction/Merchant.js.map +1 -1
- package/dist/cjs/Card/Scheme.d.ts +6 -0
- package/dist/cjs/Card/Scheme.js +2 -0
- package/dist/cjs/Card/Scheme.js.map +1 -1
- package/dist/cjs/Merchant/index.d.ts +11 -0
- package/dist/cjs/Merchant/index.js +11 -0
- package/dist/cjs/Merchant/index.js.map +1 -1
- package/dist/cjs/Operation/Status.d.ts +1 -1
- package/dist/cjs/Quarter.js.map +1 -1
- package/dist/cjs/Rail/Address/Card.d.ts +36 -0
- package/dist/cjs/Rail/Address/Card.js +17 -0
- package/dist/cjs/Rail/Address/Card.js.map +1 -1
- package/dist/cjs/Rail/Address/Iban.d.ts +8 -0
- package/dist/cjs/Rail/Address/Iban.js +8 -0
- package/dist/cjs/Rail/Address/Iban.js.map +1 -1
- package/dist/cjs/Rail/Address/PaxGiro.d.ts +5 -0
- package/dist/cjs/Rail/Address/PaxGiro.js +2 -0
- package/dist/cjs/Rail/Address/PaxGiro.js.map +1 -1
- package/dist/cjs/Rail/Address/Scan.d.ts +8 -0
- package/dist/cjs/Rail/Address/Scan.js +8 -0
- package/dist/cjs/Rail/Address/Scan.js.map +1 -1
- package/dist/cjs/Rail/Address/index.d.ts +55 -0
- package/dist/cjs/Rail/Address/index.js +9 -0
- package/dist/cjs/Rail/Address/index.js.map +1 -1
- package/dist/cjs/Rail/Address/internal.d.ts +7 -0
- package/dist/cjs/Rail/Address/internal.js +7 -0
- package/dist/cjs/Rail/Address/internal.js.map +1 -1
- package/dist/cjs/Supplier/index.d.ts +6 -0
- package/dist/cjs/Supplier/index.js +2 -0
- package/dist/cjs/Supplier/index.js.map +1 -1
- package/dist/cjs/Treasury/Snapshot/funding.js.map +1 -1
- package/dist/mjs/Account/Charge/Fx/index.d.ts +21 -0
- package/dist/mjs/Account/Charge/Fx/index.js +1 -0
- package/dist/mjs/Account/Charge/Fx/index.js.map +1 -1
- package/dist/mjs/Account/Charge/Merchant/index.d.ts +217 -0
- package/dist/mjs/Account/Charge/Merchant/index.js +5 -0
- package/dist/mjs/Account/Charge/Merchant/index.js.map +1 -1
- package/dist/mjs/Account/Charge/Preset/index.d.ts +22 -0
- package/dist/mjs/Account/Charge/Preset/index.js +4 -0
- package/dist/mjs/Account/Charge/Preset/index.js.map +1 -1
- package/dist/mjs/Account/Charge/index.d.ts +240 -0
- package/dist/mjs/Account/Charge/index.js +5 -0
- package/dist/mjs/Account/Charge/index.js.map +1 -1
- package/dist/mjs/Account/Creatable.d.ts +12 -0
- package/dist/mjs/Account/Creatable.js +3 -0
- package/dist/mjs/Account/Creatable.js.map +1 -1
- package/dist/mjs/Account/Details.d.ts +432 -0
- package/dist/mjs/Account/Details.js +11 -0
- package/dist/mjs/Account/Details.js.map +1 -1
- package/dist/mjs/Account/History.d.ts +25 -0
- package/dist/mjs/Account/History.js +7 -0
- package/dist/mjs/Account/History.js.map +1 -1
- package/dist/mjs/Account/Status.d.ts +9 -0
- package/dist/mjs/Account/Status.js +5 -0
- package/dist/mjs/Account/Status.js.map +1 -1
- package/dist/mjs/Account/index.d.ts +748 -0
- package/dist/mjs/Account/index.js +13 -0
- package/dist/mjs/Account/index.js.map +1 -1
- package/dist/mjs/Acquirer/index.d.ts +8 -0
- package/dist/mjs/Acquirer/index.js +8 -0
- package/dist/mjs/Acquirer/index.js.map +1 -1
- package/dist/mjs/Balance.d.ts +14 -0
- package/dist/mjs/Balance.js +6 -0
- package/dist/mjs/Balance.js.map +1 -1
- package/dist/mjs/Balances.d.ts +189 -0
- package/dist/mjs/Balances.js +2 -0
- package/dist/mjs/Balances.js.map +1 -1
- package/dist/mjs/Card/Expiry.d.ts +2 -0
- package/dist/mjs/Card/Expiry.js +2 -0
- package/dist/mjs/Card/Expiry.js.map +1 -1
- package/dist/mjs/Card/Preset.d.ts +19 -0
- package/dist/mjs/Card/Preset.js +2 -0
- package/dist/mjs/Card/Preset.js.map +1 -1
- package/dist/mjs/Card/Restriction/Merchant.d.ts +192 -0
- package/dist/mjs/Card/Restriction/Merchant.js +2 -0
- package/dist/mjs/Card/Restriction/Merchant.js.map +1 -1
- package/dist/mjs/Card/Scheme.d.ts +6 -0
- package/dist/mjs/Card/Scheme.js +2 -0
- package/dist/mjs/Card/Scheme.js.map +1 -1
- package/dist/mjs/Merchant/index.d.ts +11 -0
- package/dist/mjs/Merchant/index.js +11 -0
- package/dist/mjs/Merchant/index.js.map +1 -1
- package/dist/mjs/Operation/Status.d.ts +1 -1
- package/dist/mjs/Quarter.js.map +1 -1
- package/dist/mjs/Rail/Address/Card.d.ts +36 -0
- package/dist/mjs/Rail/Address/Card.js +17 -0
- package/dist/mjs/Rail/Address/Card.js.map +1 -1
- package/dist/mjs/Rail/Address/Iban.d.ts +8 -0
- package/dist/mjs/Rail/Address/Iban.js +8 -0
- package/dist/mjs/Rail/Address/Iban.js.map +1 -1
- package/dist/mjs/Rail/Address/PaxGiro.d.ts +5 -0
- package/dist/mjs/Rail/Address/PaxGiro.js +2 -0
- package/dist/mjs/Rail/Address/PaxGiro.js.map +1 -1
- package/dist/mjs/Rail/Address/Scan.d.ts +8 -0
- package/dist/mjs/Rail/Address/Scan.js +8 -0
- package/dist/mjs/Rail/Address/Scan.js.map +1 -1
- package/dist/mjs/Rail/Address/index.d.ts +55 -0
- package/dist/mjs/Rail/Address/index.js +9 -0
- package/dist/mjs/Rail/Address/index.js.map +1 -1
- package/dist/mjs/Rail/Address/internal.d.ts +7 -0
- package/dist/mjs/Rail/Address/internal.js +7 -0
- package/dist/mjs/Rail/Address/internal.js.map +1 -1
- package/dist/mjs/Supplier/index.d.ts +6 -0
- package/dist/mjs/Supplier/index.js +2 -0
- package/dist/mjs/Supplier/index.js.map +1 -1
- package/dist/mjs/Treasury/Snapshot/funding.js.map +1 -1
- package/package.json +1 -1
- package/tsconfig.json +1 -0
|
@@ -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
|
}
|
package/Account/Charge/index.ts
CHANGED
|
@@ -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,
|
package/Account/Creatable.ts
CHANGED
|
@@ -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
|
}
|
package/Account/Details.ts
CHANGED
|
@@ -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
|
}
|
package/Account/History.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 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]
|
|
@@ -67,11 +73,19 @@ export namespace Balance {
|
|
|
67
73
|
export function add(addendee: Extended, addend: Extended, currency: isoly.Currency): Extended {
|
|
68
74
|
const updated = [update(currency, addendee), update(currency, addend)]
|
|
69
75
|
return update(currency, {
|
|
70
|
-
available: isoly.Currency.add(currency, updated[0]
|
|
76
|
+
available: isoly.Currency.add(currency, updated[0]!.available ?? 0, updated[1]!.available ?? 0),
|
|
71
77
|
reserved: {
|
|
72
|
-
buffer: isoly.Currency.add(currency, updated[0]
|
|
73
|
-
incoming: isoly.Currency.add(
|
|
74
|
-
|
|
78
|
+
buffer: isoly.Currency.add(currency, updated[0]!.reserved?.buffer ?? 0, updated[1]!.reserved?.buffer ?? 0),
|
|
79
|
+
incoming: isoly.Currency.add(
|
|
80
|
+
currency,
|
|
81
|
+
updated[0]!.reserved?.incoming ?? 0,
|
|
82
|
+
updated[1]!.reserved?.incoming ?? 0
|
|
83
|
+
),
|
|
84
|
+
outgoing: isoly.Currency.add(
|
|
85
|
+
currency,
|
|
86
|
+
updated[0]!.reserved?.outgoing ?? 0,
|
|
87
|
+
updated[1]!.reserved?.outgoing ?? 0
|
|
88
|
+
),
|
|
75
89
|
},
|
|
76
90
|
})
|
|
77
91
|
}
|
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
|
}
|
package/Quarter.ts
CHANGED
|
@@ -14,7 +14,7 @@ export namespace Quarter {
|
|
|
14
14
|
}
|
|
15
15
|
export function previous(quarter: Quarter): Quarter {
|
|
16
16
|
const index = values.indexOf(quarter) - 1
|
|
17
|
-
return values[index < 0 ? values.length - 1 : index]
|
|
17
|
+
return values[index < 0 ? values.length - 1 : index]!
|
|
18
18
|
}
|
|
19
19
|
export namespace DateRange {
|
|
20
20
|
export const converter: Record<Quarter, { start: string; end: string }> = {
|
package/Rail/Address/Card.ts
CHANGED
|
@@ -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 {
|
package/Rail/Address/Iban.ts
CHANGED
|
@@ -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
|
}
|
package/Rail/Address/PaxGiro.ts
CHANGED
|
@@ -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
|
}
|
package/Rail/Address/Scan.ts
CHANGED
|
@@ -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
|
}
|
package/Rail/Address/index.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 { Card as AddressCard } from "./Card"
|
|
4
5
|
import { Iban as AddressIban } from "./Iban"
|
|
5
6
|
import { Internal as AddressInternal } from "./internal"
|
|
@@ -30,7 +31,7 @@ export namespace Address {
|
|
|
30
31
|
const splitted = value.split("-")
|
|
31
32
|
switch (splitted[0]) {
|
|
32
33
|
case "pxg":
|
|
33
|
-
result = splitted.length == 2 ? { type: "paxgiro", identifier: splitted[1] } : undefined
|
|
34
|
+
result = splitted.length == 2 ? { type: "paxgiro", identifier: splitted[1]! } : undefined
|
|
34
35
|
break
|
|
35
36
|
}
|
|
36
37
|
return result
|
|
@@ -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
|
package/Rail/Address/internal.ts
CHANGED
|
@@ -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 {
|
|
@@ -13,7 +13,7 @@ export namespace funding {
|
|
|
13
13
|
return `${transaction.currency}|${isoly.DateTime.invert(transaction.created)}|${transaction.reference}`
|
|
14
14
|
}
|
|
15
15
|
export function toTimestamp(cursor: string): isoly.DateTime {
|
|
16
|
-
return isoly.DateTime.invert(cursor.split("|")[1])
|
|
16
|
+
return isoly.DateTime.invert(cursor.split("|")[1]!)
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
export type Cursors = Partial<Record<isoly.Currency, Cursor>>
|
|
@@ -47,7 +47,7 @@ export namespace funding {
|
|
|
47
47
|
}
|
|
48
48
|
export function settle(transactions: Transaction[], amountsUpdated: Cursors): Cursors {
|
|
49
49
|
for (let i = transactions.length - 1; i >= 0; i--) {
|
|
50
|
-
Cursors.updateCursors(transactions[i]
|
|
50
|
+
Cursors.updateCursors(transactions[i]!, amountsUpdated)
|
|
51
51
|
}
|
|
52
52
|
return amountsUpdated
|
|
53
53
|
}
|
|
@@ -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,
|
|
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"}
|