@pax2pay/model-banking 0.1.211 → 0.1.213
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/Authorization/Status.ts +16 -13
- package/Authorization/index.ts +10 -4
- package/Card/Operation/Card.ts +4 -2
- package/Card/Operation/index.ts +9 -0
- package/Settlement/Entry/index.ts +1 -0
- package/dist/Authorization/Status.d.ts +5 -4
- package/dist/Authorization/Status.js +15 -12
- package/dist/Authorization/Status.js.map +1 -1
- package/dist/Authorization/index.d.ts +1 -1
- package/dist/Authorization/index.js +9 -2
- package/dist/Authorization/index.js.map +1 -1
- package/dist/Card/Operation/Card.d.ts +3 -1
- package/dist/Card/Operation/Card.js +2 -1
- package/dist/Card/Operation/Card.js.map +1 -1
- package/dist/Card/Operation/index.d.ts +4 -2
- package/dist/Card/Operation/index.js +9 -0
- package/dist/Card/Operation/index.js.map +1 -1
- package/dist/Settlement/Entry/index.d.ts +1 -0
- package/dist/Settlement/Entry/index.js.map +1 -1
- package/package.json +1 -1
package/Authorization/Status.ts
CHANGED
|
@@ -8,19 +8,23 @@ export namespace Status {
|
|
|
8
8
|
export interface Failed {
|
|
9
9
|
code: string
|
|
10
10
|
reason: string | string[]
|
|
11
|
-
error?: gracely.Error
|
|
11
|
+
error?: gracely.Error | Transaction.Note[]
|
|
12
12
|
}
|
|
13
13
|
export namespace Failed {
|
|
14
|
-
export function from(error
|
|
14
|
+
export function from(error: gracely.Error | Transaction.Note[]): Failed {
|
|
15
15
|
let result: Status
|
|
16
|
-
if (error
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
if (gracely.Error.is(error)) {
|
|
17
|
+
if (error.error?.includes("Card with id"))
|
|
18
|
+
result = { code: "14", reason: "Invalid card number" }
|
|
19
|
+
else if (error.error?.includes("must correspond to card limit")) {
|
|
20
|
+
result = { code: "13", reason: "Invalid amount" }
|
|
21
|
+
} else if (error.error?.includes("Failed to reach account")) {
|
|
22
|
+
result = { code: "78", reason: "Invalid/nonexistent account specified (general)" }
|
|
23
|
+
} else
|
|
24
|
+
result = { code: "05", reason: "Do not honor" }
|
|
25
|
+
} //default
|
|
26
|
+
else {
|
|
27
|
+
const reasons: string[] = error.reduce(
|
|
24
28
|
(a: string[], c: Transaction.Note) => [...a, `${c.created} ${c.author}: ${c.text ?? ""}`],
|
|
25
29
|
[]
|
|
26
30
|
)
|
|
@@ -29,8 +33,7 @@ export namespace Status {
|
|
|
29
33
|
//The restricted card is only allowed to be used for certain types of businesses or purchases."
|
|
30
34
|
reason: ["Restricted card.", ...reasons],
|
|
31
35
|
}
|
|
32
|
-
}
|
|
33
|
-
result = { code: "05", reason: "Do not honor" } //default
|
|
36
|
+
}
|
|
34
37
|
return { ...result, error }
|
|
35
38
|
}
|
|
36
39
|
}
|
|
@@ -39,7 +42,7 @@ export namespace Status {
|
|
|
39
42
|
isly.object<Status.Failed>({
|
|
40
43
|
code: isly.string(),
|
|
41
44
|
reason: isly.union(isly.string(), isly.string().array()),
|
|
42
|
-
error: isly.fromIs("gracely.Error", gracely.Error.is).optional(),
|
|
45
|
+
error: isly.union(Transaction.Note.type.array(), isly.fromIs("gracely.Error", gracely.Error.is)).optional(),
|
|
43
46
|
})
|
|
44
47
|
)
|
|
45
48
|
export const is = type.is
|
package/Authorization/index.ts
CHANGED
|
@@ -68,7 +68,7 @@ export namespace Authorization {
|
|
|
68
68
|
export function fromCreatable(
|
|
69
69
|
creatable: Creatable,
|
|
70
70
|
card: Card | gracely.Error,
|
|
71
|
-
transaction
|
|
71
|
+
transaction: Transaction | gracely.Error
|
|
72
72
|
): Authorization {
|
|
73
73
|
const partial: Pick<Authorization, "created" | "amount" | "merchant" | "acquirer" | "reference" | "description"> = {
|
|
74
74
|
created: isoly.DateTime.now(),
|
|
@@ -86,13 +86,20 @@ export namespace Authorization {
|
|
|
86
86
|
...partial,
|
|
87
87
|
card: { id: creatable.card },
|
|
88
88
|
}
|
|
89
|
-
else if (gracely.Error.is(transaction)
|
|
89
|
+
else if (gracely.Error.is(transaction))
|
|
90
90
|
result = {
|
|
91
91
|
id: Identifier.generate(),
|
|
92
92
|
status: Status.Failed.from(transaction),
|
|
93
93
|
...partial,
|
|
94
94
|
card: { id: card.id, iin: card.details.iin, last4: card.details.last4, token: card.details.token },
|
|
95
95
|
}
|
|
96
|
+
else if (transaction.status != "processing")
|
|
97
|
+
result = {
|
|
98
|
+
id: Identifier.generate(),
|
|
99
|
+
status: Status.Failed.from(transaction.notes),
|
|
100
|
+
...partial,
|
|
101
|
+
card: { id: card.id, iin: card.details.iin, last4: card.details.last4, token: card.details.token },
|
|
102
|
+
}
|
|
96
103
|
else
|
|
97
104
|
result = {
|
|
98
105
|
id: transaction.id,
|
|
@@ -100,11 +107,10 @@ export namespace Authorization {
|
|
|
100
107
|
...partial,
|
|
101
108
|
card: { id: card.id, iin: card.details.iin, last4: card.details.last4, token: card.details.token },
|
|
102
109
|
account: card.account,
|
|
103
|
-
transaction: { id: transaction
|
|
110
|
+
transaction: { id: transaction.id, posted: transaction.posted, description: transaction.description },
|
|
104
111
|
}
|
|
105
112
|
return result
|
|
106
113
|
}
|
|
107
|
-
|
|
108
114
|
export function toTransaction(authorization: Authorization): Transaction.Creatable {
|
|
109
115
|
return {
|
|
110
116
|
amount: authorization.amount[1],
|
package/Card/Operation/Card.ts
CHANGED
|
@@ -4,15 +4,17 @@ import { Changeable } from "../Changeable"
|
|
|
4
4
|
|
|
5
5
|
export interface Card {
|
|
6
6
|
type: "card"
|
|
7
|
-
status:
|
|
7
|
+
status: Card.Status
|
|
8
8
|
from?: Changeable
|
|
9
9
|
created: isoly.DateTime
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export namespace Card {
|
|
13
|
+
export const statuses = ["created", "changed", "cancelled"] as const
|
|
14
|
+
export type Status = typeof statuses[number]
|
|
13
15
|
export const type = isly.object<Card>({
|
|
14
16
|
type: isly.string("card"),
|
|
15
|
-
status: isly.
|
|
17
|
+
status: isly.string(statuses),
|
|
16
18
|
from: Changeable.type.optional(),
|
|
17
19
|
created: isly.fromIs("isoly.DateTime", isoly.DateTime.is),
|
|
18
20
|
})
|
package/Card/Operation/index.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { isly } from "isly"
|
|
2
|
+
import { Entry } from "../../Settlement/Entry"
|
|
2
3
|
import { Authorization } from "./Authorization"
|
|
3
4
|
import { Card } from "./Card"
|
|
4
5
|
|
|
5
6
|
export type Operation = Card | Authorization
|
|
6
7
|
|
|
7
8
|
export namespace Operation {
|
|
9
|
+
export function fromEntryStatus(status: Exclude<Entry.Type, "unknown">): Authorization.Status {
|
|
10
|
+
const statusConverter: Record<Exclude<Entry.Type, "unknown">, Authorization.Status> = {
|
|
11
|
+
capture: "captured",
|
|
12
|
+
cancel: "cancelled",
|
|
13
|
+
refund: "refunded",
|
|
14
|
+
}
|
|
15
|
+
return statusConverter[status]
|
|
16
|
+
}
|
|
8
17
|
export const type = isly.union(Card.type, Authorization.type)
|
|
9
18
|
export const is = type.is
|
|
10
19
|
}
|
|
@@ -33,6 +33,7 @@ export namespace Entry {
|
|
|
33
33
|
export namespace Unknown {
|
|
34
34
|
export type Creatable = EntryUnknown.Creatable
|
|
35
35
|
}
|
|
36
|
+
export type Type = "unknown" | "refund" | "capture" | "cancel"
|
|
36
37
|
export type Summary = EntrySummary
|
|
37
38
|
export const Summary = EntrySummary
|
|
38
39
|
export type Creatable = EntryCreatable
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { gracely } from "gracely";
|
|
2
2
|
import { isly } from "isly";
|
|
3
|
+
import { Transaction } from "../Transaction";
|
|
3
4
|
export type Status = "approved" | Status.Failed;
|
|
4
5
|
export declare namespace Status {
|
|
5
6
|
interface Failed {
|
|
6
7
|
code: string;
|
|
7
8
|
reason: string | string[];
|
|
8
|
-
error?: gracely.Error;
|
|
9
|
+
error?: gracely.Error | Transaction.Note[];
|
|
9
10
|
}
|
|
10
11
|
namespace Failed {
|
|
11
|
-
function from(error
|
|
12
|
+
function from(error: gracely.Error | Transaction.Note[]): Failed;
|
|
12
13
|
}
|
|
13
|
-
const type: isly.Type<"approved"
|
|
14
|
-
const is: isly.Type.IsFunction<"approved"
|
|
14
|
+
const type: isly.Type<Failed | "approved">;
|
|
15
|
+
const is: isly.Type.IsFunction<Failed | "approved">;
|
|
15
16
|
const flaw: isly.Type.FlawFunction;
|
|
16
17
|
}
|
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
import { gracely } from "gracely";
|
|
2
2
|
import { isly } from "isly";
|
|
3
|
+
import { Transaction } from "../Transaction";
|
|
3
4
|
export var Status;
|
|
4
5
|
(function (Status) {
|
|
5
6
|
let Failed;
|
|
6
7
|
(function (Failed) {
|
|
7
8
|
function from(error) {
|
|
8
9
|
let result;
|
|
9
|
-
if (error
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
if (gracely.Error.is(error)) {
|
|
11
|
+
if (error.error?.includes("Card with id"))
|
|
12
|
+
result = { code: "14", reason: "Invalid card number" };
|
|
13
|
+
else if (error.error?.includes("must correspond to card limit")) {
|
|
14
|
+
result = { code: "13", reason: "Invalid amount" };
|
|
15
|
+
}
|
|
16
|
+
else if (error.error?.includes("Failed to reach account")) {
|
|
17
|
+
result = { code: "78", reason: "Invalid/nonexistent account specified (general)" };
|
|
18
|
+
}
|
|
19
|
+
else
|
|
20
|
+
result = { code: "05", reason: "Do not honor" };
|
|
13
21
|
}
|
|
14
|
-
else
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
else if (gracely.client.InvalidContent.is(error) && error.content.description.includes("rules")) {
|
|
18
|
-
const reasons = error.content.details?.notes.reduce((a, c) => [...a, `${c.created} ${c.author}: ${c.text ?? ""}`], []);
|
|
22
|
+
else {
|
|
23
|
+
const reasons = error.reduce((a, c) => [...a, `${c.created} ${c.author}: ${c.text ?? ""}`], []);
|
|
19
24
|
result = {
|
|
20
25
|
code: "62",
|
|
21
26
|
reason: ["Restricted card.", ...reasons],
|
|
22
27
|
};
|
|
23
28
|
}
|
|
24
|
-
else
|
|
25
|
-
result = { code: "05", reason: "Do not honor" };
|
|
26
29
|
return { ...result, error };
|
|
27
30
|
}
|
|
28
31
|
Failed.from = from;
|
|
@@ -30,7 +33,7 @@ export var Status;
|
|
|
30
33
|
Status.type = isly.union(isly.string("approved"), isly.object({
|
|
31
34
|
code: isly.string(),
|
|
32
35
|
reason: isly.union(isly.string(), isly.string().array()),
|
|
33
|
-
error: isly.fromIs("gracely.Error", gracely.Error.is).optional(),
|
|
36
|
+
error: isly.union(Transaction.Note.type.array(), isly.fromIs("gracely.Error", gracely.Error.is)).optional(),
|
|
34
37
|
}));
|
|
35
38
|
Status.is = Status.type.is;
|
|
36
39
|
Status.flaw = Status.type.flaw;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Status.js","sourceRoot":"../","sources":["Authorization/Status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"Status.js","sourceRoot":"../","sources":["Authorization/Status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAI5C,MAAM,KAAW,MAAM,CA2CtB;AA3CD,WAAiB,MAAM;IAMtB,IAAiB,MAAM,CA0BtB;IA1BD,WAAiB,MAAM;QACtB,SAAgB,IAAI,CAAC,KAAyC;YAC7D,IAAI,MAAc,CAAA;YAClB,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC7B,IAAI,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,c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C,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC;QACxD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE;KAC3G,CAAC,CACF,CAAA;IACY,SAAE,GAAG,OAAA,IAAI,CAAC,EAAE,CAAA;IACZ,WAAI,GAAG,OAAA,IAAI,CAAC,IAAI,CAAA;AAC9B,CAAC,EA3CgB,MAAM,KAAN,MAAM,QA2CtB"}
|
|
@@ -38,6 +38,6 @@ export declare namespace Authorization {
|
|
|
38
38
|
const type: isly.object.ExtendableType<Authorization>;
|
|
39
39
|
const is: isly.Type.IsFunction<Authorization>;
|
|
40
40
|
const flaw: isly.Type.FlawFunction;
|
|
41
|
-
function fromCreatable(creatable: Creatable, card: Card | gracely.Error, transaction
|
|
41
|
+
function fromCreatable(creatable: Creatable, card: Card | gracely.Error, transaction: Transaction | gracely.Error): Authorization;
|
|
42
42
|
function toTransaction(authorization: Authorization): Transaction.Creatable;
|
|
43
43
|
}
|
|
@@ -54,13 +54,20 @@ export var Authorization;
|
|
|
54
54
|
...partial,
|
|
55
55
|
card: { id: creatable.card },
|
|
56
56
|
};
|
|
57
|
-
else if (gracely.Error.is(transaction)
|
|
57
|
+
else if (gracely.Error.is(transaction))
|
|
58
58
|
result = {
|
|
59
59
|
id: Identifier.generate(),
|
|
60
60
|
status: Status.Failed.from(transaction),
|
|
61
61
|
...partial,
|
|
62
62
|
card: { id: card.id, iin: card.details.iin, last4: card.details.last4, token: card.details.token },
|
|
63
63
|
};
|
|
64
|
+
else if (transaction.status != "processing")
|
|
65
|
+
result = {
|
|
66
|
+
id: Identifier.generate(),
|
|
67
|
+
status: Status.Failed.from(transaction.notes),
|
|
68
|
+
...partial,
|
|
69
|
+
card: { id: card.id, iin: card.details.iin, last4: card.details.last4, token: card.details.token },
|
|
70
|
+
};
|
|
64
71
|
else
|
|
65
72
|
result = {
|
|
66
73
|
id: transaction.id,
|
|
@@ -68,7 +75,7 @@ export var Authorization;
|
|
|
68
75
|
...partial,
|
|
69
76
|
card: { id: card.id, iin: card.details.iin, last4: card.details.last4, token: card.details.token },
|
|
70
77
|
account: card.account,
|
|
71
|
-
transaction: { id: transaction
|
|
78
|
+
transaction: { id: transaction.id, posted: transaction.posted, description: transaction.description },
|
|
72
79
|
};
|
|
73
80
|
return result;
|
|
74
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Authorization/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAGtC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAE,SAAS,IAAI,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAyBjC,MAAM,KAAW,aAAa,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Authorization/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAA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QACF,OAAO,MAAM,CAAA;IACd,CAAC;IA7Ce,2BAAa,gBA6C5B,CAAA;IACD,SAAgB,aAAa,CAAC,aAA4B;QACzD,OAAO;YACN,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;YAC/B,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;YACjC,WAAW,EAAE,aAAa,CAAC,WAAW;YACtC,WAAW,EAAE;gBACZ,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,aAAa,CAAC,QAAQ;gBAChC,QAAQ,EAAE,aAAa,CAAC,QAAQ;aAChC;SACD,CAAA;IACF,CAAC;IAXe,2BAAa,gBAW5B,CAAA;AACF,CAAC,EAzFgB,aAAa,KAAb,aAAa,QAyF7B"}
|
|
@@ -3,11 +3,13 @@ import { isly } from "isly";
|
|
|
3
3
|
import { Changeable } from "../Changeable";
|
|
4
4
|
export interface Card {
|
|
5
5
|
type: "card";
|
|
6
|
-
status:
|
|
6
|
+
status: Card.Status;
|
|
7
7
|
from?: Changeable;
|
|
8
8
|
created: isoly.DateTime;
|
|
9
9
|
}
|
|
10
10
|
export declare namespace Card {
|
|
11
|
+
const statuses: readonly ["created", "changed", "cancelled"];
|
|
12
|
+
type Status = typeof statuses[number];
|
|
11
13
|
const type: isly.object.ExtendableType<Card>;
|
|
12
14
|
const is: isly.Type.IsFunction<Card>;
|
|
13
15
|
}
|
|
@@ -3,9 +3,10 @@ import { isly } from "isly";
|
|
|
3
3
|
import { Changeable } from "../Changeable";
|
|
4
4
|
export var Card;
|
|
5
5
|
(function (Card) {
|
|
6
|
+
Card.statuses = ["created", "changed", "cancelled"];
|
|
6
7
|
Card.type = isly.object({
|
|
7
8
|
type: isly.string("card"),
|
|
8
|
-
status: isly.
|
|
9
|
+
status: isly.string(Card.statuses),
|
|
9
10
|
from: Changeable.type.optional(),
|
|
10
11
|
created: isly.fromIs("isoly.DateTime", isoly.DateTime.is),
|
|
11
12
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sourceRoot":"../","sources":["Card/Operation/Card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAS1C,MAAM,KAAW,IAAI,
|
|
1
|
+
{"version":3,"file":"Card.js","sourceRoot":"../","sources":["Card/Operation/Card.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAS1C,MAAM,KAAW,IAAI,CAUpB;AAVD,WAAiB,IAAI;IACP,aAAQ,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,CAAU,CAAA;IAEvD,SAAI,GAAG,IAAI,CAAC,MAAM,CAAO;QACrC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QACzB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,KAAA,QAAQ,CAAC;QAC7B,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE;QAChC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;KACzD,CAAC,CAAA;IACW,OAAE,GAAG,KAAA,IAAI,CAAC,EAAE,CAAA;AAC1B,CAAC,EAVgB,IAAI,KAAJ,IAAI,QAUpB"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { isly } from "isly";
|
|
2
|
+
import { Entry } from "../../Settlement/Entry";
|
|
2
3
|
import { Authorization } from "./Authorization";
|
|
3
4
|
import { Card } from "./Card";
|
|
4
5
|
export type Operation = Card | Authorization;
|
|
5
6
|
export declare namespace Operation {
|
|
6
|
-
|
|
7
|
-
const
|
|
7
|
+
function fromEntryStatus(status: Exclude<Entry.Type, "unknown">): Authorization.Status;
|
|
8
|
+
const type: isly.Type<Card | Authorization>;
|
|
9
|
+
const is: isly.Type.IsFunction<Card | Authorization>;
|
|
8
10
|
}
|
|
@@ -3,6 +3,15 @@ import { Authorization } from "./Authorization";
|
|
|
3
3
|
import { Card } from "./Card";
|
|
4
4
|
export var Operation;
|
|
5
5
|
(function (Operation) {
|
|
6
|
+
function fromEntryStatus(status) {
|
|
7
|
+
const statusConverter = {
|
|
8
|
+
capture: "captured",
|
|
9
|
+
cancel: "cancelled",
|
|
10
|
+
refund: "refunded",
|
|
11
|
+
};
|
|
12
|
+
return statusConverter[status];
|
|
13
|
+
}
|
|
14
|
+
Operation.fromEntryStatus = fromEntryStatus;
|
|
6
15
|
Operation.type = isly.union(Card.type, Authorization.type);
|
|
7
16
|
Operation.is = Operation.type.is;
|
|
8
17
|
})(Operation || (Operation = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Card/Operation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Card/Operation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAI7B,MAAM,KAAW,SAAS,CAWzB;AAXD,WAAiB,SAAS;IACzB,SAAgB,eAAe,CAAC,MAAsC;QACrE,MAAM,eAAe,GAAiE;YACrF,OAAO,EAAE,UAAU;YACnB,MAAM,EAAE,WAAW;YACnB,MAAM,EAAE,UAAU;SAClB,CAAA;QACD,OAAO,eAAe,CAAC,MAAM,CAAC,CAAA;IAC/B,CAAC;IAPe,yBAAe,kBAO9B,CAAA;IACY,cAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;IAChD,YAAE,GAAG,UAAA,IAAI,CAAC,EAAE,CAAA;AAC1B,CAAC,EAXgB,SAAS,KAAT,SAAS,QAWzB"}
|
|
@@ -30,6 +30,7 @@ export declare namespace Entry {
|
|
|
30
30
|
namespace Unknown {
|
|
31
31
|
type Creatable = EntryUnknown.Creatable;
|
|
32
32
|
}
|
|
33
|
+
type Type = "unknown" | "refund" | "capture" | "cancel";
|
|
33
34
|
type Summary = EntrySummary;
|
|
34
35
|
const Summary: typeof EntrySummary;
|
|
35
36
|
type Creatable = EntryCreatable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Settlement/Entry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,WAAW,CAAA;AAInD,MAAM,KAAW,KAAK,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Settlement/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