@pax2pay/model-banking 0.1.507 → 0.1.509
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/Card/Creatable.ts +10 -8
- package/Card/Restriction/Merchant.ts +108 -0
- package/Card/Restriction/index.ts +28 -0
- package/Card/index.ts +17 -8
- package/Client/Transactions/index.ts +33 -15
- package/Client/index.ts +6 -3
- package/Rail/index.ts +2 -0
- package/dist/cjs/Card/Creatable.d.ts +4 -0
- package/dist/cjs/Card/Creatable.js +9 -8
- package/dist/cjs/Card/Creatable.js.map +1 -1
- package/dist/cjs/Card/Restriction/Merchant.d.ts +16 -0
- package/dist/cjs/Card/Restriction/Merchant.js +101 -0
- package/dist/cjs/Card/Restriction/Merchant.js.map +1 -0
- package/dist/cjs/Card/Restriction/index.d.ts +12 -0
- package/dist/cjs/Card/Restriction/index.js +26 -0
- package/dist/cjs/Card/Restriction/index.js.map +1 -0
- package/dist/cjs/Card/index.d.ts +7 -2
- package/dist/cjs/Card/index.js +16 -8
- package/dist/cjs/Card/index.js.map +1 -1
- package/dist/cjs/Client/Transactions/index.d.ts +29 -11
- package/dist/cjs/Client/Transactions/index.js +25 -0
- package/dist/cjs/Client/Transactions/index.js.map +1 -1
- package/dist/cjs/Client/index.d.ts +5 -2
- package/dist/cjs/Client/index.js +3 -0
- package/dist/cjs/Client/index.js.map +1 -1
- package/dist/cjs/Rail/index.d.ts +2 -0
- package/dist/cjs/Rail/index.js +2 -0
- package/dist/cjs/Rail/index.js.map +1 -1
- package/dist/mjs/Card/Creatable.d.ts +4 -0
- package/dist/mjs/Card/Creatable.js +9 -8
- package/dist/mjs/Card/Creatable.js.map +1 -1
- package/dist/mjs/Card/Restriction/Merchant.d.ts +16 -0
- package/dist/mjs/Card/Restriction/Merchant.js +98 -0
- package/dist/mjs/Card/Restriction/Merchant.js.map +1 -0
- package/dist/mjs/Card/Restriction/index.d.ts +12 -0
- package/dist/mjs/Card/Restriction/index.js +23 -0
- package/dist/mjs/Card/Restriction/index.js.map +1 -0
- package/dist/mjs/Card/index.d.ts +7 -2
- package/dist/mjs/Card/index.js +16 -8
- package/dist/mjs/Card/index.js.map +1 -1
- package/dist/mjs/Client/Transactions/index.d.ts +29 -11
- package/dist/mjs/Client/Transactions/index.js +25 -0
- package/dist/mjs/Client/Transactions/index.js.map +1 -1
- package/dist/mjs/Client/index.d.ts +5 -2
- package/dist/mjs/Client/index.js +5 -2
- package/dist/mjs/Client/index.js.map +1 -1
- package/dist/mjs/Rail/index.d.ts +2 -0
- package/dist/mjs/Rail/index.js +2 -0
- package/dist/mjs/Rail/index.js.map +1 -1
- package/package.json +1 -1
package/Card/Creatable.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { type as ruleType } from "../Rule/type"
|
|
|
8
8
|
import { Expiry } from "./Expiry"
|
|
9
9
|
import { Meta } from "./Meta"
|
|
10
10
|
import { Preset } from "./Preset"
|
|
11
|
+
import { Restriction } from "./Restriction"
|
|
11
12
|
|
|
12
13
|
export interface Creatable {
|
|
13
14
|
account: string
|
|
@@ -21,6 +22,7 @@ export interface Creatable {
|
|
|
21
22
|
rules?: Rule[]
|
|
22
23
|
meta?: Meta
|
|
23
24
|
key?: isoly.Date | string
|
|
25
|
+
restricted?: { to?: Restriction }
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
export namespace Creatable {
|
|
@@ -28,24 +30,19 @@ export namespace Creatable {
|
|
|
28
30
|
account: isly.string(),
|
|
29
31
|
number: isly.string().optional(),
|
|
30
32
|
preset: Preset.type,
|
|
31
|
-
details: isly.object({
|
|
32
|
-
expiry: Expiry.type,
|
|
33
|
-
holder: isly.string(),
|
|
34
|
-
}),
|
|
33
|
+
details: isly.object({ expiry: Expiry.type, holder: isly.string() }),
|
|
35
34
|
limit: isly.tuple(isly.fromIs("isoly.Currency", isoly.Currency.is), isly.number()),
|
|
36
35
|
rules: ruleType.array().optional(),
|
|
37
36
|
meta: isly.fromIs("Card.Meta", Meta.is).optional(),
|
|
38
37
|
key: isly.string().optional(),
|
|
38
|
+
restricted: isly.object<Required<Creatable>["restricted"]>({ to: Restriction.type.optional() }).optional(),
|
|
39
39
|
})
|
|
40
40
|
export const type2 = isly2.object<Creatable>({
|
|
41
41
|
account: isly2.string().rename("Account").describe("The account id the card was created on."),
|
|
42
42
|
number: isly2.string().optional().rename("Number").describe("The card identifier of the user of the api."),
|
|
43
43
|
preset: Preset.type2,
|
|
44
44
|
details: isly2
|
|
45
|
-
.object({
|
|
46
|
-
expiry: Expiry.type2,
|
|
47
|
-
holder: isly2.string(),
|
|
48
|
-
})
|
|
45
|
+
.object({ expiry: Expiry.type2, holder: isly2.string() })
|
|
49
46
|
.rename("Details")
|
|
50
47
|
.describe("The card details, the information that will be displayed on the card."),
|
|
51
48
|
limit: isly2
|
|
@@ -60,5 +57,10 @@ export namespace Creatable {
|
|
|
60
57
|
.describe("Card rules that applies to authorizations made with the card."),
|
|
61
58
|
meta: isly2.from("Meta", Meta.is).optional(),
|
|
62
59
|
key: isly2.string().optional(),
|
|
60
|
+
restricted: isly2
|
|
61
|
+
.object<Required<Creatable>["restricted"]>({ to: Restriction.type2.optional() })
|
|
62
|
+
.optional()
|
|
63
|
+
.rename("Restrictions")
|
|
64
|
+
.describe("Set of restrictions that apply to the card."),
|
|
63
65
|
})
|
|
64
66
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { isly } from "isly"
|
|
2
|
+
import { isly as isly2 } from "isly2"
|
|
3
|
+
import type { Transaction } from "../../Transaction"
|
|
4
|
+
|
|
5
|
+
export type Merchant = typeof Merchant.values[number]
|
|
6
|
+
export namespace Merchant {
|
|
7
|
+
export const values = [
|
|
8
|
+
"united airlines",
|
|
9
|
+
"american air",
|
|
10
|
+
"british airways",
|
|
11
|
+
"air france",
|
|
12
|
+
"lufthansa",
|
|
13
|
+
"qantas",
|
|
14
|
+
"alitalia",
|
|
15
|
+
"saudi air",
|
|
16
|
+
"sas",
|
|
17
|
+
"air india",
|
|
18
|
+
"air algerie",
|
|
19
|
+
"emirates",
|
|
20
|
+
"air malta",
|
|
21
|
+
"etihad air",
|
|
22
|
+
"tap",
|
|
23
|
+
"avianca",
|
|
24
|
+
"gulf air",
|
|
25
|
+
"aer lingus",
|
|
26
|
+
"turkish air",
|
|
27
|
+
"royal air maroc",
|
|
28
|
+
"tunis air",
|
|
29
|
+
"austrian air",
|
|
30
|
+
"flydubai",
|
|
31
|
+
"cebu air",
|
|
32
|
+
"thai airways",
|
|
33
|
+
"china airlines",
|
|
34
|
+
"malaysia airlines",
|
|
35
|
+
"iberia",
|
|
36
|
+
"qatar air",
|
|
37
|
+
"ana air",
|
|
38
|
+
"jet blue",
|
|
39
|
+
"middle east airlines",
|
|
40
|
+
"lot polish airlines",
|
|
41
|
+
"norwegian air",
|
|
42
|
+
"air arabia",
|
|
43
|
+
"easyjet",
|
|
44
|
+
"ryanair",
|
|
45
|
+
"air china",
|
|
46
|
+
"ethiopian airlines",
|
|
47
|
+
"wizz air",
|
|
48
|
+
] as const
|
|
49
|
+
export const type = isly.string<Merchant>(values)
|
|
50
|
+
export const type2 = isly2.string<Merchant>("value", ...values)
|
|
51
|
+
export type Checker = (
|
|
52
|
+
merchant: Merchant,
|
|
53
|
+
transaction: Transaction.Creatable.CardTransaction | Transaction.PreTransaction.Authorization
|
|
54
|
+
) => boolean
|
|
55
|
+
export type Attribute = { mccs: string[]; checkers?: Checker[] }
|
|
56
|
+
export const attributes: Record<Merchant, Attribute> = {
|
|
57
|
+
"united airlines": { mccs: ["3000"] },
|
|
58
|
+
"american air": { mccs: ["3001"] },
|
|
59
|
+
"british airways": { mccs: ["3005"] },
|
|
60
|
+
"air france": { mccs: ["3007"] },
|
|
61
|
+
lufthansa: { mccs: ["3008"] },
|
|
62
|
+
qantas: { mccs: ["3012"] },
|
|
63
|
+
alitalia: { mccs: ["3013"] },
|
|
64
|
+
"saudi air": { mccs: ["3014"] },
|
|
65
|
+
sas: { mccs: ["3016"] },
|
|
66
|
+
"air india": { mccs: ["3020"] },
|
|
67
|
+
"air algerie": { mccs: ["3021"] },
|
|
68
|
+
emirates: { mccs: ["3026"] },
|
|
69
|
+
"air malta": { mccs: ["3028"] },
|
|
70
|
+
"etihad air": { mccs: ["3034"] },
|
|
71
|
+
tap: { mccs: ["3035"] },
|
|
72
|
+
avianca: { mccs: ["3039"] },
|
|
73
|
+
"gulf air": { mccs: ["3040"] },
|
|
74
|
+
"aer lingus": { mccs: ["3043"] },
|
|
75
|
+
"turkish air": { mccs: ["3047"] },
|
|
76
|
+
"royal air maroc": { mccs: ["3048"] },
|
|
77
|
+
"tunis air": { mccs: ["3049"] },
|
|
78
|
+
"austrian air": { mccs: ["3051"] },
|
|
79
|
+
flydubai: { mccs: ["3070"] },
|
|
80
|
+
"cebu air": { mccs: ["3072"] },
|
|
81
|
+
"thai airways": { mccs: ["3077"] },
|
|
82
|
+
"china airlines": { mccs: ["3078"] },
|
|
83
|
+
"malaysia airlines": { mccs: ["3100"] },
|
|
84
|
+
iberia: { mccs: ["3102"] },
|
|
85
|
+
"qatar air": { mccs: ["3136"] },
|
|
86
|
+
"ana air": { mccs: ["3161"] },
|
|
87
|
+
"jet blue": { mccs: ["3174"] },
|
|
88
|
+
"middle east airlines": { mccs: ["3175"] },
|
|
89
|
+
"lot polish airlines": { mccs: ["3182"] },
|
|
90
|
+
"norwegian air": { mccs: ["3211"] },
|
|
91
|
+
"air arabia": { mccs: ["3236"] },
|
|
92
|
+
easyjet: { mccs: ["3245"] },
|
|
93
|
+
ryanair: { mccs: ["3246"] },
|
|
94
|
+
"air china": { mccs: ["3261"] },
|
|
95
|
+
"ethiopian airlines": { mccs: ["3294"] },
|
|
96
|
+
"wizz air": { mccs: ["3301"] },
|
|
97
|
+
}
|
|
98
|
+
export function check(
|
|
99
|
+
merchant: Merchant,
|
|
100
|
+
transaction: Transaction.Creatable.CardTransaction | Transaction.PreTransaction.Authorization
|
|
101
|
+
): boolean {
|
|
102
|
+
const attribute = Merchant.attributes[merchant]
|
|
103
|
+
return (
|
|
104
|
+
attribute.mccs.some(mcc => transaction.counterpart.merchant.category == mcc) ||
|
|
105
|
+
(attribute.checkers ?? []).some(checker => checker(merchant, transaction))
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { isly } from "isly"
|
|
2
|
+
import { isly as isly2 } from "isly2"
|
|
3
|
+
import type { Transaction } from "../../Transaction"
|
|
4
|
+
import { Merchant as RestrictionsMerchant } from "./Merchant"
|
|
5
|
+
|
|
6
|
+
export interface Restriction {
|
|
7
|
+
merchants?: Restriction.Merchant[]
|
|
8
|
+
}
|
|
9
|
+
export namespace Restriction {
|
|
10
|
+
export import Merchant = RestrictionsMerchant
|
|
11
|
+
export const type = isly.object<Restriction>({ merchants: Merchant.type.array().optional() })
|
|
12
|
+
export const type2 = isly2.object<Restriction>({
|
|
13
|
+
merchants: Merchant.type2
|
|
14
|
+
.array()
|
|
15
|
+
.optional()
|
|
16
|
+
.rename("Merchants")
|
|
17
|
+
.describe("List of merchants that the card can be used with."),
|
|
18
|
+
})
|
|
19
|
+
export function check(
|
|
20
|
+
restrictions: Restriction,
|
|
21
|
+
transaction: Transaction.Creatable.CardTransaction | Transaction.PreTransaction.Authorization
|
|
22
|
+
): boolean {
|
|
23
|
+
let result: boolean = true
|
|
24
|
+
if (restrictions.merchants?.length)
|
|
25
|
+
result = restrictions.merchants.some(merchant => Merchant.check(merchant, transaction))
|
|
26
|
+
return result
|
|
27
|
+
}
|
|
28
|
+
}
|
package/Card/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { Expiry as CardExpiry } from "./Expiry"
|
|
|
12
12
|
import { Meta as CardMeta } from "./Meta"
|
|
13
13
|
import { Operation as CardOperation } from "./Operation"
|
|
14
14
|
import { Preset as CardPreset } from "./Preset"
|
|
15
|
+
import { Restriction as CardRestriction } from "./Restriction"
|
|
15
16
|
import { Scheme as CardScheme } from "./Scheme"
|
|
16
17
|
import { Stack as CardStack } from "./Stack"
|
|
17
18
|
|
|
@@ -38,8 +39,18 @@ export interface Card {
|
|
|
38
39
|
history: CardOperation[]
|
|
39
40
|
rules: Rule[]
|
|
40
41
|
meta?: CardMeta
|
|
42
|
+
restricted?: { to?: CardRestriction }
|
|
41
43
|
}
|
|
42
44
|
export namespace Card {
|
|
45
|
+
export import Creatable = CardCreatable
|
|
46
|
+
export import Preset = CardPreset
|
|
47
|
+
export import Meta = CardMeta
|
|
48
|
+
export import Expiry = CardExpiry
|
|
49
|
+
export import Changeable = CardChangeable
|
|
50
|
+
export import Operation = CardOperation
|
|
51
|
+
export import Scheme = CardScheme
|
|
52
|
+
export import Stack = CardStack
|
|
53
|
+
export import Restriction = CardRestriction
|
|
43
54
|
export const type = isly.object<Card>({
|
|
44
55
|
id: isly.string(),
|
|
45
56
|
number: isly.string().optional(),
|
|
@@ -63,6 +74,7 @@ export namespace Card {
|
|
|
63
74
|
history: isly.array(CardOperation.type),
|
|
64
75
|
rules: ruleType.array(),
|
|
65
76
|
meta: isly.fromIs("Card.Meta", CardMeta.is).optional(),
|
|
77
|
+
restricted: isly.object<Required<Card>["restricted"]>({ to: CardRestriction.type.optional() }).optional(),
|
|
66
78
|
})
|
|
67
79
|
export const type2: isly2.Object<Card> = isly2
|
|
68
80
|
.object<Card>({
|
|
@@ -92,17 +104,14 @@ export namespace Card {
|
|
|
92
104
|
.rename("Rules")
|
|
93
105
|
.describe("Card rules that applies to authorizations made with the card."),
|
|
94
106
|
meta: isly2.from("Card.Meta", CardMeta.is).optional().rename("Meta").describe("Additional card information."),
|
|
107
|
+
restricted: isly2
|
|
108
|
+
.object<Required<Card>["restricted"]>({ to: CardRestriction.type2.optional() })
|
|
109
|
+
.optional()
|
|
110
|
+
.rename("Restrictions")
|
|
111
|
+
.describe("Set of restrictions that apply to the card."),
|
|
95
112
|
})
|
|
96
113
|
.rename("Card")
|
|
97
114
|
.describe("Card information.")
|
|
98
|
-
export import Creatable = CardCreatable
|
|
99
|
-
export import Preset = CardPreset
|
|
100
|
-
export import Meta = CardMeta
|
|
101
|
-
export import Expiry = CardExpiry
|
|
102
|
-
export import Changeable = CardChangeable
|
|
103
|
-
export import Operation = CardOperation
|
|
104
|
-
export import Scheme = CardScheme
|
|
105
|
-
export import Stack = CardStack
|
|
106
115
|
const csvMap: Record<string, (card: Card) => string | number | undefined> = {
|
|
107
116
|
id: card => card.id,
|
|
108
117
|
created: card => readableDate(card.created),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { gracely } from "gracely"
|
|
2
2
|
import { isoly } from "isoly"
|
|
3
3
|
import { http } from "cloudly-http"
|
|
4
|
+
import { isly } from "isly2"
|
|
4
5
|
import { Card } from "../../Card"
|
|
5
6
|
import { Operation } from "../../Operation"
|
|
6
7
|
import { Rail } from "../../Rail"
|
|
@@ -18,21 +19,7 @@ export class Transactions {
|
|
|
18
19
|
async create(account: string, transaction: Transaction.Creatable): Promise<Transaction | gracely.Error> {
|
|
19
20
|
return this.client.post<Transaction>(`/account/${account}/transaction`, transaction)
|
|
20
21
|
}
|
|
21
|
-
async list(
|
|
22
|
-
options?:
|
|
23
|
-
| {
|
|
24
|
-
account?: string
|
|
25
|
-
limit?: number
|
|
26
|
-
cursor?: string
|
|
27
|
-
start?: isoly.DateTime
|
|
28
|
-
end?: isoly.DateTime
|
|
29
|
-
currency?: string
|
|
30
|
-
organization?: string
|
|
31
|
-
rail?: Rail
|
|
32
|
-
type?: Transaction.Types
|
|
33
|
-
}
|
|
34
|
-
| string
|
|
35
|
-
): Promise<(Transaction[] & { cursor?: string | undefined }) | gracely.Error> {
|
|
22
|
+
async list(options?: string | Transactions.Query): Promise<(Transaction[] & { cursor?: string }) | gracely.Error> {
|
|
36
23
|
const query = !options ? undefined : typeof options == "string" ? options : http.Search.stringify({ ...options })
|
|
37
24
|
return await this.client.get<Transaction[] & { cursor?: string | undefined }>(
|
|
38
25
|
"/transaction" + (query ? "?" + query : "")
|
|
@@ -57,3 +44,34 @@ export class Transactions {
|
|
|
57
44
|
return this.client.get<Transaction.Statistics>(`/transaction/statistics${query}`)
|
|
58
45
|
}
|
|
59
46
|
}
|
|
47
|
+
export namespace Transactions {
|
|
48
|
+
export interface Query {
|
|
49
|
+
account?: string
|
|
50
|
+
limit?: number
|
|
51
|
+
cursor?: string
|
|
52
|
+
start?: isoly.DateTime
|
|
53
|
+
end?: isoly.DateTime
|
|
54
|
+
currency?: string
|
|
55
|
+
organization?: string
|
|
56
|
+
rail?: Rail
|
|
57
|
+
type?: Transaction.Types
|
|
58
|
+
}
|
|
59
|
+
export namespace Query {
|
|
60
|
+
export const type = isly.object({
|
|
61
|
+
account: isly.string().optional(),
|
|
62
|
+
limit: isly.number().optional(),
|
|
63
|
+
cursor: isly.string().optional(),
|
|
64
|
+
start: isly.string().optional(),
|
|
65
|
+
end: isly.string().optional(),
|
|
66
|
+
currency: isly.string().optional(),
|
|
67
|
+
organization: isly.string().optional(),
|
|
68
|
+
rail: Rail.type2.optional(),
|
|
69
|
+
type: isly.string("value", ...Transaction.types).optional(),
|
|
70
|
+
})
|
|
71
|
+
export function parse(query: string | http.Request["search"]): Query {
|
|
72
|
+
if (typeof query == "string")
|
|
73
|
+
query = query ? http.Search.parse(query.replace("?", "")) : {} // search.parse does not support empty string
|
|
74
|
+
return type.prune(query) ?? {}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
package/Client/index.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { Processor } from "./Processor"
|
|
|
13
13
|
import { Reports } from "./Reports"
|
|
14
14
|
import { Rules } from "./Rules"
|
|
15
15
|
import { Settlements } from "./Settlements"
|
|
16
|
-
import { Transactions } from "./Transactions"
|
|
16
|
+
import { Transactions as ClientTransactions } from "./Transactions"
|
|
17
17
|
import { Treasury } from "./Treasury"
|
|
18
18
|
import { Version } from "./Version"
|
|
19
19
|
|
|
@@ -30,7 +30,7 @@ export class Client {
|
|
|
30
30
|
readonly logs: Logs
|
|
31
31
|
readonly rules: Rules
|
|
32
32
|
readonly settlements: Settlements
|
|
33
|
-
readonly transactions:
|
|
33
|
+
readonly transactions: ClientTransactions
|
|
34
34
|
readonly treasury: Treasury
|
|
35
35
|
readonly flags: Labels
|
|
36
36
|
readonly groups: Labels
|
|
@@ -60,7 +60,7 @@ export class Client {
|
|
|
60
60
|
this.logs = new Logs(this.client)
|
|
61
61
|
this.rules = new Rules(this.client)
|
|
62
62
|
this.settlements = new Settlements(this.client)
|
|
63
|
-
this.transactions = new
|
|
63
|
+
this.transactions = new ClientTransactions(this.client)
|
|
64
64
|
this.treasury = new Treasury(this.client)
|
|
65
65
|
this.flags = new Labels(this.client, "flag")
|
|
66
66
|
this.groups = new Labels(this.client, "group")
|
|
@@ -96,3 +96,6 @@ export class Client {
|
|
|
96
96
|
return result
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
+
export namespace Client {
|
|
100
|
+
export import Transactions = ClientTransactions
|
|
101
|
+
}
|
package/Rail/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isly } from "isly"
|
|
2
|
+
import { isly as isly2 } from "isly2"
|
|
2
3
|
import { Address as RailAddress } from "./Address"
|
|
3
4
|
|
|
4
5
|
export type Rail = typeof Rail.rails[number]
|
|
@@ -17,5 +18,6 @@ export namespace Rail {
|
|
|
17
18
|
"credit",
|
|
18
19
|
] as const
|
|
19
20
|
export const type = isly.string<Rail>(rails)
|
|
21
|
+
export const type2 = isly2.string<Rail>("value", ...rails)
|
|
20
22
|
export import Address = RailAddress
|
|
21
23
|
}
|
|
@@ -5,6 +5,7 @@ import type { Rule } from "../Rule";
|
|
|
5
5
|
import { Expiry } from "./Expiry";
|
|
6
6
|
import { Meta } from "./Meta";
|
|
7
7
|
import { Preset } from "./Preset";
|
|
8
|
+
import { Restriction } from "./Restriction";
|
|
8
9
|
export interface Creatable {
|
|
9
10
|
account: string;
|
|
10
11
|
number?: string;
|
|
@@ -17,6 +18,9 @@ export interface Creatable {
|
|
|
17
18
|
rules?: Rule[];
|
|
18
19
|
meta?: Meta;
|
|
19
20
|
key?: isoly.Date | string;
|
|
21
|
+
restricted?: {
|
|
22
|
+
to?: Restriction;
|
|
23
|
+
};
|
|
20
24
|
}
|
|
21
25
|
export declare namespace Creatable {
|
|
22
26
|
const type: import("isly/dist/cjs/object").IslyObject<Creatable, object>;
|
|
@@ -9,30 +9,26 @@ const type_1 = require("../Rule/type");
|
|
|
9
9
|
const Expiry_1 = require("./Expiry");
|
|
10
10
|
const Meta_1 = require("./Meta");
|
|
11
11
|
const Preset_1 = require("./Preset");
|
|
12
|
+
const Restriction_1 = require("./Restriction");
|
|
12
13
|
var Creatable;
|
|
13
14
|
(function (Creatable) {
|
|
14
15
|
Creatable.type = isly_1.isly.object({
|
|
15
16
|
account: isly_1.isly.string(),
|
|
16
17
|
number: isly_1.isly.string().optional(),
|
|
17
18
|
preset: Preset_1.Preset.type,
|
|
18
|
-
details: isly_1.isly.object({
|
|
19
|
-
expiry: Expiry_1.Expiry.type,
|
|
20
|
-
holder: isly_1.isly.string(),
|
|
21
|
-
}),
|
|
19
|
+
details: isly_1.isly.object({ expiry: Expiry_1.Expiry.type, holder: isly_1.isly.string() }),
|
|
22
20
|
limit: isly_1.isly.tuple(isly_1.isly.fromIs("isoly.Currency", isoly_1.isoly.Currency.is), isly_1.isly.number()),
|
|
23
21
|
rules: type_1.type.array().optional(),
|
|
24
22
|
meta: isly_1.isly.fromIs("Card.Meta", Meta_1.Meta.is).optional(),
|
|
25
23
|
key: isly_1.isly.string().optional(),
|
|
24
|
+
restricted: isly_1.isly.object({ to: Restriction_1.Restriction.type.optional() }).optional(),
|
|
26
25
|
});
|
|
27
26
|
Creatable.type2 = isly2_1.isly.object({
|
|
28
27
|
account: isly2_1.isly.string().rename("Account").describe("The account id the card was created on."),
|
|
29
28
|
number: isly2_1.isly.string().optional().rename("Number").describe("The card identifier of the user of the api."),
|
|
30
29
|
preset: Preset_1.Preset.type2,
|
|
31
30
|
details: isly2_1.isly
|
|
32
|
-
.object({
|
|
33
|
-
expiry: Expiry_1.Expiry.type2,
|
|
34
|
-
holder: isly2_1.isly.string(),
|
|
35
|
-
})
|
|
31
|
+
.object({ expiry: Expiry_1.Expiry.type2, holder: isly2_1.isly.string() })
|
|
36
32
|
.rename("Details")
|
|
37
33
|
.describe("The card details, the information that will be displayed on the card."),
|
|
38
34
|
limit: isly2_1.isly
|
|
@@ -47,6 +43,11 @@ var Creatable;
|
|
|
47
43
|
.describe("Card rules that applies to authorizations made with the card."),
|
|
48
44
|
meta: isly2_1.isly.from("Meta", Meta_1.Meta.is).optional(),
|
|
49
45
|
key: isly2_1.isly.string().optional(),
|
|
46
|
+
restricted: isly2_1.isly
|
|
47
|
+
.object({ to: Restriction_1.Restriction.type2.optional() })
|
|
48
|
+
.optional()
|
|
49
|
+
.rename("Restrictions")
|
|
50
|
+
.describe("Set of restrictions that apply to the card."),
|
|
50
51
|
});
|
|
51
52
|
})(Creatable || (exports.Creatable = Creatable = {}));
|
|
52
53
|
//# sourceMappingURL=Creatable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Creatable.js","sourceRoot":"","sources":["../../../Card/Creatable.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAC7B,mCAAwC;AACxC,+BAA2B;AAC3B,iCAAqC;AAGrC,uCAA+C;AAC/C,qCAAiC;AACjC,iCAA6B;AAC7B,qCAAiC;
|
|
1
|
+
{"version":3,"file":"Creatable.js","sourceRoot":"","sources":["../../../Card/Creatable.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAC7B,mCAAwC;AACxC,+BAA2B;AAC3B,iCAAqC;AAGrC,uCAA+C;AAC/C,qCAAiC;AACjC,iCAA6B;AAC7B,qCAAiC;AACjC,+CAA2C;AAiB3C,IAAiB,SAAS,CAsCzB;AAtCD,WAAiB,SAAS;IACZ,cAAI,GAAG,WAAI,CAAC,MAAM,CAAY;QAC1C,OAAO,EAAE,WAAI,CAAC,MAAM,EAAE;Q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ACjB,QAAQ,CAAC,uEAAuE,CAAC;QACnF,KAAK,EAAE,YAAK;aACV,KAAK,CAAC,cAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,YAAK,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,iCAAiC,CAAC,CAAC;aACxG,MAAM,CAAC,OAAO,CAAC;aACf,QAAQ,CAAC,+CAA+C,CAAC;QAC3D,KAAK,EAAE,YAAK;aACV,IAAI,CAAC,MAAM,EAAE,WAAQ,CAAC,EAAE,CAAC;aACzB,KAAK,EAAE;aACP,QAAQ,EAAE;aACV,MAAM,CAAC,OAAO,CAAC;aACf,QAAQ,CAAC,+DAA+D,CAAC;QAC3E,IAAI,EAAE,YAAK,CAAC,IAAI,CAAC,MAAM,EAAE,WAAI,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;QAC5C,GAAG,EAAE,YAAK,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC9B,UAAU,EAAE,YAAK;aACf,MAAM,CAAoC,EAAE,EAAE,EAAE,yBAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;aAC/E,QAAQ,EAAE;aACV,MAAM,CAAC,cAAc,CAAC;aACtB,QAAQ,CAAC,6CAA6C,CAAC;KACzD,CAAC,CAAA;AACH,CAAC,EAtCgB,SAAS,yBAAT,SAAS,QAsCzB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { isly } from "isly";
|
|
2
|
+
import { isly as isly2 } from "isly2";
|
|
3
|
+
import type { Transaction } from "../../Transaction";
|
|
4
|
+
export type Merchant = typeof Merchant.values[number];
|
|
5
|
+
export declare namespace Merchant {
|
|
6
|
+
const values: readonly ["united airlines", "american air", "british airways", "air france", "lufthansa", "qantas", "alitalia", "saudi air", "sas", "air india", "air algerie", "emirates", "air malta", "etihad air", "tap", "avianca", "gulf air", "aer lingus", "turkish air", "royal air maroc", "tunis air", "austrian air", "flydubai", "cebu air", "thai airways", "china airlines", "malaysia airlines", "iberia", "qatar air", "ana air", "jet blue", "middle east airlines", "lot polish airlines", "norwegian air", "air arabia", "easyjet", "ryanair", "air china", "ethiopian airlines", "wizz air"];
|
|
7
|
+
const type: isly.Type<"united airlines" | "american air" | "british airways" | "air france" | "lufthansa" | "qantas" | "alitalia" | "saudi air" | "sas" | "air india" | "air algerie" | "emirates" | "air malta" | "etihad air" | "tap" | "avianca" | "gulf air" | "aer lingus" | "turkish air" | "royal air maroc" | "tunis air" | "austrian air" | "flydubai" | "cebu air" | "thai airways" | "china airlines" | "malaysia airlines" | "iberia" | "qatar air" | "ana air" | "jet blue" | "middle east airlines" | "lot polish airlines" | "norwegian air" | "air arabia" | "easyjet" | "ryanair" | "air china" | "ethiopian airlines" | "wizz air">;
|
|
8
|
+
const type2: isly2.String<"united airlines" | "american air" | "british airways" | "air france" | "lufthansa" | "qantas" | "alitalia" | "saudi air" | "sas" | "air india" | "air algerie" | "emirates" | "air malta" | "etihad air" | "tap" | "avianca" | "gulf air" | "aer lingus" | "turkish air" | "royal air maroc" | "tunis air" | "austrian air" | "flydubai" | "cebu air" | "thai airways" | "china airlines" | "malaysia airlines" | "iberia" | "qatar air" | "ana air" | "jet blue" | "middle east airlines" | "lot polish airlines" | "norwegian air" | "air arabia" | "easyjet" | "ryanair" | "air china" | "ethiopian airlines" | "wizz air">;
|
|
9
|
+
type Checker = (merchant: Merchant, transaction: Transaction.Creatable.CardTransaction | Transaction.PreTransaction.Authorization) => boolean;
|
|
10
|
+
type Attribute = {
|
|
11
|
+
mccs: string[];
|
|
12
|
+
checkers?: Checker[];
|
|
13
|
+
};
|
|
14
|
+
const attributes: Record<Merchant, Attribute>;
|
|
15
|
+
function check(merchant: Merchant, transaction: Transaction.Creatable.CardTransaction | Transaction.PreTransaction.Authorization): boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Merchant = void 0;
|
|
4
|
+
const isly_1 = require("isly");
|
|
5
|
+
const isly2_1 = require("isly2");
|
|
6
|
+
var Merchant;
|
|
7
|
+
(function (Merchant) {
|
|
8
|
+
Merchant.values = [
|
|
9
|
+
"united airlines",
|
|
10
|
+
"american air",
|
|
11
|
+
"british airways",
|
|
12
|
+
"air france",
|
|
13
|
+
"lufthansa",
|
|
14
|
+
"qantas",
|
|
15
|
+
"alitalia",
|
|
16
|
+
"saudi air",
|
|
17
|
+
"sas",
|
|
18
|
+
"air india",
|
|
19
|
+
"air algerie",
|
|
20
|
+
"emirates",
|
|
21
|
+
"air malta",
|
|
22
|
+
"etihad air",
|
|
23
|
+
"tap",
|
|
24
|
+
"avianca",
|
|
25
|
+
"gulf air",
|
|
26
|
+
"aer lingus",
|
|
27
|
+
"turkish air",
|
|
28
|
+
"royal air maroc",
|
|
29
|
+
"tunis air",
|
|
30
|
+
"austrian air",
|
|
31
|
+
"flydubai",
|
|
32
|
+
"cebu air",
|
|
33
|
+
"thai airways",
|
|
34
|
+
"china airlines",
|
|
35
|
+
"malaysia airlines",
|
|
36
|
+
"iberia",
|
|
37
|
+
"qatar air",
|
|
38
|
+
"ana air",
|
|
39
|
+
"jet blue",
|
|
40
|
+
"middle east airlines",
|
|
41
|
+
"lot polish airlines",
|
|
42
|
+
"norwegian air",
|
|
43
|
+
"air arabia",
|
|
44
|
+
"easyjet",
|
|
45
|
+
"ryanair",
|
|
46
|
+
"air china",
|
|
47
|
+
"ethiopian airlines",
|
|
48
|
+
"wizz air",
|
|
49
|
+
];
|
|
50
|
+
Merchant.type = isly_1.isly.string(Merchant.values);
|
|
51
|
+
Merchant.type2 = isly2_1.isly.string("value", ...Merchant.values);
|
|
52
|
+
Merchant.attributes = {
|
|
53
|
+
"united airlines": { mccs: ["3000"] },
|
|
54
|
+
"american air": { mccs: ["3001"] },
|
|
55
|
+
"british airways": { mccs: ["3005"] },
|
|
56
|
+
"air france": { mccs: ["3007"] },
|
|
57
|
+
lufthansa: { mccs: ["3008"] },
|
|
58
|
+
qantas: { mccs: ["3012"] },
|
|
59
|
+
alitalia: { mccs: ["3013"] },
|
|
60
|
+
"saudi air": { mccs: ["3014"] },
|
|
61
|
+
sas: { mccs: ["3016"] },
|
|
62
|
+
"air india": { mccs: ["3020"] },
|
|
63
|
+
"air algerie": { mccs: ["3021"] },
|
|
64
|
+
emirates: { mccs: ["3026"] },
|
|
65
|
+
"air malta": { mccs: ["3028"] },
|
|
66
|
+
"etihad air": { mccs: ["3034"] },
|
|
67
|
+
tap: { mccs: ["3035"] },
|
|
68
|
+
avianca: { mccs: ["3039"] },
|
|
69
|
+
"gulf air": { mccs: ["3040"] },
|
|
70
|
+
"aer lingus": { mccs: ["3043"] },
|
|
71
|
+
"turkish air": { mccs: ["3047"] },
|
|
72
|
+
"royal air maroc": { mccs: ["3048"] },
|
|
73
|
+
"tunis air": { mccs: ["3049"] },
|
|
74
|
+
"austrian air": { mccs: ["3051"] },
|
|
75
|
+
flydubai: { mccs: ["3070"] },
|
|
76
|
+
"cebu air": { mccs: ["3072"] },
|
|
77
|
+
"thai airways": { mccs: ["3077"] },
|
|
78
|
+
"china airlines": { mccs: ["3078"] },
|
|
79
|
+
"malaysia airlines": { mccs: ["3100"] },
|
|
80
|
+
iberia: { mccs: ["3102"] },
|
|
81
|
+
"qatar air": { mccs: ["3136"] },
|
|
82
|
+
"ana air": { mccs: ["3161"] },
|
|
83
|
+
"jet blue": { mccs: ["3174"] },
|
|
84
|
+
"middle east airlines": { mccs: ["3175"] },
|
|
85
|
+
"lot polish airlines": { mccs: ["3182"] },
|
|
86
|
+
"norwegian air": { mccs: ["3211"] },
|
|
87
|
+
"air arabia": { mccs: ["3236"] },
|
|
88
|
+
easyjet: { mccs: ["3245"] },
|
|
89
|
+
ryanair: { mccs: ["3246"] },
|
|
90
|
+
"air china": { mccs: ["3261"] },
|
|
91
|
+
"ethiopian airlines": { mccs: ["3294"] },
|
|
92
|
+
"wizz air": { mccs: ["3301"] },
|
|
93
|
+
};
|
|
94
|
+
function check(merchant, transaction) {
|
|
95
|
+
const attribute = Merchant.attributes[merchant];
|
|
96
|
+
return (attribute.mccs.some(mcc => transaction.counterpart.merchant.category == mcc) ||
|
|
97
|
+
(attribute.checkers ?? []).some(checker => checker(merchant, transaction)));
|
|
98
|
+
}
|
|
99
|
+
Merchant.check = check;
|
|
100
|
+
})(Merchant || (exports.Merchant = Merchant = {}));
|
|
101
|
+
//# sourceMappingURL=Merchant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Merchant.js","sourceRoot":"","sources":["../../../../Card/Restriction/Merchant.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;AAC3B,iCAAqC;AAIrC,IAAiB,QAAQ,CAsGxB;AAtGD,WAAiB,QAAQ;IACX,eAAM,GAAG;QACrB,iBAAiB;QACjB,cAAc;QACd,iBAAiB;QACjB,YAAY;QACZ,WAAW;QACX,QAAQ;QACR,UAAU;QACV,WAAW;QACX,KAAK;QACL,WAAW;QACX,aAAa;QACb,UAAU;QACV,WAAW;QACX,YAAY;QACZ,KAAK;QACL,SAAS;QACT,UAAU;QACV,YAAY;QACZ,aAAa;QACb,iBAAiB;QACjB,WAAW;QACX,cAAc;QACd,UAAU;QACV,UAAU;QACV,cAAc;QACd,gBAAgB;QAChB,mBAAmB;QACnB,QAAQ;QACR,WAAW;QACX,SAAS;QACT,UAAU;QACV,sBAAsB;QACtB,qBAAqB;QACrB,eAAe;QACf,YAAY;QACZ,SAAS;QACT,SAAS;QACT,WAAW;QACX,oBAAoB;QACpB,UAAU;KACD,CAAA;IACG,aAAI,GAAG,WAAI,CAAC,MAAM,CAAW,SAAA,MAAM,CAAC,CAAA;IACpC,cAAK,GAAG,YAAK,CAAC,MAAM,CAAW,OAAO,EAAE,GAAG,SAAA,MAAM,CAAC,CAAA;IAMlD,mBAAU,GAAgC;QACtD,iBAAiB,EAAE,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,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AM,SAAS,GAAG,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;QAC/C,OAAO,CACN,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,QAAQ,CAAC,QAAQ,IAAI,GAAG,CAAC;YAC5E,CAAC,SAAS,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAC1E,CAAA;IACF,CAAC;IATe,cAAK,QASpB,CAAA;AACF,CAAC,EAtGgB,QAAQ,wBAAR,QAAQ,QAsGxB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { isly as isly2 } from "isly2";
|
|
2
|
+
import type { Transaction } from "../../Transaction";
|
|
3
|
+
import { Merchant as RestrictionsMerchant } from "./Merchant";
|
|
4
|
+
export interface Restriction {
|
|
5
|
+
merchants?: Restriction.Merchant[];
|
|
6
|
+
}
|
|
7
|
+
export declare namespace Restriction {
|
|
8
|
+
export import Merchant = RestrictionsMerchant;
|
|
9
|
+
const type: import("isly/dist/cjs/object").IslyObject<Restriction, object>;
|
|
10
|
+
const type2: isly2.Object<Restriction>;
|
|
11
|
+
function check(restrictions: Restriction, transaction: Transaction.Creatable.CardTransaction | Transaction.PreTransaction.Authorization): boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Restriction = void 0;
|
|
4
|
+
const isly_1 = require("isly");
|
|
5
|
+
const isly2_1 = require("isly2");
|
|
6
|
+
const Merchant_1 = require("./Merchant");
|
|
7
|
+
var Restriction;
|
|
8
|
+
(function (Restriction) {
|
|
9
|
+
Restriction.Merchant = Merchant_1.Merchant;
|
|
10
|
+
Restriction.type = isly_1.isly.object({ merchants: Restriction.Merchant.type.array().optional() });
|
|
11
|
+
Restriction.type2 = isly2_1.isly.object({
|
|
12
|
+
merchants: Restriction.Merchant.type2
|
|
13
|
+
.array()
|
|
14
|
+
.optional()
|
|
15
|
+
.rename("Merchants")
|
|
16
|
+
.describe("List of merchants that the card can be used with."),
|
|
17
|
+
});
|
|
18
|
+
function check(restrictions, transaction) {
|
|
19
|
+
let result = true;
|
|
20
|
+
if (restrictions.merchants?.length)
|
|
21
|
+
result = restrictions.merchants.some(merchant => Restriction.Merchant.check(merchant, transaction));
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
Restriction.check = check;
|
|
25
|
+
})(Restriction || (exports.Restriction = Restriction = {}));
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Card/Restriction/index.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;AAC3B,iCAAqC;AAErC,yCAA6D;AAK7D,IAAiB,WAAW,CAmB3B;AAnBD,WAAiB,WAAW;IACb,oBAAQ,GAAG,mBAAoB,CAAA;IAChC,gBAAI,GAAG,WAAI,CAAC,MAAM,CAAc,EAAE,SAAS,EAAE,YAAA,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;IAChF,iBAAK,GAAG,YAAK,CAAC,MAAM,CAAc;QAC9C,SAAS,EAAE,YAAA,QAAQ,CAAC,KAAK;aACvB,KAAK,EAAE;aACP,QAAQ,EAAE;aACV,MAAM,CAAC,WAAW,CAAC;aACnB,QAAQ,CAAC,mDAAmD,CAAC;KAC/D,CAAC,CAAA;IACF,SAAgB,KAAK,CACpB,YAAyB,EACzB,WAA6F;QAE7F,IAAI,MAAM,GAAY,IAAI,CAAA;QAC1B,IAAI,YAAY,CAAC,SAAS,EAAE,MAAM;YACjC,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,YAAA,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAA;QACxF,OAAO,MAAM,CAAA;IACd,CAAC;IARe,iBAAK,QAQpB,CAAA;AACF,CAAC,EAnBgB,WAAW,2BAAX,WAAW,QAmB3B"}
|
package/dist/cjs/Card/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { Expiry as CardExpiry } from "./Expiry";
|
|
|
9
9
|
import { Meta as CardMeta } from "./Meta";
|
|
10
10
|
import { Operation as CardOperation } from "./Operation";
|
|
11
11
|
import { Preset as CardPreset } from "./Preset";
|
|
12
|
+
import { Restriction as CardRestriction } from "./Restriction";
|
|
12
13
|
import { Scheme as CardScheme } from "./Scheme";
|
|
13
14
|
import { Stack as CardStack } from "./Stack";
|
|
14
15
|
export interface Card {
|
|
@@ -34,10 +35,11 @@ export interface Card {
|
|
|
34
35
|
history: CardOperation[];
|
|
35
36
|
rules: Rule[];
|
|
36
37
|
meta?: CardMeta;
|
|
38
|
+
restricted?: {
|
|
39
|
+
to?: CardRestriction;
|
|
40
|
+
};
|
|
37
41
|
}
|
|
38
42
|
export declare namespace Card {
|
|
39
|
-
const type: import("isly/dist/cjs/object").IslyObject<Card, object>;
|
|
40
|
-
const type2: isly2.Object<Card>;
|
|
41
43
|
export import Creatable = CardCreatable;
|
|
42
44
|
export import Preset = CardPreset;
|
|
43
45
|
export import Meta = CardMeta;
|
|
@@ -46,5 +48,8 @@ export declare namespace Card {
|
|
|
46
48
|
export import Operation = CardOperation;
|
|
47
49
|
export import Scheme = CardScheme;
|
|
48
50
|
export import Stack = CardStack;
|
|
51
|
+
export import Restriction = CardRestriction;
|
|
52
|
+
const type: import("isly/dist/cjs/object").IslyObject<Card, object>;
|
|
53
|
+
const type2: isly2.Object<Card>;
|
|
49
54
|
function toCsv(cards: Card[]): string;
|
|
50
55
|
}
|