@pax2pay/model-banking 0.1.50 → 0.1.52

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/Realm/index.ts CHANGED
@@ -1,13 +1,17 @@
1
- export const Realms = ["test", "uk", "eu"] as const
1
+ import { isly } from "isly"
2
+
3
+ export const Realms = ["test", "testUK", "uk", "eu"] as const
2
4
  export type Realm = typeof Realms[number]
3
5
 
4
6
  export namespace Realm {
5
7
  export const realms: Realm[] = [...Realms]
6
-
7
- export function is(value: any | Realm): value is Realm {
8
- return value && (value == "test" || value == "uk" || value == "eu")
9
- //return value && realms.includes(value)
10
- }
8
+ export const type: isly.Type<Realm> = isly.union(
9
+ isly.string("test"),
10
+ isly.string("testUK"),
11
+ isly.string("uk"),
12
+ isly.string("eu")
13
+ )
14
+ export const is = type.is
11
15
  export function toString(): string {
12
16
  return realms.toString().replaceAll(",", ", ") + "."
13
17
  }
@@ -0,0 +1,81 @@
1
+ import { gracely } from "gracely"
2
+ import { isoly } from "isoly"
3
+ import { isly } from "isly"
4
+ import { Transaction } from "../Transaction"
5
+
6
+ export type Settlement = Succeeded | Failed
7
+
8
+ export interface Base {
9
+ id: string
10
+ created: [string, isoly.DateTime]
11
+ configuration: string
12
+ status: string
13
+ }
14
+
15
+ export interface Failed extends Base {
16
+ status: "failed"
17
+ }
18
+
19
+ export interface Succeeded extends Base {
20
+ settled?: { user: string; created: isoly.DateTime; transaction: string }
21
+ amount: Record<isoly.Currency, number>
22
+ fee: Record<isoly.Currency, number>
23
+ entries: {
24
+ status: "succeeded" | "failed"
25
+ type: "capture" | "cancel" | "refund"
26
+ account: string
27
+ card: string
28
+ transaction: string
29
+ amount: [isoly.Currency, number]
30
+ fee: [isoly.Currency, number]
31
+ }[]
32
+ status: "succeeded"
33
+ }
34
+
35
+ export namespace Settlement {
36
+ export const type = isly.union<Settlement, Succeeded, Failed>(
37
+ isly.object<Succeeded>({
38
+ id: isly.string(),
39
+ created: isly.tuple(isly.string(), isly.fromIs("Settlement.created", isoly.DateTime.is)),
40
+ configuration: isly.string(),
41
+ settled: isly
42
+ .object<{ user: string; created: isoly.DateTime; transaction: string }>({
43
+ user: isly.string(),
44
+ created: isly.fromIs("Settlement.settled.created", isoly.DateTime.is),
45
+ transaction: isly.string(),
46
+ })
47
+ .optional(),
48
+ amount: isly.record(isly.fromIs("Settlement.entries.amount", isoly.Currency.is), isly.number()),
49
+ fee: isly.record(isly.fromIs("Settlement.entries.fee", isoly.Currency.is), isly.number()),
50
+ entries: isly
51
+ .object<{
52
+ status: "succeeded" | "failed"
53
+ type: "capture" | "cancel" | "refund"
54
+ account: string
55
+ card: string
56
+ transaction: string
57
+ amount: [isoly.Currency, number]
58
+ fee: [isoly.Currency, number]
59
+ }>({
60
+ status: isly.string(),
61
+ type: isly.string(),
62
+ account: isly.string(),
63
+ card: isly.string(),
64
+ transaction: isly.string(),
65
+ amount: isly.tuple(isly.fromIs("Settlement.entries.amount", isoly.Currency.is), isly.number()),
66
+ fee: isly.tuple(isly.fromIs("Settlement.entries.amount", isoly.Currency.is), isly.number()),
67
+ })
68
+ .array(),
69
+ status: isly.string("succeeded"),
70
+ }),
71
+ isly.object<Failed>({
72
+ id: isly.string(),
73
+ created: isly.tuple(isly.string(), isly.fromIs("Settlement.created", isoly.DateTime.is)),
74
+ configuration: isly.string(),
75
+ status: isly.string("failed"),
76
+ })
77
+ )
78
+ export const is = type.is
79
+ export const flaw = type.flaw
80
+ export type Result = (Transaction | (gracely.Error & { id: string }))[]
81
+ }
@@ -1,7 +1,9 @@
1
- export declare const Realms: readonly ["test", "uk", "eu"];
1
+ import { isly } from "isly";
2
+ export declare const Realms: readonly ["test", "testUK", "uk", "eu"];
2
3
  export type Realm = typeof Realms[number];
3
4
  export declare namespace Realm {
4
5
  const realms: Realm[];
5
- function is(value: any | Realm): value is Realm;
6
+ const type: isly.Type<Realm>;
7
+ const is: isly.Type.IsFunction<"eu" | "uk" | "test" | "testUK">;
6
8
  function toString(): string;
7
9
  }
@@ -1,11 +1,10 @@
1
- export const Realms = ["test", "uk", "eu"];
1
+ import { isly } from "isly";
2
+ export const Realms = ["test", "testUK", "uk", "eu"];
2
3
  export var Realm;
3
4
  (function (Realm) {
4
5
  Realm.realms = [...Realms];
5
- function is(value) {
6
- return value && (value == "test" || value == "uk" || value == "eu");
7
- }
8
- Realm.is = is;
6
+ Realm.type = isly.union(isly.string("test"), isly.string("testUK"), isly.string("uk"), isly.string("eu"));
7
+ Realm.is = Realm.type.is;
9
8
  function toString() {
10
9
  return Realm.realms.toString().replaceAll(",", ", ") + ".";
11
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../","sources":["Realm/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAU,CAAA;AAGnD,MAAM,KAAW,KAAK,CAUrB;AAVD,WAAiB,KAAK;IACR,YAAM,GAAY,CAAC,GAAG,MAAM,CAAC,CAAA;IAE1C,SAAgB,EAAE,CAAC,KAAkB;QACpC,OAAO,KAAK,IAAI,CAAC,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,CAAA;IAEpE,CAAC;IAHe,QAAE,KAGjB,CAAA;IACD,SAAgB,QAAQ;QACvB,OAAO,MAAA,MAAM,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,GAAG,CAAA;IACrD,CAAC;IAFe,cAAQ,WAEvB,CAAA;AACF,CAAC,EAVgB,KAAK,KAAL,KAAK,QAUrB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"../","sources":["Realm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAU,CAAA;AAG7D,MAAM,KAAW,KAAK,CAYrB;AAZD,WAAiB,KAAK;IACR,YAAM,GAAY,CAAC,GAAG,MAAM,CAAC,CAAA;IAC7B,UAAI,GAAqB,IAAI,CAAC,KAAK,CAC/C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EACnB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EACrB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CACjB,CAAA;IACY,QAAE,GAAG,MAAA,IAAI,CAAC,EAAE,CAAA;IACzB,SAAgB,QAAQ;QACvB,OAAO,MAAA,MAAM,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,GAAG,CAAA;IACrD,CAAC;IAFe,cAAQ,WAEvB,CAAA;AACF,CAAC,EAZgB,KAAK,KAAL,KAAK,QAYrB"}
@@ -0,0 +1,41 @@
1
+ import { gracely } from "gracely";
2
+ import { isoly } from "isoly";
3
+ import { isly } from "isly";
4
+ import { Transaction } from "../Transaction";
5
+ export type Settlement = Succeeded | Failed;
6
+ export interface Base {
7
+ id: string;
8
+ created: [string, isoly.DateTime];
9
+ configuration: string;
10
+ status: string;
11
+ }
12
+ export interface Failed extends Base {
13
+ status: "failed";
14
+ }
15
+ export interface Succeeded extends Base {
16
+ settled?: {
17
+ user: string;
18
+ created: isoly.DateTime;
19
+ transaction: string;
20
+ };
21
+ amount: Record<isoly.Currency, number>;
22
+ fee: Record<isoly.Currency, number>;
23
+ entries: {
24
+ status: "succeeded" | "failed";
25
+ type: "capture" | "cancel" | "refund";
26
+ account: string;
27
+ card: string;
28
+ transaction: string;
29
+ amount: [isoly.Currency, number];
30
+ fee: [isoly.Currency, number];
31
+ }[];
32
+ status: "succeeded";
33
+ }
34
+ export declare namespace Settlement {
35
+ const type: isly.Type<Settlement>;
36
+ const is: isly.Type.IsFunction<Settlement>;
37
+ const flaw: isly.Type.FlawFunction;
38
+ type Result = (Transaction | (gracely.Error & {
39
+ id: string;
40
+ }))[];
41
+ }
@@ -0,0 +1,39 @@
1
+ import { isoly } from "isoly";
2
+ import { isly } from "isly";
3
+ export var Settlement;
4
+ (function (Settlement) {
5
+ Settlement.type = isly.union(isly.object({
6
+ id: isly.string(),
7
+ created: isly.tuple(isly.string(), isly.fromIs("Settlement.created", isoly.DateTime.is)),
8
+ configuration: isly.string(),
9
+ settled: isly
10
+ .object({
11
+ user: isly.string(),
12
+ created: isly.fromIs("Settlement.settled.created", isoly.DateTime.is),
13
+ transaction: isly.string(),
14
+ })
15
+ .optional(),
16
+ amount: isly.record(isly.fromIs("Settlement.entries.amount", isoly.Currency.is), isly.number()),
17
+ fee: isly.record(isly.fromIs("Settlement.entries.fee", isoly.Currency.is), isly.number()),
18
+ entries: isly
19
+ .object({
20
+ status: isly.string(),
21
+ type: isly.string(),
22
+ account: isly.string(),
23
+ card: isly.string(),
24
+ transaction: isly.string(),
25
+ amount: isly.tuple(isly.fromIs("Settlement.entries.amount", isoly.Currency.is), isly.number()),
26
+ fee: isly.tuple(isly.fromIs("Settlement.entries.amount", isoly.Currency.is), isly.number()),
27
+ })
28
+ .array(),
29
+ status: isly.string("succeeded"),
30
+ }), isly.object({
31
+ id: isly.string(),
32
+ created: isly.tuple(isly.string(), isly.fromIs("Settlement.created", isoly.DateTime.is)),
33
+ configuration: isly.string(),
34
+ status: isly.string("failed"),
35
+ }));
36
+ Settlement.is = Settlement.type.is;
37
+ Settlement.flaw = Settlement.type.flaw;
38
+ })(Settlement || (Settlement = {}));
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../","sources":["Settlement/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAgC3B,MAAM,KAAW,UAAU,CA8C1B;AA9CD,WAAiB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EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;YAC9F,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,2BAA2B,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;SAC3F,CAAC;aACD,KAAK,EAAE;QACT,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;KAChC,CAAC,EACF,IAAI,CAAC,MAAM,CAAS;QACnB,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE;QACjB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACxF,aAAa,EAAE,IAAI,CAAC,MAAM,EAAE;QAC5B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;KAC7B,CAAC,CACF,CAAA;IACY,aAAE,GAAG,WAAA,IAAI,CAAC,EAAE,CAAA;IACZ,eAAI,GAAG,WAAA,IAAI,CAAC,IAAI,CAAA;AAE9B,CAAC,EA9CgB,UAAU,KAAV,UAAU,QA8C1B"}
package/dist/pax2pay.d.ts CHANGED
@@ -10,3 +10,4 @@ export { Client } from "./Client";
10
10
  export { Treasury } from "./Treasury";
11
11
  export { Realm } from "./Realm";
12
12
  export { Supplier } from "./Supplier";
13
+ export { Settlement } from "./Settlement";
package/dist/pax2pay.js CHANGED
@@ -10,4 +10,5 @@ export { Client } from "./Client";
10
10
  export { Treasury } from "./Treasury";
11
11
  export { Realm } from "./Realm";
12
12
  export { Supplier } from "./Supplier";
13
+ export { Settlement } from "./Settlement";
13
14
  //# sourceMappingURL=pax2pay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pax2pay.js","sourceRoot":"../","sources":["pax2pay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pax2pay/model-banking",
3
- "version": "0.1.50",
3
+ "version": "0.1.52",
4
4
  "description": "Library containing data model types and functions for the Pax2Pay Banking API.",
5
5
  "author": "Pax2Pay Ltd",
6
6
  "license": "MIT",
package/pax2pay.ts CHANGED
@@ -10,3 +10,4 @@ export { Client } from "./Client"
10
10
  export { Treasury } from "./Treasury"
11
11
  export { Realm } from "./Realm"
12
12
  export { Supplier } from "./Supplier"
13
+ export { Settlement } from "./Settlement"