@pax2pay/model-banking 0.1.601 → 0.1.603
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/.eslintrc +13 -14
- package/.prettierrc +2 -3
- package/Account/Charge/Fx/index.ts +2 -1
- package/Account/Creatable.ts +1 -1
- package/Account/History.ts +1 -1
- package/Account/Status.ts +2 -2
- package/Account/Type.ts +1 -1
- package/Audit.ts +1 -1
- package/Authorization/Status.ts +8 -6
- package/Backup/Base.ts +1 -1
- package/Balance.ts +2 -2
- package/Balances.ts +6 -3
- package/Card/Expiry.ts +2 -2
- package/Card/Operation/Authorization.ts +1 -1
- package/Card/Operation/Card.ts +1 -1
- package/Card/Operation/index.ts +1 -1
- package/Card/Preset.ts +1 -1
- package/Card/Restriction/Merchant.ts +8 -6
- package/Card/Restriction/index.ts +2 -1
- package/Card/Scheme.ts +1 -1
- package/Card/Stack.ts +2 -2
- package/Client/Labels.ts +4 -1
- package/Client/Operations.ts +4 -4
- package/Client/Transactions/index.ts +3 -2
- package/Client/index.ts +3 -2
- package/Holidays/index.ts +1 -1
- package/Label.ts +1 -1
- package/Log/Message/Configuration.ts +1 -1
- package/Log/Message/Entry.ts +1 -1
- package/Log/Message/index.ts +3 -2
- package/Log/index.ts +4 -2
- package/Operation/Change.ts +1 -1
- package/Operation/Changes.ts +10 -9
- package/Operation/Creatable.ts +1 -1
- package/Operation/Status.ts +1 -1
- package/Operation/index.ts +2 -1
- package/Organization/Risk.ts +1 -1
- package/Quarter.ts +1 -1
- package/Rail/Address/Route.ts +2 -2
- package/Rail/Address/index.ts +1 -11
- package/Rail/index.ts +1 -1
- package/Realm.ts +2 -2
- package/Rule/Base.ts +2 -2
- package/Rule/Other.ts +5 -3
- package/Rule/State/Authorization.ts +1 -1
- package/Rule/State/Card.ts +3 -2
- package/Rule/State/index.ts +1 -1
- package/Rule/index.ts +1 -1
- package/Settlement/Entry/fromCreatable.ts +8 -6
- package/Settlement/Status.ts +1 -1
- package/Settlement/Total.ts +8 -6
- package/Settlement/Totals.ts +4 -2
- package/Supplier/index.ts +2 -3
- package/Transaction/Statistics.ts +6 -5
- package/Transaction/Status.ts +3 -3
- package/Transaction/index.ts +22 -20
- package/Treasury/Account/Category.ts +1 -1
- package/Treasury/Snapshot/funding.ts +7 -5
- package/User/Access/Permission.ts +2 -2
- package/User/Identity.ts +7 -3
- package/User/Password.ts +5 -4
- package/Warning/Base.ts +1 -1
- package/Warning/Snapshot/MissingBuffer.ts +2 -1
- package/Warning/Snapshot/StaleFiat.ts +6 -3
- package/dist/cjs/Account/Charge/Fx/index.js +2 -1
- package/dist/cjs/Account/Charge/Fx/index.js.map +1 -1
- package/dist/cjs/Account/Creatable.d.ts +1 -1
- package/dist/cjs/Account/History.d.ts +1 -1
- package/dist/cjs/Account/Status.d.ts +2 -2
- package/dist/cjs/Account/Type.d.ts +1 -1
- package/dist/cjs/Audit.d.ts +1 -1
- package/dist/cjs/Authorization/Status.d.ts +1 -1
- package/dist/cjs/Authorization/Status.js +10 -5
- package/dist/cjs/Authorization/Status.js.map +1 -1
- package/dist/cjs/Backup/Base.d.ts +1 -1
- package/dist/cjs/Balance.d.ts +2 -2
- package/dist/cjs/Balances.js +6 -3
- package/dist/cjs/Balances.js.map +1 -1
- package/dist/cjs/Card/Expiry.d.ts +2 -2
- package/dist/cjs/Card/Operation/Authorization.d.ts +1 -1
- package/dist/cjs/Card/Operation/Card.d.ts +1 -1
- package/dist/cjs/Card/Operation/index.js.map +1 -1
- package/dist/cjs/Card/Preset.d.ts +1 -1
- package/dist/cjs/Card/Restriction/Merchant.d.ts +1 -1
- package/dist/cjs/Card/Restriction/Merchant.js +10 -5
- package/dist/cjs/Card/Restriction/Merchant.js.map +1 -1
- package/dist/cjs/Card/Restriction/index.js +2 -1
- package/dist/cjs/Card/Restriction/index.js.map +1 -1
- package/dist/cjs/Card/Scheme.d.ts +1 -1
- package/dist/cjs/Card/Stack.d.ts +2 -2
- package/dist/cjs/Client/Labels.js.map +1 -1
- package/dist/cjs/Client/Operations.js.map +1 -1
- package/dist/cjs/Client/Transactions/index.d.ts +1 -1
- package/dist/cjs/Client/Transactions/index.js +2 -1
- package/dist/cjs/Client/Transactions/index.js.map +1 -1
- package/dist/cjs/Client/index.js +3 -2
- package/dist/cjs/Client/index.js.map +1 -1
- package/dist/cjs/Holidays/index.d.ts +1 -1
- package/dist/cjs/Label.d.ts +1 -1
- package/dist/cjs/Log/Message/Configuration.js.map +1 -1
- package/dist/cjs/Log/Message/Entry.js.map +1 -1
- package/dist/cjs/Log/Message/index.js +2 -1
- package/dist/cjs/Log/Message/index.js.map +1 -1
- package/dist/cjs/Log/index.js +4 -2
- package/dist/cjs/Log/index.js.map +1 -1
- package/dist/cjs/Operation/Change.d.ts +1 -1
- package/dist/cjs/Operation/Changes.d.ts +2 -2
- package/dist/cjs/Operation/Changes.js +8 -4
- package/dist/cjs/Operation/Changes.js.map +1 -1
- package/dist/cjs/Operation/Creatable.d.ts +1 -1
- package/dist/cjs/Operation/Status.d.ts +1 -1
- package/dist/cjs/Operation/index.js +2 -1
- package/dist/cjs/Operation/index.js.map +1 -1
- package/dist/cjs/Organization/Risk.d.ts +1 -1
- package/dist/cjs/Quarter.d.ts +1 -1
- package/dist/cjs/Rail/Address/Route.d.ts +1 -1
- package/dist/cjs/Rail/Address/Route.js +1 -1
- package/dist/cjs/Rail/Address/Route.js.map +1 -1
- package/dist/cjs/Rail/Address/index.d.ts +2 -4
- package/dist/cjs/Rail/Address/index.js +1 -9
- package/dist/cjs/Rail/Address/index.js.map +1 -1
- package/dist/cjs/Rail/index.d.ts +3 -3
- package/dist/cjs/Realm.d.ts +1 -1
- package/dist/cjs/Realm.js +1 -1
- package/dist/cjs/Realm.js.map +1 -1
- package/dist/cjs/Rule/Base.d.ts +2 -2
- package/dist/cjs/Rule/Other.d.ts +1 -1
- package/dist/cjs/Rule/Other.js +4 -2
- package/dist/cjs/Rule/Other.js.map +1 -1
- package/dist/cjs/Rule/State/Authorization.js.map +1 -1
- package/dist/cjs/Rule/State/Card.js +4 -2
- package/dist/cjs/Rule/State/Card.js.map +1 -1
- package/dist/cjs/Rule/State/index.d.ts +1 -1
- package/dist/cjs/Rule/index.d.ts +1 -1
- package/dist/cjs/Settlement/Entry/fromCreatable.js +10 -5
- package/dist/cjs/Settlement/Entry/fromCreatable.js.map +1 -1
- package/dist/cjs/Settlement/Status.d.ts +1 -1
- package/dist/cjs/Settlement/Total.js +4 -2
- package/dist/cjs/Settlement/Total.js.map +1 -1
- package/dist/cjs/Settlement/Totals.js +4 -2
- package/dist/cjs/Settlement/Totals.js.map +1 -1
- package/dist/cjs/Supplier/index.d.ts +3 -3
- package/dist/cjs/Supplier/index.js +1 -1
- package/dist/cjs/Supplier/index.js.map +1 -1
- package/dist/cjs/Transaction/Statistics.d.ts +2 -2
- package/dist/cjs/Transaction/Statistics.js +2 -1
- package/dist/cjs/Transaction/Statistics.js.map +1 -1
- package/dist/cjs/Transaction/Status.d.ts +3 -3
- package/dist/cjs/Transaction/index.d.ts +2 -2
- package/dist/cjs/Transaction/index.js +10 -5
- package/dist/cjs/Transaction/index.js.map +1 -1
- package/dist/cjs/Treasury/Account/Category.d.ts +1 -1
- package/dist/cjs/Treasury/Snapshot/funding.js +8 -4
- package/dist/cjs/Treasury/Snapshot/funding.js.map +1 -1
- package/dist/cjs/User/Access/Permission.d.ts +2 -2
- package/dist/cjs/User/Identity.js +4 -2
- package/dist/cjs/User/Identity.js.map +1 -1
- package/dist/cjs/User/Password.js +8 -4
- package/dist/cjs/User/Password.js.map +1 -1
- package/dist/cjs/Warning/Base.d.ts +1 -1
- package/dist/cjs/Warning/Snapshot/MissingBuffer.js +2 -1
- package/dist/cjs/Warning/Snapshot/MissingBuffer.js.map +1 -1
- package/dist/cjs/Warning/Snapshot/StaleFiat.js +6 -3
- package/dist/cjs/Warning/Snapshot/StaleFiat.js.map +1 -1
- package/dist/cjs/fx.d.ts +1 -1
- package/dist/cjs/reports/visa/Data/Cards.js +6 -3
- package/dist/cjs/reports/visa/Data/Cards.js.map +1 -1
- package/dist/cjs/reports/visa/Data/Country.js +6 -3
- package/dist/cjs/reports/visa/Data/Country.js.map +1 -1
- package/dist/cjs/reports/visa/Data/Iin.d.ts +2 -2
- package/dist/cjs/reports/visa/Data/Monthly.d.ts +1 -1
- package/dist/cjs/reports/visa/Data/Monthly.js +2 -1
- package/dist/cjs/reports/visa/Data/Monthly.js.map +1 -1
- package/dist/cjs/reports/visa/Data/NonMonthly.js +8 -4
- package/dist/cjs/reports/visa/Data/NonMonthly.js.map +1 -1
- package/dist/cjs/reports/visa/Data/Region.d.ts +1 -1
- package/dist/cjs/reports/visa/Data/Region.js +16 -8
- package/dist/cjs/reports/visa/Data/Region.js.map +1 -1
- package/dist/cjs/reports/visa/Data/Regional.js +4 -2
- package/dist/cjs/reports/visa/Data/Regional.js.map +1 -1
- package/dist/cjs/reports/visa/Data/index.js +4 -2
- package/dist/cjs/reports/visa/Data/index.js.map +1 -1
- package/dist/cjs/reports/visa/index.js +10 -5
- package/dist/cjs/reports/visa/index.js.map +1 -1
- package/dist/cjs/reports/visa/rows.d.ts +2 -2
- package/dist/cjs/reports/visa/rows.js +2 -1
- package/dist/cjs/reports/visa/rows.js.map +1 -1
- package/dist/mjs/Account/Charge/Fx/index.js +2 -1
- package/dist/mjs/Account/Charge/Fx/index.js.map +1 -1
- package/dist/mjs/Account/Creatable.d.ts +1 -1
- package/dist/mjs/Account/History.d.ts +1 -1
- package/dist/mjs/Account/Status.d.ts +2 -2
- package/dist/mjs/Account/Type.d.ts +1 -1
- package/dist/mjs/Audit.d.ts +1 -1
- package/dist/mjs/Authorization/Status.d.ts +1 -1
- package/dist/mjs/Authorization/Status.js +10 -5
- package/dist/mjs/Authorization/Status.js.map +1 -1
- package/dist/mjs/Backup/Base.d.ts +1 -1
- package/dist/mjs/Balance.d.ts +2 -2
- package/dist/mjs/Balances.js +6 -3
- package/dist/mjs/Balances.js.map +1 -1
- package/dist/mjs/Card/Expiry.d.ts +2 -2
- package/dist/mjs/Card/Operation/Authorization.d.ts +1 -1
- package/dist/mjs/Card/Operation/Card.d.ts +1 -1
- package/dist/mjs/Card/Operation/index.js.map +1 -1
- package/dist/mjs/Card/Preset.d.ts +1 -1
- package/dist/mjs/Card/Restriction/Merchant.d.ts +1 -1
- package/dist/mjs/Card/Restriction/Merchant.js +10 -5
- package/dist/mjs/Card/Restriction/Merchant.js.map +1 -1
- package/dist/mjs/Card/Restriction/index.js +2 -1
- package/dist/mjs/Card/Restriction/index.js.map +1 -1
- package/dist/mjs/Card/Scheme.d.ts +1 -1
- package/dist/mjs/Card/Stack.d.ts +2 -2
- package/dist/mjs/Client/Labels.js.map +1 -1
- package/dist/mjs/Client/Operations.js.map +1 -1
- package/dist/mjs/Client/Transactions/index.d.ts +1 -1
- package/dist/mjs/Client/Transactions/index.js +2 -1
- package/dist/mjs/Client/Transactions/index.js.map +1 -1
- package/dist/mjs/Client/index.js +3 -2
- package/dist/mjs/Client/index.js.map +1 -1
- package/dist/mjs/Holidays/index.d.ts +1 -1
- package/dist/mjs/Label.d.ts +1 -1
- package/dist/mjs/Log/Message/Configuration.js.map +1 -1
- package/dist/mjs/Log/Message/Entry.js.map +1 -1
- package/dist/mjs/Log/Message/index.js +2 -1
- package/dist/mjs/Log/Message/index.js.map +1 -1
- package/dist/mjs/Log/index.js +4 -2
- package/dist/mjs/Log/index.js.map +1 -1
- package/dist/mjs/Operation/Change.d.ts +1 -1
- package/dist/mjs/Operation/Changes.d.ts +2 -2
- package/dist/mjs/Operation/Changes.js +8 -4
- package/dist/mjs/Operation/Changes.js.map +1 -1
- package/dist/mjs/Operation/Creatable.d.ts +1 -1
- package/dist/mjs/Operation/Status.d.ts +1 -1
- package/dist/mjs/Operation/index.js +2 -1
- package/dist/mjs/Operation/index.js.map +1 -1
- package/dist/mjs/Organization/Risk.d.ts +1 -1
- package/dist/mjs/Quarter.d.ts +1 -1
- package/dist/mjs/Rail/Address/Route.d.ts +1 -1
- package/dist/mjs/Rail/Address/Route.js +1 -1
- package/dist/mjs/Rail/Address/Route.js.map +1 -1
- package/dist/mjs/Rail/Address/index.d.ts +2 -4
- package/dist/mjs/Rail/Address/index.js +1 -9
- package/dist/mjs/Rail/Address/index.js.map +1 -1
- package/dist/mjs/Rail/index.d.ts +3 -3
- package/dist/mjs/Realm.d.ts +1 -1
- package/dist/mjs/Realm.js +1 -1
- package/dist/mjs/Realm.js.map +1 -1
- package/dist/mjs/Rule/Base.d.ts +2 -2
- package/dist/mjs/Rule/Other.d.ts +1 -1
- package/dist/mjs/Rule/Other.js +4 -2
- package/dist/mjs/Rule/Other.js.map +1 -1
- package/dist/mjs/Rule/State/Authorization.js.map +1 -1
- package/dist/mjs/Rule/State/Card.js +4 -2
- package/dist/mjs/Rule/State/Card.js.map +1 -1
- package/dist/mjs/Rule/State/index.d.ts +1 -1
- package/dist/mjs/Rule/index.d.ts +1 -1
- package/dist/mjs/Settlement/Entry/fromCreatable.js +10 -5
- package/dist/mjs/Settlement/Entry/fromCreatable.js.map +1 -1
- package/dist/mjs/Settlement/Status.d.ts +1 -1
- package/dist/mjs/Settlement/Total.js +4 -2
- package/dist/mjs/Settlement/Total.js.map +1 -1
- package/dist/mjs/Settlement/Totals.js +4 -2
- package/dist/mjs/Settlement/Totals.js.map +1 -1
- package/dist/mjs/Supplier/index.d.ts +3 -3
- package/dist/mjs/Supplier/index.js +1 -1
- package/dist/mjs/Supplier/index.js.map +1 -1
- package/dist/mjs/Transaction/Statistics.d.ts +2 -2
- package/dist/mjs/Transaction/Statistics.js +2 -1
- package/dist/mjs/Transaction/Statistics.js.map +1 -1
- package/dist/mjs/Transaction/Status.d.ts +3 -3
- package/dist/mjs/Transaction/index.d.ts +2 -2
- package/dist/mjs/Transaction/index.js +10 -5
- package/dist/mjs/Transaction/index.js.map +1 -1
- package/dist/mjs/Treasury/Account/Category.d.ts +1 -1
- package/dist/mjs/Treasury/Snapshot/funding.js +8 -4
- package/dist/mjs/Treasury/Snapshot/funding.js.map +1 -1
- package/dist/mjs/User/Access/Permission.d.ts +2 -2
- package/dist/mjs/User/Identity.js +4 -2
- package/dist/mjs/User/Identity.js.map +1 -1
- package/dist/mjs/User/Password.js +8 -4
- package/dist/mjs/User/Password.js.map +1 -1
- package/dist/mjs/Warning/Base.d.ts +1 -1
- package/dist/mjs/Warning/Snapshot/MissingBuffer.js +2 -1
- package/dist/mjs/Warning/Snapshot/MissingBuffer.js.map +1 -1
- package/dist/mjs/Warning/Snapshot/StaleFiat.js +6 -3
- package/dist/mjs/Warning/Snapshot/StaleFiat.js.map +1 -1
- package/dist/mjs/fx.d.ts +1 -1
- package/dist/mjs/reports/visa/Data/Cards.js +6 -3
- package/dist/mjs/reports/visa/Data/Cards.js.map +1 -1
- package/dist/mjs/reports/visa/Data/Country.js +6 -3
- package/dist/mjs/reports/visa/Data/Country.js.map +1 -1
- package/dist/mjs/reports/visa/Data/Iin.d.ts +2 -2
- package/dist/mjs/reports/visa/Data/Monthly.d.ts +1 -1
- package/dist/mjs/reports/visa/Data/Monthly.js +2 -1
- package/dist/mjs/reports/visa/Data/Monthly.js.map +1 -1
- package/dist/mjs/reports/visa/Data/NonMonthly.js +8 -4
- package/dist/mjs/reports/visa/Data/NonMonthly.js.map +1 -1
- package/dist/mjs/reports/visa/Data/Region.d.ts +1 -1
- package/dist/mjs/reports/visa/Data/Region.js +16 -8
- package/dist/mjs/reports/visa/Data/Region.js.map +1 -1
- package/dist/mjs/reports/visa/Data/Regional.js +4 -2
- package/dist/mjs/reports/visa/Data/Regional.js.map +1 -1
- package/dist/mjs/reports/visa/Data/index.js +4 -2
- package/dist/mjs/reports/visa/Data/index.js.map +1 -1
- package/dist/mjs/reports/visa/index.js +10 -5
- package/dist/mjs/reports/visa/index.js.map +1 -1
- package/dist/mjs/reports/visa/rows.d.ts +2 -2
- package/dist/mjs/reports/visa/rows.js +2 -1
- package/dist/mjs/reports/visa/rows.js.map +1 -1
- package/fx.ts +1 -1
- package/package.json +10 -9
- package/reports/visa/Data/Cards.ts +6 -3
- package/reports/visa/Data/Country.ts +6 -3
- package/reports/visa/Data/Iin.ts +2 -2
- package/reports/visa/Data/Monthly.ts +3 -2
- package/reports/visa/Data/NonMonthly.ts +8 -4
- package/reports/visa/Data/Region.ts +11 -9
- package/reports/visa/Data/Regional.ts +4 -2
- package/reports/visa/Data/index.ts +3 -2
- package/reports/visa/index.ts +8 -6
- package/reports/visa/rows.ts +4 -3
- package/Rail/Address/PaxgiroCredit.ts +0 -14
- package/dist/cjs/Rail/Address/PaxgiroCredit.d.ts +0 -8
- package/dist/cjs/Rail/Address/PaxgiroCredit.js +0 -13
- package/dist/cjs/Rail/Address/PaxgiroCredit.js.map +0 -1
- package/dist/mjs/Rail/Address/PaxgiroCredit.d.ts +0 -8
- package/dist/mjs/Rail/Address/PaxgiroCredit.js +0 -10
- package/dist/mjs/Rail/Address/PaxgiroCredit.js.map +0 -1
package/Rail/Address/index.ts
CHANGED
|
@@ -4,14 +4,12 @@ import { Card as AddressCard } from "./Card"
|
|
|
4
4
|
import { Iban as AddressIban } from "./Iban"
|
|
5
5
|
import { Internal as AddressInternal } from "./internal"
|
|
6
6
|
import { PaxGiro as AddressPaxGiro } from "./PaxGiro"
|
|
7
|
-
import { PaxgiroCredit as AddressPaxgiroCredit } from "./PaxgiroCredit"
|
|
8
7
|
import { Route as AddressRoute } from "./Route"
|
|
9
8
|
import { Scan as AddressScan } from "./Scan"
|
|
10
9
|
|
|
11
10
|
export type Address =
|
|
12
11
|
| AddressCard
|
|
13
12
|
| AddressCard.Counterpart
|
|
14
|
-
| AddressPaxgiroCredit
|
|
15
13
|
| AddressIban
|
|
16
14
|
| AddressInternal
|
|
17
15
|
| AddressPaxGiro
|
|
@@ -23,7 +21,7 @@ export namespace Address {
|
|
|
23
21
|
eea: ["internal", "iban", "scan", "card"],
|
|
24
22
|
}
|
|
25
23
|
export const values = ["paxgiro", "internal", "iban", "scan", "card", "paxgiro-credit"] as const
|
|
26
|
-
export type Type = typeof values[number]
|
|
24
|
+
export type Type = (typeof values)[number]
|
|
27
25
|
export function compare(addresses: [Address, Address]): boolean {
|
|
28
26
|
return Object.entries(addresses[0]).every(([key, value]) => value == (addresses[1] as any)[key])
|
|
29
27
|
}
|
|
@@ -55,9 +53,6 @@ export namespace Address {
|
|
|
55
53
|
case "card":
|
|
56
54
|
result = "id" in Address ? `${Address.type}-${Address.id}` : `${Address.type}-merchant-${Address.merchant.id}`
|
|
57
55
|
break
|
|
58
|
-
case "paxgiro-credit":
|
|
59
|
-
result = `${Address.type}-${Address.reference}`
|
|
60
|
-
break
|
|
61
56
|
}
|
|
62
57
|
return result
|
|
63
58
|
}
|
|
@@ -79,16 +74,12 @@ export namespace Address {
|
|
|
79
74
|
case "card":
|
|
80
75
|
result = "id" in Address ? `${Address.type}-${Address.id}` : `${Address.type}-merchant-${Address.merchant.id}`
|
|
81
76
|
break
|
|
82
|
-
case "paxgiro-credit":
|
|
83
|
-
result = `${Address.type}-${Address.reference}`
|
|
84
|
-
break
|
|
85
77
|
}
|
|
86
78
|
return result
|
|
87
79
|
}
|
|
88
80
|
export const type = isly.union<Address>(
|
|
89
81
|
AddressCard.type,
|
|
90
82
|
AddressCard.Counterpart.type,
|
|
91
|
-
AddressPaxgiroCredit.type,
|
|
92
83
|
AddressIban.type,
|
|
93
84
|
AddressInternal.type,
|
|
94
85
|
AddressPaxGiro.type,
|
|
@@ -100,6 +91,5 @@ export namespace Address {
|
|
|
100
91
|
export import Scan = AddressScan
|
|
101
92
|
export import Internal = AddressInternal
|
|
102
93
|
export import Card = AddressCard
|
|
103
|
-
export import PaxgiroFunding = AddressPaxgiroCredit
|
|
104
94
|
export import Route = AddressRoute
|
|
105
95
|
}
|
package/Rail/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { isly } from "isly"
|
|
|
2
2
|
import { isly as isly2 } from "isly2"
|
|
3
3
|
import { Address as RailAddress } from "./Address"
|
|
4
4
|
|
|
5
|
-
export type Rail = typeof Rail.rails[number]
|
|
5
|
+
export type Rail = (typeof Rail.rails)[number]
|
|
6
6
|
export namespace Rail {
|
|
7
7
|
export const rails = [
|
|
8
8
|
"internal",
|
package/Realm.ts
CHANGED
|
@@ -19,12 +19,12 @@ export namespace Realm {
|
|
|
19
19
|
}
|
|
20
20
|
export const currency: Record<Realm, isoly.Currency> = { test: "EUR", uk: "GBP", eea: "EUR" }
|
|
21
21
|
export const suppliers: Record<Realm, modelSupplier[]> = {
|
|
22
|
-
test: ["paxgiro", "bankingcircle"
|
|
22
|
+
test: ["paxgiro", "bankingcircle"],
|
|
23
23
|
uk: ["clearbank", "bankingcircle"],
|
|
24
24
|
eea: [],
|
|
25
25
|
}
|
|
26
26
|
export interface Suppliers extends Record<Realm, modelSupplier[]> {
|
|
27
|
-
test: ["paxgiro", "bankingcircle"
|
|
27
|
+
test: ["paxgiro", "bankingcircle"]
|
|
28
28
|
uk: ["clearbank", "bankingcircle"]
|
|
29
29
|
eea: []
|
|
30
30
|
}
|
package/Rule/Base.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface Base {
|
|
|
14
14
|
presets?: Preset[]
|
|
15
15
|
}
|
|
16
16
|
export namespace Base {
|
|
17
|
-
export type Kind = typeof Kind.values[number]
|
|
17
|
+
export type Kind = (typeof Kind.values)[number]
|
|
18
18
|
export namespace Kind {
|
|
19
19
|
export const values = ["authorization", "outbound", "inbound", "capture", "refund"] as const
|
|
20
20
|
export const type = isly.string<Kind>(values)
|
|
@@ -29,7 +29,7 @@ export namespace Base {
|
|
|
29
29
|
return kind == rule.type && applyRuleForGroup && applyRuleForPreset
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
export type Category = typeof Category.values[number]
|
|
32
|
+
export type Category = (typeof Category.values)[number]
|
|
33
33
|
export namespace Category {
|
|
34
34
|
export const values = ["fincrime", "product", "customer"] as const
|
|
35
35
|
export const type = isly.string<Category>(values)
|
package/Rule/Other.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface Other extends Base {
|
|
|
10
10
|
action: Other.Action
|
|
11
11
|
}
|
|
12
12
|
export namespace Other {
|
|
13
|
-
export type Action = typeof Action.values[number]
|
|
13
|
+
export type Action = (typeof Action.values)[number]
|
|
14
14
|
export namespace Action {
|
|
15
15
|
export const values = ["review", "reject", "flag"] as const
|
|
16
16
|
export const type = isly.string<Action>(values)
|
|
@@ -38,14 +38,16 @@ export namespace Other {
|
|
|
38
38
|
if (
|
|
39
39
|
state.transaction.stage == "initiate" &&
|
|
40
40
|
["card", "external", "internal"].some(type => type == state.transaction.type)
|
|
41
|
-
)
|
|
42
|
-
for (const rule of rules)
|
|
41
|
+
) {
|
|
42
|
+
for (const rule of rules) {
|
|
43
43
|
if (control(rule, state)) {
|
|
44
44
|
result.outcomes[rule.action].push(rule)
|
|
45
45
|
result.notes.push({ author: "automatic", created: now, text: rule.name, rule })
|
|
46
46
|
rule.flags.forEach(f => result.flags.add(f))
|
|
47
47
|
rule.action == "review" && result.flags.add("review")
|
|
48
48
|
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
49
51
|
return result
|
|
50
52
|
}
|
|
51
53
|
}
|
|
@@ -41,7 +41,7 @@ export namespace Authorization {
|
|
|
41
41
|
typeof transaction.reference == "string" ? transaction.reference : transaction.reference?.reference,
|
|
42
42
|
description: transaction.description,
|
|
43
43
|
...("exchange" in transaction ? { exchange: transaction.exchange } : {}),
|
|
44
|
-
|
|
44
|
+
}
|
|
45
45
|
: undefined
|
|
46
46
|
}
|
|
47
47
|
export function toTransaction(authorization: Authorization): Transaction.Creatable & {
|
package/Rule/State/Card.ts
CHANGED
|
@@ -34,10 +34,11 @@ export namespace Card {
|
|
|
34
34
|
}
|
|
35
35
|
export function check(card: Card, amount: number): TransactionStatus.Reason | undefined {
|
|
36
36
|
let result: TransactionStatus.Reason | undefined = undefined
|
|
37
|
-
if (ModelCard.Expiry.isExpired(card.details.expiry))
|
|
37
|
+
if (ModelCard.Expiry.isExpired(card.details.expiry)) {
|
|
38
38
|
result = "card expired"
|
|
39
|
-
else if (amount + card.spent[1] > card.limit)
|
|
39
|
+
} else if (amount + card.spent[1] > card.limit) {
|
|
40
40
|
result = "exceeds limit"
|
|
41
|
+
}
|
|
41
42
|
return result
|
|
42
43
|
}
|
|
43
44
|
export function toAddress(card: Card): Rail.Address.Card {
|
package/Rule/State/index.ts
CHANGED
|
@@ -25,7 +25,7 @@ export namespace State {
|
|
|
25
25
|
export import Account = StateAccount
|
|
26
26
|
export import Transaction = StateTransaction
|
|
27
27
|
export import Organization = StateOrganization
|
|
28
|
-
export type Outcome = typeof Outcome.values[number]
|
|
28
|
+
export type Outcome = (typeof Outcome.values)[number]
|
|
29
29
|
export namespace Outcome {
|
|
30
30
|
export const values = ["approve", "reject", "review"] as const
|
|
31
31
|
export const type = isly.string<Outcome>(values)
|
package/Rule/index.ts
CHANGED
|
@@ -15,7 +15,7 @@ export namespace Rule {
|
|
|
15
15
|
export import Category = Base.Category
|
|
16
16
|
export const control = ruleControl
|
|
17
17
|
|
|
18
|
-
export type Action = typeof Action.values[number]
|
|
18
|
+
export type Action = (typeof Action.values)[number]
|
|
19
19
|
export namespace Action {
|
|
20
20
|
export const values = [...Other.Action.values] as const
|
|
21
21
|
export const type = isly.string<Action>(values)
|
|
@@ -11,17 +11,19 @@ export function fromCreatable(
|
|
|
11
11
|
let result: Entry
|
|
12
12
|
const reasons: string[] = []
|
|
13
13
|
const created = isoly.DateTime.now()
|
|
14
|
-
if (creatable.type == "unknown")
|
|
14
|
+
if (creatable.type == "unknown") {
|
|
15
15
|
reasons.push("Unknown entry type.")
|
|
16
|
-
|
|
16
|
+
}
|
|
17
|
+
if (gracely.Error.is(transaction)) {
|
|
17
18
|
reasons.push(`gracely error: ${JSON.stringify(transaction)}`)
|
|
18
|
-
else if (typeof transaction == "string")
|
|
19
|
+
} else if (typeof transaction == "string") {
|
|
19
20
|
reasons.push(transaction || "No reason provided.")
|
|
20
|
-
else if (transaction.status != "finalized" && transaction.status != "processing")
|
|
21
|
+
} else if (transaction.status != "finalized" && transaction.status != "processing") {
|
|
21
22
|
reasons.push(`Transaction ${transaction.id} on account ${transaction.accountId} unable to be finalized.`)
|
|
22
|
-
|
|
23
|
+
}
|
|
24
|
+
if (reasons.length > 0) {
|
|
23
25
|
result = { status: "failed", reason: reasons.join("\n"), ...creatable, created }
|
|
24
|
-
else {
|
|
26
|
+
} else {
|
|
25
27
|
const cardTransaction = transaction as Transaction.CardTransaction
|
|
26
28
|
result = {
|
|
27
29
|
status: "succeeded",
|
package/Settlement/Status.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface Status {
|
|
|
7
7
|
|
|
8
8
|
export namespace Status {
|
|
9
9
|
export const values = ["pending", "failed", "partial", "done"] as const
|
|
10
|
-
export type Values = typeof values[number]
|
|
10
|
+
export type Values = (typeof values)[number]
|
|
11
11
|
export const type = isly.object<Status>({
|
|
12
12
|
collected: isly.string(values),
|
|
13
13
|
settled: isly.string(values),
|
package/Settlement/Total.ts
CHANGED
|
@@ -52,26 +52,28 @@ export namespace Total {
|
|
|
52
52
|
export function add(currency: isoly.Currency, addendee: Total, addend: Partial<Total>): Total {
|
|
53
53
|
const result: Total = { ...addendee }
|
|
54
54
|
addend.expected && (result.expected = Amount.add(currency, result.expected, addend.expected))
|
|
55
|
-
if (result.outcome || addend.outcome)
|
|
55
|
+
if (result.outcome || addend.outcome) {
|
|
56
56
|
result.outcome = Amount.add(currency, result.outcome ?? { net: 0, fee: { other: 0 } }, addend.outcome ?? {})
|
|
57
|
+
}
|
|
57
58
|
if (result.collected || addend.collected) {
|
|
58
59
|
const transactions1 = Array.isArray(result.collected?.transactions)
|
|
59
60
|
? result.collected.transactions
|
|
60
61
|
: result.collected?.transactions
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
? [result.collected.transactions]
|
|
63
|
+
: []
|
|
63
64
|
const transactions2 = Array.isArray(addend.collected?.transactions)
|
|
64
65
|
? addend.collected.transactions
|
|
65
66
|
: addend.collected?.transactions
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
? [addend.collected.transactions]
|
|
68
|
+
: []
|
|
68
69
|
result.collected = { transactions: [...transactions1, ...transactions2] }
|
|
69
70
|
}
|
|
70
|
-
if (result.settled || addend.settled)
|
|
71
|
+
if (result.settled || addend.settled) {
|
|
71
72
|
result.settled = {
|
|
72
73
|
net: addend.settled?.net ?? result.settled?.net ?? 0,
|
|
73
74
|
transactions: result.settled?.transactions ?? addend.settled?.transactions ?? [],
|
|
74
75
|
}
|
|
76
|
+
}
|
|
75
77
|
return result
|
|
76
78
|
}
|
|
77
79
|
}
|
package/Settlement/Totals.ts
CHANGED
|
@@ -8,7 +8,7 @@ export namespace Totals {
|
|
|
8
8
|
export const type = isly.record<isoly.Currency, Total>(isly.string(isoly.Currency.values), Total.type)
|
|
9
9
|
export function addEntry(totals: Totals, entry: Entry): Totals {
|
|
10
10
|
const result = { ...totals }
|
|
11
|
-
if (entry.status == "succeeded" && (entry.type == "capture" || entry.type == "refund"))
|
|
11
|
+
if (entry.status == "succeeded" && (entry.type == "capture" || entry.type == "refund")) {
|
|
12
12
|
result[entry.amount[0]] = Total.add(entry.amount[0], result[entry.amount[0]] ?? Total.create(), {
|
|
13
13
|
outcome: {
|
|
14
14
|
net: entry.amount[1],
|
|
@@ -16,6 +16,7 @@ export namespace Totals {
|
|
|
16
16
|
fee: { other: entry.fee.other[entry.amount[0]] ?? 0 },
|
|
17
17
|
},
|
|
18
18
|
})
|
|
19
|
+
}
|
|
19
20
|
return result
|
|
20
21
|
}
|
|
21
22
|
export function verify(totals: Totals, type: "outcome" | "settled"): boolean {
|
|
@@ -23,8 +24,9 @@ export namespace Totals {
|
|
|
23
24
|
}
|
|
24
25
|
export function add(addendee: Totals, addends: Partial<Record<isoly.Currency, Partial<Total>>>): Totals {
|
|
25
26
|
const result = { ...addendee }
|
|
26
|
-
for (const [currency, addend] of Object.entries(addends) as [isoly.Currency, Partial<Total>][])
|
|
27
|
+
for (const [currency, addend] of Object.entries(addends) as [isoly.Currency, Partial<Total>][]) {
|
|
27
28
|
result[currency] = Total.add(currency, result[currency] ?? Total.create(), addend)
|
|
29
|
+
}
|
|
28
30
|
return result
|
|
29
31
|
}
|
|
30
32
|
}
|
package/Supplier/index.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { isoly } from "isoly"
|
|
|
2
2
|
import { isly } from "isly"
|
|
3
3
|
import { Realm } from "../Realm"
|
|
4
4
|
|
|
5
|
-
export type Supplier = typeof Supplier.names[number]
|
|
5
|
+
export type Supplier = (typeof Supplier.names)[number]
|
|
6
6
|
export namespace Supplier {
|
|
7
|
-
export const names = ["paxgiro", "clearbank", "bankingcircle"
|
|
7
|
+
export const names = ["paxgiro", "clearbank", "bankingcircle"] as const
|
|
8
8
|
export const type = isly.string<Supplier>(names)
|
|
9
9
|
export const currencies: Record<Realm, Partial<Record<Supplier, isoly.Currency[]>>> = {
|
|
10
10
|
eea: {},
|
|
@@ -21,6 +21,5 @@ export namespace Supplier {
|
|
|
21
21
|
eea: [],
|
|
22
22
|
test: ["paxgiro", "bankingcircle"],
|
|
23
23
|
uk: ["clearbank", "bankingcircle"],
|
|
24
|
-
// eslint-disable-next-line prettierx/options
|
|
25
24
|
} as const satisfies Record<Realm, Supplier[]>
|
|
26
25
|
}
|
|
@@ -12,11 +12,11 @@ export interface Statistics {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export namespace Statistics {
|
|
15
|
-
export type TransactionType = typeof TransactionType.values[number]
|
|
15
|
+
export type TransactionType = (typeof TransactionType.values)[number]
|
|
16
16
|
export namespace TransactionType {
|
|
17
17
|
export const values = ["capture", "refund"] as const
|
|
18
18
|
}
|
|
19
|
-
export type Region = typeof Region.values[number]
|
|
19
|
+
export type Region = (typeof Region.values)[number]
|
|
20
20
|
export namespace Region {
|
|
21
21
|
export const values = ["domestic", "intraRegion", "extraRegion"] as const
|
|
22
22
|
}
|
|
@@ -54,7 +54,7 @@ export namespace Statistics {
|
|
|
54
54
|
regions: Record<"domestic" | "intraRegion", isoly.CountryCode.Alpha2[]>
|
|
55
55
|
): Statistics {
|
|
56
56
|
const result: Statistics = empty()
|
|
57
|
-
for (const transaction of transactions)
|
|
57
|
+
for (const transaction of transactions) {
|
|
58
58
|
if (
|
|
59
59
|
Transaction.CardTransaction.type.is(transaction) &&
|
|
60
60
|
transaction.status == "finalized" &&
|
|
@@ -63,8 +63,8 @@ export namespace Statistics {
|
|
|
63
63
|
const region = regions.domestic.includes(transaction.counterpart.merchant.country)
|
|
64
64
|
? "domestic"
|
|
65
65
|
: regions.intraRegion.includes(transaction.counterpart.merchant.country)
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
? "intraRegion"
|
|
67
|
+
: "extraRegion"
|
|
68
68
|
const kind = transaction.direction == "outbound" ? "capture" : "refund"
|
|
69
69
|
result[kind][region].count++
|
|
70
70
|
result[kind][region].amount = isoly.Currency.add(
|
|
@@ -74,6 +74,7 @@ export namespace Statistics {
|
|
|
74
74
|
)
|
|
75
75
|
result.cards.includes(transaction.account.id) || result.cards.push(transaction.account.id)
|
|
76
76
|
}
|
|
77
|
+
}
|
|
77
78
|
return result
|
|
78
79
|
}
|
|
79
80
|
export function combine(accumulation: Statistics, incoming: Statistics, currency: isoly.Currency): Statistics {
|
package/Transaction/Status.ts
CHANGED
|
@@ -4,10 +4,10 @@ export type Status = Status.Success | [Status.Fail, Status.Reason]
|
|
|
4
4
|
export namespace Status {
|
|
5
5
|
// DEPRECATED: "created"
|
|
6
6
|
export const successes = ["created", "review", "processing", "finalized"] as const
|
|
7
|
-
export type Success = typeof successes[number]
|
|
7
|
+
export type Success = (typeof successes)[number]
|
|
8
8
|
export const Success = isly.string<Success>(successes)
|
|
9
9
|
export const failures = ["rejected", "cancelled"] as const
|
|
10
|
-
export type Fail = typeof failures[number]
|
|
10
|
+
export type Fail = (typeof failures)[number]
|
|
11
11
|
export const Fail = isly.string<Fail>(failures)
|
|
12
12
|
export const reasons = [
|
|
13
13
|
"insufficient funds",
|
|
@@ -21,7 +21,7 @@ export namespace Status {
|
|
|
21
21
|
"denied",
|
|
22
22
|
"merchant lock violation",
|
|
23
23
|
] as const
|
|
24
|
-
export type Reason = typeof reasons[number]
|
|
24
|
+
export type Reason = (typeof reasons)[number]
|
|
25
25
|
export const Reason = isly.string<Reason>(reasons)
|
|
26
26
|
export const type = isly.union<Status, Success, [Fail, Status.Reason]>(
|
|
27
27
|
Success,
|
package/Transaction/index.ts
CHANGED
|
@@ -48,9 +48,9 @@ export namespace Transaction {
|
|
|
48
48
|
export import Exchange = TransactionExchange
|
|
49
49
|
export import Amount = TransactionAmount
|
|
50
50
|
export const types = ["card", "internal", "external", "system"] as const
|
|
51
|
-
export type Types = typeof types[number]
|
|
51
|
+
export type Types = (typeof types)[number]
|
|
52
52
|
export const directions = ["inbound", "outbound"] as const
|
|
53
|
-
export type Direction = typeof directions[number]
|
|
53
|
+
export type Direction = (typeof directions)[number]
|
|
54
54
|
export import Creatable = TransactionCreatable
|
|
55
55
|
export import PreTransaction = TransactionPreTransaction
|
|
56
56
|
export import Reference = TransactionReference
|
|
@@ -118,7 +118,7 @@ export namespace Transaction {
|
|
|
118
118
|
charge: 0,
|
|
119
119
|
total: transaction.state?.transaction.original.total ?? transaction.amount,
|
|
120
120
|
},
|
|
121
|
-
|
|
121
|
+
}
|
|
122
122
|
: { amount: transaction.amount }),
|
|
123
123
|
}
|
|
124
124
|
}
|
|
@@ -153,17 +153,17 @@ export namespace Transaction {
|
|
|
153
153
|
typeof operation == "string"
|
|
154
154
|
? ["rejected", operation]
|
|
155
155
|
: state.outcome == "reject"
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
? ["rejected", "denied"]
|
|
157
|
+
: state.outcome == "review"
|
|
158
|
+
? "review"
|
|
159
|
+
: "processing"
|
|
160
160
|
const rail: Rail = state.card
|
|
161
161
|
? state.card.scheme
|
|
162
162
|
: account.address.type == "internal"
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
? "internal"
|
|
164
|
+
: account.address.type == "paxgiro"
|
|
165
|
+
? "paxgiro"
|
|
166
|
+
: "fasterpayments"
|
|
167
167
|
return {
|
|
168
168
|
...creatable,
|
|
169
169
|
amount: Amount.fromState(state, charges, quote),
|
|
@@ -330,7 +330,7 @@ export namespace Transaction {
|
|
|
330
330
|
export function flag(transaction: Transaction, flags: string[] | undefined): void {
|
|
331
331
|
const current = new Set<string>(transaction.flags)
|
|
332
332
|
const old = new Set<string>(transaction.oldFlags)
|
|
333
|
-
for (const flag of flags ?? [])
|
|
333
|
+
for (const flag of flags ?? []) {
|
|
334
334
|
if (!flag.startsWith("-")) {
|
|
335
335
|
old.delete(flag)
|
|
336
336
|
current.add(flag)
|
|
@@ -338,6 +338,7 @@ export namespace Transaction {
|
|
|
338
338
|
current.delete(flag.substring(1))
|
|
339
339
|
old.add(flag.substring(1))
|
|
340
340
|
}
|
|
341
|
+
}
|
|
341
342
|
transaction.flags = Array.from(current)
|
|
342
343
|
transaction.oldFlags = Array.from(old)
|
|
343
344
|
}
|
|
@@ -350,14 +351,15 @@ export namespace Transaction {
|
|
|
350
351
|
accountName.startsWith("net-") ||
|
|
351
352
|
accountName.startsWith("interchange-") ||
|
|
352
353
|
accountName.startsWith("collect-")
|
|
353
|
-
)
|
|
354
|
+
) {
|
|
354
355
|
result = "system"
|
|
355
|
-
else if (counterpart.type == "internal")
|
|
356
|
+
} else if (counterpart.type == "internal") {
|
|
356
357
|
result = "internal"
|
|
357
|
-
else if (counterpart.type == "card")
|
|
358
|
+
} else if (counterpart.type == "card") {
|
|
358
359
|
result = "card"
|
|
359
|
-
else
|
|
360
|
+
} else {
|
|
360
361
|
result = "external"
|
|
362
|
+
}
|
|
361
363
|
return result
|
|
362
364
|
}
|
|
363
365
|
|
|
@@ -392,15 +394,15 @@ export namespace Transaction {
|
|
|
392
394
|
return address.type != "card"
|
|
393
395
|
? Rail.Address.stringify(address)
|
|
394
396
|
: Rail.Address.Card.Counterpart.type.is(address)
|
|
395
|
-
|
|
396
|
-
|
|
397
|
+
? `${address.merchant.category} ${address.merchant.name}`
|
|
398
|
+
: `${address.iin}******${address.last4}`
|
|
397
399
|
}
|
|
398
400
|
function railAddressId(address: Rail.Address): string {
|
|
399
401
|
return address.type != "card"
|
|
400
402
|
? Rail.Address.stringify(address)
|
|
401
403
|
: Rail.Address.Card.Counterpart.type.is(address)
|
|
402
|
-
|
|
403
|
-
|
|
404
|
+
? address.merchant.id
|
|
405
|
+
: address.id
|
|
404
406
|
}
|
|
405
407
|
export function toCsv(transactions: (Transaction | Transaction.Legacy)[]): string {
|
|
406
408
|
return Report.toCsv(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isly } from "isly"
|
|
2
2
|
|
|
3
|
-
export type Category = typeof Category.name[number]
|
|
3
|
+
export type Category = (typeof Category.name)[number]
|
|
4
4
|
export namespace Category {
|
|
5
5
|
export const name = ["safeguarded", "unsafe", "buffer", "other", "external"] as const
|
|
6
6
|
export const type = isly.string(name)
|
|
@@ -21,23 +21,24 @@ export namespace funding {
|
|
|
21
21
|
export const type = isly.record<Cursors>(isly.fromIs("isoly.Currency", isoly.Currency.is), Cursor.type)
|
|
22
22
|
export function updateAmount(settlement: Transaction, cursors: Cursors): Cursors {
|
|
23
23
|
const cursor = cursors[settlement.currency]
|
|
24
|
-
if (!cursor)
|
|
24
|
+
if (!cursor) {
|
|
25
25
|
cursors[settlement.currency] = {
|
|
26
26
|
cursor: Cursor.fromTransaction(settlement),
|
|
27
27
|
amount: Math.abs(settlement.amount),
|
|
28
28
|
}
|
|
29
|
-
else
|
|
29
|
+
} else {
|
|
30
30
|
cursor.amount += Math.abs(settlement.amount)
|
|
31
|
+
}
|
|
31
32
|
return cursors
|
|
32
33
|
}
|
|
33
34
|
export function updateCursors(funding: Transaction, cursors: Cursors): Cursors {
|
|
34
35
|
const cursor = cursors[funding.currency]
|
|
35
|
-
if (!cursor)
|
|
36
|
+
if (!cursor) {
|
|
36
37
|
cursors[funding.currency] = {
|
|
37
38
|
cursor: Cursor.fromTransaction(funding),
|
|
38
39
|
amount: -Math.abs(funding.amount),
|
|
39
40
|
}
|
|
40
|
-
else if (cursor.amount > 0) {
|
|
41
|
+
} else if (cursor.amount > 0) {
|
|
41
42
|
cursor.amount -= Math.abs(funding.amount)
|
|
42
43
|
cursor.cursor = Cursor.fromTransaction(funding)
|
|
43
44
|
}
|
|
@@ -45,8 +46,9 @@ export namespace funding {
|
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
export function settle(transactions: Transaction[], amountsUpdated: Cursors): Cursors {
|
|
48
|
-
for (let i = transactions.length - 1; i >= 0; i--)
|
|
49
|
+
for (let i = transactions.length - 1; i >= 0; i--) {
|
|
49
50
|
Cursors.updateCursors(transactions[i], amountsUpdated)
|
|
51
|
+
}
|
|
50
52
|
return amountsUpdated
|
|
51
53
|
}
|
|
52
54
|
export function isStale(cursor: Cursor, bankingDays?: number, holidays?: isoly.Date[]): boolean {
|
|
@@ -30,7 +30,7 @@ export namespace Permission {
|
|
|
30
30
|
}
|
|
31
31
|
export type Collection = zod.infer<typeof Collection.typeZod>
|
|
32
32
|
export namespace Collection {
|
|
33
|
-
export type Realm = typeof Realm.values[number]
|
|
33
|
+
export type Realm = (typeof Realm.values)[number]
|
|
34
34
|
export namespace Realm {
|
|
35
35
|
export const values = [
|
|
36
36
|
"*",
|
|
@@ -44,7 +44,7 @@ export namespace Permission {
|
|
|
44
44
|
"treasury",
|
|
45
45
|
] as const
|
|
46
46
|
}
|
|
47
|
-
export type Global = typeof Global.values[number]
|
|
47
|
+
export type Global = (typeof Global.values)[number]
|
|
48
48
|
export namespace Global {
|
|
49
49
|
export const values = ["user"] as const
|
|
50
50
|
}
|
package/User/Identity.ts
CHANGED
|
@@ -8,14 +8,18 @@ export class Identity {
|
|
|
8
8
|
get realm(): Realm {
|
|
9
9
|
return this.payload.realm
|
|
10
10
|
}
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(
|
|
12
|
+
public readonly payload: JWT.Payload,
|
|
13
|
+
public readonly jwt: string
|
|
14
|
+
) {}
|
|
12
15
|
|
|
13
16
|
authenticate(constraint: Access.Permission | Access.Permission[]): Identity | gracely.Error {
|
|
14
17
|
let allowed: boolean
|
|
15
|
-
if (Array.isArray(constraint))
|
|
18
|
+
if (Array.isArray(constraint)) {
|
|
16
19
|
allowed = constraint.some(c => this.authenticate(c))
|
|
17
|
-
else
|
|
20
|
+
} else {
|
|
18
21
|
allowed = Access.Permission.check(constraint, this.payload.permission)
|
|
22
|
+
}
|
|
19
23
|
return allowed ? this : gracely.client.forbidden()
|
|
20
24
|
}
|
|
21
25
|
|
package/User/Password.ts
CHANGED
|
@@ -20,14 +20,15 @@ export namespace Password {
|
|
|
20
20
|
}
|
|
21
21
|
export async function create(creatable: Creatable, pepper: string | undefined): Promise<Password | gracely.Error> {
|
|
22
22
|
let result: Awaited<ReturnType<typeof create>>
|
|
23
|
-
if (creatable.new !== creatable.repeat)
|
|
23
|
+
if (creatable.new !== creatable.repeat) {
|
|
24
24
|
result = gracely.client.forbidden("The new password and the repeated password do not match.")
|
|
25
|
-
else if (creatable.new.length < 8)
|
|
25
|
+
} else if (creatable.new.length < 8) {
|
|
26
26
|
result = gracely.client.forbidden("The new password must be at least 8 characters long.")
|
|
27
|
-
else if (!pepper)
|
|
27
|
+
} else if (!pepper) {
|
|
28
28
|
result = gracely.server.backendFailure("The password cannot be created without a pepper.")
|
|
29
|
-
else
|
|
29
|
+
} else {
|
|
30
30
|
result = { hash: await hash(creatable.new, pepper), changed: isoly.DateTime.now() }
|
|
31
|
+
}
|
|
31
32
|
return result
|
|
32
33
|
}
|
|
33
34
|
export function salt(): string {
|
package/Warning/Base.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface Base {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export namespace Base {
|
|
15
|
-
export type Severity = typeof Severity.values[number]
|
|
15
|
+
export type Severity = (typeof Severity.values)[number]
|
|
16
16
|
export namespace Severity {
|
|
17
17
|
export const values = ["low", "medium", "high"] as const
|
|
18
18
|
export const type = isly.string<Severity>(values)
|
|
@@ -22,7 +22,7 @@ export namespace MissingBuffer {
|
|
|
22
22
|
const result: MissingBuffer[] = []
|
|
23
23
|
for (const [currency, amount] of Object.entries(account.balance)) {
|
|
24
24
|
const minimum = account.conditions?.minimum?.[currency as isoly.Currency]
|
|
25
|
-
if (typeof minimum != "undefined" && minimum > amount)
|
|
25
|
+
if (typeof minimum != "undefined" && minimum > amount) {
|
|
26
26
|
result.push({
|
|
27
27
|
type: "missing-buffer",
|
|
28
28
|
resource: account.code,
|
|
@@ -31,6 +31,7 @@ export namespace MissingBuffer {
|
|
|
31
31
|
balance: amount,
|
|
32
32
|
date: isoly.Date.now(),
|
|
33
33
|
})
|
|
34
|
+
}
|
|
34
35
|
}
|
|
35
36
|
return result
|
|
36
37
|
}
|
|
@@ -22,7 +22,7 @@ export namespace StaleFiat {
|
|
|
22
22
|
for (const [currency, amount] of Object.entries(account.balance)) {
|
|
23
23
|
let oldest: { id: string; date: isoly.Date; created: isoly.DateTime } | undefined = undefined
|
|
24
24
|
let remainder = amount
|
|
25
|
-
for (const transaction of transactions)
|
|
25
|
+
for (const transaction of transactions) {
|
|
26
26
|
if (transaction.amount > 0 && transaction.currency == currency && remainder > 0) {
|
|
27
27
|
remainder = isoly.Currency.subtract(currency, remainder, transaction.amount)
|
|
28
28
|
oldest = {
|
|
@@ -30,9 +30,11 @@ export namespace StaleFiat {
|
|
|
30
30
|
date: isoly.DateTime.getDate(transaction.created),
|
|
31
31
|
created: transaction.created,
|
|
32
32
|
}
|
|
33
|
-
} else if (remainder < 0)
|
|
33
|
+
} else if (remainder < 0) {
|
|
34
34
|
break
|
|
35
|
-
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (oldest && isoly.Date.now() > isoly.Date.nextBusinessDay(oldest.date, 3, Holidays.dates["England"])) {
|
|
36
38
|
result.push({
|
|
37
39
|
type: "stale-fiat",
|
|
38
40
|
currency: currency as isoly.Currency,
|
|
@@ -40,6 +42,7 @@ export namespace StaleFiat {
|
|
|
40
42
|
transaction: { id: oldest.id, created: oldest.created },
|
|
41
43
|
resource: oldest.id,
|
|
42
44
|
})
|
|
45
|
+
}
|
|
43
46
|
}
|
|
44
47
|
return result
|
|
45
48
|
}
|
|
@@ -10,12 +10,13 @@ var Fx;
|
|
|
10
10
|
let result;
|
|
11
11
|
const chargePreset = preset && charge[preset] ? preset : "default";
|
|
12
12
|
const chargeRate = charge[chargePreset] ?? 0;
|
|
13
|
-
if (exchange)
|
|
13
|
+
if (exchange) {
|
|
14
14
|
result = {
|
|
15
15
|
preset: chargePreset,
|
|
16
16
|
rate: chargeRate,
|
|
17
17
|
amount: -isoly_1.isoly.Currency.multiply(currency, amount, chargeRate),
|
|
18
18
|
};
|
|
19
|
+
}
|
|
19
20
|
return result;
|
|
20
21
|
}
|
|
21
22
|
Fx.evaluate = evaluate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../Account/Charge/Fx/index.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAI7B,sCAAkC;AAIlC,IAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../Account/Charge/Fx/index.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAI7B,sCAAkC;AAIlC,IAAiB,EAAE,CAqBlB;AArBD,WAAiB,EAAE;IACL,OAAI,GAAG,eAAM,CAAC,IAAI,CAAA;IAC/B,SAAgB,QAAQ,CACvB,MAAU,EACV,QAAwB,EACxB,MAAc,EACd,MAAoB,EACpB,QAAmB;QAEnB,IAAI,MAAoC,CAAA;QACxC,MAAM,YAAY,GAAG,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;QAClE,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;QAC5C,IAAI,QAAQ,EAAE,CAAC;YACd,MAAM,GAAG;gBACR,MAAM,EAAE,YAAY;gBACpB,IAAI,EAAE,UAAU;gBAChB,MAAM,EAAE,CAAC,aAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC;aAC9D,CAAA;QACF,CAAC;QACD,OAAO,MAAM,CAAA;IACd,CAAC;IAlBe,WAAQ,WAkBvB,CAAA;AACF,CAAC,EArBgB,EAAE,kBAAF,EAAE,QAqBlB"}
|