@pax2pay/model-banking 0.1.54 → 0.1.56

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/Merchant.ts ADDED
@@ -0,0 +1,21 @@
1
+ import { isoly } from "isoly"
2
+ import { isly } from "isly"
3
+
4
+ export interface Merchant {
5
+ name: string
6
+ id: string
7
+ category: string
8
+ country: isoly.CountryCode.Alpha2
9
+ address: string
10
+ }
11
+ export namespace Merchant {
12
+ export const type = isly.object<Merchant>({
13
+ name: isly.string(),
14
+ id: isly.string(),
15
+ category: isly.string(),
16
+ country: isly.string(),
17
+ address: isly.string(),
18
+ })
19
+ export const is = type.is
20
+ export const flaw = type.flaw
21
+ }
package/Rail/Card.ts ADDED
@@ -0,0 +1,30 @@
1
+ import { isly } from "isly"
2
+ import { Card as ModelCard } from "../Card"
3
+ import { Merchant } from "../Merchant"
4
+
5
+ export interface Card {
6
+ type: Card.Type
7
+ id: string
8
+ iin: string
9
+ last4: string
10
+ expiry: ModelCard.Expiry
11
+ holder: string
12
+ merchant: Merchant
13
+ }
14
+ export namespace Card {
15
+ export const currencies = ["EUR", "GBP", "SEK", "USD"] as const
16
+ type Mastercard = "mastercard"
17
+ type Visa = "visa"
18
+ export type Type = Mastercard | Visa
19
+ export const type = isly.object<Card>({
20
+ type: isly.union<Type, Mastercard, Visa>(isly.string("mastercard"), isly.string("visa")),
21
+ id: isly.string(),
22
+ iin: isly.string(),
23
+ last4: isly.string(),
24
+ expiry: ModelCard.Expiry.type,
25
+ holder: isly.string(),
26
+ merchant: Merchant.type,
27
+ })
28
+ export const is = type.is
29
+ export const flaw = type.flaw
30
+ }
package/Rail/Type.ts CHANGED
@@ -1 +1 @@
1
- export type Type = "paxgiro" | "internal" | "iban" | "scan" | "visa" | "mastercard" //| "swedish" |
1
+ export type Type = "paxgiro" | "internal" | "iban" | "scan" | "card" //| "swedish" |
package/Rail/index.ts CHANGED
@@ -1,12 +1,11 @@
1
+ import { Card as RailCard } from "./Card"
1
2
  import { Iban as RailIban } from "./Iban"
2
3
  import { Internal as RailInternal } from "./internal"
3
- import { Mastercard as RailMastercard } from "./Mastercard"
4
4
  import { PaxGiro as RailPaxGiro } from "./PaxGiro"
5
5
  import { Scan as RailScan } from "./Scan"
6
6
  import { Type as RailType } from "./Type"
7
- import { Visa as RailVisa } from "./Visa"
8
7
 
