@pax2pay/model-banking 0.1.118 → 0.1.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/Amount.ts +10 -0
  2. package/Amounts.ts +10 -0
  3. package/Authorization/Creatable.ts +2 -1
  4. package/Authorization/Status.ts +47 -0
  5. package/Authorization/index.ts +83 -18
  6. package/Card/Changeable.ts +2 -1
  7. package/Card/Creatable.ts +2 -1
  8. package/Card/Operation/Settlement.ts +2 -2
  9. package/Card/Preset.ts +1 -0
  10. package/Card/index.ts +3 -2
  11. package/Client/Settlements.ts +2 -2
  12. package/Identifier.ts +12 -0
  13. package/{Realm/index.ts → Realm.ts} +2 -1
  14. package/Rule/State/index.ts +1 -1
  15. package/Settlement/Creatable.ts +18 -0
  16. package/Settlement/Entry/Cancel.ts +34 -0
  17. package/Settlement/Entry/Capture.ts +34 -0
  18. package/Settlement/Entry/Creatable.ts +18 -0
  19. package/Settlement/Entry/Refund.ts +34 -0
  20. package/Settlement/Entry/Summary.ts +21 -0
  21. package/Settlement/Entry/Unknown.ts +29 -0
  22. package/Settlement/Entry/index.ts +49 -0
  23. package/Settlement/Fee.ts +12 -0
  24. package/Settlement/Settled.ts +19 -0
  25. package/Settlement/Status.ts +13 -0
  26. package/Settlement/Total.ts +17 -0
  27. package/Settlement/index.ts +67 -75
  28. package/Treasury/Balance/index.ts +5 -9
  29. package/dist/Amount.d.ts +8 -0
  30. package/dist/Amount.js +9 -0
  31. package/dist/Amount.js.map +1 -0
  32. package/dist/Amounts.d.ts +8 -0
  33. package/dist/Amounts.js +9 -0
  34. package/dist/Amounts.js.map +1 -0
  35. package/dist/Authorization/Creatable.d.ts +2 -2
  36. package/dist/Authorization/Creatable.js.map +1 -1
  37. package/dist/Authorization/Status.d.ts +16 -0
  38. package/dist/Authorization/Status.js +38 -0
  39. package/dist/Authorization/Status.js.map +1 -0
  40. package/dist/Authorization/index.d.ts +30 -9
  41. package/dist/Authorization/index.js +57 -11
  42. package/dist/Authorization/index.js.map +1 -1
  43. package/dist/Card/Changeable.d.ts +2 -2
  44. package/dist/Card/Changeable.js.map +1 -1
  45. package/dist/Card/Creatable.d.ts +2 -2
  46. package/dist/Card/Creatable.js.map +1 -1
  47. package/dist/Card/Operation/Settlement.d.ts +1 -1
  48. package/dist/Card/Operation/Settlement.js +1 -1
  49. package/dist/Card/Operation/Settlement.js.map +1 -1
  50. package/dist/Card/Preset.js.map +1 -1
  51. package/dist/Card/index.d.ts +3 -2
  52. package/dist/Card/index.js.map +1 -1
  53. package/dist/Client/Settlements.d.ts +1 -1
  54. package/dist/Client/Settlements.js.map +1 -1
  55. package/dist/Identifier.d.ts +5 -0
  56. package/dist/Identifier.js +10 -0
  57. package/dist/Identifier.js.map +1 -0
  58. package/dist/{Realm/index.d.ts → Realm.d.ts} +2 -1
  59. package/dist/{Realm/index.js → Realm.js} +2 -1
  60. package/dist/Realm.js.map +1 -0
  61. package/dist/Rule/State/index.d.ts +1 -1
  62. package/dist/Rule/State/index.js.map +1 -1
  63. package/dist/Settlement/Creatable.d.ts +12 -0
  64. package/dist/Settlement/Creatable.js +13 -0
  65. package/dist/Settlement/Creatable.js.map +1 -0
  66. package/dist/Settlement/Entry/Cancel.d.ts +24 -0
  67. package/dist/Settlement/Entry/Cancel.js +25 -0
  68. package/dist/Settlement/Entry/Cancel.js.map +1 -0
  69. package/dist/Settlement/Entry/Capture.d.ts +24 -0
  70. package/dist/Settlement/Entry/Capture.js +25 -0
  71. package/dist/Settlement/Entry/Capture.js.map +1 -0
  72. package/dist/Settlement/Entry/Creatable.d.ts +11 -0
  73. package/dist/Settlement/Entry/Creatable.js +12 -0
  74. package/dist/Settlement/Entry/Creatable.js.map +1 -0
  75. package/dist/Settlement/Entry/Refund.d.ts +24 -0
  76. package/dist/Settlement/Entry/Refund.js +25 -0
  77. package/dist/Settlement/Entry/Refund.js.map +1 -0
  78. package/dist/Settlement/Entry/Summary.d.ts +12 -0
  79. package/dist/Settlement/Entry/Summary.js +15 -0
  80. package/dist/Settlement/Entry/Summary.js.map +1 -0
  81. package/dist/Settlement/Entry/Unknown.d.ts +21 -0
  82. package/dist/Settlement/Entry/Unknown.js +23 -0
  83. package/dist/Settlement/Entry/Unknown.js.map +1 -0
  84. package/dist/Settlement/Entry/index.d.ts +31 -0
  85. package/dist/Settlement/Entry/index.js +33 -0
  86. package/dist/Settlement/Entry/index.js.map +1 -0
  87. package/dist/Settlement/Fee.d.ts +10 -0
  88. package/dist/Settlement/Fee.js +9 -0
  89. package/dist/Settlement/Fee.js.map +1 -0
  90. package/dist/Settlement/Settled.d.ts +13 -0
  91. package/dist/Settlement/Settled.js +14 -0
  92. package/dist/Settlement/Settled.js.map +1 -0
  93. package/dist/Settlement/Status.d.ts +7 -0
  94. package/dist/Settlement/Status.js +8 -0
  95. package/dist/Settlement/Status.js.map +1 -0
  96. package/dist/Settlement/Total.d.ts +13 -0
  97. package/dist/Settlement/Total.js +14 -0
  98. package/dist/Settlement/Total.js.map +1 -0
  99. package/dist/Settlement/index.d.ts +46 -45
  100. package/dist/Settlement/index.js +49 -47
  101. package/dist/Settlement/index.js.map +1 -1
  102. package/dist/Treasury/Balance/index.d.ts +5 -3
  103. package/dist/Treasury/Balance/index.js +4 -7
  104. package/dist/Treasury/Balance/index.js.map +1 -1
  105. package/dist/pax2pay.d.ts +3 -0
  106. package/dist/pax2pay.js +3 -0
  107. package/dist/pax2pay.js.map +1 -1
  108. package/global.d.ts +2 -0
  109. package/package.json +8 -8
  110. package/pax2pay.ts +3 -0
  111. package/tsconfig.json +3 -1
  112. package/Authorization/Approved.ts +0 -21
  113. package/Authorization/Base.ts +0 -43
  114. package/Authorization/Failed.ts +0 -46
  115. package/Settlement/Entry.ts +0 -87
  116. package/dist/Authorization/Approved.d.ts +0 -14
  117. package/dist/Authorization/Approved.js +0 -16
  118. package/dist/Authorization/Approved.js.map +0 -1
  119. package/dist/Authorization/Base.d.ts +0 -22
  120. package/dist/Authorization/Base.js +0 -34
  121. package/dist/Authorization/Base.js.map +0 -1
  122. package/dist/Authorization/Failed.d.ts +0 -18
  123. package/dist/Authorization/Failed.js +0 -41
  124. package/dist/Authorization/Failed.js.map +0 -1
  125. package/dist/Realm/index.js.map +0 -1
  126. package/dist/Settlement/Entry.d.ts +0 -59
  127. package/dist/Settlement/Entry.js +0 -64
  128. package/dist/Settlement/Entry.js.map +0 -1
