@pax2pay/model-banking 0.1.540 → 0.1.541
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/Settlement/Entry/Creatable.ts +2 -47
- package/Settlement/Entry/index.ts +0 -4
- package/Settlement/index.ts +0 -33
- package/dist/cjs/Client/Transactions/index.d.ts +1 -1
- package/dist/cjs/Rail/index.d.ts +2 -2
- package/dist/cjs/Settlement/Entry/Creatable.d.ts +0 -4
- package/dist/cjs/Settlement/Entry/Creatable.js +2 -47
- package/dist/cjs/Settlement/Entry/Creatable.js.map +1 -1
- package/dist/cjs/Settlement/Entry/index.d.ts +0 -4
- package/dist/cjs/Settlement/Entry/index.js +0 -4
- package/dist/cjs/Settlement/Entry/index.js.map +1 -1
- package/dist/cjs/Settlement/index.d.ts +0 -2
- package/dist/cjs/Settlement/index.js +0 -32
- package/dist/cjs/Settlement/index.js.map +1 -1
- package/dist/mjs/Client/Transactions/index.d.ts +1 -1
- package/dist/mjs/Rail/index.d.ts +2 -2
- package/dist/mjs/Settlement/Entry/Creatable.d.ts +0 -4
- package/dist/mjs/Settlement/Entry/Creatable.js +2 -47
- package/dist/mjs/Settlement/Entry/Creatable.js.map +1 -1
- package/dist/mjs/Settlement/Entry/index.d.ts +0 -4
- package/dist/mjs/Settlement/Entry/index.js +0 -4
- package/dist/mjs/Settlement/Entry/index.js.map +1 -1
- package/dist/mjs/Settlement/index.d.ts +0 -2
- package/dist/mjs/Settlement/index.js +0 -32
- package/dist/mjs/Settlement/index.js.map +1 -1
- package/package.json +1 -1
- package/Settlement/Entry/Legacy/Cancel.ts +0 -42
- package/Settlement/Entry/Legacy/Capture.ts +0 -47
- package/Settlement/Entry/Legacy/Creatable.ts +0 -15
- package/Settlement/Entry/Legacy/Refund.ts +0 -58
- package/Settlement/Entry/Legacy/Unknown.ts +0 -40
- package/Settlement/Entry/Legacy/index.ts +0 -55
- package/Settlement/Entry/fromLegacy.ts +0 -95
- package/dist/cjs/Settlement/Entry/Legacy/Cancel.d.ts +0 -27
- package/dist/cjs/Settlement/Entry/Legacy/Cancel.js +0 -32
- package/dist/cjs/Settlement/Entry/Legacy/Cancel.js.map +0 -1
- package/dist/cjs/Settlement/Entry/Legacy/Capture.d.ts +0 -29
- package/dist/cjs/Settlement/Entry/Legacy/Capture.js +0 -37
- package/dist/cjs/Settlement/Entry/Legacy/Capture.js.map +0 -1
- package/dist/cjs/Settlement/Entry/Legacy/Creatable.d.ts +0 -9
- package/dist/cjs/Settlement/Entry/Legacy/Creatable.js +0 -13
- package/dist/cjs/Settlement/Entry/Legacy/Creatable.js.map +0 -1
- package/dist/cjs/Settlement/Entry/Legacy/Refund.d.ts +0 -36
- package/dist/cjs/Settlement/Entry/Legacy/Refund.js +0 -43
- package/dist/cjs/Settlement/Entry/Legacy/Refund.js.map +0 -1
- package/dist/cjs/Settlement/Entry/Legacy/Unknown.d.ts +0 -24
- package/dist/cjs/Settlement/Entry/Legacy/Unknown.js +0 -32
- package/dist/cjs/Settlement/Entry/Legacy/Unknown.js.map +0 -1
- package/dist/cjs/Settlement/Entry/Legacy/index.d.ts +0 -19
- package/dist/cjs/Settlement/Entry/Legacy/index.js +0 -53
- package/dist/cjs/Settlement/Entry/Legacy/index.js.map +0 -1
- package/dist/cjs/Settlement/Entry/fromLegacy.d.ts +0 -3
- package/dist/cjs/Settlement/Entry/fromLegacy.js +0 -90
- package/dist/cjs/Settlement/Entry/fromLegacy.js.map +0 -1
- package/dist/mjs/Settlement/Entry/Legacy/Cancel.d.ts +0 -27
- package/dist/mjs/Settlement/Entry/Legacy/Cancel.js +0 -29
- package/dist/mjs/Settlement/Entry/Legacy/Cancel.js.map +0 -1
- package/dist/mjs/Settlement/Entry/Legacy/Capture.d.ts +0 -29
- package/dist/mjs/Settlement/Entry/Legacy/Capture.js +0 -34
- package/dist/mjs/Settlement/Entry/Legacy/Capture.js.map +0 -1
- package/dist/mjs/Settlement/Entry/Legacy/Creatable.d.ts +0 -9
- package/dist/mjs/Settlement/Entry/Legacy/Creatable.js +0 -10
- package/dist/mjs/Settlement/Entry/Legacy/Creatable.js.map +0 -1
- package/dist/mjs/Settlement/Entry/Legacy/Refund.d.ts +0 -36
- package/dist/mjs/Settlement/Entry/Legacy/Refund.js +0 -40
- package/dist/mjs/Settlement/Entry/Legacy/Refund.js.map +0 -1
- package/dist/mjs/Settlement/Entry/Legacy/Unknown.d.ts +0 -24
- package/dist/mjs/Settlement/Entry/Legacy/Unknown.js +0 -29
- package/dist/mjs/Settlement/Entry/Legacy/Unknown.js.map +0 -1
- package/dist/mjs/Settlement/Entry/Legacy/index.d.ts +0 -19
- package/dist/mjs/Settlement/Entry/Legacy/index.js +0 -50
- package/dist/mjs/Settlement/Entry/Legacy/index.js.map +0 -1
- package/dist/mjs/Settlement/Entry/fromLegacy.d.ts +0 -3
- package/dist/mjs/Settlement/Entry/fromLegacy.js +0 -87
- package/dist/mjs/Settlement/Entry/fromLegacy.js.map +0 -1
|
@@ -6,7 +6,6 @@ import { Exchange } from "../../Transaction/Exchange"
|
|
|
6
6
|
import { Batch } from "../Batch"
|
|
7
7
|
import { Fee } from "../Fee"
|
|
8
8
|
import { Identifier as SettlementIdentifier } from "../Identifier"
|
|
9
|
-
import { Entry as LegacyEntry } from "./Legacy"
|
|
10
9
|
|
|
11
10
|
export type Creatable = Creatable.Known | Creatable.Unknown
|
|
12
11
|
export namespace Creatable {
|
|
@@ -44,62 +43,18 @@ export namespace Creatable {
|
|
|
44
43
|
type: "capture"
|
|
45
44
|
}
|
|
46
45
|
export namespace Capture {
|
|
47
|
-
export const type = Base.type.extend<Capture>({
|
|
48
|
-
type: isly.string("capture"),
|
|
49
|
-
})
|
|
50
|
-
export function fromLegacy(maybeLegacy: Capture | LegacyEntry.Capture.Creatable): Capture {
|
|
51
|
-
return type.is(maybeLegacy)
|
|
52
|
-
? maybeLegacy
|
|
53
|
-
: {
|
|
54
|
-
type: maybeLegacy.type,
|
|
55
|
-
card: maybeLegacy.authorization.card.id,
|
|
56
|
-
transaction: maybeLegacy.authorization.transaction?.id,
|
|
57
|
-
account: maybeLegacy.authorization.account || "unknown",
|
|
58
|
-
approvalCode: maybeLegacy.authorization.approvalCode ?? "unknown",
|
|
59
|
-
merchant: maybeLegacy.authorization.merchant,
|
|
60
|
-
acquirer: maybeLegacy.authorization.acquirer,
|
|
61
|
-
reference: maybeLegacy.reference,
|
|
62
|
-
batch: maybeLegacy.batch,
|
|
63
|
-
fee: maybeLegacy.fee,
|
|
64
|
-
amount: maybeLegacy.amount,
|
|
65
|
-
settlement: maybeLegacy.settlement ?? "unknown",
|
|
66
|
-
}
|
|
67
|
-
}
|
|
46
|
+
export const type = Base.type.extend<Capture>({ type: isly.string("capture") })
|
|
68
47
|
}
|
|
69
48
|
export interface Refund extends Base {
|
|
70
49
|
type: "refund"
|
|
71
50
|
}
|
|
72
51
|
export namespace Refund {
|
|
73
|
-
export const type = Base.type.extend<Refund>({
|
|
74
|
-
type: isly.string("refund"),
|
|
75
|
-
})
|
|
76
|
-
export function fromLegacy(maybeLegacy: Refund | LegacyEntry.Refund.Creatable): Refund {
|
|
77
|
-
return type.is(maybeLegacy)
|
|
78
|
-
? maybeLegacy
|
|
79
|
-
: {
|
|
80
|
-
type: maybeLegacy.type,
|
|
81
|
-
card: maybeLegacy.card,
|
|
82
|
-
account: maybeLegacy.account ?? "unknown",
|
|
83
|
-
approvalCode: maybeLegacy.authorization.approvalCode ?? "unknown",
|
|
84
|
-
merchant: maybeLegacy.merchant,
|
|
85
|
-
acquirer: maybeLegacy.acquirer,
|
|
86
|
-
reference: maybeLegacy.reference,
|
|
87
|
-
batch: maybeLegacy.batch,
|
|
88
|
-
fee: maybeLegacy.fee,
|
|
89
|
-
amount: maybeLegacy.amount,
|
|
90
|
-
settlement: maybeLegacy.settlement ?? "unknown",
|
|
91
|
-
}
|
|
92
|
-
}
|
|
52
|
+
export const type = Base.type.extend<Refund>({ type: isly.string("refund") })
|
|
93
53
|
}
|
|
94
54
|
export type Known = Capture | Refund
|
|
95
55
|
|
|
96
56
|
export namespace Known {
|
|
97
57
|
export const type = isly.union(Capture.type, Refund.type)
|
|
98
|
-
export function fromLegacy(
|
|
99
|
-
maybeLegacy: Creatable.Known | LegacyEntry.Capture.Creatable | LegacyEntry.Refund.Creatable
|
|
100
|
-
): Creatable.Known {
|
|
101
|
-
return maybeLegacy.type == "capture" ? Capture.fromLegacy(maybeLegacy) : Refund.fromLegacy(maybeLegacy)
|
|
102
|
-
}
|
|
103
58
|
}
|
|
104
59
|
export interface Unknown extends Partial<Base> {
|
|
105
60
|
type: "unknown"
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Creatable as EntryCreatable } from "./Creatable"
|
|
2
2
|
import { Failed as EntryFailed } from "./Failed"
|
|
3
3
|
import { fromCreatable } from "./fromCreatable"
|
|
4
|
-
import { fromLegacy as entryFromLegacy } from "./fromLegacy"
|
|
5
|
-
import { Entry as LegacyEntry } from "./Legacy"
|
|
6
4
|
import { Succeeded as EntrySucceeded } from "./Succeeded"
|
|
7
5
|
import { Summary as EntrySummary } from "./Summary"
|
|
8
6
|
import { type as entryType } from "./type"
|
|
@@ -19,8 +17,6 @@ export namespace Entry {
|
|
|
19
17
|
export import Failed = EntryFailed
|
|
20
18
|
export import Succeeded = EntrySucceeded
|
|
21
19
|
export import Summary = EntrySummary
|
|
22
|
-
export import Legacy = LegacyEntry
|
|
23
20
|
export const type = entryType
|
|
24
|
-
export const fromLegacy = entryFromLegacy
|
|
25
21
|
export const from = fromCreatable
|
|
26
22
|
}
|
package/Settlement/index.ts
CHANGED
|
@@ -65,39 +65,6 @@ export namespace Settlement {
|
|
|
65
65
|
outcome: OldTotal
|
|
66
66
|
settled?: { paid: Amounts; transactions: string[] }
|
|
67
67
|
}
|
|
68
|
-
export type MaybeOld = Settlement | OldSettlement
|
|
69
|
-
export function fromLegacy(settlement: MaybeOld): Settlement {
|
|
70
|
-
let result: Settlement
|
|
71
|
-
if (!type.is(settlement)) {
|
|
72
|
-
const totalToAmount: (currency: isoly.Currency, total?: OldTotal) => Amount = (currency, oldTotal) => ({
|
|
73
|
-
net: oldTotal?.amount[currency] ?? 0,
|
|
74
|
-
fee: { other: oldTotal?.fee.other[currency] ?? 0 },
|
|
75
|
-
})
|
|
76
|
-
const { expected, collected, outcome, settled, ...partialSettlement } = settlement
|
|
77
|
-
const currencies = Array.from(
|
|
78
|
-
new Set<isoly.Currency>([
|
|
79
|
-
...Object.keys(expected?.amount ?? {}),
|
|
80
|
-
...Object.keys(collected?.amount ?? {}),
|
|
81
|
-
...Object.keys(settled?.paid ?? {}),
|
|
82
|
-
...Object.keys(outcome.amount),
|
|
83
|
-
] as isoly.Currency[])
|
|
84
|
-
)
|
|
85
|
-
const totals = currencies.reduce((total, currency) => {
|
|
86
|
-
total[currency] = {
|
|
87
|
-
expected: totalToAmount(currency, expected),
|
|
88
|
-
...(outcome ? { outcome: totalToAmount(currency, outcome) } : {}),
|
|
89
|
-
...(collected
|
|
90
|
-
? { collected: { ...totalToAmount(currency, collected), transactions: { net: "", fee: "", charge: "" } } } //TODO: Find transactions?
|
|
91
|
-
: {}),
|
|
92
|
-
...(settled ? { settled: { net: settled.paid[currency] ?? 0, transactions: settled.transactions } } : {}), //Find transactions?
|
|
93
|
-
}
|
|
94
|
-
return total
|
|
95
|
-
}, {} as Totals)
|
|
96
|
-
result = { ...partialSettlement, totals }
|
|
97
|
-
} else
|
|
98
|
-
result = settlement
|
|
99
|
-
return result
|
|
100
|
-
}
|
|
101
68
|
export const type = SettlementCreatable.type.extend<Settlement>({
|
|
102
69
|
id: isly.union(SettlementIdentifier.type, isly.string()),
|
|
103
70
|
by: isly.string().optional(),
|
|
@@ -50,7 +50,7 @@ export declare namespace Transactions {
|
|
|
50
50
|
end: string | undefined;
|
|
51
51
|
currency: string | undefined;
|
|
52
52
|
organization: string | undefined;
|
|
53
|
-
rail: "paxgiro" | "mastercard" | "diners" | "visa" | "internal" | "paxgiro-credit" | "
|
|
53
|
+
rail: "paxgiro" | "mastercard" | "diners" | "visa" | "internal" | "paxgiro-credit" | "transfer" | "fasterpayments" | "chaps" | "bacs" | "credit" | undefined;
|
|
54
54
|
type: "internal" | "card" | "external" | "system" | undefined;
|
|
55
55
|
}>;
|
|
56
56
|
function parse(query: string | http.Request["search"]): Query;
|
package/dist/cjs/Rail/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Address as RailAddress } from "./Address";
|
|
|
4
4
|
export type Rail = typeof Rail.rails[number];
|
|
5
5
|
export declare namespace Rail {
|
|
6
6
|
const rails: readonly ["internal", "paxgiro", "paxgiro-credit", "mastercard", "diners", "visa", "fasterpayments", "chaps", "bacs", "transfer", "credit"];
|
|
7
|
-
const type: isly.Type<"paxgiro" | "mastercard" | "diners" | "visa" | "internal" | "paxgiro-credit" | "
|
|
8
|
-
const type2: isly2.String<"paxgiro" | "mastercard" | "diners" | "visa" | "internal" | "paxgiro-credit" | "
|
|
7
|
+
const type: isly.Type<"paxgiro" | "mastercard" | "diners" | "visa" | "internal" | "paxgiro-credit" | "transfer" | "fasterpayments" | "chaps" | "bacs" | "credit">;
|
|
8
|
+
const type2: isly2.String<"paxgiro" | "mastercard" | "diners" | "visa" | "internal" | "paxgiro-credit" | "transfer" | "fasterpayments" | "chaps" | "bacs" | "credit">;
|
|
9
9
|
export import Address = RailAddress;
|
|
10
10
|
}
|
|
@@ -6,7 +6,6 @@ import { Exchange } from "../../Transaction/Exchange";
|
|
|
6
6
|
import { Batch } from "../Batch";
|
|
7
7
|
import { Fee } from "../Fee";
|
|
8
8
|
import { Identifier as SettlementIdentifier } from "../Identifier";
|
|
9
|
-
import { Entry as LegacyEntry } from "./Legacy";
|
|
10
9
|
export type Creatable = Creatable.Known | Creatable.Unknown;
|
|
11
10
|
export declare namespace Creatable {
|
|
12
11
|
interface Base {
|
|
@@ -31,19 +30,16 @@ export declare namespace Creatable {
|
|
|
31
30
|
}
|
|
32
31
|
namespace Capture {
|
|
33
32
|
const type: import("isly/dist/cjs/object").IslyObject<Capture, Base>;
|
|
34
|
-
function fromLegacy(maybeLegacy: Capture | LegacyEntry.Capture.Creatable): Capture;
|
|
35
33
|
}
|
|
36
34
|
interface Refund extends Base {
|
|
37
35
|
type: "refund";
|
|
38
36
|
}
|
|
39
37
|
namespace Refund {
|
|
40
38
|
const type: import("isly/dist/cjs/object").IslyObject<Refund, Base>;
|
|
41
|
-
function fromLegacy(maybeLegacy: Refund | LegacyEntry.Refund.Creatable): Refund;
|
|
42
39
|
}
|
|
43
40
|
type Known = Capture | Refund;
|
|
44
41
|
namespace Known {
|
|
45
42
|
const type: isly.Type<Capture | Refund>;
|
|
46
|
-
function fromLegacy(maybeLegacy: Creatable.Known | LegacyEntry.Capture.Creatable | LegacyEntry.Refund.Creatable): Creatable.Known;
|
|
47
43
|
}
|
|
48
44
|
interface Unknown extends Partial<Base> {
|
|
49
45
|
type: "unknown";
|
|
@@ -30,60 +30,15 @@ var Creatable;
|
|
|
30
30
|
})(Base = Creatable.Base || (Creatable.Base = {}));
|
|
31
31
|
let Capture;
|
|
32
32
|
(function (Capture) {
|
|
33
|
-
Capture.type = Base.type.extend({
|
|
34
|
-
type: isly_1.isly.string("capture"),
|
|
35
|
-
});
|
|
36
|
-
function fromLegacy(maybeLegacy) {
|
|
37
|
-
return Capture.type.is(maybeLegacy)
|
|
38
|
-
? maybeLegacy
|
|
39
|
-
: {
|
|
40
|
-
type: maybeLegacy.type,
|
|
41
|
-
card: maybeLegacy.authorization.card.id,
|
|
42
|
-
transaction: maybeLegacy.authorization.transaction?.id,
|
|
43
|
-
account: maybeLegacy.authorization.account || "unknown",
|
|
44
|
-
approvalCode: maybeLegacy.authorization.approvalCode ?? "unknown",
|
|
45
|
-
merchant: maybeLegacy.authorization.merchant,
|
|
46
|
-
acquirer: maybeLegacy.authorization.acquirer,
|
|
47
|
-
reference: maybeLegacy.reference,
|
|
48
|
-
batch: maybeLegacy.batch,
|
|
49
|
-
fee: maybeLegacy.fee,
|
|
50
|
-
amount: maybeLegacy.amount,
|
|
51
|
-
settlement: maybeLegacy.settlement ?? "unknown",
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
Capture.fromLegacy = fromLegacy;
|
|
33
|
+
Capture.type = Base.type.extend({ type: isly_1.isly.string("capture") });
|
|
55
34
|
})(Capture = Creatable.Capture || (Creatable.Capture = {}));
|
|
56
35
|
let Refund;
|
|
57
36
|
(function (Refund) {
|
|
58
|
-
Refund.type = Base.type.extend({
|
|
59
|
-
type: isly_1.isly.string("refund"),
|
|
60
|
-
});
|
|
61
|
-
function fromLegacy(maybeLegacy) {
|
|
62
|
-
return Refund.type.is(maybeLegacy)
|
|
63
|
-
? maybeLegacy
|
|
64
|
-
: {
|
|
65
|
-
type: maybeLegacy.type,
|
|
66
|
-
card: maybeLegacy.card,
|
|
67
|
-
account: maybeLegacy.account ?? "unknown",
|
|
68
|
-
approvalCode: maybeLegacy.authorization.approvalCode ?? "unknown",
|
|
69
|
-
merchant: maybeLegacy.merchant,
|
|
70
|
-
acquirer: maybeLegacy.acquirer,
|
|
71
|
-
reference: maybeLegacy.reference,
|
|
72
|
-
batch: maybeLegacy.batch,
|
|
73
|
-
fee: maybeLegacy.fee,
|
|
74
|
-
amount: maybeLegacy.amount,
|
|
75
|
-
settlement: maybeLegacy.settlement ?? "unknown",
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
Refund.fromLegacy = fromLegacy;
|
|
37
|
+
Refund.type = Base.type.extend({ type: isly_1.isly.string("refund") });
|
|
79
38
|
})(Refund = Creatable.Refund || (Creatable.Refund = {}));
|
|
80
39
|
let Known;
|
|
81
40
|
(function (Known) {
|
|
82
41
|
Known.type = isly_1.isly.union(Capture.type, Refund.type);
|
|
83
|
-
function fromLegacy(maybeLegacy) {
|
|
84
|
-
return maybeLegacy.type == "capture" ? Capture.fromLegacy(maybeLegacy) : Refund.fromLegacy(maybeLegacy);
|
|
85
|
-
}
|
|
86
|
-
Known.fromLegacy = fromLegacy;
|
|
87
42
|
})(Known = Creatable.Known || (Creatable.Known = {}));
|
|
88
43
|
let Unknown;
|
|
89
44
|
(function (Unknown) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Creatable.js","sourceRoot":"","sources":["../../../../Settlement/Entry/Creatable.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;AAC3B,6CAAyC;AACzC,yCAAqC;AACrC,6CAAyC;AACzC,yDAAqD;AACrD,oCAAgC;AAChC,gCAA4B;AAC5B,8CAAkE;
|
|
1
|
+
{"version":3,"file":"Creatable.js","sourceRoot":"","sources":["../../../../Settlement/Entry/Creatable.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;AAC3B,6CAAyC;AACzC,yCAAqC;AACrC,6CAAyC;AACzC,yDAAqD;AACrD,oCAAgC;AAChC,gCAA4B;AAC5B,8CAAkE;AAGlE,IAAiB,SAAS,CA8DzB;AA9DD,WAAiB,SAAS;IAezB,IAAiB,IAAI,CAepB;IAfD,WAAiB,IAAI;QACP,SAAI,GAAG,WAAI,CAAC,MAAM,CAAO;YACrC,IAAI,EAAE,WAAI,CAAC,MAAM,EAAE;YACnB,WAAW,EAAE,WAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YACrC,OAAO,EAAE,WAAI,CAAC,MAAM,EAAE;YACtB,YAAY,EAAE,WAAI,CAAC,MAAM,EAAE;YAC3B,QAAQ,EAAE,mBAAQ,CAAC,IAAI;YACvB,QAAQ,EAAE,mBAAQ,CAAC,IAAI;YACvB,SAAS,EAAE,WAAI,CAAC,MAAM,EAAE;YACxB,KAAK,EAAE,aAAK,CAAC,IAAI;YACjB,GAAG,EAAE,SAAG,CAAC,IAAI;YACb,MAAM,EAAE,eAAM,CAAC,IAAI;YACnB,UAAU,EAAE,uBAAoB,CAAC,IAAI;YACrC,QAAQ,EAAE,mBAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE;SAClC,CAAC,CAAA;IACH,CAAC,EAfgB,IAAI,GAAJ,cAAI,KAAJ,cAAI,Q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,WAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;AACzD,CAAC,EA9DgB,SAAS,yBAAT,SAAS,QA8DzB"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Creatable as EntryCreatable } from "./Creatable";
|
|
2
2
|
import { Failed as EntryFailed } from "./Failed";
|
|
3
3
|
import { fromCreatable } from "./fromCreatable";
|
|
4
|
-
import { fromLegacy as entryFromLegacy } from "./fromLegacy";
|
|
5
|
-
import { Entry as LegacyEntry } from "./Legacy";
|
|
6
4
|
import { Succeeded as EntrySucceeded } from "./Succeeded";
|
|
7
5
|
import { Summary as EntrySummary } from "./Summary";
|
|
8
6
|
export type Entry = EntrySucceeded | EntryFailed;
|
|
@@ -17,8 +15,6 @@ export declare namespace Entry {
|
|
|
17
15
|
export import Failed = EntryFailed;
|
|
18
16
|
export import Succeeded = EntrySucceeded;
|
|
19
17
|
export import Summary = EntrySummary;
|
|
20
|
-
export import Legacy = LegacyEntry;
|
|
21
18
|
const type: import("isly/dist/cjs/Type").Type<Entry>;
|
|
22
|
-
const fromLegacy: typeof entryFromLegacy;
|
|
23
19
|
const from: typeof fromCreatable;
|
|
24
20
|
}
|
|
@@ -4,8 +4,6 @@ exports.Entry = void 0;
|
|
|
4
4
|
const Creatable_1 = require("./Creatable");
|
|
5
5
|
const Failed_1 = require("./Failed");
|
|
6
6
|
const fromCreatable_1 = require("./fromCreatable");
|
|
7
|
-
const fromLegacy_1 = require("./fromLegacy");
|
|
8
|
-
const Legacy_1 = require("./Legacy");
|
|
9
7
|
const Succeeded_1 = require("./Succeeded");
|
|
10
8
|
const Summary_1 = require("./Summary");
|
|
11
9
|
const type_1 = require("./type");
|
|
@@ -15,9 +13,7 @@ var Entry;
|
|
|
15
13
|
Entry.Failed = Failed_1.Failed;
|
|
16
14
|
Entry.Succeeded = Succeeded_1.Succeeded;
|
|
17
15
|
Entry.Summary = Summary_1.Summary;
|
|
18
|
-
Entry.Legacy = Legacy_1.Entry;
|
|
19
16
|
Entry.type = type_1.type;
|
|
20
|
-
Entry.fromLegacy = fromLegacy_1.fromLegacy;
|
|
21
17
|
Entry.from = fromCreatable_1.fromCreatable;
|
|
22
18
|
})(Entry || (exports.Entry = Entry = {}));
|
|
23
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Settlement/Entry/index.ts"],"names":[],"mappings":";;;AAAA,2CAAyD;AACzD,qCAAgD;AAChD,mDAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Settlement/Entry/index.ts"],"names":[],"mappings":";;;AAAA,2CAAyD;AACzD,qCAAgD;AAChD,mDAA+C;AAC/C,2CAAyD;AACzD,uCAAmD;AACnD,iCAA0C;AAG1C,IAAiB,KAAK,CAarB;AAbD,WAAiB,KAAK;IAOP,eAAS,GAAG,qBAAc,CAAA;IAC1B,YAAM,GAAG,eAAW,CAAA;IACpB,eAAS,GAAG,qBAAc,CAAA;IAC1B,aAAO,GAAG,iBAAY,CAAA;IACvB,UAAI,GAAG,WAAS,CAAA;IAChB,UAAI,GAAG,6BAAa,CAAA;AAClC,CAAC,EAbgB,KAAK,qBAAL,KAAK,QAarB"}
|
|
@@ -43,8 +43,6 @@ export declare namespace Settlement {
|
|
|
43
43
|
transactions: string[];
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
|
-
export type MaybeOld = Settlement | OldSettlement;
|
|
47
|
-
export function fromLegacy(settlement: MaybeOld): Settlement;
|
|
48
46
|
export const type: import("isly/dist/cjs/object").IslyObject<Settlement, Creatable>;
|
|
49
47
|
export {};
|
|
50
48
|
}
|
|
@@ -55,38 +55,6 @@ var Settlement;
|
|
|
55
55
|
return result;
|
|
56
56
|
}
|
|
57
57
|
Settlement.compile = compile;
|
|
58
|
-
function fromLegacy(settlement) {
|
|
59
|
-
let result;
|
|
60
|
-
if (!Settlement.type.is(settlement)) {
|
|
61
|
-
const totalToAmount = (currency, oldTotal) => ({
|
|
62
|
-
net: oldTotal?.amount[currency] ?? 0,
|
|
63
|
-
fee: { other: oldTotal?.fee.other[currency] ?? 0 },
|
|
64
|
-
});
|
|
65
|
-
const { expected, collected, outcome, settled, ...partialSettlement } = settlement;
|
|
66
|
-
const currencies = Array.from(new Set([
|
|
67
|
-
...Object.keys(expected?.amount ?? {}),
|
|
68
|
-
...Object.keys(collected?.amount ?? {}),
|
|
69
|
-
...Object.keys(settled?.paid ?? {}),
|
|
70
|
-
...Object.keys(outcome.amount),
|
|
71
|
-
]));
|
|
72
|
-
const totals = currencies.reduce((total, currency) => {
|
|
73
|
-
total[currency] = {
|
|
74
|
-
expected: totalToAmount(currency, expected),
|
|
75
|
-
...(outcome ? { outcome: totalToAmount(currency, outcome) } : {}),
|
|
76
|
-
...(collected
|
|
77
|
-
? { collected: { ...totalToAmount(currency, collected), transactions: { net: "", fee: "", charge: "" } } }
|
|
78
|
-
: {}),
|
|
79
|
-
...(settled ? { settled: { net: settled.paid[currency] ?? 0, transactions: settled.transactions } } : {}),
|
|
80
|
-
};
|
|
81
|
-
return total;
|
|
82
|
-
}, {});
|
|
83
|
-
result = { ...partialSettlement, totals };
|
|
84
|
-
}
|
|
85
|
-
else
|
|
86
|
-
result = settlement;
|
|
87
|
-
return result;
|
|
88
|
-
}
|
|
89
|
-
Settlement.fromLegacy = fromLegacy;
|
|
90
58
|
Settlement.type = Creatable_1.Creatable.type.extend({
|
|
91
59
|
id: isly_1.isly.union(Identifier_1.Identifier.type, isly_1.isly.string()),
|
|
92
60
|
by: isly_1.isly.string().optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../Settlement/index.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAC7B,+BAA2B;AAE3B,sDAAuE;AACvE,qCAAqD;AACrD,mCAAkD;AAClD,2CAA8D;AAC9D,mCAAkD;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AC,CAAA;AACH,CAAC,EArDgB,UAAU,0BAAV,UAAU,QAqD1B"}
|
|
@@ -50,7 +50,7 @@ export declare namespace Transactions {
|
|
|
50
50
|
end: string | undefined;
|
|
51
51
|
currency: string | undefined;
|
|
52
52
|
organization: string | undefined;
|
|
53
|
-
rail: "paxgiro" | "mastercard" | "diners" | "visa" | "internal" | "paxgiro-credit" | "
|
|
53
|
+
rail: "paxgiro" | "mastercard" | "diners" | "visa" | "internal" | "paxgiro-credit" | "transfer" | "fasterpayments" | "chaps" | "bacs" | "credit" | undefined;
|
|
54
54
|
type: "internal" | "card" | "external" | "system" | undefined;
|
|
55
55
|
}>;
|
|
56
56
|
function parse(query: string | http.Request["search"]): Query;
|
package/dist/mjs/Rail/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Address as RailAddress } from "./Address";
|
|
|
4
4
|
export type Rail = typeof Rail.rails[number];
|
|
5
5
|
export declare namespace Rail {
|
|
6
6
|
const rails: readonly ["internal", "paxgiro", "paxgiro-credit", "mastercard", "diners", "visa", "fasterpayments", "chaps", "bacs", "transfer", "credit"];
|
|
7
|
-
const type: isly.Type<"paxgiro" | "mastercard" | "diners" | "visa" | "internal" | "paxgiro-credit" | "
|
|
8
|
-
const type2: isly2.String<"paxgiro" | "mastercard" | "diners" | "visa" | "internal" | "paxgiro-credit" | "
|
|
7
|
+
const type: isly.Type<"paxgiro" | "mastercard" | "diners" | "visa" | "internal" | "paxgiro-credit" | "transfer" | "fasterpayments" | "chaps" | "bacs" | "credit">;
|
|
8
|
+
const type2: isly2.String<"paxgiro" | "mastercard" | "diners" | "visa" | "internal" | "paxgiro-credit" | "transfer" | "fasterpayments" | "chaps" | "bacs" | "credit">;
|
|
9
9
|
export import Address = RailAddress;
|
|
10
10
|
}
|
|
@@ -6,7 +6,6 @@ import { Exchange } from "../../Transaction/Exchange";
|
|
|
6
6
|
import { Batch } from "../Batch";
|
|
7
7
|
import { Fee } from "../Fee";
|
|
8
8
|
import { Identifier as SettlementIdentifier } from "../Identifier";
|
|
9
|
-
import { Entry as LegacyEntry } from "./Legacy";
|
|
10
9
|
export type Creatable = Creatable.Known | Creatable.Unknown;
|
|
11
10
|
export declare namespace Creatable {
|
|
12
11
|
interface Base {
|
|
@@ -31,19 +30,16 @@ export declare namespace Creatable {
|
|
|
31
30
|
}
|
|
32
31
|
namespace Capture {
|
|
33
32
|
const type: import("isly/dist/cjs/object").IslyObject<Capture, Base>;
|
|
34
|
-
function fromLegacy(maybeLegacy: Capture | LegacyEntry.Capture.Creatable): Capture;
|
|
35
33
|
}
|
|
36
34
|
interface Refund extends Base {
|
|
37
35
|
type: "refund";
|
|
38
36
|
}
|
|
39
37
|
namespace Refund {
|
|
40
38
|
const type: import("isly/dist/cjs/object").IslyObject<Refund, Base>;
|
|
41
|
-
function fromLegacy(maybeLegacy: Refund | LegacyEntry.Refund.Creatable): Refund;
|
|
42
39
|
}
|
|
43
40
|
type Known = Capture | Refund;
|
|
44
41
|
namespace Known {
|
|
45
42
|
const type: isly.Type<Capture | Refund>;
|
|
46
|
-
function fromLegacy(maybeLegacy: Creatable.Known | LegacyEntry.Capture.Creatable | LegacyEntry.Refund.Creatable): Creatable.Known;
|
|
47
43
|
}
|
|
48
44
|
interface Unknown extends Partial<Base> {
|
|
49
45
|
type: "unknown";
|
|
@@ -27,60 +27,15 @@ export var Creatable;
|
|
|
27
27
|
})(Base = Creatable.Base || (Creatable.Base = {}));
|
|
28
28
|
let Capture;
|
|
29
29
|
(function (Capture) {
|
|
30
|
-
Capture.type = Base.type.extend({
|
|
31
|
-
type: isly.string("capture"),
|
|
32
|
-
});
|
|
33
|
-
function fromLegacy(maybeLegacy) {
|
|
34
|
-
return Capture.type.is(maybeLegacy)
|
|
35
|
-
? maybeLegacy
|
|
36
|
-
: {
|
|
37
|
-
type: maybeLegacy.type,
|
|
38
|
-
card: maybeLegacy.authorization.card.id,
|
|
39
|
-
transaction: maybeLegacy.authorization.transaction?.id,
|
|
40
|
-
account: maybeLegacy.authorization.account || "unknown",
|
|
41
|
-
approvalCode: maybeLegacy.authorization.approvalCode ?? "unknown",
|
|
42
|
-
merchant: maybeLegacy.authorization.merchant,
|
|
43
|
-
acquirer: maybeLegacy.authorization.acquirer,
|
|
44
|
-
reference: maybeLegacy.reference,
|
|
45
|
-
batch: maybeLegacy.batch,
|
|
46
|
-
fee: maybeLegacy.fee,
|
|
47
|
-
amount: maybeLegacy.amount,
|
|
48
|
-
settlement: maybeLegacy.settlement ?? "unknown",
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
Capture.fromLegacy = fromLegacy;
|
|
30
|
+
Capture.type = Base.type.extend({ type: isly.string("capture") });
|
|
52
31
|
})(Capture = Creatable.Capture || (Creatable.Capture = {}));
|
|
53
32
|
let Refund;
|
|
54
33
|
(function (Refund) {
|
|
55
|
-
Refund.type = Base.type.extend({
|
|
56
|
-
type: isly.string("refund"),
|
|
57
|
-
});
|
|
58
|
-
function fromLegacy(maybeLegacy) {
|
|
59
|
-
return Refund.type.is(maybeLegacy)
|
|
60
|
-
? maybeLegacy
|
|
61
|
-
: {
|
|
62
|
-
type: maybeLegacy.type,
|
|
63
|
-
card: maybeLegacy.card,
|
|
64
|
-
account: maybeLegacy.account ?? "unknown",
|
|
65
|
-
approvalCode: maybeLegacy.authorization.approvalCode ?? "unknown",
|
|
66
|
-
merchant: maybeLegacy.merchant,
|
|
67
|
-
acquirer: maybeLegacy.acquirer,
|
|
68
|
-
reference: maybeLegacy.reference,
|
|
69
|
-
batch: maybeLegacy.batch,
|
|
70
|
-
fee: maybeLegacy.fee,
|
|
71
|
-
amount: maybeLegacy.amount,
|
|
72
|
-
settlement: maybeLegacy.settlement ?? "unknown",
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
Refund.fromLegacy = fromLegacy;
|
|
34
|
+
Refund.type = Base.type.extend({ type: isly.string("refund") });
|
|
76
35
|
})(Refund = Creatable.Refund || (Creatable.Refund = {}));
|
|
77
36
|
let Known;
|
|
78
37
|
(function (Known) {
|
|
79
38
|
Known.type = isly.union(Capture.type, Refund.type);
|
|
80
|
-
function fromLegacy(maybeLegacy) {
|
|
81
|
-
return maybeLegacy.type == "capture" ? Capture.fromLegacy(maybeLegacy) : Refund.fromLegacy(maybeLegacy);
|
|
82
|
-
}
|
|
83
|
-
Known.fromLegacy = fromLegacy;
|
|
84
39
|
})(Known = Creatable.Known || (Creatable.Known = {}));
|
|
85
40
|
let Unknown;
|
|
86
41
|
(function (Unknown) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Creatable.js","sourceRoot":"","sources":["../../../../Settlement/Entry/Creatable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"Creatable.js","sourceRoot":"","sources":["../../../../Settlement/Entry/Creatable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,G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EAFgB,MAAM,GAAN,gBAAM,KAAN,gBAAM,QAEtB;IAGD,IAAiB,KAAK,CAErB;IAFD,WAAiB,KAAK;QACR,UAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;IAC1D,CAAC,EAFgB,KAAK,GAAL,eAAK,KAAL,eAAK,QAErB;IAKD,IAAiB,OAAO,CAQvB;IARD,WAAiB,OAAO;QACV,YAAI,GAAG,IAAI,CAAC,MAAM,CAAU;YACxC,GAAI,MAAM,CAAC,WAAW,CACrB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAClC;YAC3C,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;YAC5B,IAAI,EAAE,IAAI,CAAC,MAAM,CAA0B,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;SACrE,CAAC,CAAA;IACH,CAAC,EARgB,OAAO,GAAP,iBAAO,KAAP,iBAAO,QAQvB;IACY,cAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;AACzD,CAAC,EA9DgB,SAAS,KAAT,SAAS,QA8DzB"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Creatable as EntryCreatable } from "./Creatable";
|
|
2
2
|
import { Failed as EntryFailed } from "./Failed";
|
|
3
3
|
import { fromCreatable } from "./fromCreatable";
|
|
4
|
-
import { fromLegacy as entryFromLegacy } from "./fromLegacy";
|
|
5
|
-
import { Entry as LegacyEntry } from "./Legacy";
|
|
6
4
|
import { Succeeded as EntrySucceeded } from "./Succeeded";
|
|
7
5
|
import { Summary as EntrySummary } from "./Summary";
|
|
8
6
|
export type Entry = EntrySucceeded | EntryFailed;
|
|
@@ -17,8 +15,6 @@ export declare namespace Entry {
|
|
|
17
15
|
export import Failed = EntryFailed;
|
|
18
16
|
export import Succeeded = EntrySucceeded;
|
|
19
17
|
export import Summary = EntrySummary;
|
|
20
|
-
export import Legacy = LegacyEntry;
|
|
21
18
|
const type: import("isly/dist/cjs/Type").Type<Entry>;
|
|
22
|
-
const fromLegacy: typeof entryFromLegacy;
|
|
23
19
|
const from: typeof fromCreatable;
|
|
24
20
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Creatable as EntryCreatable } from "./Creatable";
|
|
2
2
|
import { Failed as EntryFailed } from "./Failed";
|
|
3
3
|
import { fromCreatable } from "./fromCreatable";
|
|
4
|
-
import { fromLegacy as entryFromLegacy } from "./fromLegacy";
|
|
5
|
-
import { Entry as LegacyEntry } from "./Legacy";
|
|
6
4
|
import { Succeeded as EntrySucceeded } from "./Succeeded";
|
|
7
5
|
import { Summary as EntrySummary } from "./Summary";
|
|
8
6
|
import { type as entryType } from "./type";
|
|
@@ -12,9 +10,7 @@ export var Entry;
|
|
|
12
10
|
Entry.Failed = EntryFailed;
|
|
13
11
|
Entry.Succeeded = EntrySucceeded;
|
|
14
12
|
Entry.Summary = EntrySummary;
|
|
15
|
-
Entry.Legacy = LegacyEntry;
|
|
16
13
|
Entry.type = entryType;
|
|
17
|
-
Entry.fromLegacy = entryFromLegacy;
|
|
18
14
|
Entry.from = fromCreatable;
|
|
19
15
|
})(Entry || (Entry = {}));
|
|
20
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Settlement/Entry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Settlement/Entry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,QAAQ,CAAA;AAG1C,MAAM,KAAW,KAAK,CAarB;AAbD,WAAiB,KAAK;IAOP,eAAS,GAAG,cAAc,CAAA;IAC1B,YAAM,GAAG,WAAW,CAAA;IACpB,eAAS,GAAG,cAAc,CAAA;IAC1B,aAAO,GAAG,YAAY,CAAA;IACvB,UAAI,GAAG,SAAS,CAAA;IAChB,UAAI,GAAG,aAAa,CAAA;AAClC,CAAC,EAbgB,KAAK,KAAL,KAAK,QAarB"}
|
|
@@ -43,8 +43,6 @@ export declare namespace Settlement {
|
|
|
43
43
|
transactions: string[];
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
|
-
export type MaybeOld = Settlement | OldSettlement;
|
|
47
|
-
export function fromLegacy(settlement: MaybeOld): Settlement;
|
|
48
46
|
export const type: import("isly/dist/cjs/object").IslyObject<Settlement, Creatable>;
|
|
49
47
|
export {};
|
|
50
48
|
}
|
|
@@ -52,38 +52,6 @@ export var Settlement;
|
|
|
52
52
|
return result;
|
|
53
53
|
}
|
|
54
54
|
Settlement.compile = compile;
|
|
55
|
-
function fromLegacy(settlement) {
|
|
56
|
-
let result;
|
|
57
|
-
if (!Settlement.type.is(settlement)) {
|
|
58
|
-
const totalToAmount = (currency, oldTotal) => ({
|
|
59
|
-
net: oldTotal?.amount[currency] ?? 0,
|
|
60
|
-
fee: { other: oldTotal?.fee.other[currency] ?? 0 },
|
|
61
|
-
});
|
|
62
|
-
const { expected, collected, outcome, settled, ...partialSettlement } = settlement;
|
|
63
|
-
const currencies = Array.from(new Set([
|
|
64
|
-
...Object.keys(expected?.amount ?? {}),
|
|
65
|
-
...Object.keys(collected?.amount ?? {}),
|
|
66
|
-
...Object.keys(settled?.paid ?? {}),
|
|
67
|
-
...Object.keys(outcome.amount),
|
|
68
|
-
]));
|
|
69
|
-
const totals = currencies.reduce((total, currency) => {
|
|
70
|
-
total[currency] = {
|
|
71
|
-
expected: totalToAmount(currency, expected),
|
|
72
|
-
...(outcome ? { outcome: totalToAmount(currency, outcome) } : {}),
|
|
73
|
-
...(collected
|
|
74
|
-
? { collected: { ...totalToAmount(currency, collected), transactions: { net: "", fee: "", charge: "" } } }
|
|
75
|
-
: {}),
|
|
76
|
-
...(settled ? { settled: { net: settled.paid[currency] ?? 0, transactions: settled.transactions } } : {}),
|
|
77
|
-
};
|
|
78
|
-
return total;
|
|
79
|
-
}, {});
|
|
80
|
-
result = { ...partialSettlement, totals };
|
|
81
|
-
}
|
|
82
|
-
else
|
|
83
|
-
result = settlement;
|
|
84
|
-
return result;
|
|
85
|
-
}
|
|
86
|
-
Settlement.fromLegacy = fromLegacy;
|
|
87
55
|
Settlement.type = SettlementCreatable.type.extend({
|
|
88
56
|
id: isly.union(SettlementIdentifier.type, isly.string()),
|
|
89
57
|
by: isly.string().optional(),
|
|
@@ -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;AAE3B,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACv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