@pax2pay/model-banking 0.1.663 → 0.1.665
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/Amounts.ts +2 -0
- package/Merchant/Category.ts +2 -0
- package/Merchant/index.ts +1 -1
- package/Settlement/Amount.ts +5 -0
- package/Settlement/Batch.ts +2 -0
- package/Settlement/Creatable.ts +8 -0
- package/Settlement/Entry/Creatable.ts +24 -0
- package/Settlement/Entry/Failed.ts +9 -0
- package/Settlement/Entry/Succeeded.ts +12 -0
- package/Settlement/Entry/Summary.ts +5 -0
- package/Settlement/Entry/index.ts +2 -1
- package/Settlement/Entry/type.ts +2 -0
- package/Settlement/Fee.ts +2 -0
- package/Settlement/Identifier.ts +2 -0
- package/Settlement/Status.ts +5 -0
- package/Settlement/Total.ts +20 -0
- package/Settlement/Totals.ts +2 -0
- package/Settlement/index.ts +12 -2
- package/Warning/Base.ts +11 -0
- package/Warning/Issue.ts +11 -0
- package/Warning/Settlement/MissingFile.ts +7 -0
- package/Warning/Settlement/NegativeAmount.ts +7 -0
- package/Warning/Settlement/UnknownEntry.ts +7 -0
- package/Warning/Settlement/index.ts +6 -0
- package/dist/cjs/Account/Charge/Fx/index.d.ts +2 -2
- package/dist/cjs/Account/Details.d.ts +254 -3
- package/dist/cjs/Account/History.d.ts +1 -1
- package/dist/cjs/Account/index.d.ts +509 -7
- package/dist/cjs/Acquirer/index.d.ts +1 -1
- package/dist/cjs/Amounts.d.ts +2 -0
- package/dist/cjs/Amounts.js +2 -0
- package/dist/cjs/Amounts.js.map +1 -1
- package/dist/cjs/Card/Changeable.d.ts +1 -1
- package/dist/cjs/Card/Creatable.d.ts +2 -2
- package/dist/cjs/Card/Expiry.d.ts +1 -1
- package/dist/cjs/Card/Meta.d.ts +1 -1
- package/dist/cjs/Card/Operation/Authorization.d.ts +1 -1
- package/dist/cjs/Card/Operation/Card.d.ts +2 -2
- package/dist/cjs/Card/Operation/index.d.ts +3 -3
- package/dist/cjs/Card/index.d.ts +6 -6
- package/dist/cjs/Identifier.d.ts +1 -1
- package/dist/cjs/Log/index.d.ts +1 -1
- package/dist/cjs/Merchant/Category.d.ts +2 -0
- package/dist/cjs/Merchant/Category.js +2 -0
- package/dist/cjs/Merchant/Category.js.map +1 -1
- package/dist/cjs/Merchant/index.d.ts +252 -1
- package/dist/cjs/Merchant/index.js +2 -1
- package/dist/cjs/Merchant/index.js.map +1 -1
- package/dist/cjs/Operation/index.d.ts +1 -1
- package/dist/cjs/Rail/Address/Card.d.ts +254 -3
- package/dist/cjs/Rail/Address/index.d.ts +254 -3
- package/dist/cjs/Settlement/Amount.d.ts +2 -0
- package/dist/cjs/Settlement/Amount.js +5 -0
- package/dist/cjs/Settlement/Amount.js.map +1 -1
- package/dist/cjs/Settlement/Batch.d.ts +2 -0
- package/dist/cjs/Settlement/Batch.js +2 -0
- package/dist/cjs/Settlement/Batch.js.map +1 -1
- package/dist/cjs/Settlement/Creatable.d.ts +16 -0
- package/dist/cjs/Settlement/Creatable.js +8 -0
- package/dist/cjs/Settlement/Creatable.js.map +1 -1
- package/dist/cjs/Settlement/Entry/Creatable.d.ts +832 -0
- package/dist/cjs/Settlement/Entry/Creatable.js +24 -0
- package/dist/cjs/Settlement/Entry/Creatable.js.map +1 -1
- package/dist/cjs/Settlement/Entry/Failed.d.ts +6 -0
- package/dist/cjs/Settlement/Entry/Failed.js +6 -0
- package/dist/cjs/Settlement/Entry/Failed.js.map +1 -1
- package/dist/cjs/Settlement/Entry/Succeeded.d.ts +2 -0
- package/dist/cjs/Settlement/Entry/Succeeded.js +12 -0
- package/dist/cjs/Settlement/Entry/Succeeded.js.map +1 -1
- package/dist/cjs/Settlement/Entry/Summary.d.ts +2 -0
- package/dist/cjs/Settlement/Entry/Summary.js +5 -0
- package/dist/cjs/Settlement/Entry/Summary.js.map +1 -1
- package/dist/cjs/Settlement/Entry/index.d.ts +1 -0
- package/dist/cjs/Settlement/Entry/index.js +1 -0
- package/dist/cjs/Settlement/Entry/index.js.map +1 -1
- package/dist/cjs/Settlement/Entry/type.d.ts +2 -0
- package/dist/cjs/Settlement/Entry/type.js +3 -1
- package/dist/cjs/Settlement/Entry/type.js.map +1 -1
- package/dist/cjs/Settlement/Fee.d.ts +2 -0
- package/dist/cjs/Settlement/Fee.js +2 -0
- package/dist/cjs/Settlement/Fee.js.map +1 -1
- package/dist/cjs/Settlement/Identifier.d.ts +2 -0
- package/dist/cjs/Settlement/Identifier.js +2 -0
- package/dist/cjs/Settlement/Identifier.js.map +1 -1
- package/dist/cjs/Settlement/Status.d.ts +2 -0
- package/dist/cjs/Settlement/Status.js +5 -0
- package/dist/cjs/Settlement/Status.js.map +1 -1
- package/dist/cjs/Settlement/Total.d.ts +5 -0
- package/dist/cjs/Settlement/Total.js +20 -0
- package/dist/cjs/Settlement/Total.js.map +1 -1
- package/dist/cjs/Settlement/Totals.d.ts +2 -0
- package/dist/cjs/Settlement/Totals.js +2 -0
- package/dist/cjs/Settlement/Totals.js.map +1 -1
- package/dist/cjs/Settlement/index.d.ts +5 -2
- package/dist/cjs/Settlement/index.js +11 -1
- package/dist/cjs/Settlement/index.js.map +1 -1
- package/dist/cjs/Transaction/Creatable.d.ts +507 -5
- package/dist/cjs/Transaction/Identifier.d.ts +1 -1
- package/dist/cjs/Transaction/Note.d.ts +1 -1
- package/dist/cjs/Transaction/PreTransaction/Authorization.d.ts +253 -2
- package/dist/cjs/Transaction/PreTransaction/Base.d.ts +254 -3
- package/dist/cjs/Transaction/PreTransaction/Incoming.d.ts +508 -6
- package/dist/cjs/Transaction/PreTransaction/Outgoing.d.ts +254 -3
- package/dist/cjs/Transaction/PreTransaction/index.d.ts +1015 -11
- package/dist/cjs/Transaction/index.d.ts +1805 -48
- package/dist/cjs/Warning/Base.d.ts +11 -0
- package/dist/cjs/Warning/Base.js +11 -0
- package/dist/cjs/Warning/Base.js.map +1 -1
- package/dist/cjs/Warning/Issue.d.ts +3 -0
- package/dist/cjs/Warning/Issue.js +11 -0
- package/dist/cjs/Warning/Issue.js.map +1 -1
- package/dist/cjs/Warning/Settlement/MissingFile.d.ts +2 -0
- package/dist/cjs/Warning/Settlement/MissingFile.js +7 -0
- package/dist/cjs/Warning/Settlement/MissingFile.js.map +1 -1
- package/dist/cjs/Warning/Settlement/NegativeAmount.d.ts +2 -0
- package/dist/cjs/Warning/Settlement/NegativeAmount.js +7 -0
- package/dist/cjs/Warning/Settlement/NegativeAmount.js.map +1 -1
- package/dist/cjs/Warning/Settlement/UnknownEntry.d.ts +2 -0
- package/dist/cjs/Warning/Settlement/UnknownEntry.js +7 -0
- package/dist/cjs/Warning/Settlement/UnknownEntry.js.map +1 -1
- package/dist/cjs/Warning/Settlement/index.d.ts +2 -0
- package/dist/cjs/Warning/Settlement/index.js +6 -0
- package/dist/cjs/Warning/Settlement/index.js.map +1 -1
- package/dist/cjs/policy/Mcc/Action.d.ts +2 -0
- package/dist/cjs/policy/Mcc/Action.js +2 -0
- package/dist/cjs/policy/Mcc/Action.js.map +1 -1
- package/dist/cjs/policy/Mcc/Creatable.d.ts +17 -0
- package/dist/cjs/policy/Mcc/Creatable.js +9 -0
- package/dist/cjs/policy/Mcc/Creatable.js.map +1 -1
- package/dist/cjs/policy/Mcc/Group.d.ts +3 -0
- package/dist/cjs/policy/Mcc/Group.js +9 -0
- package/dist/cjs/policy/Mcc/Group.js.map +1 -1
- package/dist/cjs/policy/Mcc/Updatable.d.ts +2 -0
- package/dist/cjs/policy/Mcc/Updatable.js +2 -0
- package/dist/cjs/policy/Mcc/Updatable.js.map +1 -1
- package/dist/cjs/policy/Mcc/index.d.ts +2 -0
- package/dist/cjs/policy/Mcc/index.js +7 -0
- package/dist/cjs/policy/Mcc/index.js.map +1 -1
- package/dist/mjs/Account/Charge/Fx/index.d.ts +2 -2
- package/dist/mjs/Account/Details.d.ts +254 -3
- package/dist/mjs/Account/History.d.ts +1 -1
- package/dist/mjs/Account/index.d.ts +509 -7
- package/dist/mjs/Acquirer/index.d.ts +1 -1
- package/dist/mjs/Amounts.d.ts +2 -0
- package/dist/mjs/Amounts.js +2 -0
- package/dist/mjs/Amounts.js.map +1 -1
- package/dist/mjs/Card/Changeable.d.ts +1 -1
- package/dist/mjs/Card/Creatable.d.ts +2 -2
- package/dist/mjs/Card/Expiry.d.ts +1 -1
- package/dist/mjs/Card/Meta.d.ts +1 -1
- package/dist/mjs/Card/Operation/Authorization.d.ts +1 -1
- package/dist/mjs/Card/Operation/Card.d.ts +2 -2
- package/dist/mjs/Card/Operation/index.d.ts +3 -3
- package/dist/mjs/Card/index.d.ts +6 -6
- package/dist/mjs/Identifier.d.ts +1 -1
- package/dist/mjs/Log/index.d.ts +1 -1
- package/dist/mjs/Merchant/Category.d.ts +2 -0
- package/dist/mjs/Merchant/Category.js +2 -0
- package/dist/mjs/Merchant/Category.js.map +1 -1
- package/dist/mjs/Merchant/index.d.ts +252 -1
- package/dist/mjs/Merchant/index.js +2 -1
- package/dist/mjs/Merchant/index.js.map +1 -1
- package/dist/mjs/Operation/index.d.ts +1 -1
- package/dist/mjs/Rail/Address/Card.d.ts +254 -3
- package/dist/mjs/Rail/Address/index.d.ts +254 -3
- package/dist/mjs/Settlement/Amount.d.ts +2 -0
- package/dist/mjs/Settlement/Amount.js +5 -0
- package/dist/mjs/Settlement/Amount.js.map +1 -1
- package/dist/mjs/Settlement/Batch.d.ts +2 -0
- package/dist/mjs/Settlement/Batch.js +2 -0
- package/dist/mjs/Settlement/Batch.js.map +1 -1
- package/dist/mjs/Settlement/Creatable.d.ts +16 -0
- package/dist/mjs/Settlement/Creatable.js +8 -0
- package/dist/mjs/Settlement/Creatable.js.map +1 -1
- package/dist/mjs/Settlement/Entry/Creatable.d.ts +832 -0
- package/dist/mjs/Settlement/Entry/Creatable.js +24 -0
- package/dist/mjs/Settlement/Entry/Creatable.js.map +1 -1
- package/dist/mjs/Settlement/Entry/Failed.d.ts +6 -0
- package/dist/mjs/Settlement/Entry/Failed.js +6 -0
- package/dist/mjs/Settlement/Entry/Failed.js.map +1 -1
- package/dist/mjs/Settlement/Entry/Succeeded.d.ts +2 -0
- package/dist/mjs/Settlement/Entry/Succeeded.js +12 -0
- package/dist/mjs/Settlement/Entry/Succeeded.js.map +1 -1
- package/dist/mjs/Settlement/Entry/Summary.d.ts +2 -0
- package/dist/mjs/Settlement/Entry/Summary.js +5 -0
- package/dist/mjs/Settlement/Entry/Summary.js.map +1 -1
- package/dist/mjs/Settlement/Entry/index.d.ts +1 -0
- package/dist/mjs/Settlement/Entry/index.js +2 -1
- package/dist/mjs/Settlement/Entry/index.js.map +1 -1
- package/dist/mjs/Settlement/Entry/type.d.ts +2 -0
- package/dist/mjs/Settlement/Entry/type.js +2 -0
- package/dist/mjs/Settlement/Entry/type.js.map +1 -1
- package/dist/mjs/Settlement/Fee.d.ts +2 -0
- package/dist/mjs/Settlement/Fee.js +2 -0
- package/dist/mjs/Settlement/Fee.js.map +1 -1
- package/dist/mjs/Settlement/Identifier.d.ts +2 -0
- package/dist/mjs/Settlement/Identifier.js +2 -0
- package/dist/mjs/Settlement/Identifier.js.map +1 -1
- package/dist/mjs/Settlement/Status.d.ts +2 -0
- package/dist/mjs/Settlement/Status.js +5 -0
- package/dist/mjs/Settlement/Status.js.map +1 -1
- package/dist/mjs/Settlement/Total.d.ts +5 -0
- package/dist/mjs/Settlement/Total.js +20 -0
- package/dist/mjs/Settlement/Total.js.map +1 -1
- package/dist/mjs/Settlement/Totals.d.ts +2 -0
- package/dist/mjs/Settlement/Totals.js +2 -0
- package/dist/mjs/Settlement/Totals.js.map +1 -1
- package/dist/mjs/Settlement/index.d.ts +5 -2
- package/dist/mjs/Settlement/index.js +12 -2
- package/dist/mjs/Settlement/index.js.map +1 -1
- package/dist/mjs/Transaction/Creatable.d.ts +507 -5
- package/dist/mjs/Transaction/Identifier.d.ts +1 -1
- package/dist/mjs/Transaction/Note.d.ts +1 -1
- package/dist/mjs/Transaction/PreTransaction/Authorization.d.ts +253 -2
- package/dist/mjs/Transaction/PreTransaction/Base.d.ts +254 -3
- package/dist/mjs/Transaction/PreTransaction/Incoming.d.ts +508 -6
- package/dist/mjs/Transaction/PreTransaction/Outgoing.d.ts +254 -3
- package/dist/mjs/Transaction/PreTransaction/index.d.ts +1015 -11
- package/dist/mjs/Transaction/index.d.ts +1805 -48
- package/dist/mjs/Warning/Base.d.ts +11 -0
- package/dist/mjs/Warning/Base.js +11 -0
- package/dist/mjs/Warning/Base.js.map +1 -1
- package/dist/mjs/Warning/Issue.d.ts +3 -0
- package/dist/mjs/Warning/Issue.js +11 -0
- package/dist/mjs/Warning/Issue.js.map +1 -1
- package/dist/mjs/Warning/Settlement/MissingFile.d.ts +2 -0
- package/dist/mjs/Warning/Settlement/MissingFile.js +7 -0
- package/dist/mjs/Warning/Settlement/MissingFile.js.map +1 -1
- package/dist/mjs/Warning/Settlement/NegativeAmount.d.ts +2 -0
- package/dist/mjs/Warning/Settlement/NegativeAmount.js +7 -0
- package/dist/mjs/Warning/Settlement/NegativeAmount.js.map +1 -1
- package/dist/mjs/Warning/Settlement/UnknownEntry.d.ts +2 -0
- package/dist/mjs/Warning/Settlement/UnknownEntry.js +7 -0
- package/dist/mjs/Warning/Settlement/UnknownEntry.js.map +1 -1
- package/dist/mjs/Warning/Settlement/index.d.ts +2 -0
- package/dist/mjs/Warning/Settlement/index.js +6 -0
- package/dist/mjs/Warning/Settlement/index.js.map +1 -1
- package/dist/mjs/policy/Mcc/Action.d.ts +2 -0
- package/dist/mjs/policy/Mcc/Action.js +2 -0
- package/dist/mjs/policy/Mcc/Action.js.map +1 -1
- package/dist/mjs/policy/Mcc/Creatable.d.ts +17 -0
- package/dist/mjs/policy/Mcc/Creatable.js +9 -0
- package/dist/mjs/policy/Mcc/Creatable.js.map +1 -1
- package/dist/mjs/policy/Mcc/Group.d.ts +3 -0
- package/dist/mjs/policy/Mcc/Group.js +9 -0
- package/dist/mjs/policy/Mcc/Group.js.map +1 -1
- package/dist/mjs/policy/Mcc/Updatable.d.ts +2 -0
- package/dist/mjs/policy/Mcc/Updatable.js +2 -0
- package/dist/mjs/policy/Mcc/Updatable.js.map +1 -1
- package/dist/mjs/policy/Mcc/index.d.ts +2 -0
- package/dist/mjs/policy/Mcc/index.js +7 -0
- package/dist/mjs/policy/Mcc/index.js.map +1 -1
- package/package.json +2 -2
- package/policy/Mcc/Action.ts +2 -0
- package/policy/Mcc/Creatable.ts +9 -0
- package/policy/Mcc/Group.ts +9 -0
- package/policy/Mcc/Updatable.ts +2 -0
- package/policy/Mcc/index.ts +7 -0
package/Amounts.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 Amounts = Partial<Record<isoly.Currency, number>>
|
|
5
6
|
|
|
@@ -19,4 +20,5 @@ export namespace Amounts {
|
|
|
19
20
|
)
|
|
20
21
|
}
|
|
21
22
|
export const type = isly.record<Amounts>(isly.string(isoly.Currency.values), isly.number())
|
|
23
|
+
export const typeZod: zod.ZodType<Amounts> = zod.partialRecord(zod.enum(isoly.Currency.values), zod.number())
|
|
22
24
|
}
|
package/Merchant/Category.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isly } from "isly"
|
|
2
|
+
import { zod } from "../zod"
|
|
2
3
|
|
|
3
4
|
export type Category = string
|
|
4
5
|
|
|
@@ -7,4 +8,5 @@ export namespace Category {
|
|
|
7
8
|
"Merchant.Category",
|
|
8
9
|
(value: any): value is Category => typeof value === "string" && /^\d{4}$/.test(value)
|
|
9
10
|
)
|
|
11
|
+
export const typeZod: zod.ZodType<Category> = zod.string().regex(/^\d{4}$/)
|
|
10
12
|
}
|
package/Merchant/index.ts
CHANGED
package/Settlement/Amount.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 Amount = {
|
|
5
6
|
net: number
|
|
@@ -12,6 +13,10 @@ export namespace Amount {
|
|
|
12
13
|
net: isly.number(),
|
|
13
14
|
fee: isly.object<Amount["fee"]>({ other: isly.number() }),
|
|
14
15
|
})
|
|
16
|
+
export const typeZod: zod.ZodType<Amount> = zod.object({
|
|
17
|
+
net: zod.number(),
|
|
18
|
+
fee: zod.object({ other: zod.number() }),
|
|
19
|
+
})
|
|
15
20
|
export function sum(currency: isoly.Currency, amount: Amount | undefined): number {
|
|
16
21
|
return isoly.Currency.add(currency, amount?.net ?? 0, amount?.fee.other ?? 0)
|
|
17
22
|
}
|
package/Settlement/Batch.ts
CHANGED
package/Settlement/Creatable.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isly } from "isly"
|
|
2
2
|
import { Card } from "../Card"
|
|
3
|
+
import { zod } from "../zod"
|
|
3
4
|
import { Batch } from "./Batch"
|
|
4
5
|
import { Totals } from "./Totals"
|
|
5
6
|
|
|
@@ -19,4 +20,11 @@ export namespace Creatable {
|
|
|
19
20
|
batch: Batch.type,
|
|
20
21
|
count: isly.number().optional(),
|
|
21
22
|
})
|
|
23
|
+
export const typeZod = zod.object({
|
|
24
|
+
totals: Totals.typeZod,
|
|
25
|
+
processor: Card.Stack.typeZod,
|
|
26
|
+
references: zod.array(zod.string()).optional(),
|
|
27
|
+
batch: Batch.typeZod,
|
|
28
|
+
count: zod.number().optional(),
|
|
29
|
+
}) satisfies zod.ZodType<Creatable>
|
|
22
30
|
}
|
|
@@ -3,6 +3,7 @@ import { Acquirer } from "../../Acquirer"
|
|
|
3
3
|
import { Amount } from "../../Amount"
|
|
4
4
|
import { Merchant } from "../../Merchant"
|
|
5
5
|
import { Exchange } from "../../Transaction/Exchange"
|
|
6
|
+
import { zod } from "../../zod"
|
|
6
7
|
import { Batch } from "../Batch"
|
|
7
8
|
import { Fee } from "../Fee"
|
|
8
9
|
import { Identifier as SettlementIdentifier } from "../Identifier"
|
|
@@ -40,23 +41,41 @@ export namespace Creatable {
|
|
|
40
41
|
settlement: SettlementIdentifier.type,
|
|
41
42
|
exchange: Exchange.type.optional(),
|
|
42
43
|
})
|
|
44
|
+
export const typeZod = zod.object({
|
|
45
|
+
card: zod.string(),
|
|
46
|
+
transaction: zod.string().optional(),
|
|
47
|
+
transactionReference: zod.string().optional(),
|
|
48
|
+
account: zod.string(),
|
|
49
|
+
approvalCode: zod.string(),
|
|
50
|
+
merchant: Merchant.typeZod,
|
|
51
|
+
acquirer: Acquirer.typeZod,
|
|
52
|
+
reference: zod.string(),
|
|
53
|
+
batch: Batch.typeZod,
|
|
54
|
+
fee: Fee.typeZod,
|
|
55
|
+
amount: Amount.typeZod,
|
|
56
|
+
settlement: SettlementIdentifier.typeZod,
|
|
57
|
+
exchange: Exchange.typeZod.optional(),
|
|
58
|
+
})
|
|
43
59
|
}
|
|
44
60
|
export interface Capture extends Base {
|
|
45
61
|
type: "capture"
|
|
46
62
|
}
|
|
47
63
|
export namespace Capture {
|
|
48
64
|
export const type = Base.type.extend<Capture>({ type: isly.string("capture") })
|
|
65
|
+
export const typeZod: zod.ZodType<Capture> = Base.typeZod.extend({ type: zod.literal("capture") })
|
|
49
66
|
}
|
|
50
67
|
export interface Refund extends Base {
|
|
51
68
|
type: "refund"
|
|
52
69
|
}
|
|
53
70
|
export namespace Refund {
|
|
54
71
|
export const type = Base.type.extend<Refund>({ type: isly.string("refund") })
|
|
72
|
+
export const typeZod: zod.ZodType<Refund> = Base.typeZod.extend({ type: zod.literal("refund") })
|
|
55
73
|
}
|
|
56
74
|
export type Known = Capture | Refund
|
|
57
75
|
|
|
58
76
|
export namespace Known {
|
|
59
77
|
export const type = isly.union(Capture.type, Refund.type)
|
|
78
|
+
export const typeZod: zod.ZodType<Known> = zod.union([Capture.typeZod, Refund.typeZod])
|
|
60
79
|
}
|
|
61
80
|
export interface Unknown extends Partial<Base> {
|
|
62
81
|
type: "unknown"
|
|
@@ -70,6 +89,11 @@ export namespace Creatable {
|
|
|
70
89
|
type: isly.string("unknown"),
|
|
71
90
|
data: isly.record<Record<string, unknown>>(isly.string(), isly.any()),
|
|
72
91
|
})
|
|
92
|
+
export const typeZod: zod.ZodType<Unknown> = Base.typeZod.partial().extend({
|
|
93
|
+
type: zod.literal("unknown"),
|
|
94
|
+
data: zod.record(zod.string(), zod.any()),
|
|
95
|
+
})
|
|
73
96
|
}
|
|
74
97
|
export const type = isly.union(Known.type, Unknown.type)
|
|
98
|
+
export const typeZod: zod.ZodType<Creatable> = zod.union([Known.typeZod, Unknown.typeZod])
|
|
75
99
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isoly } from "isoly"
|
|
2
2
|
import { isly } from "isly"
|
|
3
|
+
import { zod } from "../../zod"
|
|
3
4
|
import { Creatable } from "./Creatable"
|
|
4
5
|
|
|
5
6
|
export type Failed = Creatable & {
|
|
@@ -24,4 +25,12 @@ export namespace Failed {
|
|
|
24
25
|
created: isly.fromIs("isoly.DateTime", isoly.DateTime.is),
|
|
25
26
|
})
|
|
26
27
|
)
|
|
28
|
+
export const typeZod = zod.intersection(
|
|
29
|
+
Creatable.typeZod,
|
|
30
|
+
zod.object({
|
|
31
|
+
status: zod.literal("failed"),
|
|
32
|
+
reason: zod.string(),
|
|
33
|
+
created: zod.string().refine(isoly.DateTime.is),
|
|
34
|
+
})
|
|
35
|
+
)
|
|
27
36
|
}
|
|
@@ -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 { Creatable } from "./Creatable"
|
|
5
6
|
|
|
6
7
|
export interface Succeeded extends Omit<Creatable.Known, "transaction" | "card"> {
|
|
@@ -23,4 +24,15 @@ export namespace Succeeded {
|
|
|
23
24
|
}),
|
|
24
25
|
created: isly.fromIs("isoly.DateTime", isoly.DateTime.is),
|
|
25
26
|
})
|
|
27
|
+
export const typeZod: zod.ZodType<Succeeded> = Creatable.Base.typeZod.omit({ card: true, transaction: true }).extend({
|
|
28
|
+
type: zod.enum(["capture", "refund"]),
|
|
29
|
+
status: zod.literal("succeeded"),
|
|
30
|
+
card: Rail.Address.Card.typeZod,
|
|
31
|
+
transaction: zod.object({
|
|
32
|
+
id: zod.string(),
|
|
33
|
+
posted: zod.string().refine(isoly.DateTime.is),
|
|
34
|
+
description: zod.string(),
|
|
35
|
+
}),
|
|
36
|
+
created: zod.string().refine(isoly.DateTime.is),
|
|
37
|
+
})
|
|
26
38
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isly } from "isly"
|
|
2
|
+
import { zod } from "../../zod"
|
|
2
3
|
|
|
3
4
|
export interface Summary {
|
|
4
5
|
count: number
|
|
@@ -10,4 +11,8 @@ export namespace Summary {
|
|
|
10
11
|
count: isly.number(),
|
|
11
12
|
failed: isly.object<{ count: number }>({ count: isly.number() }).optional(),
|
|
12
13
|
})
|
|
14
|
+
export const typeZod: zod.ZodType<Summary> = zod.object({
|
|
15
|
+
count: zod.number(),
|
|
16
|
+
failed: zod.object({ count: zod.number() }).optional(),
|
|
17
|
+
})
|
|
13
18
|
}
|
|
@@ -8,7 +8,7 @@ import { Failed as EntryFailed } from "./Failed"
|
|
|
8
8
|
import { fromCreatable } from "./fromCreatable"
|
|
9
9
|
import { Succeeded as EntrySucceeded } from "./Succeeded"
|
|
10
10
|
import { Summary as EntrySummary } from "./Summary"
|
|
11
|
-
import { type as entryType } from "./type"
|
|
11
|
+
import { type as entryType, typeZod as entryTypeZod } from "./type"
|
|
12
12
|
|
|
13
13
|
export type Entry = EntrySucceeded | EntryFailed
|
|
14
14
|
export namespace Entry {
|
|
@@ -23,6 +23,7 @@ export namespace Entry {
|
|
|
23
23
|
export import Succeeded = EntrySucceeded
|
|
24
24
|
export import Summary = EntrySummary
|
|
25
25
|
export const type = entryType
|
|
26
|
+
export const typeZod = entryTypeZod
|
|
26
27
|
export const from = fromCreatable
|
|
27
28
|
export function charge(
|
|
28
29
|
counterpart: Rail.Address.Card.Counterpart,
|
package/Settlement/Entry/type.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { isly } from "isly"
|
|
2
|
+
import { zod } from "../../zod"
|
|
2
3
|
import type { Entry } from "."
|
|
3
4
|
import { Failed } from "./Failed"
|
|
4
5
|
import { Succeeded } from "./Succeeded"
|
|
5
6
|
|
|
6
7
|
export const type = isly.union<Entry, Succeeded, Failed>(Succeeded.type, Failed.type)
|
|
8
|
+
export const typeZod: zod.ZodType<Entry> = zod.union([Succeeded.typeZod, Failed.typeZod])
|
package/Settlement/Fee.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isly } from "isly"
|
|
2
2
|
import { Amounts } from "../Amounts"
|
|
3
|
+
import { zod } from "../zod"
|
|
3
4
|
|
|
4
5
|
export interface Fee {
|
|
5
6
|
other: Amounts
|
|
@@ -9,4 +10,5 @@ export namespace Fee {
|
|
|
9
10
|
return { other: Amounts.add(addendee.other, addend.other) }
|
|
10
11
|
}
|
|
11
12
|
export const type = isly.object<Fee>({ other: Amounts.type })
|
|
13
|
+
export const typeZod: zod.ZodType<Fee> = zod.object({ other: Amounts.typeZod })
|
|
12
14
|
}
|
package/Settlement/Identifier.ts
CHANGED
|
@@ -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
|
//(date without dashes)(stack.Character)(single digit number representing batch)
|
|
6
7
|
//20200102a3
|
|
@@ -16,6 +17,7 @@ export namespace Identifier {
|
|
|
16
17
|
return Card.Stack.Character.toStack(getCharacter(identifier))
|
|
17
18
|
}
|
|
18
19
|
export const type = isly.string()
|
|
20
|
+
export const typeZod: zod.ZodType<Identifier> = zod.string()
|
|
19
21
|
export function create(date: isoly.Date, stack: Card.Stack, order: number): Identifier {
|
|
20
22
|
return date.replace(/-/g, "") + Card.Stack.Character.from(stack) + order
|
|
21
23
|
}
|
package/Settlement/Status.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isly } from "isly"
|
|
2
|
+
import { zod } from "../zod"
|
|
2
3
|
|
|
3
4
|
export interface Status {
|
|
4
5
|
collected: Status.Values
|
|
@@ -12,4 +13,8 @@ export namespace Status {
|
|
|
12
13
|
collected: isly.string(values),
|
|
13
14
|
settled: isly.string(values),
|
|
14
15
|
})
|
|
16
|
+
export const typeZod: zod.ZodType<Status> = zod.object({
|
|
17
|
+
collected: zod.enum(values),
|
|
18
|
+
settled: zod.enum(values),
|
|
19
|
+
})
|
|
15
20
|
}
|
package/Settlement/Total.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isoly } from "isoly"
|
|
2
2
|
import { isly } from "isly"
|
|
3
3
|
import { Supplier } from "../Supplier"
|
|
4
|
+
import { zod } from "../zod"
|
|
4
5
|
import { Amount } from "./Amount"
|
|
5
6
|
|
|
6
7
|
export interface Total {
|
|
@@ -19,8 +20,16 @@ export namespace Total {
|
|
|
19
20
|
fee: isly.string().optional(),
|
|
20
21
|
supplier: Supplier.type.optional(),
|
|
21
22
|
})
|
|
23
|
+
export const typeZod: zod.ZodType<Transaction> = zod.object({
|
|
24
|
+
net: zod.string(),
|
|
25
|
+
fee: zod.string().optional(),
|
|
26
|
+
supplier: Supplier.typeZod.optional(),
|
|
27
|
+
})
|
|
22
28
|
}
|
|
23
29
|
export const type = isly.object<Collected>({ transactions: isly.union(Transaction.type, Transaction.type.array()) })
|
|
30
|
+
export const typeZod: zod.ZodType<Collected> = zod.object({
|
|
31
|
+
transactions: zod.union([Transaction.typeZod, zod.array(Transaction.typeZod)]),
|
|
32
|
+
})
|
|
24
33
|
}
|
|
25
34
|
export type Settled = { net: number; transactions: string[]; fee?: string }
|
|
26
35
|
export const Settled = isly.object<Settled>({
|
|
@@ -28,12 +37,23 @@ export namespace Total {
|
|
|
28
37
|
transactions: isly.string().array(),
|
|
29
38
|
fee: isly.string().optional(),
|
|
30
39
|
})
|
|
40
|
+
export const SettledZod: zod.ZodType<Settled> = zod.object({
|
|
41
|
+
net: zod.number(),
|
|
42
|
+
transactions: zod.array(zod.string()),
|
|
43
|
+
fee: zod.string().optional(),
|
|
44
|
+
})
|
|
31
45
|
export const type = isly.object<Total>({
|
|
32
46
|
expected: Amount.type,
|
|
33
47
|
outcome: Amount.type.optional(),
|
|
34
48
|
collected: Collected.type.optional(),
|
|
35
49
|
settled: Settled.optional(),
|
|
36
50
|
})
|
|
51
|
+
export const typeZod: zod.ZodType<Total> = zod.object({
|
|
52
|
+
expected: Amount.typeZod,
|
|
53
|
+
outcome: Amount.typeZod.optional(),
|
|
54
|
+
collected: Collected.typeZod.optional(),
|
|
55
|
+
settled: SettledZod.optional(),
|
|
56
|
+
})
|
|
37
57
|
export function create(): Total {
|
|
38
58
|
return { expected: { net: 0, fee: { other: 0 } } }
|
|
39
59
|
}
|
package/Settlement/Totals.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { isoly } from "isoly"
|
|
2
2
|
import { isly } from "isly"
|
|
3
|
+
import { zod } from "../zod"
|
|
3
4
|
import { Entry } from "./Entry"
|
|
4
5
|
import { Total } from "./Total"
|
|
5
6
|
|
|
6
7
|
export type Totals = Partial<Record<isoly.Currency, Total>>
|
|
7
8
|
export namespace Totals {
|
|
8
9
|
export const type = isly.record<isoly.Currency, Total>(isly.string(isoly.Currency.values), Total.type)
|
|
10
|
+
export const typeZod: zod.ZodType<Totals> = zod.partialRecord(zod.enum(isoly.Currency.values), Total.typeZod)
|
|
9
11
|
export function addEntry(totals: Totals, entry: Entry): Totals {
|
|
10
12
|
const result = { ...totals }
|
|
11
13
|
if (entry.status == "succeeded" && (entry.type == "capture" || entry.type == "refund")) {
|
package/Settlement/index.ts
CHANGED
|
@@ -2,13 +2,14 @@ import { isoly } from "isoly"
|
|
|
2
2
|
import { isly } from "isly"
|
|
3
3
|
import { Amounts } from "../Amounts"
|
|
4
4
|
import { Settlement as SettlementWarning } from "../Warning/Settlement"
|
|
5
|
+
import { zod } from "../zod"
|
|
5
6
|
import { Amount as SettlementAmount } from "./Amount"
|
|
6
7
|
import { Batch as SettlementBatch } from "./Batch"
|
|
7
8
|
import { Creatable as SettlementCreatable } from "./Creatable"
|
|
8
9
|
import { Entry as SettlementEntry } from "./Entry"
|
|
9
10
|
import { Fee as SettlementFee } from "./Fee"
|
|
10
11
|
import { Identifier as SettlementIdentifier } from "./Identifier"
|
|
11
|
-
import { Status } from "./Status"
|
|
12
|
+
import { Status as SettlementStatus } from "./Status"
|
|
12
13
|
import { Total as SettlementTotal } from "./Total"
|
|
13
14
|
import { Totals as SettlementTotals } from "./Totals"
|
|
14
15
|
|
|
@@ -16,7 +17,7 @@ export interface Settlement extends Settlement.Creatable {
|
|
|
16
17
|
id: SettlementIdentifier | string // string is deprecated and there for legacy reasons
|
|
17
18
|
by?: string
|
|
18
19
|
created: isoly.DateTime
|
|
19
|
-
status:
|
|
20
|
+
status: SettlementStatus
|
|
20
21
|
entries: Settlement.Entry.Summary
|
|
21
22
|
warnings?: Settlement.Warning[]
|
|
22
23
|
}
|
|
@@ -25,6 +26,7 @@ export namespace Settlement {
|
|
|
25
26
|
export import Total = SettlementTotal
|
|
26
27
|
export import Totals = SettlementTotals
|
|
27
28
|
export import Amount = SettlementAmount
|
|
29
|
+
export import Status = SettlementStatus
|
|
28
30
|
export import Fee = SettlementFee
|
|
29
31
|
export import Creatable = SettlementCreatable
|
|
30
32
|
export import Entry = SettlementEntry
|
|
@@ -73,4 +75,12 @@ export namespace Settlement {
|
|
|
73
75
|
entries: Settlement.Entry.Summary.type,
|
|
74
76
|
warnings: Settlement.Warning.type.array().optional(),
|
|
75
77
|
})
|
|
78
|
+
export const typeZod: zod.ZodType<Settlement> = SettlementCreatable.typeZod.extend({
|
|
79
|
+
id: zod.union([SettlementIdentifier.typeZod, zod.string()]),
|
|
80
|
+
by: zod.string().optional(),
|
|
81
|
+
created: zod.string().refine(isoly.DateTime.is),
|
|
82
|
+
status: Status.typeZod,
|
|
83
|
+
entries: Settlement.Entry.Summary.typeZod,
|
|
84
|
+
warnings: zod.array(Settlement.Warning.typeZod).optional(),
|
|
85
|
+
})
|
|
76
86
|
}
|
package/Warning/Base.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 { Issue } from "./Issue"
|
|
4
5
|
|
|
5
6
|
export interface Base {
|
|
@@ -17,6 +18,7 @@ export namespace Base {
|
|
|
17
18
|
export namespace Severity {
|
|
18
19
|
export const values = ["low", "medium", "high"] as const
|
|
19
20
|
export const type = isly.string<Severity>(values)
|
|
21
|
+
export const typeZod: zod.ZodType<Severity> = zod.enum(values)
|
|
20
22
|
}
|
|
21
23
|
export const type = isly.object<Base>({
|
|
22
24
|
type: isly.string(),
|
|
@@ -27,4 +29,13 @@ export namespace Base {
|
|
|
27
29
|
issue: Issue.type.optional(),
|
|
28
30
|
description: isly.string().optional(),
|
|
29
31
|
})
|
|
32
|
+
export const typeZod = zod.object({
|
|
33
|
+
type: zod.string(),
|
|
34
|
+
severity: Severity.typeZod.optional(),
|
|
35
|
+
resource: zod.string(),
|
|
36
|
+
value: zod.number().optional(),
|
|
37
|
+
date: zod.string(),
|
|
38
|
+
issue: Issue.typeZod.optional(),
|
|
39
|
+
description: zod.string().optional(),
|
|
40
|
+
}) satisfies zod.ZodType<Base>
|
|
30
41
|
}
|
package/Warning/Issue.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 Issue {
|
|
5
6
|
link: string
|
|
@@ -10,6 +11,10 @@ export namespace Issue {
|
|
|
10
11
|
link: isly.string(),
|
|
11
12
|
status: isly.string(["closed", "open"]),
|
|
12
13
|
})
|
|
14
|
+
export const typeZod: zod.ZodType<Issue> = zod.object({
|
|
15
|
+
link: zod.string(),
|
|
16
|
+
status: zod.enum(["closed", "open"]),
|
|
17
|
+
})
|
|
13
18
|
export interface Creatable {
|
|
14
19
|
type: string
|
|
15
20
|
currency: isoly.Currency
|
|
@@ -23,5 +28,11 @@ export namespace Issue {
|
|
|
23
28
|
resource: isly.string().optional(),
|
|
24
29
|
issue: Issue.type,
|
|
25
30
|
})
|
|
31
|
+
export const typeZod: zod.ZodType<Creatable> = zod.object({
|
|
32
|
+
type: zod.string(),
|
|
33
|
+
currency: zod.enum(isoly.Currency.values),
|
|
34
|
+
resource: zod.string().optional(),
|
|
35
|
+
issue: Issue.typeZod,
|
|
36
|
+
})
|
|
26
37
|
}
|
|
27
38
|
}
|
|
@@ -2,6 +2,7 @@ import { isoly } from "isoly"
|
|
|
2
2
|
import { isly } from "isly"
|
|
3
3
|
import { Identifier } from "../../Settlement/Identifier"
|
|
4
4
|
import { Totals } from "../../Settlement/Totals"
|
|
5
|
+
import { zod } from "../../zod"
|
|
5
6
|
import { Base } from "../Base"
|
|
6
7
|
|
|
7
8
|
export interface MissingFile extends Base {
|
|
@@ -18,6 +19,12 @@ export namespace MissingFile {
|
|
|
18
19
|
cycle: isly.string().optional(),
|
|
19
20
|
totals: Totals.type.optional(),
|
|
20
21
|
})
|
|
22
|
+
export const typeZod: zod.ZodType<MissingFile> = Base.typeZod.extend({
|
|
23
|
+
type: zod.literal("missing-file"),
|
|
24
|
+
resource: Identifier.typeZod,
|
|
25
|
+
cycle: zod.string().optional(),
|
|
26
|
+
totals: Totals.typeZod.optional(),
|
|
27
|
+
})
|
|
21
28
|
export function create(id: string, cycle: string, date: isoly.Date): MissingFile {
|
|
22
29
|
return {
|
|
23
30
|
type: "missing-file",
|
|
@@ -3,6 +3,7 @@ import { isly } from "isly"
|
|
|
3
3
|
import { typedly } from "typedly"
|
|
4
4
|
import { Identifier } from "../../Settlement/Identifier"
|
|
5
5
|
import { Totals } from "../../Settlement/Totals"
|
|
6
|
+
import { zod } from "../../zod"
|
|
6
7
|
import { Base } from "../Base"
|
|
7
8
|
|
|
8
9
|
export interface NegativeAmount extends Base {
|
|
@@ -19,6 +20,12 @@ export namespace NegativeAmount {
|
|
|
19
20
|
value: isly.number(),
|
|
20
21
|
currency: isly.fromIs("currency", isoly.Currency.is),
|
|
21
22
|
})
|
|
23
|
+
export const typeZod: zod.ZodType<NegativeAmount> = Base.typeZod.extend({
|
|
24
|
+
type: zod.literal("negative-amount"),
|
|
25
|
+
resource: Identifier.typeZod,
|
|
26
|
+
value: zod.number(),
|
|
27
|
+
currency: zod.enum(isoly.Currency.values),
|
|
28
|
+
})
|
|
22
29
|
export function create(resource: Identifier, totals: Totals): NegativeAmount[] {
|
|
23
30
|
const warnings: NegativeAmount[] = []
|
|
24
31
|
typedly.Object.entries(totals).forEach(
|
|
@@ -5,6 +5,7 @@ import { Authorization } from "../../Authorization"
|
|
|
5
5
|
import { Entry } from "../../Settlement/Entry"
|
|
6
6
|
import { Identifier } from "../../Settlement/Identifier"
|
|
7
7
|
import { Transaction } from "../../Transaction"
|
|
8
|
+
import { zod } from "../../zod"
|
|
8
9
|
import { Base } from "../Base"
|
|
9
10
|
|
|
10
11
|
export interface UnknownEntry extends Base {
|
|
@@ -21,6 +22,12 @@ export namespace UnknownEntry {
|
|
|
21
22
|
authorization: isly.fromIs("Authorization.id", cryptly.Identifier.is).optional(),
|
|
22
23
|
transaction: isly.string().optional(),
|
|
23
24
|
})
|
|
25
|
+
export const typeZod: zod.ZodType<UnknownEntry> = Base.typeZod.extend({
|
|
26
|
+
type: zod.literal("unknown-entry"),
|
|
27
|
+
resource: Identifier.typeZod,
|
|
28
|
+
authorization: zod.string().refine(cryptly.Identifier.is).optional(),
|
|
29
|
+
transaction: zod.string().optional(),
|
|
30
|
+
})
|
|
24
31
|
export function create(entry: Extract<Entry.Failed, { type: "unknown" }>, resource: Identifier): UnknownEntry {
|
|
25
32
|
return {
|
|
26
33
|
type: "unknown-entry",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isly } from "isly"
|
|
2
|
+
import { zod } from "../../zod"
|
|
2
3
|
import { MissingFile as MissingFileWarning } from "./MissingFile"
|
|
3
4
|
import { NegativeAmount as NegativeAmountWarning } from "./NegativeAmount"
|
|
4
5
|
import { UnknownEntry as UnknownEntryWarning } from "./UnknownEntry"
|
|
@@ -14,4 +15,9 @@ export namespace Settlement {
|
|
|
14
15
|
MissingFile.type,
|
|
15
16
|
UnknownEntry.type
|
|
16
17
|
)
|
|
18
|
+
export const typeZod: zod.ZodType<Settlement> = zod.union([
|
|
19
|
+
NegativeAmount.typeZod,
|
|
20
|
+
MissingFile.typeZod,
|
|
21
|
+
UnknownEntry.typeZod,
|
|
22
|
+
])
|
|
17
23
|
}
|
|
@@ -24,8 +24,8 @@ export declare namespace Fx {
|
|
|
24
24
|
"test-ta-pg-200": "test-ta-pg-200";
|
|
25
25
|
"test-ta-pg-bc-200": "test-ta-pg-bc-200";
|
|
26
26
|
"test-diners-175": "test-diners-175";
|
|
27
|
-
}> & import("zod/v4/core
|
|
27
|
+
}> & import("zod/v4/core").$partial, import("zod").ZodNumber>, import("zod").ZodObject<{
|
|
28
28
|
default: import("zod").ZodNumber;
|
|
29
|
-
}, import("zod/v4/core
|
|
29
|
+
}, import("zod/v4/core").$strip>>;
|
|
30
30
|
function evaluate(charge: Fx, currency: isoly.Currency, amount: number, preset?: Card.Preset, exchange?: Exchange): Amount.Charge.Fx | undefined;
|
|
31
31
|
}
|