9
- export type Rail = (RailPaxGiro | RailInternal | RailIban | RailScan | RailMastercard | RailVisa) & {
8
+ export type Rail = (RailPaxGiro | RailInternal | RailIban | RailScan | RailCard) & {
10
9
  reference?: { supplier: string; value: string }
11
10
  }
12
11
 
@@ -46,10 +45,8 @@ export namespace Rail {
46
45
  result = `scan-${rail.sort}-${rail.account}`
47
46
  break
48
47
  case "visa":
49
- result = `visa-${rail.id}`
50
- break
51
48
  case "mastercard":
52
- result = `mastercard-${rail.id}`
49
+ result = `${rail.type}-${rail.id}`
53
50
  break
54
51
  //case "swedish":
55
52
  // result = `swe-${rail.clearing}-${rail.account}`
@@ -73,10 +70,8 @@ export namespace Rail {
73
70
  result = `${rail.sort} ${rail.account}`
74
71
  break
75
72
  case "visa":
76
- result = `visa-${rail.id}`
77
- break
78
73
  case "mastercard":
79
- result = `mastercard-${rail.id}`
74
+ result = `${rail.type}-${rail.id}`
80
75
  break
81
76
  //case "swedish":
82
77
  // result = `swe-${rail.clearing}-${rail.account}`
@@ -88,12 +83,7 @@ export namespace Rail {
88
83
  return (
89
84
  value &&
90
85
  typeof value == "object" &&
91
- (PaxGiro.is(value) ||
92
- Iban.is(value) ||
93
- Internal.is(value) ||
94
- Scan.is(value) ||
95
- Mastercard.is(value) ||
96
- Visa.is(value))
86
+ (PaxGiro.is(value) || Iban.is(value) || Internal.is(value) || Scan.is(value) || Card.is(value))
97
87
  )
98
88
  }
99
89
 
@@ -106,8 +96,6 @@ export namespace Rail {
106
96
  export const Scan = RailScan
107
97
  export type Internal = RailInternal
108
98
  export const Internal = RailInternal
109
- export type Visa = RailVisa
110
- export const Visa = RailVisa
111
- export type Mastercard = RailMastercard
112
- export const Mastercard = RailMastercard
99
+ export type Card = RailCard
100
+ export const Card = RailCard
113
101
  }
package/Realm/index.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { isly } from "isly"
2
+ import { Supplier as modelSupplier } from "../Supplier"
2
3
 
3
- export const Realms = ["test", "testUK", "uk", "eu"] as const
4
- export type Realm = typeof Realms[number]
4
+ export type Realm = typeof Realm.realms[number]
5
5
 
6
6
  export namespace Realm {
7
- export const realms: Realm[] = [...Realms]
7
+ export const realms = ["test", "testUK", "uk", "eu"] as const
8
8
  export const type: isly.Type<Realm> = isly.union(
9
9
  isly.string("test"),
10
10
  isly.string("testUK"),
@@ -15,4 +15,22 @@ export namespace Realm {
15
15
  export function toString(): string {
16
16
  return realms.toString().replaceAll(",", ", ") + "."
17
17
  }
18
+ export const suppliers: Record<Realm, modelSupplier[]> = {
19
+ test: ["paxgiro"],
20
+ testUK: ["clearbank"],
21
+ uk: ["clearbank"],
22
+ eu: [],
23
+ }
24
+ export interface Suppliers extends Record<Realm, modelSupplier[]> {
25
+ test: ["paxgiro"]
26
+ testUK: ["clearbank"]
27
+ uk: ["clearbank"]
28
+ eu: []
29
+ }
30
+ export type Supplier<P extends keyof Suppliers> = Pick<Suppliers, P>[P][number]
31
+ export namespace Supplier {
32
+ export function is(realm: Realm, supplier: modelSupplier | any): supplier is Supplier<Realm> {
33
+ return suppliers[realm].includes(supplier)
34
+ }
35
+ }
18
36
  }
@@ -0,0 +1,14 @@
1
+ import { isoly } from "isoly";
2
+ import { isly } from "isly";
3
+ export interface Merchant {
4
+ name: string;
5
+ id: string;
6
+ category: string;
7
+ country: isoly.CountryCode.Alpha2;
8
+ address: string;
9
+ }
10
+ export declare namespace Merchant {
11
+ const type: isly.object.ExtendableType<Merchant>;
12
+ const is: isly.Type.IsFunction<Merchant>;
13
+ const flaw: isly.Type.FlawFunction;
14
+ }
@@ -0,0 +1,14 @@
1
+ import { isly } from "isly";
2
+ export var Merchant;
3
+ (function (Merchant) {
4
+ Merchant.type = isly.object({
5
+ name: isly.string(),
6
+ id: isly.string(),
7
+ category: isly.string(),
8
+ country: isly.string(),
9
+ address: isly.string(),
10
+ });
11
+ Merchant.is = Merchant.type.is;
12
+ Merchant.flaw = Merchant.type.flaw;
13
+ })(Merchant || (Merchant = {}));
14
+ //# sourceMappingURL=Merchant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Merchant.js","sourceRoot":"../","sources":["Merchant.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAS3B,MAAM,KAAW,QAAQ,CAUxB;AAVD,WAAiB,QAAQ;IACX,aAAI,GAAG,IAAI,CAAC,MAAM,CAAW;QACzC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;QACnB,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE;QACjB,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE;QACvB,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE;QACtB,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE;KACtB,CAAC,CAAA;IACW,WAAE,GAAG,SAAA,IAAI,CAAC,EAAE,CAAA;IACZ,aAAI,GAAG,SAAA,IAAI,CAAC,IAAI,CAAA;AAC9B,CAAC,EAVgB,QAAQ,KAAR,QAAQ,QAUxB"}
@@ -0,0 +1,22 @@
1
+ import { isly } from "isly";
2
+ import { Card as ModelCard } from "../Card";
3
+ import { Merchant } from "../Merchant";
4
+ export interface Card {
5
+ type: Card.Type;
6
+ id: string;
7
+ iin: string;
8
+ last4: string;
9
+ expiry: ModelCard.Expiry;
10
+ holder: string;
11
+ merchant: Merchant;
12
+ }
13
+ export declare namespace Card {
14
+ export const currencies: readonly ["EUR", "GBP", "SEK", "USD"];
15
+ type Mastercard = "mastercard";
16
+ type Visa = "visa";
17
+ export type Type = Mastercard | Visa;
18
+ export const type: isly.object.ExtendableType<Card>;
19
+ export const is: isly.Type.IsFunction<Card>;
20
+ export const flaw: isly.Type.FlawFunction;
21
+ export {};
22
+ }
@@ -0,0 +1,19 @@
1
+ import { isly } from "isly";
2
+ import { Card as ModelCard } from "../Card";
3
+ import { Merchant } from "../Merchant";
4
+ export var Card;
5
+ (function (Card) {
6
+ Card.currencies = ["EUR", "GBP", "SEK", "USD"];
7
+ Card.type = isly.object({
8
+ type: isly.union(isly.string("mastercard"), isly.string("visa")),
9
+ id: isly.string(),
10
+ iin: isly.string(),
11
+ last4: isly.string(),
12
+ expiry: ModelCard.Expiry.type,
13
+ holder: isly.string(),
14
+ merchant: Merchant.type,
15
+ });
16
+ Card.is = Card.type.is;
17
+ Card.flaw = Card.type.flaw;
18
+ })(Card || (Card = {}));
19
+ //# sourceMappingURL=Card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.js","sourceRoot":"../","sources":["Rail/Card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAWtC,MAAM,KAAW,IAAI,CAgBpB;AAhBD,WAAiB,IAAI;IACP,eAAU,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAU,CAAA;IAIlD,SAAI,GAAG,IAAI,CAAC,MAAM,CAAO;QACrC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAyB,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACxF,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE;QACjB,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE;QAClB,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE;QACpB,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,IAAI;QAC7B,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;QACrB,QAAQ,EAAE,QAAQ,CAAC,IAAI;KACvB,CAAC,CAAA;IACW,OAAE,GAAG,KAAA,IAAI,CAAC,EAAE,CAAA;IACZ,SAAI,GAAG,KAAA,IAAI,CAAC,IAAI,CAAA;AAC9B,CAAC,EAhBgB,IAAI,KAAJ,IAAI,QAgBpB"}
@@ -1 +1 @@
1
- export type Type = "paxgiro" | "internal" | "iban" | "scan" | "visa" | "mastercard";
1
+ export type Type = "paxgiro" | "internal" | "iban" | "scan" | "card";
@@ -1,11 +1,10 @@
1
+ import { Card as RailCard } from "./Card";
1
2
  import { Iban as RailIban } from "./Iban";
2
3
  import { Internal as RailInternal } from "./internal";
3
- import { Mastercard as RailMastercard } from "./Mastercard";
4
4
  import { PaxGiro as RailPaxGiro } from "./PaxGiro";
5
5
  import { Scan as RailScan } from "./Scan";
6
6
  import { Type as RailType } from "./Type";
7
- import { Visa as RailVisa } from "./Visa";
8
- export type Rail = (RailPaxGiro | RailInternal | RailIban | RailScan | RailMastercard | RailVisa) & {
7
+ export type Rail = (RailPaxGiro | RailInternal | RailIban | RailScan | RailCard) & {
9
8
  reference?: {
10
9
  supplier: string;
11
10
  value: string;
@@ -25,8 +24,6 @@ export declare namespace Rail {
25
24
  const Scan: typeof RailScan;
26
25
  type Internal = RailInternal;
27
26
  const Internal: typeof RailInternal;
28
- type Visa = RailVisa;
29
- const Visa: typeof RailVisa;
30
- type Mastercard = RailMastercard;
31
- const Mastercard: typeof RailMastercard;
27
+ type Card = RailCard;
28
+ const Card: typeof RailCard;
32
29
  }
@@ -1,9 +1,8 @@
1
+ import { Card as RailCard } from "./Card";
1
2
  import { Iban as RailIban } from "./Iban";
2
3
  import { Internal as RailInternal } from "./internal";
3
- import { Mastercard as RailMastercard } from "./Mastercard";
4
4
  import { PaxGiro as RailPaxGiro } from "./PaxGiro";
5
5
  import { Scan as RailScan } from "./Scan";
6
- import { Visa as RailVisa } from "./Visa";
7
6
  export var Rail;
8
7
  (function (Rail) {
9
8
  function parse(value) {
@@ -33,10 +32,8 @@ export var Rail;
33
32
  result = `scan-${rail.sort}-${rail.account}`;
34
33
  break;
35
34
  case "visa":
36
- result = `visa-${rail.id}`;
37
- break;
38
35
  case "mastercard":
39
- result = `mastercard-${rail.id}`;
36
+ result = `${rail.type}-${rail.id}`;
40
37
  break;
41
38
  }
42
39
  return result;
@@ -58,10 +55,8 @@ export var Rail;
58
55
  result = `${rail.sort} ${rail.account}`;
59
56
  break;
60
57
  case "visa":
61
- result = `visa-${rail.id}`;
62
- break;
63
58
  case "mastercard":
64
- result = `mastercard-${rail.id}`;
59
+ result = `${rail.type}-${rail.id}`;
65
60
  break;
66
61
  }
67
62
  return result;
@@ -70,19 +65,13 @@ export var Rail;
70
65
  function is(value) {
71
66
  return (value &&
72
67
  typeof value == "object" &&
73
- (Rail.PaxGiro.is(value) ||
74
- Rail.Iban.is(value) ||
75
- Rail.Internal.is(value) ||
76
- Rail.Scan.is(value) ||
77
- Rail.Mastercard.is(value) ||
78
- Rail.Visa.is(value)));
68
+ (Rail.PaxGiro.is(value) || Rail.Iban.is(value) || Rail.Internal.is(value) || Rail.Scan.is(value) || Rail.Card.is(value)));
79
69
  }
80
70
  Rail.is = is;
81
71
  Rail.PaxGiro = RailPaxGiro;
82
72
  Rail.Iban = RailIban;
83
73
  Rail.Scan = RailScan;
84
74
  Rail.Internal = RailInternal;
85
- Rail.Visa = RailVisa;
86
- Rail.Mastercard = RailMastercard;
75
+ Rail.Card = RailCard;
87
76
  })(Rail || (Rail = {}));
88
77
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../","sources":["Rail/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACzC,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,YAAY,CAAA;AACrD,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,cAAc,CAAA;AAC3D,O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D,SAAgB,EAAE,CAAC,KAAiB;QACnC,OAAO,CACN,KAAK;YACL,OAAO,KAAK,IAAI,QAAQ;YACxB,CAAC,KAAA,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAA,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAA,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAA,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAA,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAC/F,CAAA;IACF,CAAC;IANe,OAAE,KAMjB,CAAA;IAIY,YAAO,GAAG,WAAW,CAAA;IAErB,SAAI,GAAG,QAAQ,CAAA;IAEf,SAAI,GAAG,QAAQ,CAAA;IAEf,aAAQ,GAAG,YAAY,CAAA;IAEvB,SAAI,GAAG,QAAQ,CAAA;AAC7B,CAAC,EAzFgB,IAAI,KAAJ,IAAI,QAyFpB"}
@@ -1,9 +1,20 @@
1
1
  import { isly } from "isly";
2
- export declare const Realms: readonly ["test", "testUK", "uk", "eu"];
3
- export type Realm = typeof Realms[number];
2
+ import { Supplier as modelSupplier } from "../Supplier";
3
+ export type Realm = typeof Realm.realms[number];
4
4
  export declare namespace Realm {
5
- const realms: Realm[];
5
+ const realms: readonly ["test", "testUK", "uk", "eu"];
6
6
  const type: isly.Type<Realm>;
7
7
  const is: isly.Type.IsFunction<"eu" | "uk" | "test" | "testUK">;
8
8
  function toString(): string;
9
+ const suppliers: Record<Realm, modelSupplier[]>;
10
+ interface Suppliers extends Record<Realm, modelSupplier[]> {
11
+ test: ["paxgiro"];
12
+ testUK: ["clearbank"];
13
+ uk: ["clearbank"];
14
+ eu: [];
15
+ }
16
+ type Supplier<P extends keyof Suppliers> = Pick<Suppliers, P>[P][number];
17
+ namespace Supplier {
18
+ function is(realm: Realm, supplier: modelSupplier | any): supplier is Supplier<Realm>;
19
+ }
9
20
  }
@@ -1,13 +1,25 @@
1
1
  import { isly } from "isly";
2
- export const Realms = ["test", "testUK", "uk", "eu"];
3
2
  export var Realm;
4
3
  (function (Realm) {
5
- Realm.realms = [...Realms];
4
+ Realm.realms = ["test", "testUK", "uk", "eu"];
6
5
  Realm.type = isly.union(isly.string("test"), isly.string("testUK"), isly.string("uk"), isly.string("eu"));
7
6
  Realm.is = Realm.type.is;
8
7
  function toString() {
9
8
  return Realm.realms.toString().replaceAll(",", ", ") + ".";
10
9
  }
11
10
  Realm.toString = toString;
11
+ Realm.suppliers = {
12
+ test: ["paxgiro"],
13
+ testUK: ["clearbank"],
14
+ uk: ["clearbank"],
15
+ eu: [],
16
+ };
17
+ let Supplier;
18
+ (function (Supplier) {
19
+ function is(realm, supplier) {
20
+ return Realm.suppliers[realm].includes(supplier);
21
+ }
22
+ Supplier.is = is;
23
+ })(Supplier = Realm.Supplier || (Realm.Supplier = {}));
12
24
  })(Realm || (Realm = {}));
13
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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,EA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,KAAR,cAAQ,QAIxB;AACF,CAAC,EA9BgB,KAAK,KAAL,KAAK,QA8BrB"}
package/dist/pax2pay.d.ts CHANGED
@@ -11,3 +11,4 @@ export { Treasury } from "./Treasury";
11
11
  export { Realm } from "./Realm";
12
12
  export { Supplier } from "./Supplier";
13
13
  export { Settlement } from "./Settlement";
14
+ export { Merchant } from "./Merchant";
package/dist/pax2pay.js CHANGED
@@ -11,4 +11,5 @@ export { Treasury } from "./Treasury";
11
11
  export { Realm } from "./Realm";
12
12
  export { Supplier } from "./Supplier";
13
13
  export { Settlement } from "./Settlement";
14
+ export { Merchant } from "./Merchant";
14
15
  //# sourceMappingURL=pax2pay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pax2pay.js","sourceRoot":"../","sources":["pax2pay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA"}
1
+ {"version":3,"file":"pax2pay.js","sourceRoot":"../","sources":["pax2pay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pax2pay/model-banking",
3
- "version": "0.1.54",
3
+ "version": "0.1.56",
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
@@ -11,3 +11,4 @@ export { Treasury } from "./Treasury"
11
11
  export { Realm } from "./Realm"
12
12
  export { Supplier } from "./Supplier"
13
13
  export { Settlement } from "./Settlement"
14
+ export { Merchant } from "./Merchant"
@@ -1,24 +0,0 @@
1
- import { isly } from "isly"
2
- import { Card } from "../Card"
3
-
4
- export interface Mastercard {
5
- type: "mastercard"
6
- id: string
7
- iin: string
8
- last4: string
9
- expiry: Card.Expiry
10
- holder: string
11
- }
12
- export namespace Mastercard {
13
- export const currencies = ["EUR", "GBP", "SEK", "USD"] as const
14
- export const type = isly.object<Mastercard>({
15
- type: isly.string("mastercard"),
16
- id: isly.string(),
17
- iin: isly.string(),
18
- last4: isly.string(),
19
- expiry: Card.Expiry.type,
20
- holder: isly.string(),
21
- })
22
- export const is = type.is
23
- export const flaw = type.flaw
24
- }
package/Rail/Visa.ts DELETED
@@ -1,24 +0,0 @@
1
- import { isly } from "isly"
2
- import { Card } from "../Card"
3
-
4
- export interface Visa {
5
- type: "visa"
6
- id: string
7
- iin: string
8
- last4: string
9
- expiry: Card.Expiry
10
- holder: string
11
- }
12
- export namespace Visa {
13
- export const currencies = ["EUR", "GBP", "SEK", "USD"] as const
14
- export const type = isly.object<Visa>({
15
- type: isly.string("visa"),
16
- id: isly.string(),
17
- iin: isly.string(),
18
- last4: isly.string(),
19
- expiry: Card.Expiry.type,
20
- holder: isly.string(),
21
- })
22
- export const is = type.is
23
- export const flaw = type.flaw
24
- }
@@ -1,16 +0,0 @@
1
- import { isly } from "isly";
2
- import { Card } from "../Card";
3
- export interface Mastercard {
4
- type: "mastercard";
5
- id: string;
6
- iin: string;
7
- last4: string;
8
- expiry: Card.Expiry;
9
- holder: string;
10
- }
11
- export declare namespace Mastercard {
12
- const currencies: readonly ["EUR", "GBP", "SEK", "USD"];
13
- const type: isly.object.ExtendableType<Mastercard>;
14
- const is: isly.Type.IsFunction<Mastercard>;
15
- const flaw: isly.Type.FlawFunction;
16
- }
@@ -1,17 +0,0 @@
1
- import { isly } from "isly";
2
- import { Card } from "../Card";
3
- export var Mastercard;
4
- (function (Mastercard) {
5
- Mastercard.currencies = ["EUR", "GBP", "SEK", "USD"];
6
- Mastercard.type = isly.object({
7
- type: isly.string("mastercard"),
8
- id: isly.string(),
9
- iin: isly.string(),
10
- last4: isly.string(),
11
- expiry: Card.Expiry.type,
12
- holder: isly.string(),
13
- });
14
- Mastercard.is = Mastercard.type.is;
15
- Mastercard.flaw = Mastercard.type.flaw;
16
- })(Mastercard || (Mastercard = {}));
17
- //# sourceMappingURL=Mastercard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Mastercard.js","sourceRoot":"../","sources":["Rail/Mastercard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAU9B,MAAM,KAAW,UAAU,CAY1B;AAZD,WAAiB,UAAU;IACb,qBAAU,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAU,CAAA;IAClD,eAAI,GAAG,IAAI,CAAC,MAAM,CAAa;QAC3C,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;QAC/B,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE;QACjB,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE;QAClB,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE;QACpB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;QACxB,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;KACrB,CAAC,CAAA;IACW,aAAE,GAAG,WAAA,IAAI,CAAC,EAAE,CAAA;IACZ,eAAI,GAAG,WAAA,IAAI,CAAC,IAAI,CAAA;AAC9B,CAAC,EAZgB,UAAU,KAAV,UAAU,QAY1B"}
@@ -1,16 +0,0 @@
1
- import { isly } from "isly";
2
- import { Card } from "../Card";
3
- export interface Visa {
4
- type: "visa";
5
- id: string;
6
- iin: string;
7
- last4: string;
8
- expiry: Card.Expiry;
9
- holder: string;
10
- }
11
- export declare namespace Visa {
12
- const currencies: readonly ["EUR", "GBP", "SEK", "USD"];
13
- const type: isly.object.ExtendableType<Visa>;
14
- const is: isly.Type.IsFunction<Visa>;
15
- const flaw: isly.Type.FlawFunction;
16
- }
package/dist/Rail/Visa.js DELETED
@@ -1,17 +0,0 @@
1
- import { isly } from "isly";
2
- import { Card } from "../Card";
3
- export var Visa;
4
- (function (Visa) {
5
- Visa.currencies = ["EUR", "GBP", "SEK", "USD"];
6
- Visa.type = isly.object({
7
- type: isly.string("visa"),
8
- id: isly.string(),
9
- iin: isly.string(),
10
- last4: isly.string(),
11
- expiry: Card.Expiry.type,
12
- holder: isly.string(),
13
- });
14
- Visa.is = Visa.type.is;
15
- Visa.flaw = Visa.type.flaw;
16
- })(Visa || (Visa = {}));
17
- //# sourceMappingURL=Visa.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Visa.js","sourceRoot":"../","sources":["Rail/Visa.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAU9B,MAAM,KAAW,IAAI,CAYpB;AAZD,WAAiB,IAAI;IACP,eAAU,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAU,CAAA;IAClD,SAAI,GAAG,IAAI,CAAC,MAAM,CAAO;QACrC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QACzB,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE;QACjB,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE;QAClB,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE;QACpB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;QACxB,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;KACrB,CAAC,CAAA;IACW,OAAE,GAAG,KAAA,IAAI,CAAC,EAAE,CAAA;IACZ,SAAI,GAAG,KAAA,IAAI,CAAC,IAAI,CAAA;AAC9B,CAAC,EAZgB,IAAI,KAAJ,IAAI,QAYpB"}