@@ -1,52 +1,53 @@
1
+ import { cryptly } from "cryptly";
1
2
  import { isoly } from "isoly";
2
3
  import { isly } from "isly";
4
+ import { Creatable as SettlementCreatable } from "./Creatable";
3
5
  import { Entry as SettlementEntry } from "./Entry";
4
- export type Settlement = Settlement.Succeeded | Settlement.Failed | Settlement.Ongoing;
6
+ import { Fee as SettlementFee } from "./Fee";
7
+ import { Settled } from "./Settled";
8
+ import { Status } from "./Status";
9
+ import { Total as SettlementTotal } from "./Total";
10
+ export interface Settlement {
11
+ id: string;
12
+ by?: string;
13
+ created: isoly.DateTime;
14
+ reference: string;
15
+ processor: string;
16
+ status: Status;
17
+ expected: Settlement.Total;
18
+ outcome?: Settlement.Total;
19
+ settled?: Settled;
20
+ entries?: Settlement.Entry.Summary;
21
+ }
5
22
  export declare namespace Settlement {
6
- type Summary = Omit<Settlement.Succeeded, "entries"> | Settlement.Failed | Omit<Settlement.Ongoing, "entries">;
7
- interface Base {
8
- id: string;
9
- created: [string, isoly.DateTime];
10
- regarding: isoly.Date;
11
- configuration: string;
12
- status: string;
13
- }
14
- interface Succeeded extends Base {
15
- status: "succeeded";
16
- amount: Partial<Record<isoly.Currency, number>>;
17
- fee: Partial<Record<isoly.Currency, number>>;
18
- entries: SettlementEntry[];
19
- settled: {
20
- user: string;
21
- created: isoly.DateTime;
22
- transactions: Record<string, [isoly.Currency, number]>;
23
- };
24
- }
25
- interface Failed extends Base {
26
- status: "failed";
27
- reason: string;
28
- }
29
- interface Ongoing extends Base {
30
- status: "ongoing";
31
- amount: Partial<Record<isoly.Currency, number>>;
32
- fee: Partial<Record<isoly.Currency, number>>;
33
- entries: SettlementEntry[];
34
- }
35
- namespace Succeeded {
36
- const type: isly.object.ExtendableType<Succeeded>;
37
- const is: isly.Type.IsFunction<Succeeded>;
38
- }
39
- namespace Failed {
40
- const type: isly.object.ExtendableType<Failed>;
41
- const is: isly.Type.IsFunction<Failed>;
42
- }
43
- namespace Ongoing {
44
- const type: isly.object.ExtendableType<Ongoing>;
45
- const is: isly.Type.IsFunction<Ongoing>;
23
+ const Total: typeof SettlementTotal;
24
+ type Total = SettlementTotal;
25
+ const Fee: typeof SettlementFee;
26
+ type Fee = SettlementFee;
27
+ type Creatable = SettlementCreatable;
28
+ const Creatable: typeof SettlementCreatable;
29
+ type Entry = SettlementEntry;
30
+ namespace Entry {
31
+ type Summary = SettlementEntry.Summary;
32
+ const Summary: typeof import("./Entry/Summary").Summary;
33
+ type Creatable = SettlementEntry.Creatable;
34
+ const Creatable: typeof import("./Entry/Creatable").Creatable;
35
+ type Refund = SettlementEntry.Refund;
36
+ const Refund: typeof import("./Entry/Refund").Refund;
37
+ type Cancel = SettlementEntry.Cancel;
38
+ const Cancel: typeof import("./Entry/Cancel").Cancel;
39
+ type Capture = SettlementEntry.Capture;
40
+ const Capture: typeof import("./Entry/Capture").Capture;
41
+ type Unknown = SettlementEntry.Unknown;
42
+ const Unknown: typeof import("./Entry/Unknown").Unknown;
43
+ const from: typeof SettlementEntry.from;
44
+ const type: isly.Type<SettlementEntry>;
45
+ const is: isly.Type.IsFunction<SettlementEntry>;
46
+ const flaw: isly.Type.FlawFunction;
46
47
  }
47
- const type: isly.Type<Settlement>;
48
- const is: isly.Type.IsFunction<Settlement>;
48
+ function from(id: cryptly.Identifier, creatable: Settlement.Creatable, by: string): Settlement;
49
+ function toFailed(id: string, creatable: Settlement.Creatable, by: string, reason: string): Settlement;
50
+ const type: isly.object.ExtendableType<object>;
51
+ const is: isly.Type.IsFunction<object>;
49
52
  const flaw: isly.Type.FlawFunction;
50
- const Entry: typeof SettlementEntry;
51
- type Entry = SettlementEntry;
52
53
  }
@@ -1,56 +1,58 @@
1
1
  import { isoly } from "isoly";
2
2
  import { isly } from "isly";
3
+ import { Creatable as SettlementCreatable } from "./Creatable";
3
4
  import { Entry as SettlementEntry } from "./Entry";
5
+ import { Fee as SettlementFee } from "./Fee";
6
+ import { Settled } from "./Settled";
7
+ import { Status } from "./Status";
8
+ import { Total as SettlementTotal } from "./Total";
4
9
  export var Settlement;
5
10
  (function (Settlement) {
6
- let Succeeded;
7
- (function (Succeeded) {
8
- Succeeded.type = isly.object({
9
- id: isly.string(),
10
- created: isly.tuple(isly.string(), isly.fromIs("Settlement.created", isoly.DateTime.is)),
11
- regarding: isly.fromIs("Settlement.regarding", isoly.Date.is),
12
- configuration: isly.string(),
13
- settled: isly.object({
14
- user: isly.string(),
15
- created: isly.fromIs("Settlement.settled.created", isoly.DateTime.is),
16
- transactions: isly.record(isly.string(), isly.tuple(isly.fromIs("Settlement.settled.transactions.currency", isoly.Currency.is), isly.number())),
17
- }),
18
- amount: isly.record(isly.fromIs("Settlement.entries.amount", isoly.Currency.is), isly.number()),
19
- fee: isly.record(isly.fromIs("Settlement.entries.fee", isoly.Currency.is), isly.number()),
20
- entries: SettlementEntry.type.array(),
21
- status: isly.string("succeeded"),
22
- });
23
- Succeeded.is = Succeeded.type.is;
24
- })(Succeeded = Settlement.Succeeded || (Settlement.Succeeded = {}));
25
- let Failed;
26
- (function (Failed) {
27
- Failed.type = isly.object({
28
- id: isly.string(),
29
- created: isly.tuple(isly.string(), isly.fromIs("Settlement.created", isoly.DateTime.is)),
30
- regarding: isly.fromIs("Settlement.regarding", isoly.Date.is),
31
- configuration: isly.string(),
32
- status: isly.string("failed"),
33
- reason: isly.string(),
34
- });
35
- Failed.is = Failed.type.is;
36
- })(Failed = Settlement.Failed || (Settlement.Failed = {}));
37
- let Ongoing;
38
- (function (Ongoing) {
39
- Ongoing.type = isly.object({
40
- id: isly.string(),
41
- created: isly.tuple(isly.string(), isly.fromIs("Settlement.created", isoly.DateTime.is)),
42
- regarding: isly.fromIs("Settlement.regarding", isoly.Date.is),
43
- configuration: isly.string(),
44
- amount: isly.record(isly.fromIs("Settlement.entries.amount", isoly.Currency.is), isly.number()),
45
- fee: isly.record(isly.fromIs("Settlement.entries.fee", isoly.Currency.is), isly.number()),
46
- entries: SettlementEntry.type.array(),
47
- status: isly.string("ongoing"),
48
- });
49
- Ongoing.is = Ongoing.type.is;
50
- })(Ongoing = Settlement.Ongoing || (Settlement.Ongoing = {}));
51
- Settlement.type = isly.union(Succeeded.type, Failed.type, Ongoing.type);
11
+ Settlement.Total = SettlementTotal;
12
+ Settlement.Fee = SettlementFee;
13
+ Settlement.Creatable = SettlementCreatable;
14
+ let Entry;
15
+ (function (Entry) {
16
+ Entry.Summary = SettlementEntry.Summary;
17
+ Entry.Creatable = SettlementEntry.Creatable;
18
+ Entry.Refund = SettlementEntry.Refund;
19
+ Entry.Cancel = SettlementEntry.Cancel;
20
+ Entry.Capture = SettlementEntry.Capture;
21
+ Entry.Unknown = SettlementEntry.Unknown;
22
+ Entry.from = SettlementEntry.from;
23
+ Entry.type = SettlementEntry.type;
24
+ Entry.is = SettlementEntry.is;
25
+ Entry.flaw = SettlementEntry.flaw;
26
+ })(Entry = Settlement.Entry || (Settlement.Entry = {}));
27
+ function from(id, creatable, by) {
28
+ return { id, status: "ongoing", by, expected: Settlement.Total.initiate(), ...creatable, created: isoly.DateTime.now() };
29
+ }
30
+ Settlement.from = from;
31
+ function toFailed(id, creatable, by, reason) {
32
+ return {
33
+ id,
34
+ created: isoly.DateTime.now(),
35
+ status: ["failed", reason],
36
+ by,
37
+ processor: creatable.processor,
38
+ reference: creatable.reference,
39
+ expected: Settlement.Total.initiate(),
40
+ };
41
+ }
42
+ Settlement.toFailed = toFailed;
43
+ Settlement.type = isly.object({
44
+ id: isly.string(),
45
+ by: isly.string().optional(),
46
+ created: isly.fromIs("isoly.DateTime", isoly.DateTime.is),
47
+ reference: isly.string(),
48
+ processor: isly.string(),
49
+ status: Status.type,
50
+ expected: Settlement.Total.type,
51
+ outcome: Settlement.Total.type.optional(),
52
+ settled: Settled.type.optional(),
53
+ entries: Settlement.Entry.Summary.type.optional(),
54
+ });
52
55
  Settlement.is = Settlement.type.is;
53
56
  Settlement.flaw = Settlement.type.flaw;
54
- Settlement.Entry = SettlementEntry;
55
57
  })(Settlement || (Settlement = {}));
56
58
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../","sources":["Settlement/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,KAAK,IAAI,eAAe,EAAE,MAAM,SAAS,CAAA;AAGlD,MAAM,KAAW,UAAU,CAiF1B;AAjFD,WAAiB,UAAU;IA2B1B,IAAiB,SAAS,CAwBzB;IAxBD,WAAiB,SAAS;QACZ,cAAI,GAAG,IAAI,CAAC,MAAM,CAAY;YAC1C,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE;YACjB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YACxF,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7D,aAAa,EAAE,IAAI,CAAC,MAAM,EAAE;YAC5B,OAAO,EAAE,IAAI,CAAC,MAAM,CAIjB;gBACF,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;gBACnB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,4BAA4B,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACrE,YAAY,EAAE,IAAI,CAAC,MAAM,CACxB,IAAI,CAAC,MAAM,EAAE,E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AI,CAAC,QAAQ,EAAE;QACzC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE;QAChC,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE;KACjD,CAAC,CAAA;IACW,aAAE,GAAG,WAAA,IAAI,CAAC,EAAE,CAAA;IACZ,eAAI,GAAG,WAAA,IAAI,CAAC,IAAI,CAAA;AAC9B,CAAC,EAvDgB,UAAU,KAAV,UAAU,QAuD1B"}
@@ -1,11 +1,13 @@
1
- import { isoly } from "isoly";
2
- export type Balance = Partial<Record<isoly.Currency, number>>;
1
+ import { Amounts } from "../../Amounts";
2
+ export type Balance = Amounts;
3
3
  export type Result = {
4
4
  account: string;
5
5
  balance: number;
6
6
  };
7
7
  export declare namespace Balance {
8
- function is(value: Balance | any): value is Balance;
8
+ const type: import("isly/dist/Type").Type<Partial<Record<"BTN" | "CHE" | "MKD" | "AED" | "AFN" | "ALL" | "AMD" | "ANG" | "AOA" | "ARS" | "AUD" | "AWG" | "AZN" | "BAM" | "BBD" | "BDT" | "BGN" | "BHD" | "BIF" | "BMD" | "BND" | "BOB" | "BOV" | "BRL" | "BSD" | "BWP" | "BYN" | "BZD" | "CAD" | "CDF" | "CHF" | "CHW" | "CLF" | "CLP" | "CNY" | "COP" | "COU" | "CRC" | "CUC" | "CUP" | "CVE" | "CZK" | "DJF" | "DKK" | "DOP" | "DZD" | "EGP" | "ERN" | "ETB" | "EUR" | "FJD" | "FKP" | "GBP" | "GEL" | "GHS" | "GIP" | "GMD" | "GNF" | "GTQ" | "GYD" | "HKD" | "HNL" | "HRK" | "HTG" | "HUF" | "IDR" | "ILS" | "INR" | "IQD" | "IRR" | "ISK" | "JMD" | "JOD" | "JPY" | "KES" | "KGS" | "KHR" | "KMF" | "KPW" | "KRW" | "KWD" | "KYD" | "KZT" | "LAK" | "LBP" | "LKR" | "LRD" | "LSL" | "LYD" | "MAD" | "MDL" | "MGA" | "MMK" | "MNT" | "MOP" | "MRU" | "MUR" | "MVR" | "MWK" | "MXN" | "MXV" | "MYR" | "MZN" | "NAD" | "NGN" | "NIO" | "NOK" | "NPR" | "NZD" | "OMR" | "PAB" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "QAR" | "RON" | "RSD" | "RUB" | "RWF" | "SAR" | "SBD" | "SCR" | "SDG" | "SEK" | "SGD" | "SHP" | "SLL" | "SOS" | "SRD" | "SSP" | "STN" | "SVC" | "SYP" | "SZL" | "THB" | "TJS" | "TMT" | "TND" | "TOP" | "TRY" | "TTD" | "TWD" | "TZS" | "UAH" | "UGX" | "USD" | "USN" | "UYI" | "UYU" | "UYW" | "UZS" | "VES" | "VND" | "VUV" | "WST" | "XAF" | "XAG" | "XAU" | "XBA" | "XBB" | "XBC" | "XBD" | "XCD" | "XDR" | "XOF" | "XPD" | "XPF" | "XPT" | "XSU" | "XTS" | "XUA" | "XXX" | "YER" | "ZAR" | "ZMW" | "ZWL", number>>>;
9
+ const is: import("isly/dist/Type").Type.IsFunction<Partial<Record<"BTN" | "CHE" | "MKD" | "AED" | "AFN" | "ALL" | "AMD" | "ANG" | "AOA" | "ARS" | "AUD" | "AWG" | "AZN" | "BAM" | "BBD" | "BDT" | "BGN" | "BHD" | "BIF" | "BMD" | "BND" | "BOB" | "BOV" | "BRL" | "BSD" | "BWP" | "BYN" | "BZD" | "CAD" | "CDF" | "CHF" | "CHW" | "CLF" | "CLP" | "CNY" | "COP" | "COU" | "CRC" | "CUC" | "CUP" | "CVE" | "CZK" | "DJF" | "DKK" | "DOP" | "DZD" | "EGP" | "ERN" | "ETB" | "EUR" | "FJD" | "FKP" | "GBP" | "GEL" | "GHS" | "GIP" | "GMD" | "GNF" | "GTQ" | "GYD" | "HKD" | "HNL" | "HRK" | "HTG" | "HUF" | "IDR" | "ILS" | "INR" | "IQD" | "IRR" | "ISK" | "JMD" | "JOD" | "JPY" | "KES" | "KGS" | "KHR" | "KMF" | "KPW" | "KRW" | "KWD" | "KYD" | "KZT" | "LAK" | "LBP" | "LKR" | "LRD" | "LSL" | "LYD" | "MAD" | "MDL" | "MGA" | "MMK" | "MNT" | "MOP" | "MRU" | "MUR" | "MVR" | "MWK" | "MXN" | "MXV" | "MYR" | "MZN" | "NAD" | "NGN" | "NIO" | "NOK" | "NPR" | "NZD" | "OMR" | "PAB" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "QAR" | "RON" | "RSD" | "RUB" | "RWF" | "SAR" | "SBD" | "SCR" | "SDG" | "SEK" | "SGD" | "SHP" | "SLL" | "SOS" | "SRD" | "SSP" | "STN" | "SVC" | "SYP" | "SZL" | "THB" | "TJS" | "TMT" | "TND" | "TOP" | "TRY" | "TTD" | "TWD" | "TZS" | "UAH" | "UGX" | "USD" | "USN" | "UYI" | "UYU" | "UYW" | "UZS" | "VES" | "VND" | "VUV" | "WST" | "XAF" | "XAG" | "XAU" | "XBA" | "XBB" | "XBC" | "XBD" | "XCD" | "XDR" | "XOF" | "XPD" | "XPF" | "XPT" | "XSU" | "XTS" | "XUA" | "XXX" | "YER" | "ZAR" | "ZMW" | "ZWL", number>>>;
10
+ const flaw: import("isly/dist/Type").Type.FlawFunction;
9
11
  }
10
12
  export declare namespace Result {
11
13
  function is(value: Result | any): value is Result;
@@ -1,12 +1,9 @@
1
- import { isoly } from "isoly";
1
+ import { Amounts } from "../../Amounts";
2
2
  export var Balance;
3
3
  (function (Balance) {
4
- function is(value) {
5
- return (value &&
6
- typeof value == "object" &&
7
- Object.entries(value).every(([k, v]) => isoly.Currency.is(k) && typeof v == "number"));
8
- }
9
- Balance.is = is;
4
+ Balance.type = Amounts.type;
5
+ Balance.is = Amounts.is;
6
+ Balance.flaw = Amounts.flaw;
10
7
  })(Balance || (Balance = {}));
11
8
  export var Result;
12
9
  (function (Result) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../","sources":["Treasury/Balance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KA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OAAO,KAAK,CAAC,OAAO,IAAI,QAAQ,IAAI,OAAO,KAAK,CAAC,OAAO,IAAI,QAAQ,CAAA;IACjH,CAAC;IAFe,SAAE,KAEjB,CAAA;AACF,CAAC,EAJgB,MAAM,KAAN,MAAM,QAItB"}
package/dist/pax2pay.d.ts CHANGED
@@ -15,3 +15,6 @@ export { Settlement } from "./Settlement";
15
15
  export { Merchant } from "./Merchant";
16
16
  export { Rule } from "./Rule";
17
17
  export { Authorization } from "./Authorization";
18
+ export { Identifier } from "./Identifier";
19
+ export { Amount } from "./Amount";
20
+ export { Amounts } from "./Amounts";
package/dist/pax2pay.js CHANGED
@@ -15,4 +15,7 @@ export { Settlement } from "./Settlement";
15
15
  export { Merchant } from "./Merchant";
16
16
  export { Rule } from "./Rule";
17
17
  export { Authorization } from "./Authorization";
18
+ export { Identifier } from "./Identifier";
19
+ export { Amount } from "./Amount";
20
+ export { Amounts } from "./Amounts";
18
21
  //# 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,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,CA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UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA"}
package/global.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare type Optional<T extends object, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>
2
+ declare type Override<T, R> = Omit<T, keyof R> & R
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pax2pay/model-banking",
3
- "version": "0.1.118",
3
+ "version": "0.1.119",
4
4
  "description": "Library containing data model types and functions for the Pax2Pay Banking API.",
5
5
  "author": "Pax2Pay Ltd",
6
6
  "license": "MIT",
@@ -20,13 +20,13 @@
20
20
  "release": true
21
21
  },
22
22
  "jest": {
23
- "globals": {
24
- "ts-jest": {
25
- "tsconfig": "tsconfig.test.json"
26
- }
27
- },
28
23
  "transform": {
29
- "^.+\\.(j|t)sx?$": "ts-jest"
24
+ "^.+\\.(j|t)sx?$": [
25
+ "ts-jest",
26
+ {
27
+ "tsconfig": "tsconfig.test.json"
28
+ }
29
+ ]
30
30
  },
31
31
  "transformIgnorePatterns": [
32
32
  "<rootDir>/node_modules/(?!(cryptly|authly|isly|isoly|gracely|cloudly-http|cloudly-rest|cloudly-router|cloudly-formdata|@userwidgets|selectively)/.*)"
@@ -74,7 +74,7 @@
74
74
  "authly": "^3.0.6",
75
75
  "cloudly-http": "^0.1.6",
76
76
  "cloudly-rest": "^0.1.3",
77
- "cryptly": "^3.0.4",
77
+ "cryptly": "3.0.7",
78
78
  "gracely": "^2.0.4",
79
79
  "isoly": "^2.0.20",
80
80
  "isly": "0.1.7",
package/pax2pay.ts CHANGED
@@ -15,3 +15,6 @@ export { Settlement } from "./Settlement"
15
15
  export { Merchant } from "./Merchant"
16
16
  export { Rule } from "./Rule"
17
17
  export { Authorization } from "./Authorization"
18
+ export { Identifier } from "./Identifier"
19
+ export { Amount } from "./Amount"
20
+ export { Amounts } from "./Amounts"
package/tsconfig.json CHANGED
@@ -7,7 +7,9 @@
7
7
  "outDir": "dist",
8
8
  "baseUrl": ".",
9
9
  "allowSyntheticDefaultImports": true,
10
- "types": []
10
+ "types": [
11
+ "./global.d.ts"
12
+ ]
11
13
  },
12
14
  "files": [
13
15
  "index.ts",
@@ -1,21 +0,0 @@
1
- import { isly } from "isly"
2
- import { Transaction } from "../Transaction"
3
- import { Base } from "./Base"
4
- import { Creatable } from "./Creatable"
5
-
6
- export interface Approved extends Base {
7
- transaction: string
8
- status: "approved"
9
- }
10
-
11
- export namespace Approved {
12
- export const type = Base.type.extend<Approved>({
13
- transaction: isly.string(),
14
- status: isly.string("approved"),
15
- })
16
- export const is = type.is
17
- export const flaw = type.flaw
18
- export function fromCreatable(authorization: Creatable, transaction: Transaction): Approved {
19
- return { ...Base.fromCreatable(authorization), transaction: transaction.id, status: "approved" }
20
- }
21
- }
@@ -1,43 +0,0 @@
1
- import { cryptly } from "cryptly"
2
- import { isoly } from "isoly"
3
- import { isly } from "isly"
4
- import { Acquirer } from "../Acquirer"
5
- import { Merchant } from "../Merchant"
6
- import { Creatable } from "./Creatable"
7
-
8
- export type Base = {
9
- id: cryptly.Identifier
10
- card: string
11
- created: isoly.DateTime
12
- amount: [isoly.Currency, number]
13
- merchant: Merchant
14
- acquirer: Acquirer
15
- reference: string
16
- description: string
17
- }
18
- export namespace Base {
19
- export function fromCreatable(authorization: Creatable): Base {
20
- return {
21
- id: cryptly.Identifier.generate(8),
22
- card: authorization.card,
23
- created: isoly.DateTime.now(),
24
- amount: authorization.amount,
25
- merchant: authorization.merchant,
26
- acquirer: authorization.acquirer,
27
- reference: authorization.reference,
28
- description: authorization.description,
29
- }
30
- }
31
- export const type = isly.object<Base>({
32
- id: isly.fromIs("Authorization.id", cryptly.Identifier.is),
33
- card: isly.string(),
34
- created: isly.fromIs("Authorization.created", isoly.DateTime.is),
35
- amount: isly.tuple(isly.fromIs("isoly.Currency", isoly.Currency.is), isly.number()),
36
- merchant: Merchant.type,
37
- acquirer: Acquirer.type,
38
- reference: isly.string(),
39
- description: isly.string(),
40
- })
41
- export const is = type.is
42
- export const flaw = type.flaw
43
- }
@@ -1,46 +0,0 @@
1
- import { gracely } from "gracely"
2
- import { isly } from "isly"
3
- import { Transaction } from "../Transaction"
4
- import { Base } from "./Base"
5
- import { Creatable } from "./Creatable"
6
-
7
- export interface Failed extends Base {
8
- status: { code: string; reason: string | string[] }
9
- error?: gracely.Error
10
- }
11
-
12
- export namespace Failed {
13
- export const type = Base.type.extend<Failed>({
14
- status: isly.object({ code: isly.string(), reason: isly.union(isly.string(), isly.string().array()) }),
15
- error: isly.fromIs("error", gracely.Error.is).optional(),
16
- })
17
- export const is = type.is
18
- export const flaw = type.flaw
19
- export function fromCreatable(authorization: Creatable, error: gracely.Error): Failed {
20
- return { ...Base.fromCreatable(authorization), ...statusFrom(error), error }
21
- }
22
- export function statusFrom(transaction: gracely.Error): Pick<Failed, "status"> {
23
- let result: Pick<Failed, "status">
24
- if (transaction.error?.includes("Card with id"))
25
- result = { status: { code: "14", reason: "Invalid card number" } }
26
- else if (transaction.error?.includes("must correspond to card limit")) {
27
- result = { status: { code: "13", reason: "Invalid amount" } }
28
- } else if (transaction.error?.includes("Failed to reach account")) {
29
- result = { status: { code: "78", reason: "Invalid/nonexistent account specified (general)" } }
30
- } else if (gracely.client.InvalidContent.is(transaction) && transaction.content.description.includes("rules")) {
31
- const reasons: string[] = transaction.content.details?.notes.reduce(
32
- (a: string[], c: Transaction.Note) => [...a, `${c.created} ${c.author}: ${c.text ?? ""}`],
33
- []
34
- )
35
- result = {
36
- status: {
37
- code: "62", //Restricted card: "This means that the card that you processed is restricted to where it can be used.
38
- //The restricted card is only allowed to be used for certain types of businesses or purchases."
39
- reason: ["Restricted card.", ...reasons],
40
- },
41
- }
42
- } else
43
- result = { status: { code: "05", reason: "Do not honor" } } //default
44
- return result
45
- }
46
- }
@@ -1,87 +0,0 @@
1
- import { isoly } from "isoly"
2
- import { isly } from "isly"
3
- import { Acquirer } from "../Acquirer"
4
- import { Merchant } from "../Merchant"
5
-
6
- export type Entry = Succeeded | Failed
7
-
8
- export interface Succeeded {
9
- status: "succeeded"
10
- type: "capture" | "cancel" | "refund"
11
- account: string
12
- card: { id: string; token: string; iin: string; last4: string }
13
- authorization: string
14
- transaction: { id: string; posted: isoly.DateTime; description: string }
15
- amount: [isoly.Currency, number]
16
- fee: [isoly.Currency, number]
17
- merchant: Merchant
18
- acquirer: Acquirer
19
- }
20
- export interface Failed {
21
- status: "failed"
22
- type?: "capture" | "cancel" | "refund"
23
- account?: string
24
- card?: { id: string; token: string; iin: string; last4: string }
25
- authorization?: string
26
- transaction?: { id: string; posted: isoly.DateTime; description: string }
27
- amount?: [isoly.Currency, number]
28
- fee?: [isoly.Currency, number]
29
- reason?: string
30
- data?: any
31
- }
32
- export namespace Entry {
33
- export namespace Succeeded {
34
- export const type = isly.object<Succeeded>({
35
- status: isly.string("succeeded"),
36
- type: isly.union(isly.string("capture"), isly.string("cancel"), isly.string("refund")),
37
- account: isly.string(),
38
- card: isly.object<{ id: string; token: string; iin: string; last4: string }>({
39
- id: isly.string(),
40
- token: isly.string(),
41
- iin: isly.string(),
42
- last4: isly.string(),
43
- }),
44
- authorization: isly.string(),
45
- transaction: isly.object<{ id: string; posted: string; description: string }>({
46
- id: isly.string(),
47
- posted: isly.fromIs("transaction.posted", isoly.DateTime.is),
48
- description: isly.string(),
49
- }),
50
- amount: isly.tuple(isly.fromIs("Entry.amount", isoly.Currency.is), isly.number()),
51
- fee: isly.tuple(isly.fromIs("Entry.fee", isoly.Currency.is), isly.number()),
52
- merchant: Merchant.type,
53
- acquirer: Acquirer.type,
54
- })
55
- export const is = type.is
56
- }
57
- export namespace Failed {
58
- export const type = isly.object<Failed>({
59
- status: isly.string("failed"),
60
- type: isly.union(isly.string("capture"), isly.string("cancel"), isly.string("refund")).optional(),
61
- account: isly.string().optional(),
62
- card: isly
63
- .object<{ id: string; token: string; iin: string; last4: string }>({
64
- id: isly.string(),
65
- token: isly.string(),
66
- iin: isly.string(),
67
- last4: isly.string(),
68
- })
69
- .optional(),
70
- authorization: isly.string().optional(),
71
- transaction: isly
72
- .object<{ id: string; posted: string; description: string }>({
73
- id: isly.string(),
74
- posted: isly.fromIs("transaction.posted", isoly.DateTime.is),
75
- description: isly.string(),
76
- })
77
- .optional(),
78
- amount: isly.tuple(isly.fromIs("Entry.amount", isoly.Currency.is), isly.number()).optional(),
79
- fee: isly.tuple(isly.fromIs("Entry.fee", isoly.Currency.is), isly.number()).optional(),
80
- reason: isly.string().optional(),
81
- data: isly.any().optional(),
82
- })
83
- export const is = type.is
84
- }
85
- export const type = isly.union<Entry, Succeeded, Failed>(Succeeded.type, Failed.type)
86
- export const is = type.is
87
- }
@@ -1,14 +0,0 @@
1
- import { isly } from "isly";
2
- import { Transaction } from "../Transaction";
3
- import { Base } from "./Base";
4
- import { Creatable } from "./Creatable";
5
- export interface Approved extends Base {
6
- transaction: string;
7
- status: "approved";
8
- }
9
- export declare namespace Approved {
10
- const type: isly.object.ExtendableType<Approved>;
11
- const is: isly.Type.IsFunction<Approved>;
12
- const flaw: isly.Type.FlawFunction;
13
- function fromCreatable(authorization: Creatable, transaction: Transaction): Approved;
14
- }
@@ -1,16 +0,0 @@
1
- import { isly } from "isly";
2
- import { Base } from "./Base";
3
- export var Approved;
4
- (function (Approved) {
5
- Approved.type = Base.type.extend({
6
- transaction: isly.string(),
7
- status: isly.string("approved"),
8
- });
9
- Approved.is = Approved.type.is;
10
- Approved.flaw = Approved.type.flaw;
11
- function fromCreatable(authorization, transaction) {
12
- return { ...Base.fromCreatable(authorization), transaction: transaction.id, status: "approved" };
13
- }
14
- Approved.fromCreatable = fromCreatable;
15
- })(Approved || (Approved = {}));
16
- //# sourceMappingURL=Approved.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Approved.js","sourceRoot":"../","sources":["Authorization/Approved.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAQ7B,MAAM,KAAW,QAAQ,CAUxB;AAVD,WAAiB,QAAQ;IACX,aAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAW;QAC9C,WAAW,EAAE,IAAI,CAAC,MAAM,EAAE;QAC1B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;KAC/B,CAAC,CAAA;IACW,WAAE,GAAG,SAAA,IAAI,CAAC,EAAE,CAAA;IACZ,aAAI,GAAG,SAAA,IAAI,CAAC,IAAI,CAAA;IAC7B,SAAgB,aAAa,CAAC,aAAwB,EAAE,WAAwB;QAC/E,OAAO,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,WAAW,EAAE,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,CAAA;IACjG,CAAC;IAFe,sBAAa,gBAE5B,CAAA;AACF,CAAC,EAVgB,QAAQ,KAAR,QAAQ,QAUxB"}
@@ -1,22 +0,0 @@
1
- import { cryptly } from "cryptly";
2
- import { isoly } from "isoly";
3
- import { isly } from "isly";
4
- import { Acquirer } from "../Acquirer";
5
- import { Merchant } from "../Merchant";
6
- import { Creatable } from "./Creatable";
7
- export type Base = {
8
- id: cryptly.Identifier;
9
- card: string;
10
- created: isoly.DateTime;
11
- amount: [isoly.Currency, number];
12
- merchant: Merchant;
13
- acquirer: Acquirer;
14
- reference: string;
15
- description: string;
16
- };
17
- export declare namespace Base {
18
- function fromCreatable(authorization: Creatable): Base;
19
- const type: isly.object.ExtendableType<Base>;
20
- const is: isly.Type.IsFunction<Base>;
21
- const flaw: isly.Type.FlawFunction;
22
- }