@pax2pay/model-banking 0.1.549 → 0.1.551
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/Analytics/Configuration/Transaction.ts +0 -1
- package/Counterbalance.ts +0 -2
- package/Operation/Changes.ts +3 -14
- package/Rule/State/Transaction.ts +0 -2
- package/Rule/State/index.ts +0 -7
- package/Rule/index.ts +8 -71
- package/Rule/type.ts +1 -11
- package/Transaction/Amount.ts +1 -1
- package/Transaction/index.ts +4 -19
- package/dist/cjs/Analytics/Configuration/Transaction.js +0 -1
- package/dist/cjs/Analytics/Configuration/Transaction.js.map +1 -1
- package/dist/cjs/Backup/Rule.d.ts +1 -1
- package/dist/cjs/Counterbalance.d.ts +0 -1
- package/dist/cjs/Counterbalance.js +0 -1
- package/dist/cjs/Counterbalance.js.map +1 -1
- package/dist/cjs/Operation/Changes.d.ts +1 -2
- package/dist/cjs/Operation/Changes.js +2 -8
- package/dist/cjs/Operation/Changes.js.map +1 -1
- package/dist/cjs/Rule/State/Transaction.d.ts +0 -5
- package/dist/cjs/Rule/State/Transaction.js.map +1 -1
- package/dist/cjs/Rule/State/index.d.ts +2 -5
- package/dist/cjs/Rule/State/index.js +2 -4
- package/dist/cjs/Rule/State/index.js.map +1 -1
- package/dist/cjs/Rule/index.d.ts +4 -16
- package/dist/cjs/Rule/index.js +2 -60
- package/dist/cjs/Rule/index.js.map +1 -1
- package/dist/cjs/Rule/type.d.ts +2 -3
- package/dist/cjs/Rule/type.js +1 -5
- package/dist/cjs/Rule/type.js.map +1 -1
- package/dist/cjs/Transaction/Amount.js +1 -1
- package/dist/cjs/Transaction/Amount.js.map +1 -1
- package/dist/cjs/Transaction/index.d.ts +0 -1
- package/dist/cjs/Transaction/index.js +4 -15
- package/dist/cjs/Transaction/index.js.map +1 -1
- package/dist/mjs/Analytics/Configuration/Transaction.js +0 -1
- package/dist/mjs/Analytics/Configuration/Transaction.js.map +1 -1
- package/dist/mjs/Backup/Rule.d.ts +1 -1
- package/dist/mjs/Counterbalance.d.ts +0 -1
- package/dist/mjs/Counterbalance.js +0 -1
- package/dist/mjs/Counterbalance.js.map +1 -1
- package/dist/mjs/Operation/Changes.d.ts +1 -2
- package/dist/mjs/Operation/Changes.js +2 -8
- package/dist/mjs/Operation/Changes.js.map +1 -1
- package/dist/mjs/Rule/State/Transaction.d.ts +0 -5
- package/dist/mjs/Rule/State/Transaction.js.map +1 -1
- package/dist/mjs/Rule/State/index.d.ts +2 -5
- package/dist/mjs/Rule/State/index.js +2 -4
- package/dist/mjs/Rule/State/index.js.map +1 -1
- package/dist/mjs/Rule/index.d.ts +4 -16
- package/dist/mjs/Rule/index.js +2 -60
- package/dist/mjs/Rule/index.js.map +1 -1
- package/dist/mjs/Rule/type.d.ts +2 -3
- package/dist/mjs/Rule/type.js +1 -5
- package/dist/mjs/Rule/type.js.map +1 -1
- package/dist/mjs/Transaction/Amount.js +1 -1
- package/dist/mjs/Transaction/Amount.js.map +1 -1
- package/dist/mjs/Transaction/index.d.ts +0 -1
- package/dist/mjs/Transaction/index.js +4 -15
- package/dist/mjs/Transaction/index.js.map +1 -1
- package/package.json +1 -1
- package/Rule/Charge.ts +0 -117
- package/Rule/Reserve.ts +0 -113
- package/Rule/Score.ts +0 -63
- package/Rule/State/Data.ts +0 -21
- package/dist/cjs/Rule/Charge.d.ts +0 -41
- package/dist/cjs/Rule/Charge.js +0 -79
- package/dist/cjs/Rule/Charge.js.map +0 -1
- package/dist/cjs/Rule/Reserve.d.ts +0 -39
- package/dist/cjs/Rule/Reserve.js +0 -80
- package/dist/cjs/Rule/Reserve.js.map +0 -1
- package/dist/cjs/Rule/Score.d.ts +0 -26
- package/dist/cjs/Rule/Score.js +0 -49
- package/dist/cjs/Rule/Score.js.map +0 -1
- package/dist/cjs/Rule/State/Data.d.ts +0 -23
- package/dist/cjs/Rule/State/Data.js +0 -3
- package/dist/cjs/Rule/State/Data.js.map +0 -1
- package/dist/mjs/Rule/Charge.d.ts +0 -41
- package/dist/mjs/Rule/Charge.js +0 -76
- package/dist/mjs/Rule/Charge.js.map +0 -1
- package/dist/mjs/Rule/Reserve.d.ts +0 -39
- package/dist/mjs/Rule/Reserve.js +0 -77
- package/dist/mjs/Rule/Reserve.js.map +0 -1
- package/dist/mjs/Rule/Score.d.ts +0 -26
- package/dist/mjs/Rule/Score.js +0 -46
- package/dist/mjs/Rule/Score.js.map +0 -1
- package/dist/mjs/Rule/State/Data.d.ts +0 -23
- package/dist/mjs/Rule/State/Data.js +0 -2
- package/dist/mjs/Rule/State/Data.js.map +0 -1
|
@@ -28,7 +28,6 @@ export namespace Transaction {
|
|
|
28
28
|
posted: "value.posted",
|
|
29
29
|
transacted: "value.transacted",
|
|
30
30
|
by: "value.by",
|
|
31
|
-
charge: { selector: "value.charge", transform: "string" },
|
|
32
31
|
actualBalance: { selector: "value.balance.actual", transform: "string" },
|
|
33
32
|
reservedBalance: { selector: "value.balance.reserved", transform: "string" },
|
|
34
33
|
availableBalance: { selector: "value.balance.available", transform: "string" },
|
package/Counterbalance.ts
CHANGED
|
@@ -4,7 +4,6 @@ export type Counterbalance = {
|
|
|
4
4
|
minted: Partial<Record<Counterbalance.Source, number>>
|
|
5
5
|
burned: Partial<Record<Counterbalance.Sink, number>>
|
|
6
6
|
internal?: Partial<Record<string, number>>
|
|
7
|
-
charge?: number
|
|
8
7
|
}
|
|
9
8
|
export namespace Counterbalance {
|
|
10
9
|
export type Source = string
|
|
@@ -15,7 +14,6 @@ export namespace Counterbalance {
|
|
|
15
14
|
minted: isly.record<Counterbalance["minted"]>(Source, isly.number()),
|
|
16
15
|
burned: isly.record<Counterbalance["burned"]>(Sink, isly.number()),
|
|
17
16
|
internal: isly.record<Required<Counterbalance>["internal"]>(isly.string(), isly.number()).optional(),
|
|
18
|
-
charge: isly.number().optional(),
|
|
19
17
|
})
|
|
20
18
|
export type Link = Source | Sink
|
|
21
19
|
export const Link = isly.string()
|
package/Operation/Changes.ts
CHANGED
|
@@ -100,25 +100,17 @@ export namespace Changes {
|
|
|
100
100
|
export const type = isly.string<Balance>(values)
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
export function fromCapture(settlement: string, amounts: { net: number; fee: number
|
|
103
|
+
export function fromCapture(settlement: string, amounts: { net: number; fee: number }): Changes {
|
|
104
104
|
return {
|
|
105
105
|
[`${settlement}-net`]: { type: "add" as const, amount: amounts.net, status: "pending" as const },
|
|
106
106
|
[`${settlement}-fee`]: { type: "add" as const, amount: amounts.fee, status: "pending" as const },
|
|
107
|
-
...(amounts.charge && {
|
|
108
|
-
[`${settlement}-charge`]: { type: "add" as const, amount: amounts.charge, status: "pending" as const },
|
|
109
|
-
}),
|
|
110
107
|
}
|
|
111
108
|
}
|
|
112
|
-
export function fromRefund(
|
|
113
|
-
settlement: string,
|
|
114
|
-
refund: Settlement.Entry.Creatable.Refund,
|
|
115
|
-
charge: number | undefined,
|
|
116
|
-
sum: Sum
|
|
117
|
-
): Changes {
|
|
109
|
+
export function fromRefund(settlement: string, refund: Settlement.Entry.Creatable.Refund, sum: Sum): Changes {
|
|
118
110
|
const currency = refund.amount[0]
|
|
119
111
|
const fee = Math.abs(refund.fee.other[currency] ?? 0)
|
|
120
112
|
const net = Math.abs(refund.amount[1])
|
|
121
|
-
const available = isoly.Currency.
|
|
113
|
+
const available = isoly.Currency.add(currency, fee, net)
|
|
122
114
|
return {
|
|
123
115
|
available: { type: available > 0 ? "add" : "subtract", amount: Math.abs(available), status: "pending" },
|
|
124
116
|
["reserved-incoming"]: {
|
|
@@ -126,9 +118,6 @@ export namespace Changes {
|
|
|
126
118
|
amount: sum["reserved-incoming"] ?? 0,
|
|
127
119
|
status: "pending",
|
|
128
120
|
},
|
|
129
|
-
...(charge && {
|
|
130
|
-
[`${settlement}-charge`]: { type: "add" as const, amount: charge, status: "pending" as const },
|
|
131
|
-
}),
|
|
132
121
|
}
|
|
133
122
|
}
|
|
134
123
|
}
|
|
@@ -9,12 +9,10 @@ export type Transaction = ModelTransaction.Creatable.Resolved & {
|
|
|
9
9
|
stage: "finalize" | "initiate"
|
|
10
10
|
amount: number
|
|
11
11
|
type: ModelTransaction.Types
|
|
12
|
-
risk?: number
|
|
13
12
|
original: {
|
|
14
13
|
currency: isoly.Currency
|
|
15
14
|
total: number
|
|
16
15
|
amount: number
|
|
17
|
-
charge?: { current: number; total: number } //Legacy
|
|
18
16
|
}
|
|
19
17
|
}
|
|
20
18
|
export namespace Transaction {
|
package/Rule/State/index.ts
CHANGED
|
@@ -7,13 +7,11 @@ import type { Rule } from "../index"
|
|
|
7
7
|
import { Account as StateAccount } from "./Account"
|
|
8
8
|
import { Authorization as StateAuthorization } from "./Authorization"
|
|
9
9
|
import { Card as StateCard } from "./Card"
|
|
10
|
-
import { Data as StateData } from "./Data"
|
|
11
10
|
import { Organization as StateOrganization } from "./Organization"
|
|
12
11
|
import { Partial as StatePartial } from "./Partial"
|
|
13
12
|
import { Transaction as StateTransaction } from "./Transaction"
|
|
14
13
|
|
|
15
14
|
export interface State {
|
|
16
|
-
data: State.Data
|
|
17
15
|
account: State.Account
|
|
18
16
|
transaction: State.Transaction
|
|
19
17
|
authorization?: State.Authorization
|
|
@@ -27,7 +25,6 @@ export namespace State {
|
|
|
27
25
|
export import Account = StateAccount
|
|
28
26
|
export import Transaction = StateTransaction
|
|
29
27
|
export import Organization = StateOrganization
|
|
30
|
-
export type Data = StateData
|
|
31
28
|
export type Outcome = typeof Outcome.values[number]
|
|
32
29
|
export namespace Outcome {
|
|
33
30
|
export const values = ["approve", "reject", "review"] as const
|
|
@@ -40,7 +37,6 @@ export namespace State {
|
|
|
40
37
|
notes: ModelTransaction.Note[]
|
|
41
38
|
}
|
|
42
39
|
export function from(
|
|
43
|
-
data: Data,
|
|
44
40
|
account: ModelAccount,
|
|
45
41
|
address: Rail.Address,
|
|
46
42
|
transactions: Account.Transactions,
|
|
@@ -52,7 +48,6 @@ export namespace State {
|
|
|
52
48
|
organization?: Organization
|
|
53
49
|
): State {
|
|
54
50
|
return {
|
|
55
|
-
data,
|
|
56
51
|
account: Account.from(account, address, transactions, days),
|
|
57
52
|
transaction: Transaction.from(account, transaction, kind, stage),
|
|
58
53
|
authorization: Authorization.from(transaction),
|
|
@@ -66,7 +61,6 @@ export namespace State {
|
|
|
66
61
|
outgoing: "outbound",
|
|
67
62
|
}
|
|
68
63
|
export function fromPreTransaction(
|
|
69
|
-
data: Data,
|
|
70
64
|
account: ModelAccount,
|
|
71
65
|
address: Rail.Address,
|
|
72
66
|
transactions: Account.Transactions,
|
|
@@ -76,7 +70,6 @@ export namespace State {
|
|
|
76
70
|
organization?: Organization
|
|
77
71
|
): State {
|
|
78
72
|
return {
|
|
79
|
-
data,
|
|
80
73
|
account: Account.from(account, address, transactions, days),
|
|
81
74
|
transaction: Transaction.from(account, transaction, type[transaction.type], "initiate"),
|
|
82
75
|
card: card ? Card.from(card, card.statistics) : undefined,
|
package/Rule/index.ts
CHANGED
|
@@ -1,52 +1,25 @@
|
|
|
1
1
|
import { selectively } from "selectively"
|
|
2
2
|
import { isly } from "isly"
|
|
3
3
|
import { Exchange } from "../Exchange"
|
|
4
|
-
import { Realm } from "../Realm"
|
|
5
4
|
import type { Note } from "../Transaction/Note"
|
|
6
5
|
import { Base as RuleBase } from "./Base"
|
|
7
|
-
import { Charge as RuleCharge } from "./Charge"
|
|
8
6
|
import { control as ruleControl } from "./control"
|
|
9
7
|
import { Other as RuleOther } from "./Other"
|
|
10
|
-
import { Reserve as RuleReserve } from "./Reserve"
|
|
11
|
-
import { Score as RuleScore } from "./Score"
|
|
12
8
|
import { State as RuleState } from "./State"
|
|
13
9
|
import { type as ruleType } from "./type"
|
|
14
10
|
|
|
15
|
-
export type Rule = Rule.Other
|
|
11
|
+
export type Rule = Rule.Other
|
|
16
12
|
export namespace Rule {
|
|
17
13
|
export import Other = RuleOther
|
|
18
|
-
export import Score = RuleScore
|
|
19
|
-
export import Charge = RuleCharge
|
|
20
14
|
export import State = RuleState
|
|
21
|
-
export import Reserve = RuleReserve
|
|
22
15
|
export import Base = RuleBase
|
|
23
16
|
export import Kind = Base.Kind
|
|
24
17
|
export import Category = Base.Category
|
|
25
18
|
export const control = ruleControl
|
|
26
|
-
|
|
27
|
-
export namespace Api {
|
|
28
|
-
export const type = isly.union<Api, Rule.Other, Rule.Score, Rule.Charge.Api, Rule.Reserve.Api>(
|
|
29
|
-
Rule.Other.type,
|
|
30
|
-
Rule.Score.type,
|
|
31
|
-
Rule.Charge.Api.type,
|
|
32
|
-
Rule.Reserve.Api.type
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
export function fromApi(rule: Rule.Api, realm: Realm): Rule {
|
|
36
|
-
return rule.action == "charge"
|
|
37
|
-
? Charge.fromApi(rule, realm)
|
|
38
|
-
: rule.action == "reserve"
|
|
39
|
-
? Reserve.fromApi(rule, realm)
|
|
40
|
-
: rule
|
|
41
|
-
}
|
|
19
|
+
|
|
42
20
|
export type Action = typeof Action.values[number]
|
|
43
21
|
export namespace Action {
|
|
44
|
-
export const values = [
|
|
45
|
-
...Other.Action.values,
|
|
46
|
-
Score.Action.value,
|
|
47
|
-
Charge.Action.value,
|
|
48
|
-
Reserve.Action.value,
|
|
49
|
-
] as const
|
|
22
|
+
export const values = [...Other.Action.values] as const
|
|
50
23
|
export const type = isly.string<Action>(values)
|
|
51
24
|
}
|
|
52
25
|
export const type = ruleType
|
|
@@ -60,56 +33,20 @@ export namespace Rule {
|
|
|
60
33
|
review: [],
|
|
61
34
|
reject: [],
|
|
62
35
|
flag: [],
|
|
63
|
-
charge: [],
|
|
64
|
-
score: [],
|
|
65
|
-
reserve: [],
|
|
66
36
|
}
|
|
67
37
|
const notes: Note[] = []
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const evaluated = Other.evaluate(other, state, macros)
|
|
38
|
+
const evaluated = Other.evaluate(
|
|
39
|
+
rules.filter(rule => Base.Kind.is(state.transaction.kind, rule, state.organization?.groups, state.card?.preset)),
|
|
40
|
+
state,
|
|
41
|
+
macros
|
|
42
|
+
)
|
|
74
43
|
notes.push(...evaluated.notes)
|
|
75
44
|
outcomes.flag.push(...evaluated.outcomes.flag)
|
|
76
45
|
outcomes.review.push(...evaluated.outcomes.review)
|
|
77
46
|
outcomes.reject.push(...evaluated.outcomes.reject)
|
|
78
|
-
if (state.transaction.stage == "initiate") {
|
|
79
|
-
const reserved = Reserve.evaluate(reservers, state, macros, table)
|
|
80
|
-
state.transaction.original.charge = { current: reserved.reserve, total: reserved.reserve }
|
|
81
|
-
state.transaction.original.total = Reserve.apply(reserved.reserve, state)
|
|
82
|
-
outcomes.reserve.push(...reserved.outcomes)
|
|
83
|
-
notes.push(...reserved.notes)
|
|
84
|
-
} else if (state.transaction.stage == "finalize") {
|
|
85
|
-
const charged = Charge.evaluate(chargers, state, macros, table)
|
|
86
|
-
outcomes.charge.push(...charged.outcomes)
|
|
87
|
-
state.transaction.original.charge = charged.charge
|
|
88
|
-
state.transaction.original.total = Charge.apply(charged.charge, state)
|
|
89
|
-
notes.push(...charged.notes)
|
|
90
|
-
}
|
|
91
47
|
const outcome = outcomes.reject.length > 0 ? "reject" : outcomes.review.length > 0 ? "review" : "approve"
|
|
92
48
|
return { ...state, flags: [...evaluated.flags], notes, outcomes, outcome }
|
|
93
49
|
}
|
|
94
|
-
function sort(
|
|
95
|
-
rules: Rule[],
|
|
96
|
-
state: State
|
|
97
|
-
): { other: Rule.Other[]; chargers: Rule.Charge[]; scorers: Rule.Score[]; reservers: Rule.Reserve[] } {
|
|
98
|
-
return rules.reduce(
|
|
99
|
-
(r: ReturnType<typeof sort>, rule) => {
|
|
100
|
-
if (Base.Kind.is(state.transaction.kind, rule, state.organization?.groups, state.card?.preset))
|
|
101
|
-
rule.action == "score"
|
|
102
|
-
? r.scorers.push(rule)
|
|
103
|
-
: rule.action == "charge"
|
|
104
|
-
? r.chargers.push(rule)
|
|
105
|
-
: rule.action == "reserve"
|
|
106
|
-
? r.reservers.push(rule)
|
|
107
|
-
: r.other.push(rule)
|
|
108
|
-
return r
|
|
109
|
-
},
|
|
110
|
-
{ other: [], chargers: [], scorers: [], reservers: [] }
|
|
111
|
-
)
|
|
112
|
-
}
|
|
113
50
|
export function isLegacy(rule: Rule): boolean {
|
|
114
51
|
return !Rule.Base.Category.type.is(rule.category)
|
|
115
52
|
}
|
package/Rule/type.ts
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
import { isly } from "isly"
|
|
2
1
|
// import { isly as isly2 } from "isly2"
|
|
3
|
-
import { Charge } from "./Charge"
|
|
4
|
-
import type { Rule } from "./index"
|
|
5
2
|
import { Other } from "./Other"
|
|
6
|
-
import { Reserve } from "./Reserve"
|
|
7
|
-
import { Score } from "./Score"
|
|
8
3
|
|
|
9
|
-
export const type =
|
|
10
|
-
Other.type,
|
|
11
|
-
Score.type,
|
|
12
|
-
Charge.Api.type,
|
|
13
|
-
Reserve.type
|
|
14
|
-
)
|
|
4
|
+
export const type = Other.type
|
|
15
5
|
// TODO: Implement type2
|
|
16
6
|
// export const type2 = isly2
|
|
17
7
|
// .union<Rule, Other, Score, Charge.Api, Reserve>(Other.type2, Score.type2, Charge.Api.type2, Reserve.type2)
|
package/Transaction/Amount.ts
CHANGED
|
@@ -40,7 +40,7 @@ export namespace Amount {
|
|
|
40
40
|
const charge = Amount.Charge.total(state.transaction.original.currency, charges)
|
|
41
41
|
return {
|
|
42
42
|
original: sign * state.transaction.original.amount,
|
|
43
|
-
charge:
|
|
43
|
+
charge: 0,
|
|
44
44
|
charges,
|
|
45
45
|
total: isoly.Currency.add(state.transaction.original.currency, sign * state.transaction.original.total, charge),
|
|
46
46
|
exchange: state?.transaction.exchange ?? state.authorization?.exchange,
|
package/Transaction/index.ts
CHANGED
|
@@ -20,7 +20,6 @@ export interface Transaction {
|
|
|
20
20
|
counterpart: Rail.Address & { code?: string }
|
|
21
21
|
currency: isoly.Currency
|
|
22
22
|
amount: Transaction.Amount
|
|
23
|
-
charge?: number
|
|
24
23
|
description: string
|
|
25
24
|
organization: string
|
|
26
25
|
accountId: string
|
|
@@ -61,7 +60,6 @@ export namespace Transaction {
|
|
|
61
60
|
counterpart: isly.fromIs("Rail.Address", Rail.Address.type.is),
|
|
62
61
|
currency: isly.fromIs("isoly.Currency", isoly.Currency.is),
|
|
63
62
|
amount: Amount.type,
|
|
64
|
-
charge: isly.number().optional(),
|
|
65
63
|
description: isly.string(),
|
|
66
64
|
organization: isly.string(),
|
|
67
65
|
accountId: isly.string(),
|
|
@@ -94,7 +92,6 @@ export namespace Transaction {
|
|
|
94
92
|
state?: Rule.State,
|
|
95
93
|
charges?: Amount.Charge[]
|
|
96
94
|
): Amount {
|
|
97
|
-
const stateAmount = state && Amount.fromState(state)
|
|
98
95
|
const changes = Operation.sum(operations)
|
|
99
96
|
const reserved = isoly.Currency.add(
|
|
100
97
|
transaction.currency,
|
|
@@ -103,7 +100,7 @@ export namespace Transaction {
|
|
|
103
100
|
)
|
|
104
101
|
return {
|
|
105
102
|
original: typeof transaction.amount == "number" ? transaction.amount : transaction.amount.original,
|
|
106
|
-
charge:
|
|
103
|
+
charge: 0,
|
|
107
104
|
charges,
|
|
108
105
|
total: changes.available ?? reserved ?? 0,
|
|
109
106
|
exchange: state?.transaction.exchange ?? state?.authorization?.exchange,
|
|
@@ -121,10 +118,8 @@ export namespace Transaction {
|
|
|
121
118
|
...(typeof transaction.amount == "number"
|
|
122
119
|
? {
|
|
123
120
|
amount: {
|
|
124
|
-
original:
|
|
125
|
-
|
|
126
|
-
isoly.Currency.subtract(transaction.currency, transaction.amount, transaction.charge ?? 0),
|
|
127
|
-
charge: transaction.state?.transaction.original.charge?.total ?? transaction.charge ?? 0,
|
|
121
|
+
original: transaction.state?.transaction.original.amount ?? transaction.amount,
|
|
122
|
+
charge: 0,
|
|
128
123
|
total: transaction.state?.transaction.original.total ?? transaction.amount,
|
|
129
124
|
},
|
|
130
125
|
}
|
|
@@ -191,8 +186,6 @@ export namespace Transaction {
|
|
|
191
186
|
oldFlags: [],
|
|
192
187
|
notes: state.notes,
|
|
193
188
|
state,
|
|
194
|
-
risk: state.transaction.risk,
|
|
195
|
-
...(state.transaction.original.charge && { charge: state.transaction.original.charge.total }),
|
|
196
189
|
}
|
|
197
190
|
}
|
|
198
191
|
export function system(
|
|
@@ -305,8 +298,6 @@ export namespace Transaction {
|
|
|
305
298
|
oldFlags: [],
|
|
306
299
|
notes: state.notes,
|
|
307
300
|
state,
|
|
308
|
-
risk: state.transaction.risk,
|
|
309
|
-
...(state.transaction.original.charge && { charge: state.transaction.original.charge.total }),
|
|
310
301
|
}
|
|
311
302
|
}
|
|
312
303
|
export function fromRefund(
|
|
@@ -333,7 +324,6 @@ export namespace Transaction {
|
|
|
333
324
|
flags: [],
|
|
334
325
|
oldFlags: [],
|
|
335
326
|
notes: [],
|
|
336
|
-
...(state.transaction.original.charge && { charge: state.transaction.original.charge.total }),
|
|
337
327
|
}
|
|
338
328
|
}
|
|
339
329
|
export function isIdentifier(value: string | any): value is string {
|
|
@@ -355,12 +345,7 @@ export namespace Transaction {
|
|
|
355
345
|
}
|
|
356
346
|
export function getType(counterpart: Rail.Address, accountName: string): Types {
|
|
357
347
|
let result: Types
|
|
358
|
-
if (
|
|
359
|
-
accountName.startsWith("settlement-") ||
|
|
360
|
-
accountName.startsWith("fee-") ||
|
|
361
|
-
accountName.startsWith("charge-") ||
|
|
362
|
-
accountName.startsWith("net-")
|
|
363
|
-
)
|
|
348
|
+
if (accountName.startsWith("settlement-") || accountName.startsWith("fee-") || accountName.startsWith("net-"))
|
|
364
349
|
result = "system"
|
|
365
350
|
else if (counterpart.type == "internal")
|
|
366
351
|
result = "internal"
|
|
@@ -27,7 +27,6 @@ var Transaction;
|
|
|
27
27
|
posted: "value.posted",
|
|
28
28
|
transacted: "value.transacted",
|
|
29
29
|
by: "value.by",
|
|
30
|
-
charge: { selector: "value.charge", transform: "string" },
|
|
31
30
|
actualBalance: { selector: "value.balance.actual", transform: "string" },
|
|
32
31
|
reservedBalance: { selector: "value.balance.reserved", transform: "string" },
|
|
33
32
|
availableBalance: { selector: "value.balance.available", transform: "string" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../Analytics/Configuration/Transaction.ts"],"names":[],"mappings":";;;AAGA,iCAA6B;AAE7B,IAAiB,WAAW,
|
|
1
|
+
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../Analytics/Configuration/Transaction.ts"],"names":[],"mappings":";;;AAGA,iCAA6B;AAE7B,IAAiB,WAAW,CAwI3B;AAxID,WAAiB,WAAW;IAEd,mBAAO,GAAiD;QACpE,GAAG,WAAI,CAAC,OAAO;QACf,eAAe,EAAE,wBAAwB;QACzC,WAAW,EAAE,EAAE,QAAQ,EAAE,mBAAmB,EAAE,SAAS,EAAE,WAAW,EAAE;QACtE,eAAe,EAAE,wBAAwB;QACzC,QAAQ,EAAE,gBAAgB;QAC1B,MAAM,EAAE,EAAE,QAAQ,EAAE,oBAAoB,EAAE,SAAS,EAAE,QAAQ,EAAE;QAC/D,WAAW,EAAE,mBAAmB;QAChC,YAAY,EAAE,oBAAoB;QAClC,OAAO,EAAE,iBAAiB;QAC1B,WAAW,EAAE,mBAAmB;QAChC,cAAc,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE;QACrE,WAAW,EAAE,oBAAoB;QACjC,IAAI,EAAE,YAAY;QAClB,SAAS,EAAE,iBAAiB;QAC5B,EAAE,EAAE,UAAU;QACd,iBAAiB,EAAE,0BAA0B;QAC7C,kBAAkB,EAAE,2BAA2B;QAC/C,iBAAiB,EAAE,0BAA0B;QAC7C,mBAAmB,EAAE,4BAA4B;QACjD,MAAM,EAAE,cAAc;QACtB,UAAU,EAAE,kBAAkB;QAC9B,EAAE,EAAE,UAAU;QACd,aAAa,EAAE,EAAE,QAAQ,EAAE,sBAAsB,EAAE,SAAS,EAAE,QAAQ,EAAE;QACxE,eAAe,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12
|
}>;
|
|
13
|
-
const addSender: (sender: (backup: Rule) => any | Promise<any>) => (args_0: modelRule, args_1: "created" | "cancelled" | "updated" | "removed" | "inactivated", args_2?: {
|
|
13
|
+
const addSender: (sender: (backup: Rule) => any | Promise<any>) => (args_0: modelRule.Other, args_1: "created" | "cancelled" | "updated" | "removed" | "inactivated", args_2?: {
|
|
14
14
|
organization?: string;
|
|
15
15
|
account?: string;
|
|
16
16
|
} | undefined) => ReturnType<(backup: Rule) => any | Promise<any>>;
|
|
@@ -3,7 +3,6 @@ export type Counterbalance = {
|
|
|
3
3
|
minted: Partial<Record<Counterbalance.Source, number>>;
|
|
4
4
|
burned: Partial<Record<Counterbalance.Sink, number>>;
|
|
5
5
|
internal?: Partial<Record<string, number>>;
|
|
6
|
-
charge?: number;
|
|
7
6
|
};
|
|
8
7
|
export declare namespace Counterbalance {
|
|
9
8
|
type Source = string;
|
|
@@ -10,7 +10,6 @@ var Counterbalance;
|
|
|
10
10
|
minted: isly_1.isly.record(Counterbalance.Source, isly_1.isly.number()),
|
|
11
11
|
burned: isly_1.isly.record(Counterbalance.Sink, isly_1.isly.number()),
|
|
12
12
|
internal: isly_1.isly.record(isly_1.isly.string(), isly_1.isly.number()).optional(),
|
|
13
|
-
charge: isly_1.isly.number().optional(),
|
|
14
13
|
});
|
|
15
14
|
Counterbalance.Link = isly_1.isly.string();
|
|
16
15
|
})(Counterbalance || (exports.Counterbalance = Counterbalance = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Counterbalance.js","sourceRoot":"","sources":["../../Counterbalance.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;
|
|
1
|
+
{"version":3,"file":"Counterbalance.js","sourceRoot":"","sources":["../../Counterbalance.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;AAO3B,IAAiB,cAAc,CAY9B;AAZD,WAAiB,cAAc;IAEjB,qBAAM,GAAG,WAAI,CAAC,MAAM,EAAE,CAAA;IAEtB,mBAAI,GAAG,WAAI,CAAC,MAAM,EAAE,CAAA;IACpB,mBAAI,GAAG,WAAI,CAAC,MAAM,CAAiB;QAC/C,MAAM,EAAE,WAAI,CAAC,MAAM,CAA2B,eAAA,MAAM,EAAE,WAAI,CAAC,MAAM,EAAE,CAAC;QACpE,MAAM,EAAE,WAAI,CAAC,MAAM,CAA2B,eAAA,IAAI,EAAE,WAAI,CAAC,MAAM,EAAE,CAAC;QAClE,QAAQ,EAAE,WAAI,CAAC,MAAM,CAAuC,WAAI,CAAC,MAAM,EAAE,EAAE,WAAI,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;KACpG,CAAC,CAAA;IAEW,mBAAI,GAAG,WAAI,CAAC,MAAM,EAAE,CAAA;AAClC,CAAC,EAZgB,cAAc,8BAAd,cAAc,QAY9B"}
|
|
@@ -40,7 +40,6 @@ export declare namespace Changes {
|
|
|
40
40
|
function fromCapture(settlement: string, amounts: {
|
|
41
41
|
net: number;
|
|
42
42
|
fee: number;
|
|
43
|
-
charge?: number;
|
|
44
43
|
}): Changes;
|
|
45
|
-
function fromRefund(settlement: string, refund: Settlement.Entry.Creatable.Refund,
|
|
44
|
+
function fromRefund(settlement: string, refund: Settlement.Entry.Creatable.Refund, sum: Sum): Changes;
|
|
46
45
|
}
|
|
@@ -81,17 +81,14 @@ var Changes;
|
|
|
81
81
|
return {
|
|
82
82
|
[`${settlement}-net`]: { type: "add", amount: amounts.net, status: "pending" },
|
|
83
83
|
[`${settlement}-fee`]: { type: "add", amount: amounts.fee, status: "pending" },
|
|
84
|
-
...(amounts.charge && {
|
|
85
|
-
[`${settlement}-charge`]: { type: "add", amount: amounts.charge, status: "pending" },
|
|
86
|
-
}),
|
|
87
84
|
};
|
|
88
85
|
}
|
|
89
86
|
Changes.fromCapture = fromCapture;
|
|
90
|
-
function fromRefund(settlement, refund,
|
|
87
|
+
function fromRefund(settlement, refund, sum) {
|
|
91
88
|
const currency = refund.amount[0];
|
|
92
89
|
const fee = Math.abs(refund.fee.other[currency] ?? 0);
|
|
93
90
|
const net = Math.abs(refund.amount[1]);
|
|
94
|
-
const available = isoly_1.isoly.Currency.
|
|
91
|
+
const available = isoly_1.isoly.Currency.add(currency, fee, net);
|
|
95
92
|
return {
|
|
96
93
|
available: { type: available > 0 ? "add" : "subtract", amount: Math.abs(available), status: "pending" },
|
|
97
94
|
["reserved-incoming"]: {
|
|
@@ -99,9 +96,6 @@ var Changes;
|
|
|
99
96
|
amount: sum["reserved-incoming"] ?? 0,
|
|
100
97
|
status: "pending",
|
|
101
98
|
},
|
|
102
|
-
...(charge && {
|
|
103
|
-
[`${settlement}-charge`]: { type: "add", amount: charge, status: "pending" },
|
|
104
|
-
}),
|
|
105
99
|
};
|
|
106
100
|
}
|
|
107
101
|
Changes.fromRefund = fromRefund;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Changes.js","sourceRoot":"","sources":["../../../Operation/Changes.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAC7B,+BAA2B;AAC3B,wCAAsD;AAGtD,qCAAiC;AAGjC,IAAiB,OAAO,
|
|
1
|
+
{"version":3,"file":"Changes.js","sourceRoot":"","sources":["../../../Operation/Changes.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAC7B,+BAA2B;AAC3B,wCAAsD;AAGtD,qCAAiC;AAGjC,IAAiB,OAAO,CAkHvB;AAlHD,WAAiB,OAAO;IACvB,SAAgB,SAAS,CAAC,OAAoB,EAAE,QAAwB,EAAE,SAAkB,KAAK;QAChG,OAAO,MAAM;YACZ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAC9B,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,EAAE,CACtB,aAAK,CAAC,QAAQ,CAAC,GAAG,CACjB,QAAQ,EACR,CAAC,EACD,iBAAc,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC;gBACzC,CAAC,CA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AAG,aAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;QACxD,OAAO;YACN,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE;YACvG,CAAC,mBAAmB,CAAC,EAAE;gBACtB,IAAI,EAAE,UAAU;gBAChB,MAAM,EAAE,GAAG,CAAC,mBAAmB,CAAC,IAAI,CAAC;gBACrC,MAAM,EAAE,SAAS;aACjB;SACD,CAAA;IACF,CAAC;IAbe,kBAAU,aAazB,CAAA;AACF,CAAC,EAlHgB,OAAO,uBAAP,OAAO,QAkHvB"}
|
|
@@ -8,15 +8,10 @@ export type Transaction = ModelTransaction.Creatable.Resolved & {
|
|
|
8
8
|
stage: "finalize" | "initiate";
|
|
9
9
|
amount: number;
|
|
10
10
|
type: ModelTransaction.Types;
|
|
11
|
-
risk?: number;
|
|
12
11
|
original: {
|
|
13
12
|
currency: isoly.Currency;
|
|
14
13
|
total: number;
|
|
15
14
|
amount: number;
|
|
16
|
-
charge?: {
|
|
17
|
-
current: number;
|
|
18
|
-
total: number;
|
|
19
|
-
};
|
|
20
15
|
};
|
|
21
16
|
};
|
|
22
17
|
export declare namespace Transaction {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../Rule/State/Transaction.ts"],"names":[],"mappings":";;;AAEA,mDAAmE;
|
|
1
|
+
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../Rule/State/Transaction.ts"],"names":[],"mappings":";;;AAEA,mDAAmE;AAenE,IAAiB,WAAW,CA0C3B;AA1CD,WAAiB,WAAW;IAC3B,SAAgB,IAAI,CACnB,OAAqB,EACrB,WAAmE,EACnE,IAAoB,EACpB,KAA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AAO,WAAW,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC;gBAC1G,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,WAAW,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC;aACtG;SACD,CAAA;IACF,CAAC;IAnBe,8BAAkB,qBAmBjC,CAAA;AACF,CAAC,EA1CgB,WAAW,2BAAX,WAAW,QA0C3B"}
|
|
@@ -7,12 +7,10 @@ import type { Rule } from "../index";
|
|
|
7
7
|
import { Account as StateAccount } from "./Account";
|
|
8
8
|
import { Authorization as StateAuthorization } from "./Authorization";
|
|
9
9
|
import { Card as StateCard } from "./Card";
|
|
10
|
-
import { Data as StateData } from "./Data";
|
|
11
10
|
import { Organization as StateOrganization } from "./Organization";
|
|
12
11
|
import { Partial as StatePartial } from "./Partial";
|
|
13
12
|
import { Transaction as StateTransaction } from "./Transaction";
|
|
14
13
|
export interface State {
|
|
15
|
-
data: State.Data;
|
|
16
14
|
account: State.Account;
|
|
17
15
|
transaction: State.Transaction;
|
|
18
16
|
authorization?: State.Authorization;
|
|
@@ -26,7 +24,6 @@ export declare namespace State {
|
|
|
26
24
|
export import Account = StateAccount;
|
|
27
25
|
export import Transaction = StateTransaction;
|
|
28
26
|
export import Organization = StateOrganization;
|
|
29
|
-
type Data = StateData;
|
|
30
27
|
type Outcome = typeof Outcome.values[number];
|
|
31
28
|
namespace Outcome {
|
|
32
29
|
const values: readonly ["approve", "reject", "review"];
|
|
@@ -38,9 +35,9 @@ export declare namespace State {
|
|
|
38
35
|
flags: string[];
|
|
39
36
|
notes: ModelTransaction.Note[];
|
|
40
37
|
}
|
|
41
|
-
function from(
|
|
38
|
+
function from(account: ModelAccount, address: Rail.Address, transactions: Account.Transactions, days: Account.Days, transaction: ModelTransaction.Creatable.Resolved | ModelTransaction, kind: Rule.Base.Kind, stage: "finalize" | "initiate", card?: Card, organization?: Organization): State;
|
|
42
39
|
const type: Record<ModelTransaction.PreTransaction["type"], Rule.Base.Kind>;
|
|
43
|
-
function fromPreTransaction(
|
|
40
|
+
function fromPreTransaction(account: ModelAccount, address: Rail.Address, transactions: Account.Transactions, days: Account.Days, transaction: ModelTransaction.PreTransaction, card?: ModelCard & {
|
|
44
41
|
statistics: Card.Statistics;
|
|
45
42
|
}, organization?: Organization): State;
|
|
46
43
|
}
|
|
@@ -21,9 +21,8 @@ var State;
|
|
|
21
21
|
Outcome.values = ["approve", "reject", "review"];
|
|
22
22
|
Outcome.type = isly_1.isly.string(Outcome.values);
|
|
23
23
|
})(Outcome = State.Outcome || (State.Outcome = {}));
|
|
24
|
-
function from(
|
|
24
|
+
function from(account, address, transactions, days, transaction, kind, stage, card, organization) {
|
|
25
25
|
return {
|
|
26
|
-
data,
|
|
27
26
|
account: State.Account.from(account, address, transactions, days),
|
|
28
27
|
transaction: State.Transaction.from(account, transaction, kind, stage),
|
|
29
28
|
authorization: State.Authorization.from(transaction),
|
|
@@ -37,9 +36,8 @@ var State;
|
|
|
37
36
|
incoming: "inbound",
|
|
38
37
|
outgoing: "outbound",
|
|
39
38
|
};
|
|
40
|
-
function fromPreTransaction(
|
|
39
|
+
function fromPreTransaction(account, address, transactions, days, transaction, card, organization) {
|
|
41
40
|
return {
|
|
42
|
-
data,
|
|
43
41
|
account: State.Account.from(account, address, transactions, days),
|
|
44
42
|
transaction: State.Transaction.from(account, transaction, State.type[transaction.type], "initiate"),
|
|
45
43
|
card: card ? State.Card.from(card, card.statistics) : undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Rule/State/index.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;AAM3B,uCAAmD;AACnD,mDAAqE;AACrE,iCAA0C;
|
|
1
|
+
{"version":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ACD,SAAgB,kBAAkB,CACjC,OAAqB,EACrB,OAAqB,EACrB,YAAkC,EAClC,IAAkB,EAClB,WAA4C,EAC5C,IAAkD,EAClD,YAA2B;QAE3B,OAAO;YACN,OAAO,EAAE,MAAA,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,CAAC;YAC3D,WAAW,EAAE,MAAA,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,MAAA,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;YACvF,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;YACzD,YAAY;SACZ,CAAA;IACF,CAAC;IAfe,wBAAkB,qBAejC,CAAA;AACF,CAAC,EA1DgB,KAAK,qBAAL,KAAK,QA0DrB"}
|
package/dist/cjs/Rule/index.d.ts
CHANGED
|
@@ -1,36 +1,24 @@
|
|
|
1
1
|
import { selectively } from "selectively";
|
|
2
2
|
import { isly } from "isly";
|
|
3
3
|
import { Exchange } from "../Exchange";
|
|
4
|
-
import { Realm } from "../Realm";
|
|
5
4
|
import { Base as RuleBase } from "./Base";
|
|
6
|
-
import { Charge as RuleCharge } from "./Charge";
|
|
7
5
|
import { control as ruleControl } from "./control";
|
|
8
6
|
import { Other as RuleOther } from "./Other";
|
|
9
|
-
import { Reserve as RuleReserve } from "./Reserve";
|
|
10
|
-
import { Score as RuleScore } from "./Score";
|
|
11
7
|
import { State as RuleState } from "./State";
|
|
12
|
-
export type Rule = Rule.Other
|
|
8
|
+
export type Rule = Rule.Other;
|
|
13
9
|
export declare namespace Rule {
|
|
14
10
|
export import Other = RuleOther;
|
|
15
|
-
export import Score = RuleScore;
|
|
16
|
-
export import Charge = RuleCharge;
|
|
17
11
|
export import State = RuleState;
|
|
18
|
-
export import Reserve = RuleReserve;
|
|
19
12
|
export import Base = RuleBase;
|
|
20
13
|
export import Kind = Base.Kind;
|
|
21
14
|
export import Category = Base.Category;
|
|
22
15
|
const control: typeof ruleControl;
|
|
23
|
-
type Api = Rule.Other | Rule.Score | Rule.Charge.Api | Rule.Reserve.Api;
|
|
24
|
-
namespace Api {
|
|
25
|
-
const type: isly.Type<Api>;
|
|
26
|
-
}
|
|
27
|
-
function fromApi(rule: Rule.Api, realm: Realm): Rule;
|
|
28
16
|
type Action = typeof Action.values[number];
|
|
29
17
|
namespace Action {
|
|
30
|
-
const values: readonly ["review", "reject", "flag"
|
|
31
|
-
const type: isly.Type<"reject" | "
|
|
18
|
+
const values: readonly ["review", "reject", "flag"];
|
|
19
|
+
const type: isly.Type<"reject" | "review" | "flag">;
|
|
32
20
|
}
|
|
33
|
-
const type: isly.
|
|
21
|
+
const type: import("isly/dist/cjs/object").IslyObject<Other, Base>;
|
|
34
22
|
function evaluate(rules: Rule[], state: RuleState, macros?: Record<string, selectively.Definition>, table?: Exchange.Rates): RuleState.Evaluated;
|
|
35
23
|
function isLegacy(rule: Rule): boolean;
|
|
36
24
|
function fromLegacy(rule: Rule): Rule;
|