@pax2pay/model-banking 0.1.260 → 0.1.262
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/Amount.ts +21 -0
- package/Settlement/Creatable.ts +3 -3
- package/Settlement/Entry/Capture.ts +1 -1
- package/Settlement/Entry/index.ts +0 -7
- package/Settlement/Total.ts +72 -24
- package/Settlement/Totals.ts +54 -0
- package/Settlement/index.ts +49 -39
- package/Treasury/Snapshot/Emoney.ts +11 -0
- package/Treasury/Snapshot/index.ts +2 -0
- package/Treasury/index.ts +1 -0
- package/dist/Settlement/Amount.d.ts +12 -0
- package/dist/Settlement/Amount.js +17 -0
- package/dist/Settlement/Amount.js.map +1 -0
- package/dist/Settlement/Creatable.d.ts +2 -2
- package/dist/Settlement/Creatable.js +2 -2
- package/dist/Settlement/Creatable.js.map +1 -1
- package/dist/Settlement/Entry/index.d.ts +0 -2
- package/dist/Settlement/Entry/index.js +0 -8
- package/dist/Settlement/Entry/index.js.map +1 -1
- package/dist/Settlement/Total.d.ts +25 -13
- package/dist/Settlement/Total.js +62 -23
- package/dist/Settlement/Total.js.map +1 -1
- package/dist/Settlement/Totals.d.ts +13 -0
- package/dist/Settlement/Totals.js +48 -0
- package/dist/Settlement/Totals.js.map +1 -0
- package/dist/Settlement/index.d.ts +39 -25
- package/dist/Settlement/index.js +39 -37
- package/dist/Settlement/index.js.map +1 -1
- package/dist/Treasury/Snapshot/Emoney.d.ts +10 -0
- package/dist/Treasury/Snapshot/Emoney.js +2 -0
- package/dist/Treasury/Snapshot/Emoney.js.map +1 -0
- package/dist/Treasury/Snapshot/index.d.ts +2 -0
- package/dist/Treasury/Snapshot/index.js.map +1 -1
- package/dist/Treasury/index.d.ts +1 -0
- package/dist/Treasury/index.js.map +1 -1
- package/package.json +1 -1
- package/Settlement/Settled.ts +0 -16
- package/dist/Settlement/Settled.d.ts +0 -11
- package/dist/Settlement/Settled.js +0 -12
- package/dist/Settlement/Settled.js.map +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isoly } from "isoly"
|
|
2
|
+
import { isly } from "isly"
|
|
3
|
+
|
|
4
|
+
export type Amount = {
|
|
5
|
+
net: number
|
|
6
|
+
fee: {
|
|
7
|
+
other: number
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export namespace Amount {
|
|
11
|
+
export const type = isly.object<Amount>({
|
|
12
|
+
net: isly.number(),
|
|
13
|
+
fee: isly.object<Amount["fee"]>({ other: isly.number() }),
|
|
14
|
+
})
|
|
15
|
+
export function add(currency: isoly.Currency, addendee: Amount, addend: Partial<Amount>): Amount {
|
|
16
|
+
const result = { ...addendee }
|
|
17
|
+
result.net = isoly.Currency.add(currency, result.net, addend.net ?? 0)
|
|
18
|
+
result.fee.other = isoly.Currency.add(currency, result.fee.other, addend.fee?.other ?? 0)
|
|
19
|
+
return result
|
|
20
|
+
}
|
|
21
|
+
}
|
package/Settlement/Creatable.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { isly } from "isly"
|
|
2
2
|
import { Card } from "../Card"
|
|
3
3
|
import { Batch } from "./Batch"
|
|
4
|
-
import {
|
|
4
|
+
import { Totals } from "./Totals"
|
|
5
5
|
|
|
6
6
|
export interface Creatable {
|
|
7
|
-
|
|
7
|
+
totals: Totals
|
|
8
8
|
processor: Card.Stack
|
|
9
9
|
references?: string[] //File name
|
|
10
10
|
batch: Batch
|
|
@@ -12,7 +12,7 @@ export interface Creatable {
|
|
|
12
12
|
|
|
13
13
|
export namespace Creatable {
|
|
14
14
|
export const type = isly.object<Creatable>({
|
|
15
|
-
|
|
15
|
+
totals: Totals.type,
|
|
16
16
|
processor: Card.Stack.type,
|
|
17
17
|
references: isly.string().array().optional(),
|
|
18
18
|
batch: Batch.type,
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { gracely } from "gracely"
|
|
2
2
|
import { isly } from "isly"
|
|
3
|
-
import { Amount } from "../../Amount"
|
|
4
3
|
import { Transaction } from "../../Transaction"
|
|
5
|
-
import { Total } from "../Total"
|
|
6
4
|
import { Cancel as EntryCancel } from "./Cancel"
|
|
7
5
|
import { Capture as EntryCapture } from "./Capture"
|
|
8
6
|
import { Creatable as EntryCreatable } from "./Creatable"
|
|
@@ -38,11 +36,6 @@ export namespace Entry {
|
|
|
38
36
|
export const Summary = EntrySummary
|
|
39
37
|
export type Creatable = EntryCreatable
|
|
40
38
|
export const Creatable = EntryCreatable
|
|
41
|
-
export function compile(entry: Entry): Total {
|
|
42
|
-
return entry.type == "unknown"
|
|
43
|
-
? Total.initiate()
|
|
44
|
-
: Total.initiate({ amount: Amount.toAmounts(entry.amount), fee: entry.fee })
|
|
45
|
-
}
|
|
46
39
|
export function from(creatable: Entry.Creatable, transaction: Transaction | gracely.Error | string): Entry {
|
|
47
40
|
let result: Entry
|
|
48
41
|
if (!Transaction.is(transaction) || transaction.status != "finalized")
|
package/Settlement/Total.ts
CHANGED
|
@@ -1,34 +1,82 @@
|
|
|
1
|
+
import { isoly } from "isoly"
|
|
1
2
|
import { isly } from "isly"
|
|
2
|
-
import {
|
|
3
|
-
import { Transaction } from "../Transaction"
|
|
4
|
-
import { Fee } from "./Fee"
|
|
3
|
+
import { Amount } from "./Amount"
|
|
5
4
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export interface Total {
|
|
6
|
+
expected: Amount
|
|
7
|
+
outcome?: Amount
|
|
8
|
+
collected?: Amount & { transactions: { net: string; fee: string } }
|
|
9
|
+
settled?: Total.Settled
|
|
9
10
|
}
|
|
10
11
|
export namespace Total {
|
|
11
|
-
export
|
|
12
|
-
|
|
12
|
+
export type Settled = {
|
|
13
|
+
net: number
|
|
14
|
+
transactions: string[]
|
|
13
15
|
}
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
+
export const Settled = isly.object<Settled>({ net: isly.number(), transactions: isly.string().array() })
|
|
17
|
+
export const type = isly.object<Total>({
|
|
18
|
+
expected: Amount.type,
|
|
19
|
+
outcome: Amount.type.optional(),
|
|
20
|
+
collected: Amount.type
|
|
21
|
+
.extend<Required<Total>["collected"]>({
|
|
22
|
+
transactions: isly.object<Required<Total>["collected"]["transactions"]>({
|
|
23
|
+
net: isly.string(),
|
|
24
|
+
fee: isly.string(),
|
|
25
|
+
}),
|
|
26
|
+
})
|
|
27
|
+
.optional(),
|
|
28
|
+
settled: Settled.optional(),
|
|
29
|
+
})
|
|
30
|
+
export function create(): Total {
|
|
31
|
+
return { expected: { net: 0, fee: { other: 0 } } }
|
|
16
32
|
}
|
|
17
|
-
export function
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
export function verify(total: Total, type: "outcome" | "collected" | "settled"): boolean {
|
|
34
|
+
let result: boolean
|
|
35
|
+
switch (type) {
|
|
36
|
+
case "outcome":
|
|
37
|
+
result = total.outcome?.net == total.expected.net && total.outcome.fee.other == total.expected.fee.other
|
|
38
|
+
break
|
|
39
|
+
case "collected":
|
|
40
|
+
result = total.collected?.net == total.outcome?.net && total.collected?.fee.other == total.outcome?.fee.other
|
|
41
|
+
break
|
|
42
|
+
case "settled":
|
|
43
|
+
result = total.settled?.net == total.collected?.net
|
|
44
|
+
break
|
|
28
45
|
}
|
|
29
46
|
return result
|
|
30
47
|
}
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
|
|
48
|
+
export function add(currency: isoly.Currency, addendee: Total, addend: Partial<Total>): Total {
|
|
49
|
+
const result: Total = { ...addendee }
|
|
50
|
+
addend.expected && (result.expected = Amount.add(currency, result.expected, addend.expected))
|
|
51
|
+
if (result.outcome || addend.outcome)
|
|
52
|
+
result.outcome = Amount.add(currency, result.outcome ?? { net: 0, fee: { other: 0 } }, addend.outcome ?? {})
|
|
53
|
+
if (result.collected || addend.collected)
|
|
54
|
+
result.collected = {
|
|
55
|
+
...Amount.add(currency, result.collected ?? { net: 0, fee: { other: 0 } }, addend.collected ?? {}),
|
|
56
|
+
transactions: {
|
|
57
|
+
net: addend.collected?.transactions.net ?? result.collected?.transactions.net ?? "",
|
|
58
|
+
fee: addend.collected?.transactions.fee ?? result.collected?.transactions.fee ?? "",
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
if (result.settled || addend.settled)
|
|
62
|
+
result.settled = {
|
|
63
|
+
net: isoly.Currency.add(currency, result.settled?.net ?? 0, addend.settled?.net ?? 0),
|
|
64
|
+
transactions: (result.settled?.transactions ?? []).concat(addend.settled?.transactions ?? []),
|
|
65
|
+
}
|
|
66
|
+
return result
|
|
67
|
+
}
|
|
68
|
+
export function collect(
|
|
69
|
+
currency: isoly.Currency,
|
|
70
|
+
total: Total,
|
|
71
|
+
collected: Amount,
|
|
72
|
+
transactions: { net: string; fee: string }
|
|
73
|
+
): Total {
|
|
74
|
+
const result = { ...total }
|
|
75
|
+
if (result.collected) {
|
|
76
|
+
result.collected.net = isoly.Currency.add(currency, result.collected.net, collected.net)
|
|
77
|
+
result.collected.fee.other = isoly.Currency.add(currency, result.collected.fee.other, collected.fee.other)
|
|
78
|
+
} else
|
|
79
|
+
result.collected = { ...collected, transactions }
|
|
80
|
+
return result
|
|
81
|
+
}
|
|
34
82
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { isoly } from "isoly"
|
|
2
|
+
import { isly } from "isly"
|
|
3
|
+
import type { Collect } from "../Transaction/Collect"
|
|
4
|
+
import { Amount } from "./Amount"
|
|
5
|
+
import { Entry } from "./Entry"
|
|
6
|
+
import { Total } from "./Total"
|
|
7
|
+
|
|
8
|
+
export type Totals = Partial<Record<isoly.Currency, Total>>
|
|
9
|
+
export namespace Totals {
|
|
10
|
+
export const type = isly.record<isoly.Currency, Total>(isly.string(isoly.Currency.types), Total.type)
|
|
11
|
+
export function addEntry(totals: Totals, entry: Entry): Totals {
|
|
12
|
+
const result = { ...totals }
|
|
13
|
+
if (entry.status == "succeeded" && (entry.type == "capture" || entry.type == "refund")) {
|
|
14
|
+
result[entry.amount[0]] = Total.add(entry.amount[0], result[entry.amount[0]] ?? Total.create(), {
|
|
15
|
+
outcome: {
|
|
16
|
+
net: entry.amount[1],
|
|
17
|
+
// TODO: other currencies in fees
|
|
18
|
+
fee: { other: entry.fee.other[entry.amount[0]] ?? 0 },
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
return result
|
|
23
|
+
}
|
|
24
|
+
export function verify(totals: Totals, type: "outcome" | "collected" | "settled"): boolean {
|
|
25
|
+
return Object.values(totals).every(t => Total.verify(t, type))
|
|
26
|
+
}
|
|
27
|
+
export function add(addendee: Totals, addends: Partial<Record<isoly.Currency, Partial<Total>>>): Totals {
|
|
28
|
+
const result = { ...addendee }
|
|
29
|
+
for (const [currency, addend] of Object.entries(addends) as [isoly.Currency, Partial<Total>][]) {
|
|
30
|
+
result[currency] = Total.add(currency, result[currency] ?? Total.create(), addend)
|
|
31
|
+
}
|
|
32
|
+
return result
|
|
33
|
+
}
|
|
34
|
+
// TODO: update this for new collection method
|
|
35
|
+
export function collect(totals: Totals, collect: Collect): Totals {
|
|
36
|
+
const result: Totals = { ...totals }
|
|
37
|
+
for (const [currency, counterbalance] of Object.entries(collect.counterbalances)) {
|
|
38
|
+
const collected: Amount = { net: 0, fee: { other: 0 } }
|
|
39
|
+
for (const [entry, amount] of Object.entries(counterbalance)) {
|
|
40
|
+
if (entry.startsWith("fee"))
|
|
41
|
+
collected.fee.other = isoly.Currency.add(currency as isoly.Currency, collected.fee.other, amount ?? 0)
|
|
42
|
+
else if (entry.startsWith("settle"))
|
|
43
|
+
collected.net = isoly.Currency.add(currency as isoly.Currency, collected.net, amount ?? 0)
|
|
44
|
+
}
|
|
45
|
+
result[currency as isoly.Currency] = Total.collect(
|
|
46
|
+
currency as isoly.Currency,
|
|
47
|
+
result[currency as isoly.Currency] ?? Total.create(),
|
|
48
|
+
collected,
|
|
49
|
+
{ net: "", fee: "" }
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
return result
|
|
53
|
+
}
|
|
54
|
+
}
|
package/Settlement/index.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { isoly } from "isoly"
|
|
2
2
|
import { isly } from "isly"
|
|
3
|
-
import {
|
|
3
|
+
import { Amounts } from "../Amounts"
|
|
4
4
|
import { Identifier } from "../Identifier"
|
|
5
|
+
import { Amount as SettlementAmount } from "./Amount"
|
|
5
6
|
import { Batch as SettlementBatch } from "./Batch"
|
|
6
7
|
import { Creatable as SettlementCreatable } from "./Creatable"
|
|
7
8
|
import { Entry as SettlementEntry } from "./Entry"
|
|
8
9
|
import { Fee as SettlementFee } from "./Fee"
|
|
9
|
-
import { Settled as SettlementSettled } from "./Settled"
|
|
10
10
|
import { Status } from "./Status"
|
|
11
11
|
import { Total as SettlementTotal } from "./Total"
|
|
12
|
+
import { Totals as SettlementTotals } from "./Totals"
|
|
12
13
|
|
|
13
14
|
export interface Settlement extends Settlement.Creatable {
|
|
14
15
|
id: string
|
|
15
16
|
by?: string
|
|
16
17
|
created: isoly.DateTime
|
|
17
18
|
status: Status
|
|
18
|
-
collected?: Settlement.Total
|
|
19
|
-
outcome: Settlement.Total
|
|
20
|
-
settled?: Settlement.Settled
|
|
21
19
|
entries: Settlement.Entry.Summary
|
|
22
20
|
}
|
|
23
21
|
export namespace Settlement {
|
|
24
|
-
export type Settled = SettlementSettled
|
|
25
|
-
export const Settled = SettlementSettled
|
|
26
22
|
export const Total = SettlementTotal
|
|
27
23
|
export type Total = SettlementTotal
|
|
24
|
+
export const Totals = SettlementTotals
|
|
25
|
+
export type Totals = SettlementTotals
|
|
26
|
+
export const Amount = SettlementAmount
|
|
27
|
+
export type Amount = SettlementAmount
|
|
28
28
|
export const Fee = SettlementFee
|
|
29
29
|
export type Fee = SettlementFee
|
|
30
30
|
export type Creatable = SettlementCreatable
|
|
@@ -53,25 +53,11 @@ export namespace Settlement {
|
|
|
53
53
|
export type Creatable = SettlementEntry.Unknown.Creatable
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
export function
|
|
56
|
+
export function from(creatable: Settlement.Creatable, by: string): Settlement {
|
|
57
57
|
return {
|
|
58
|
-
id:
|
|
59
|
-
by,
|
|
60
|
-
created: isoly.DateTime.now(),
|
|
61
|
-
batch,
|
|
62
|
-
processor,
|
|
63
|
-
status: { collected: "pending", settled: "pending" },
|
|
64
|
-
expected: Total.initiate(),
|
|
65
|
-
outcome: Total.initiate(),
|
|
66
|
-
entries: { count: 0 },
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
export function from(id: string, creatable: Settlement.Creatable, by: string): Settlement {
|
|
70
|
-
return {
|
|
71
|
-
id,
|
|
58
|
+
id: Identifier.generate(),
|
|
72
59
|
status: { collected: "pending", settled: "pending" },
|
|
73
60
|
by,
|
|
74
|
-
outcome: Total.initiate(),
|
|
75
61
|
...creatable,
|
|
76
62
|
created: isoly.DateTime.now(),
|
|
77
63
|
entries: { count: 0 },
|
|
@@ -82,7 +68,7 @@ export namespace Settlement {
|
|
|
82
68
|
for (const entry of entries) {
|
|
83
69
|
switch (entry.status) {
|
|
84
70
|
case "succeeded":
|
|
85
|
-
result.
|
|
71
|
+
result.totals = Totals.addEntry(result.totals, entry)
|
|
86
72
|
result.entries.count++
|
|
87
73
|
break
|
|
88
74
|
case "failed":
|
|
@@ -92,28 +78,52 @@ export namespace Settlement {
|
|
|
92
78
|
}
|
|
93
79
|
return result
|
|
94
80
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
81
|
+
type OldTotal = { amount: Amounts; fee: Fee }
|
|
82
|
+
export type OldSettlement = Omit<Settlement, "totals"> & {
|
|
83
|
+
expected?: OldTotal
|
|
84
|
+
collected?: OldTotal
|
|
85
|
+
outcome: OldTotal
|
|
86
|
+
settled?: { paid: Amounts; transactions: string[] }
|
|
87
|
+
}
|
|
88
|
+
export type MaybeOld = Settlement | OldSettlement
|
|
89
|
+
export function fromLegacy(settlement: MaybeOld): Settlement {
|
|
90
|
+
let result: Settlement
|
|
91
|
+
if (!is(settlement)) {
|
|
92
|
+
const totalToAmount: (currency: isoly.Currency, total?: OldTotal) => Amount = (currency, oldTotal) => ({
|
|
93
|
+
net: oldTotal?.amount[currency] ?? 0,
|
|
94
|
+
fee: { other: oldTotal?.fee.other[currency] ?? 0 },
|
|
95
|
+
})
|
|
96
|
+
const { expected, collected, outcome, settled, ...partialSettlement } = settlement
|
|
97
|
+
const currencies = Array.from(
|
|
98
|
+
new Set<isoly.Currency>([
|
|
99
|
+
...Object.keys(expected?.amount ?? {}),
|
|
100
|
+
...Object.keys(collected?.amount ?? {}),
|
|
101
|
+
...Object.keys(settled?.paid ?? {}),
|
|
102
|
+
...Object.keys(outcome.amount),
|
|
103
|
+
] as isoly.Currency[])
|
|
104
|
+
)
|
|
105
|
+
const totals = currencies.reduce((total, currency) => {
|
|
106
|
+
total[currency] = {
|
|
107
|
+
expected: totalToAmount(currency, expected),
|
|
108
|
+
...(outcome ? { outcome: totalToAmount(currency, outcome) } : {}),
|
|
109
|
+
...(collected
|
|
110
|
+
? { collected: { ...totalToAmount(currency, collected), transactions: { net: "", fee: "" } } } //TODO: Find transactions?
|
|
111
|
+
: {}),
|
|
112
|
+
...(settled ? { settled: { net: settled.paid[currency] ?? 0, transactions: settled.transactions } } : {}), //Find transactions?
|
|
113
|
+
}
|
|
114
|
+
return total
|
|
115
|
+
}, {} as Totals)
|
|
116
|
+
result = { ...partialSettlement, totals }
|
|
117
|
+
} else {
|
|
118
|
+
result = settlement
|
|
107
119
|
}
|
|
120
|
+
return result
|
|
108
121
|
}
|
|
109
122
|
export const type = SettlementCreatable.type.extend<Settlement>({
|
|
110
123
|
id: isly.string(),
|
|
111
124
|
by: isly.string().optional(),
|
|
112
125
|
created: isly.fromIs("isoly.DateTime", isoly.DateTime.is),
|
|
113
126
|
status: Status.type,
|
|
114
|
-
collected: Settlement.Total.type.optional(),
|
|
115
|
-
outcome: Settlement.Total.type,
|
|
116
|
-
settled: Settled.type.optional(),
|
|
117
127
|
entries: Settlement.Entry.Summary.type,
|
|
118
128
|
})
|
|
119
129
|
export const is = type.is
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { isoly } from "isoly"
|
|
2
|
+
import { Balances } from "../../Balances"
|
|
3
|
+
import { Counterbalances2 } from "../../Counterbalances2"
|
|
4
|
+
|
|
5
|
+
export interface Emoney {
|
|
6
|
+
organization: string
|
|
7
|
+
account: string
|
|
8
|
+
timestamp: isoly.DateTime
|
|
9
|
+
balances: Balances
|
|
10
|
+
counterbalances: Counterbalances2
|
|
11
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isoly } from "isoly"
|
|
2
2
|
import { isly } from "isly"
|
|
3
|
+
import { Emoney as SnapshotEmoney } from "./Emoney"
|
|
3
4
|
import { Fragment as SnapshotFragment } from "./Fragment"
|
|
4
5
|
import { Warning as SnapshotWarning } from "./Warning"
|
|
5
6
|
|
|
@@ -10,5 +11,6 @@ export namespace Snapshot {
|
|
|
10
11
|
export const Fragment = SnapshotFragment
|
|
11
12
|
export type Warning = SnapshotWarning
|
|
12
13
|
export const Warning = SnapshotWarning
|
|
14
|
+
export type Emoney = SnapshotEmoney
|
|
13
15
|
export const type = isly.record(isly.fromIs("Currency", isoly.Currency.is), Fragment.type)
|
|
14
16
|
}
|
package/Treasury/index.ts
CHANGED
|
@@ -22,6 +22,7 @@ export namespace Treasury {
|
|
|
22
22
|
export namespace Snapshot {
|
|
23
23
|
export type Fragment = TreasurySnapshot.Fragment
|
|
24
24
|
export type Warning = TreasurySnapshot.Warning
|
|
25
|
+
export type Emoney = TreasurySnapshot.Emoney
|
|
25
26
|
}
|
|
26
27
|
export namespace Account {
|
|
27
28
|
export type Creatable = TreasuryAccount.Creatable
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { isoly } from "isoly";
|
|
2
|
+
import { isly } from "isly";
|
|
3
|
+
export type Amount = {
|
|
4
|
+
net: number;
|
|
5
|
+
fee: {
|
|
6
|
+
other: number;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare namespace Amount {
|
|
10
|
+
const type: isly.object.ExtendableType<Amount>;
|
|
11
|
+
function add(currency: isoly.Currency, addendee: Amount, addend: Partial<Amount>): Amount;
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { isoly } from "isoly";
|
|
2
|
+
import { isly } from "isly";
|
|
3
|
+
export var Amount;
|
|
4
|
+
(function (Amount) {
|
|
5
|
+
Amount.type = isly.object({
|
|
6
|
+
net: isly.number(),
|
|
7
|
+
fee: isly.object({ other: isly.number() }),
|
|
8
|
+
});
|
|
9
|
+
function add(currency, addendee, addend) {
|
|
10
|
+
const result = { ...addendee };
|
|
11
|
+
result.net = isoly.Currency.add(currency, result.net, addend.net ?? 0);
|
|
12
|
+
result.fee.other = isoly.Currency.add(currency, result.fee.other, addend.fee?.other ?? 0);
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
Amount.add = add;
|
|
16
|
+
})(Amount || (Amount = {}));
|
|
17
|
+
//# sourceMappingURL=Amount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Amount.js","sourceRoot":"../","sources":["Settlement/Amount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAQ3B,MAAM,KAAW,MAAM,CAWtB;AAXD,WAAiB,MAAM;IACT,WAAI,GAAG,IAAI,CAAC,MAAM,CAAS;QACvC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE;QAClB,GAAG,EAAE,IAAI,CAAC,MAAM,CAAgB,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;KACzD,CAAC,CAAA;IACF,SAAgB,GAAG,CAAC,QAAwB,EAAE,QAAgB,EAAE,MAAuB;QACtF,MAAM,MAAM,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAA;QAC9B,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;QACtE,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,EAAE,KAAK,IAAI,CAAC,CAAC,CAAA;QACzF,OAAO,MAAM,CAAA;IACd,CAAC;IALe,UAAG,MAKlB,CAAA;AACF,CAAC,EAXgB,MAAM,KAAN,MAAM,QAWtB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { isly } from "isly";
|
|
2
2
|
import { Card } from "../Card";
|
|
3
3
|
import { Batch } from "./Batch";
|
|
4
|
-
import {
|
|
4
|
+
import { Totals } from "./Totals";
|
|
5
5
|
export interface Creatable {
|
|
6
|
-
|
|
6
|
+
totals: Totals;
|
|
7
7
|
processor: Card.Stack;
|
|
8
8
|
references?: string[];
|
|
9
9
|
batch: Batch;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { isly } from "isly";
|
|
2
2
|
import { Card } from "../Card";
|
|
3
3
|
import { Batch } from "./Batch";
|
|
4
|
-
import {
|
|
4
|
+
import { Totals } from "./Totals";
|
|
5
5
|
export var Creatable;
|
|
6
6
|
(function (Creatable) {
|
|
7
7
|
Creatable.type = isly.object({
|
|
8
|
-
|
|
8
|
+
totals: Totals.type,
|
|
9
9
|
processor: Card.Stack.type,
|
|
10
10
|
references: isly.string().array().optional(),
|
|
11
11
|
batch: Batch.type,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Creatable.js","sourceRoot":"../","sources":["Settlement/Creatable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Creatable.js","sourceRoot":"../","sources":["Settlement/Creatable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AASjC,MAAM,KAAW,SAAS,CASzB;AATD,WAAiB,SAAS;IACZ,cAAI,GAAG,IAAI,CAAC,MAAM,CAAY;QAC1C,MAAM,EAAE,MAAM,CAAC,IAAI;QACnB,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;QAC1B,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;QAC5C,KAAK,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC,CAAA;IACW,YAAE,GAAG,UAAA,IAAI,CAAC,EAAE,CAAA;IACZ,cAAI,GAAG,UAAA,IAAI,CAAC,IAAI,CAAA;AAC9B,CAAC,EATgB,SAAS,KAAT,SAAS,QASzB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { gracely } from "gracely";
|
|
2
2
|
import { isly } from "isly";
|
|
3
3
|
import { Transaction } from "../../Transaction";
|
|
4
|
-
import { Total } from "../Total";
|
|
5
4
|
import { Cancel as EntryCancel } from "./Cancel";
|
|
6
5
|
import { Capture as EntryCapture } from "./Capture";
|
|
7
6
|
import { Creatable as EntryCreatable } from "./Creatable";
|
|
@@ -35,7 +34,6 @@ export declare namespace Entry {
|
|
|
35
34
|
const Summary: typeof EntrySummary;
|
|
36
35
|
type Creatable = EntryCreatable;
|
|
37
36
|
const Creatable: typeof EntryCreatable;
|
|
38
|
-
function compile(entry: Entry): Total;
|
|
39
37
|
function from(creatable: Entry.Creatable, transaction: Transaction | gracely.Error | string): Entry;
|
|
40
38
|
const type: isly.Type<Entry>;
|
|
41
39
|
const is: isly.Type.IsFunction<Entry>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { gracely } from "gracely";
|
|
2
2
|
import { isly } from "isly";
|
|
3
|
-
import { Amount } from "../../Amount";
|
|
4
3
|
import { Transaction } from "../../Transaction";
|
|
5
|
-
import { Total } from "../Total";
|
|
6
4
|
import { Cancel as EntryCancel } from "./Cancel";
|
|
7
5
|
import { Capture as EntryCapture } from "./Capture";
|
|
8
6
|
import { Creatable as EntryCreatable } from "./Creatable";
|
|
@@ -17,12 +15,6 @@ export var Entry;
|
|
|
17
15
|
Entry.Unknown = EntryUnknown;
|
|
18
16
|
Entry.Summary = EntrySummary;
|
|
19
17
|
Entry.Creatable = EntryCreatable;
|
|
20
|
-
function compile(entry) {
|
|
21
|
-
return entry.type == "unknown"
|
|
22
|
-
? Total.initiate()
|
|
23
|
-
: Total.initiate({ amount: Amount.toAmounts(entry.amount), fee: entry.fee });
|
|
24
|
-
}
|
|
25
|
-
Entry.compile = compile;
|
|
26
18
|
function from(creatable, transaction) {
|
|
27
19
|
let result;
|
|
28
20
|
if (!Transaction.is(transaction) || transaction.status != "finalized")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Settlement/Entry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.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I,CAAA;AAC9B,CAAC,EAtEgB,KAAK,KAAL,KAAK,QAsErB"}
|
|
@@ -1,17 +1,29 @@
|
|
|
1
|
+
import { isoly } from "isoly";
|
|
1
2
|
import { isly } from "isly";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { Amount } from "./Amount";
|
|
4
|
+
export interface Total {
|
|
5
|
+
expected: Amount;
|
|
6
|
+
outcome?: Amount;
|
|
7
|
+
collected?: Amount & {
|
|
8
|
+
transactions: {
|
|
9
|
+
net: string;
|
|
10
|
+
fee: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
settled?: Total.Settled;
|
|
14
|
+
}
|
|
9
15
|
export declare namespace Total {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
type Settled = {
|
|
17
|
+
net: number;
|
|
18
|
+
transactions: string[];
|
|
19
|
+
};
|
|
20
|
+
const Settled: isly.object.ExtendableType<Settled>;
|
|
14
21
|
const type: isly.object.ExtendableType<Total>;
|
|
15
|
-
|
|
16
|
-
|
|
22
|
+
function create(): Total;
|
|
23
|
+
function verify(total: Total, type: "outcome" | "collected" | "settled"): boolean;
|
|
24
|
+
function add(currency: isoly.Currency, addendee: Total, addend: Partial<Total>): Total;
|
|
25
|
+
function collect(currency: isoly.Currency, total: Total, collected: Amount, transactions: {
|
|
26
|
+
net: string;
|
|
27
|
+
fee: string;
|
|
28
|
+
}): Total;
|
|
17
29
|
}
|
package/dist/Settlement/Total.js
CHANGED
|
@@ -1,34 +1,73 @@
|
|
|
1
|
+
import { isoly } from "isoly";
|
|
1
2
|
import { isly } from "isly";
|
|
2
|
-
import {
|
|
3
|
-
import { Fee } from "./Fee";
|
|
3
|
+
import { Amount } from "./Amount";
|
|
4
4
|
export var Total;
|
|
5
5
|
(function (Total) {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
Total.Settled = isly.object({ net: isly.number(), transactions: isly.string().array() });
|
|
7
|
+
Total.type = isly.object({
|
|
8
|
+
expected: Amount.type,
|
|
9
|
+
outcome: Amount.type.optional(),
|
|
10
|
+
collected: Amount.type
|
|
11
|
+
.extend({
|
|
12
|
+
transactions: isly.object({
|
|
13
|
+
net: isly.string(),
|
|
14
|
+
fee: isly.string(),
|
|
15
|
+
}),
|
|
16
|
+
})
|
|
17
|
+
.optional(),
|
|
18
|
+
settled: Total.Settled.optional(),
|
|
19
|
+
});
|
|
20
|
+
function create() {
|
|
21
|
+
return { expected: { net: 0, fee: { other: 0 } } };
|
|
8
22
|
}
|
|
9
|
-
Total.
|
|
10
|
-
function
|
|
11
|
-
|
|
23
|
+
Total.create = create;
|
|
24
|
+
function verify(total, type) {
|
|
25
|
+
let result;
|
|
26
|
+
switch (type) {
|
|
27
|
+
case "outcome":
|
|
28
|
+
result = total.outcome?.net == total.expected.net && total.outcome.fee.other == total.expected.fee.other;
|
|
29
|
+
break;
|
|
30
|
+
case "collected":
|
|
31
|
+
result = total.collected?.net == total.outcome?.net && total.collected?.fee.other == total.outcome?.fee.other;
|
|
32
|
+
break;
|
|
33
|
+
case "settled":
|
|
34
|
+
result = total.settled?.net == total.collected?.net;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
12
38
|
}
|
|
13
|
-
Total.
|
|
14
|
-
function
|
|
15
|
-
|
|
39
|
+
Total.verify = verify;
|
|
40
|
+
function add(currency, addendee, addend) {
|
|
41
|
+
const result = { ...addendee };
|
|
42
|
+
addend.expected && (result.expected = Amount.add(currency, result.expected, addend.expected));
|
|
43
|
+
if (result.outcome || addend.outcome)
|
|
44
|
+
result.outcome = Amount.add(currency, result.outcome ?? { net: 0, fee: { other: 0 } }, addend.outcome ?? {});
|
|
45
|
+
if (result.collected || addend.collected)
|
|
46
|
+
result.collected = {
|
|
47
|
+
...Amount.add(currency, result.collected ?? { net: 0, fee: { other: 0 } }, addend.collected ?? {}),
|
|
48
|
+
transactions: {
|
|
49
|
+
net: addend.collected?.transactions.net ?? result.collected?.transactions.net ?? "",
|
|
50
|
+
fee: addend.collected?.transactions.fee ?? result.collected?.transactions.fee ?? "",
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
if (result.settled || addend.settled)
|
|
54
|
+
result.settled = {
|
|
55
|
+
net: isoly.Currency.add(currency, result.settled?.net ?? 0, addend.settled?.net ?? 0),
|
|
56
|
+
transactions: (result.settled?.transactions ?? []).concat(addend.settled?.transactions ?? []),
|
|
57
|
+
};
|
|
58
|
+
return result;
|
|
16
59
|
}
|
|
17
|
-
Total.
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
result = add(result, initiate({ fee: { other: { [currency]: amount } } }));
|
|
24
|
-
else if (entry.startsWith("settle"))
|
|
25
|
-
result = add(result, initiate({ amount: { [currency]: amount } }));
|
|
60
|
+
Total.add = add;
|
|
61
|
+
function collect(currency, total, collected, transactions) {
|
|
62
|
+
const result = { ...total };
|
|
63
|
+
if (result.collected) {
|
|
64
|
+
result.collected.net = isoly.Currency.add(currency, result.collected.net, collected.net);
|
|
65
|
+
result.collected.fee.other = isoly.Currency.add(currency, result.collected.fee.other, collected.fee.other);
|
|
26
66
|
}
|
|
67
|
+
else
|
|
68
|
+
result.collected = { ...collected, transactions };
|
|
27
69
|
return result;
|
|
28
70
|
}
|
|
29
|
-
Total.
|
|
30
|
-
Total.type = isly.object({ amount: Amounts.type, fee: Fee.type });
|
|
31
|
-
Total.is = Total.type.is;
|
|
32
|
-
Total.flaw = Total.type.flaw;
|
|
71
|
+
Total.collect = collect;
|
|
33
72
|
})(Total || (Total = {}));
|
|
34
73
|
//# sourceMappingURL=Total.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Total.js","sourceRoot":"../","sources":["Settlement/Total.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Total.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AK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAC3G,CAAC;;YACA,MAAM,CAAC,SAAS,GAAG,EAAE,GAAG,SAAS,EAAE,YAAY,EAAE,CAAA;QAClD,OAAO,MAAM,CAAA;IACd,CAAC;IAbe,aAAO,UAatB,CAAA;AACF,CAAC,EAvEgB,KAAK,KAAL,KAAK,QAuErB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isoly } from "isoly";
|
|
2
|
+
import { isly } from "isly";
|
|
3
|
+
import type { Collect } from "../Transaction/Collect";
|
|
4
|
+
import { Entry } from "./Entry";
|
|
5
|
+
import { Total } from "./Total";
|
|
6
|
+
export type Totals = Partial<Record<isoly.Currency, Total>>;
|
|
7
|
+
export declare namespace Totals {
|
|
8
|
+
const type: isly.Type<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", Total>>;
|
|
9
|
+
function addEntry(totals: Totals, entry: Entry): Totals;
|
|
10
|
+
function verify(totals: Totals, type: "outcome" | "collected" | "settled"): boolean;
|
|
11
|
+
function add(addendee: Totals, addends: Partial<Record<isoly.Currency, Partial<Total>>>): Totals;
|
|
12
|
+
function collect(totals: Totals, collect: Collect): Totals;
|
|
13
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { isoly } from "isoly";
|
|
2
|
+
import { isly } from "isly";
|
|
3
|
+
import { Total } from "./Total";
|
|
4
|
+
export var Totals;
|
|
5
|
+
(function (Totals) {
|
|
6
|
+
Totals.type = isly.record(isly.string(isoly.Currency.types), Total.type);
|
|
7
|
+
function addEntry(totals, entry) {
|
|
8
|
+
const result = { ...totals };
|
|
9
|
+
if (entry.status == "succeeded" && (entry.type == "capture" || entry.type == "refund")) {
|
|
10
|
+
result[entry.amount[0]] = Total.add(entry.amount[0], result[entry.amount[0]] ?? Total.create(), {
|
|
11
|
+
outcome: {
|
|
12
|
+
net: entry.amount[1],
|
|
13
|
+
fee: { other: entry.fee.other[entry.amount[0]] ?? 0 },
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
Totals.addEntry = addEntry;
|
|
20
|
+
function verify(totals, type) {
|
|
21
|
+
return Object.values(totals).every(t => Total.verify(t, type));
|
|
22
|
+
}
|
|
23
|
+
Totals.verify = verify;
|
|
24
|
+
function add(addendee, addends) {
|
|
25
|
+
const result = { ...addendee };
|
|
26
|
+
for (const [currency, addend] of Object.entries(addends)) {
|
|
27
|
+
result[currency] = Total.add(currency, result[currency] ?? Total.create(), addend);
|
|
28
|
+
}
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
Totals.add = add;
|
|
32
|
+
function collect(totals, collect) {
|
|
33
|
+
const result = { ...totals };
|
|
34
|
+
for (const [currency, counterbalance] of Object.entries(collect.counterbalances)) {
|
|
35
|
+
const collected = { net: 0, fee: { other: 0 } };
|
|
36
|
+
for (const [entry, amount] of Object.entries(counterbalance)) {
|
|
37
|
+
if (entry.startsWith("fee"))
|
|
38
|
+
collected.fee.other = isoly.Currency.add(currency, collected.fee.other, amount ?? 0);
|
|
39
|
+
else if (entry.startsWith("settle"))
|
|
40
|
+
collected.net = isoly.Currency.add(currency, collected.net, amount ?? 0);
|
|
41
|
+
}
|
|
42
|
+
result[currency] = Total.collect(currency, result[currency] ?? Total.create(), collected, { net: "", fee: "" });
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
Totals.collect = collect;
|
|
47
|
+
})(Totals || (Totals = {}));
|
|
48
|
+
//# sourceMappingURL=Totals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Totals.js","sourceRoot":"../","sources":["Settlement/Totals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAA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,CAAC,GAAG,CAAC,QAA0B,EAAE,SAAS,CAAC,GAAG,EAAE,MAAM,IAAI,CAAC,CAAC,CAAA;YAC5F,CAAC;YACD,MAAM,CAAC,QAA0B,CAAC,GAAG,KAAK,CAAC,OAAO,CACjD,QAA0B,EAC1B,MAAM,CAAC,QAA0B,CAAC,IAAI,KAAK,CAAC,MAAM,EAAE,EACpD,SAAS,EACT,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CACpB,CAAA;QACF,CAAC;QACD,OAAO,MAAM,CAAA;IACd,CAAC;IAlBe,cAAO,UAkBtB,CAAA;AACF,CAAC,EA7CgB,MAAM,KAAN,MAAM,QA6CtB"}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { isoly } from "isoly";
|
|
2
2
|
import { isly } from "isly";
|
|
3
|
-
import {
|
|
3
|
+
import { Amounts } from "../Amounts";
|
|
4
|
+
import { Amount as SettlementAmount } from "./Amount";
|
|
4
5
|
import { Batch as SettlementBatch } from "./Batch";
|
|
5
6
|
import { Creatable as SettlementCreatable } from "./Creatable";
|
|
6
7
|
import { Entry as SettlementEntry } from "./Entry";
|
|
7
8
|
import { Fee as SettlementFee } from "./Fee";
|
|
8
|
-
import { Settled as SettlementSettled } from "./Settled";
|
|
9
9
|
import { Status } from "./Status";
|
|
10
10
|
import { Total as SettlementTotal } from "./Total";
|
|
11
|
+
import { Totals as SettlementTotals } from "./Totals";
|
|
11
12
|
export interface Settlement extends Settlement.Creatable {
|
|
12
13
|
id: string;
|
|
13
14
|
by?: string;
|
|
14
15
|
created: isoly.DateTime;
|
|
15
16
|
status: Status;
|
|
16
|
-
collected?: Settlement.Total;
|
|
17
|
-
outcome: Settlement.Total;
|
|
18
|
-
settled?: Settlement.Settled;
|
|
19
17
|
entries: Settlement.Entry.Summary;
|
|
20
18
|
}
|
|
21
19
|
export declare namespace Settlement {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
type
|
|
26
|
-
const
|
|
27
|
-
type
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
type
|
|
31
|
-
const
|
|
32
|
-
type
|
|
33
|
-
const
|
|
34
|
-
|
|
20
|
+
export const Total: typeof SettlementTotal;
|
|
21
|
+
export type Total = SettlementTotal;
|
|
22
|
+
export const Totals: typeof SettlementTotals;
|
|
23
|
+
export type Totals = SettlementTotals;
|
|
24
|
+
export const Amount: typeof SettlementAmount;
|
|
25
|
+
export type Amount = SettlementAmount;
|
|
26
|
+
export const Fee: typeof SettlementFee;
|
|
27
|
+
export type Fee = SettlementFee;
|
|
28
|
+
export type Creatable = SettlementCreatable;
|
|
29
|
+
export const Creatable: typeof SettlementCreatable;
|
|
30
|
+
export type Entry = SettlementEntry;
|
|
31
|
+
export const Entry: typeof SettlementEntry;
|
|
32
|
+
export type Batch = SettlementBatch;
|
|
33
|
+
export const Batch: typeof SettlementBatch;
|
|
34
|
+
export namespace Entry {
|
|
35
35
|
type Summary = SettlementEntry.Summary;
|
|
36
36
|
type Creatable = SettlementEntry.Creatable;
|
|
37
37
|
type Refund = SettlementEntry.Refund;
|
|
@@ -51,11 +51,25 @@ export declare namespace Settlement {
|
|
|
51
51
|
type Creatable = SettlementEntry.Unknown.Creatable;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
function
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
export function from(creatable: Settlement.Creatable, by: string): Settlement;
|
|
55
|
+
export function compile(settlement: Settlement, entries: Settlement.Entry[]): Settlement;
|
|
56
|
+
type OldTotal = {
|
|
57
|
+
amount: Amounts;
|
|
58
|
+
fee: Fee;
|
|
59
|
+
};
|
|
60
|
+
export type OldSettlement = Omit<Settlement, "totals"> & {
|
|
61
|
+
expected?: OldTotal;
|
|
62
|
+
collected?: OldTotal;
|
|
63
|
+
outcome: OldTotal;
|
|
64
|
+
settled?: {
|
|
65
|
+
paid: Amounts;
|
|
66
|
+
transactions: string[];
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export type MaybeOld = Settlement | OldSettlement;
|
|
70
|
+
export function fromLegacy(settlement: MaybeOld): Settlement;
|
|
71
|
+
export const type: isly.object.ExtendableType<Settlement>;
|
|
72
|
+
export const is: isly.Type.IsFunction<Settlement>;
|
|
73
|
+
export const flaw: isly.Type.FlawFunction;
|
|
74
|
+
export {};
|
|
61
75
|
}
|
package/dist/Settlement/index.js
CHANGED
|
@@ -1,41 +1,28 @@
|
|
|
1
1
|
import { isoly } from "isoly";
|
|
2
2
|
import { isly } from "isly";
|
|
3
3
|
import { Identifier } from "../Identifier";
|
|
4
|
+
import { Amount as SettlementAmount } from "./Amount";
|
|
4
5
|
import { Batch as SettlementBatch } from "./Batch";
|
|
5
6
|
import { Creatable as SettlementCreatable } from "./Creatable";
|
|
6
7
|
import { Entry as SettlementEntry } from "./Entry";
|
|
7
8
|
import { Fee as SettlementFee } from "./Fee";
|
|
8
|
-
import { Settled as SettlementSettled } from "./Settled";
|
|
9
9
|
import { Status } from "./Status";
|
|
10
10
|
import { Total as SettlementTotal } from "./Total";
|
|
11
|
+
import { Totals as SettlementTotals } from "./Totals";
|
|
11
12
|
export var Settlement;
|
|
12
13
|
(function (Settlement) {
|
|
13
|
-
Settlement.Settled = SettlementSettled;
|
|
14
14
|
Settlement.Total = SettlementTotal;
|
|
15
|
+
Settlement.Totals = SettlementTotals;
|
|
16
|
+
Settlement.Amount = SettlementAmount;
|
|
15
17
|
Settlement.Fee = SettlementFee;
|
|
16
18
|
Settlement.Creatable = SettlementCreatable;
|
|
17
19
|
Settlement.Entry = SettlementEntry;
|
|
18
20
|
Settlement.Batch = SettlementBatch;
|
|
19
|
-
function
|
|
21
|
+
function from(creatable, by) {
|
|
20
22
|
return {
|
|
21
|
-
id:
|
|
22
|
-
by,
|
|
23
|
-
created: isoly.DateTime.now(),
|
|
24
|
-
batch,
|
|
25
|
-
processor,
|
|
26
|
-
status: { collected: "pending", settled: "pending" },
|
|
27
|
-
expected: Settlement.Total.initiate(),
|
|
28
|
-
outcome: Settlement.Total.initiate(),
|
|
29
|
-
entries: { count: 0 },
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
Settlement.initiate = initiate;
|
|
33
|
-
function from(id, creatable, by) {
|
|
34
|
-
return {
|
|
35
|
-
id,
|
|
23
|
+
id: Identifier.generate(),
|
|
36
24
|
status: { collected: "pending", settled: "pending" },
|
|
37
25
|
by,
|
|
38
|
-
outcome: Settlement.Total.initiate(),
|
|
39
26
|
...creatable,
|
|
40
27
|
created: isoly.DateTime.now(),
|
|
41
28
|
entries: { count: 0 },
|
|
@@ -47,7 +34,7 @@ export var Settlement;
|
|
|
47
34
|
for (const entry of entries) {
|
|
48
35
|
switch (entry.status) {
|
|
49
36
|
case "succeeded":
|
|
50
|
-
result.
|
|
37
|
+
result.totals = Settlement.Totals.addEntry(result.totals, entry);
|
|
51
38
|
result.entries.count++;
|
|
52
39
|
break;
|
|
53
40
|
case "failed":
|
|
@@ -58,29 +45,44 @@ export var Settlement;
|
|
|
58
45
|
return result;
|
|
59
46
|
}
|
|
60
47
|
Settlement.compile = compile;
|
|
61
|
-
function
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
48
|
+
function fromLegacy(settlement) {
|
|
49
|
+
let result;
|
|
50
|
+
if (!Settlement.is(settlement)) {
|
|
51
|
+
const totalToAmount = (currency, oldTotal) => ({
|
|
52
|
+
net: oldTotal?.amount[currency] ?? 0,
|
|
53
|
+
fee: { other: oldTotal?.fee.other[currency] ?? 0 },
|
|
54
|
+
});
|
|
55
|
+
const { expected, collected, outcome, settled, ...partialSettlement } = settlement;
|
|
56
|
+
const currencies = Array.from(new Set([
|
|
57
|
+
...Object.keys(expected?.amount ?? {}),
|
|
58
|
+
...Object.keys(collected?.amount ?? {}),
|
|
59
|
+
...Object.keys(settled?.paid ?? {}),
|
|
60
|
+
...Object.keys(outcome.amount),
|
|
61
|
+
]));
|
|
62
|
+
const totals = currencies.reduce((total, currency) => {
|
|
63
|
+
total[currency] = {
|
|
64
|
+
expected: totalToAmount(currency, expected),
|
|
65
|
+
...(outcome ? { outcome: totalToAmount(currency, outcome) } : {}),
|
|
66
|
+
...(collected
|
|
67
|
+
? { collected: { ...totalToAmount(currency, collected), transactions: { net: "", fee: "" } } }
|
|
68
|
+
: {}),
|
|
69
|
+
...(settled ? { settled: { net: settled.paid[currency] ?? 0, transactions: settled.transactions } } : {}),
|
|
70
|
+
};
|
|
71
|
+
return total;
|
|
72
|
+
}, {});
|
|
73
|
+
result = { ...partialSettlement, totals };
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
result = settlement;
|
|
77
|
+
}
|
|
78
|
+
return result;
|
|
74
79
|
}
|
|
75
|
-
Settlement.
|
|
80
|
+
Settlement.fromLegacy = fromLegacy;
|
|
76
81
|
Settlement.type = SettlementCreatable.type.extend({
|
|
77
82
|
id: isly.string(),
|
|
78
83
|
by: isly.string().optional(),
|
|
79
84
|
created: isly.fromIs("isoly.DateTime", isoly.DateTime.is),
|
|
80
85
|
status: Status.type,
|
|
81
|
-
collected: Settlement.Total.type.optional(),
|
|
82
|
-
outcome: Settlement.Total.type,
|
|
83
|
-
settled: Settlement.Settled.type.optional(),
|
|
84
86
|
entries: Settlement.Entry.Summary.type,
|
|
85
87
|
});
|
|
86
88
|
Settlement.is = Settlement.type.is;
|
|
@@ -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,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,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;oBACN,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBACzG,CAAA;gBACD,OAAO,KAAK,CAAA;YACb,CAAC,EAAE,EAAY,CAAC,CAAA;YAChB,MAAM,GAAG,EAAE,GAAG,iBAAiB,EAAE,MAAM,EAAE,CAAA;QAC1C,CAAC;aAAM,CAAC;YACP,MAAM,GAAG,UAAU,CAAA;QACpB,CAAC;QACD,OAAO,MAAM,CAAA;IACd,CAAC;IAhCe,qBAAU,aAgCzB,CAAA;IACY,eAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAa;QAC/D,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE;QACjB,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC5B,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzD,MAAM,EAAE,MAAM,CAAC,IAAI;QACnB,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI;KACtC,CAAC,CAAA;IACW,aAAE,GAAG,WAAA,IAAI,CAAC,EAAE,CAAA;IACZ,eAAI,GAAG,WAAA,IAAI,CAAC,IAAI,CAAA;AAC9B,CAAC,EA9GgB,UAAU,KAAV,UAAU,QA8G1B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isoly } from "isoly";
|
|
2
|
+
import { Balances } from "../../Balances";
|
|
3
|
+
import { Counterbalances2 } from "../../Counterbalances2";
|
|
4
|
+
export interface Emoney {
|
|
5
|
+
organization: string;
|
|
6
|
+
account: string;
|
|
7
|
+
timestamp: isoly.DateTime;
|
|
8
|
+
balances: Balances;
|
|
9
|
+
counterbalances: Counterbalances2;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Emoney.js","sourceRoot":"../","sources":["Treasury/Snapshot/Emoney.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isoly } from "isoly";
|
|
2
2
|
import { isly } from "isly";
|
|
3
|
+
import { Emoney as SnapshotEmoney } from "./Emoney";
|
|
3
4
|
import { Fragment as SnapshotFragment } from "./Fragment";
|
|
4
5
|
import { Warning as SnapshotWarning } from "./Warning";
|
|
5
6
|
export type Snapshot = Partial<Record<isoly.Currency, Snapshot.Fragment>>;
|
|
@@ -8,6 +9,7 @@ export declare namespace Snapshot {
|
|
|
8
9
|
const Fragment: typeof SnapshotFragment;
|
|
9
10
|
type Warning = SnapshotWarning;
|
|
10
11
|
const Warning: typeof SnapshotWarning;
|
|
12
|
+
type Emoney = SnapshotEmoney;
|
|
11
13
|
const type: isly.Type<{
|
|
12
14
|
BTN: any;
|
|
13
15
|
CHE: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Treasury/Snapshot/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Treasury/Snapshot/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,WAAW,CAAA;AAItD,MAAM,KAAW,QAAQ,CAOxB;AAPD,WAAiB,QAAQ;IAEX,iBAAQ,GAAG,gBAAgB,CAAA;IAE3B,gBAAO,GAAG,eAAe,CAAA;IAEzB,aAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,SAAA,QAAQ,CAAC,IAAI,CAAC,CAAA;AAC3F,CAAC,EAPgB,QAAQ,KAAR,QAAQ,QAOxB"}
|
package/dist/Treasury/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare namespace Treasury {
|
|
|
14
14
|
namespace Snapshot {
|
|
15
15
|
type Fragment = TreasurySnapshot.Fragment;
|
|
16
16
|
type Warning = TreasurySnapshot.Warning;
|
|
17
|
+
type Emoney = TreasurySnapshot.Emoney;
|
|
17
18
|
}
|
|
18
19
|
namespace Account {
|
|
19
20
|
type Creatable = TreasuryAccount.Creatable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Treasury/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAGzD,MAAM,KAAW,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Treasury/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAGzD,MAAM,KAAW,QAAQ,CAiCxB;AAjCD,WA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|
-
|
|
4
|
-
export interface Settled {
|
|
5
|
-
paid: Amounts
|
|
6
|
-
transactions: string[]
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export namespace Settled {
|
|
10
|
-
export const type = isly.object<Settled>({
|
|
11
|
-
paid: Amounts.type,
|
|
12
|
-
transactions: isly.string().array(),
|
|
13
|
-
})
|
|
14
|
-
export const is = type.is
|
|
15
|
-
export const flaw = type.flaw
|
|
16
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { isly } from "isly";
|
|
2
|
-
import { Amounts } from "../Amounts";
|
|
3
|
-
export interface Settled {
|
|
4
|
-
paid: Amounts;
|
|
5
|
-
transactions: string[];
|
|
6
|
-
}
|
|
7
|
-
export declare namespace Settled {
|
|
8
|
-
const type: isly.object.ExtendableType<Settled>;
|
|
9
|
-
const is: isly.Type.IsFunction<Settled>;
|
|
10
|
-
const flaw: isly.Type.FlawFunction;
|
|
11
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { isly } from "isly";
|
|
2
|
-
import { Amounts } from "../Amounts";
|
|
3
|
-
export var Settled;
|
|
4
|
-
(function (Settled) {
|
|
5
|
-
Settled.type = isly.object({
|
|
6
|
-
paid: Amounts.type,
|
|
7
|
-
transactions: isly.string().array(),
|
|
8
|
-
});
|
|
9
|
-
Settled.is = Settled.type.is;
|
|
10
|
-
Settled.flaw = Settled.type.flaw;
|
|
11
|
-
})(Settled || (Settled = {}));
|
|
12
|
-
//# sourceMappingURL=Settled.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Settled.js","sourceRoot":"../","sources":["Settlement/Settled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAOpC,MAAM,KAAW,OAAO,CAOvB;AAPD,WAAiB,OAAO;IACV,YAAI,GAAG,IAAI,CAAC,MAAM,CAAU;QACxC,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,YAAY,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;KACnC,CAAC,CAAA;IACW,UAAE,GAAG,QAAA,IAAI,CAAC,EAAE,CAAA;IACZ,YAAI,GAAG,QAAA,IAAI,CAAC,IAAI,CAAA;AAC9B,CAAC,EAPgB,OAAO,KAAP,OAAO,QAOvB"}
|