@pax2pay/client 0.3.91 → 0.3.93
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/Client/Auth/Session/Item.ts +29 -0
- package/Client/Auth/Session/index.ts +38 -0
- package/Client/Auth/index.ts +16 -30
- package/Client/Connection.ts +7 -10
- package/dist/Client/Auth/Session/Item.d.ts +14 -0
- package/dist/Client/Auth/Session/Item.js +23 -0
- package/dist/Client/Auth/Session/Item.js.map +1 -0
- package/dist/Client/Auth/Session/index.d.ts +7 -0
- package/dist/Client/Auth/Session/index.js +37 -0
- package/dist/Client/Auth/Session/index.js.map +1 -0
- package/dist/Client/Auth/index.d.ts +3 -5
- package/dist/Client/Auth/index.js +14 -42
- package/dist/Client/Auth/index.js.map +1 -1
- package/dist/Client/Connection.js +6 -11
- package/dist/Client/Connection.js.map +1 -1
- package/dist/model/CardResponseV2.d.ts +5 -1
- package/dist/model/CardResponseV2.js +30 -30
- package/dist/model/CardResponseV2.js.map +1 -1
- package/dist/model/InternalOrganisationConfig.d.ts +0 -4
- package/dist/model/InternalOrganisationConfig.js.map +1 -1
- package/model/CardResponseV2.ts +30 -30
- package/model/InternalOrganisationConfig.ts +0 -4
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export class Item<K extends string, V> {
|
|
2
|
+
private constructor(
|
|
3
|
+
private key: K,
|
|
4
|
+
private fromString: (v: string | undefined) => V | undefined,
|
|
5
|
+
private toString: (v: V) => string,
|
|
6
|
+
private storage: Pick<Storage, "getItem" | "setItem" | "removeItem">
|
|
7
|
+
) {}
|
|
8
|
+
get(): V | undefined {
|
|
9
|
+
return this.fromString(this.storage.getItem(this.key) ?? undefined)
|
|
10
|
+
}
|
|
11
|
+
set(value: V | undefined): V | undefined {
|
|
12
|
+
if (value != undefined && value != null)
|
|
13
|
+
this.storage.setItem(this.key, this.toString(value))
|
|
14
|
+
else
|
|
15
|
+
this.storage.removeItem(this.key)
|
|
16
|
+
return value
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static create<K extends string, V>(
|
|
20
|
+
key: K,
|
|
21
|
+
setup: {
|
|
22
|
+
fromString: (v: string | undefined) => V | undefined
|
|
23
|
+
toString: (v: V) => string
|
|
24
|
+
storage: Pick<Storage, "getItem" | "setItem" | "removeItem">
|
|
25
|
+
}
|
|
26
|
+
) {
|
|
27
|
+
return new Item(key, setup.fromString, setup.toString, setup.storage)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as model from "../../../model"
|
|
2
|
+
import { Item } from "./Item"
|
|
3
|
+
|
|
4
|
+
export namespace Session {
|
|
5
|
+
const storage =
|
|
6
|
+
typeof window == "undefined"
|
|
7
|
+
? (() => {
|
|
8
|
+
const storage: Record<string, string> = {}
|
|
9
|
+
return {
|
|
10
|
+
removeItem: (key: string) => {
|
|
11
|
+
delete storage[key]
|
|
12
|
+
},
|
|
13
|
+
setItem: (key: string, value: string) => {
|
|
14
|
+
storage[key] = value
|
|
15
|
+
},
|
|
16
|
+
getItem: (key: string): string | null => {
|
|
17
|
+
return storage[key] ?? null
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
})()
|
|
21
|
+
: window.sessionStorage
|
|
22
|
+
|
|
23
|
+
export const roles = Item.create("roles", {
|
|
24
|
+
fromString: (v: string | undefined) => v?.split(","),
|
|
25
|
+
toString: v => v.join(","),
|
|
26
|
+
storage,
|
|
27
|
+
})
|
|
28
|
+
export const features = Item.create<"features", model.PaxpayFeature[]>("features", {
|
|
29
|
+
fromString: (v: string | undefined) => v?.split(",") as model.PaxpayFeature[],
|
|
30
|
+
toString: (v: model.PaxpayFeature[]) => v.join(","),
|
|
31
|
+
storage,
|
|
32
|
+
})
|
|
33
|
+
export const authentication = Item.create("authentication", {
|
|
34
|
+
fromString: (v: string | undefined) => (v ? (JSON.parse(v) as Partial<model.LoginResponse>) : undefined),
|
|
35
|
+
toString: (v: Partial<model.LoginResponse>) => JSON.stringify(v),
|
|
36
|
+
storage,
|
|
37
|
+
})
|
|
38
|
+
}
|
package/Client/Auth/index.ts
CHANGED
|
@@ -1,50 +1,36 @@
|
|
|
1
1
|
import * as model from "../../model"
|
|
2
|
-
import { PaxpayFeature } from "../../model/PaxpayFeature"
|
|
3
2
|
import { Connection } from "../Connection"
|
|
3
|
+
import { Session } from "./Session"
|
|
4
4
|
|
|
5
5
|
export class Auth {
|
|
6
|
-
#roles?: string[]
|
|
7
|
-
#features?: PaxpayFeature[]
|
|
8
|
-
#data: Partial<model.LoginResponse>
|
|
9
6
|
constructor(private connection: Connection) {}
|
|
10
7
|
static create(connection: Connection) {
|
|
11
8
|
return new Auth(connection)
|
|
12
9
|
}
|
|
10
|
+
|
|
13
11
|
get roles(): string[] | undefined {
|
|
14
|
-
return
|
|
12
|
+
return Session.roles.get()
|
|
15
13
|
}
|
|
16
14
|
set roles(roles: string[] | undefined) {
|
|
17
|
-
|
|
18
|
-
if (roles)
|
|
19
|
-
window.sessionStorage.setItem("roles", roles.join(","))
|
|
20
|
-
else
|
|
21
|
-
window.sessionStorage.removeItem("roles")
|
|
15
|
+
Session.roles.set(roles)
|
|
22
16
|
}
|
|
23
17
|
hasRole(role: string): boolean {
|
|
24
18
|
return this.roles?.includes(role) ?? false
|
|
25
19
|
}
|
|
26
|
-
get features(): PaxpayFeature[] | undefined {
|
|
27
|
-
return
|
|
20
|
+
get features(): model.PaxpayFeature[] | undefined {
|
|
21
|
+
return Session.features.get()
|
|
28
22
|
}
|
|
29
|
-
set features(features: PaxpayFeature[] | undefined) {
|
|
30
|
-
|
|
31
|
-
if (features)
|
|
32
|
-
window.sessionStorage.setItem("features", features.join(","))
|
|
33
|
-
else
|
|
34
|
-
window.sessionStorage.removeItem("features")
|
|
23
|
+
set features(features: model.PaxpayFeature[] | undefined) {
|
|
24
|
+
Session.features.set(features)
|
|
35
25
|
}
|
|
36
|
-
hasFeature(feature: PaxpayFeature) {
|
|
26
|
+
hasFeature(feature: model.PaxpayFeature) {
|
|
37
27
|
return this.features?.includes(feature) ?? false
|
|
38
28
|
}
|
|
39
29
|
get data(): Partial<model.LoginResponse> {
|
|
40
|
-
return
|
|
30
|
+
return Session.authentication.get() ?? {}
|
|
41
31
|
}
|
|
42
32
|
set data(value: Partial<model.LoginResponse> | undefined) {
|
|
43
|
-
|
|
44
|
-
if (value)
|
|
45
|
-
window.sessionStorage.setItem("authData", JSON.stringify(value))
|
|
46
|
-
else
|
|
47
|
-
window.sessionStorage.removeItem("authData")
|
|
33
|
+
Session.authentication.set(value) ?? {}
|
|
48
34
|
}
|
|
49
35
|
get token(): string | undefined {
|
|
50
36
|
return this.connection.token
|
|
@@ -54,7 +40,7 @@ export class Auth {
|
|
|
54
40
|
}
|
|
55
41
|
setTempToken(value: string) {
|
|
56
42
|
this.data = { token: value }
|
|
57
|
-
this.
|
|
43
|
+
this.token = value
|
|
58
44
|
}
|
|
59
45
|
isLoggedIn(): boolean {
|
|
60
46
|
return this.data.status == "SUCCESS" ?? false
|
|
@@ -67,7 +53,7 @@ export class Auth {
|
|
|
67
53
|
otp ? { "x-otp": otp } : {}
|
|
68
54
|
)
|
|
69
55
|
if (!isError(result) && result.token) {
|
|
70
|
-
this.
|
|
56
|
+
this.token = result.token
|
|
71
57
|
this.data = result
|
|
72
58
|
}
|
|
73
59
|
return result
|
|
@@ -80,7 +66,7 @@ export class Auth {
|
|
|
80
66
|
result = await this.connection.get<model.LoginResponse, 400 | 403 | 404 | 500>("auth/relog")
|
|
81
67
|
}
|
|
82
68
|
if (!isError(result)) {
|
|
83
|
-
this.
|
|
69
|
+
this.token = result.token
|
|
84
70
|
this.data = result
|
|
85
71
|
}
|
|
86
72
|
return result
|
|
@@ -93,7 +79,7 @@ export class Auth {
|
|
|
93
79
|
): Promise<model.LoginResponse | (model.ErrorResponse & { status: 400 | 403 | 404 | 500 | 503 })> {
|
|
94
80
|
const result = await this.connection.get<model.LoginResponse, 400 | 403 | 404 | 500>(`auth/assume/org/${code}`)
|
|
95
81
|
if (!isError(result)) {
|
|
96
|
-
this.
|
|
82
|
+
this.token = result.token
|
|
97
83
|
this.data = result
|
|
98
84
|
}
|
|
99
85
|
return result
|
|
@@ -108,7 +94,7 @@ export class Auth {
|
|
|
108
94
|
this.roles = undefined
|
|
109
95
|
this.features = undefined
|
|
110
96
|
this.data = undefined
|
|
111
|
-
this.
|
|
97
|
+
this.token = undefined
|
|
112
98
|
}
|
|
113
99
|
}
|
|
114
100
|
|
package/Client/Connection.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { default as fetch } from "isomorphic-fetch"
|
|
2
2
|
import * as model from "../model"
|
|
3
|
+
import { Session } from "./Auth/Session"
|
|
3
4
|
|
|
4
5
|
type DefaultCodes = 503
|
|
5
6
|
export class Connection {
|
|
@@ -41,8 +42,8 @@ export class Connection {
|
|
|
41
42
|
"Content-Type": "application/json; charset=utf-8",
|
|
42
43
|
}
|
|
43
44
|
try {
|
|
44
|
-
const data =
|
|
45
|
-
this.#token = data
|
|
45
|
+
const data = Session.authentication.get()
|
|
46
|
+
this.#token = data?.token
|
|
46
47
|
} catch (e) {
|
|
47
48
|
if (this.token)
|
|
48
49
|
console.error("Caught exception ", JSON.stringify(e))
|
|
@@ -63,13 +64,9 @@ export class Connection {
|
|
|
63
64
|
(parameters
|
|
64
65
|
? "?" +
|
|
65
66
|
Object.entries(parameters)
|
|
66
|
-
.map(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
else if (param[1] != undefined)
|
|
70
|
-
return param.join("=")
|
|
71
|
-
return undefined
|
|
72
|
-
})
|
|
67
|
+
.map(([key, value]) =>
|
|
68
|
+
Array.isArray(value) ? `${key}=${value.join(",")}` : value != undefined ? `${key}=${value}` : undefined
|
|
69
|
+
)
|
|
73
70
|
.filter(param => param != undefined)
|
|
74
71
|
.join("&")
|
|
75
72
|
: ""),
|
|
@@ -88,7 +85,7 @@ export class Connection {
|
|
|
88
85
|
window.localStorage.setItem("cookie", response.headers.get("x-otp-cookie") ?? "")
|
|
89
86
|
//get temp token to set up 2fa before login
|
|
90
87
|
if (response && response.status == 403 && response.url.includes("login") && response.headers.has("X-Auth-Token"))
|
|
91
|
-
|
|
88
|
+
Session.authentication.set({ token: response.headers.get("X-Auth-Token") ?? undefined })
|
|
92
89
|
|
|
93
90
|
return !response
|
|
94
91
|
? { code: 503, errors: [{ message: "Service unavailable" }] }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class Item<K extends string, V> {
|
|
2
|
+
private key;
|
|
3
|
+
private fromString;
|
|
4
|
+
private toString;
|
|
5
|
+
private storage;
|
|
6
|
+
private constructor();
|
|
7
|
+
get(): V | undefined;
|
|
8
|
+
set(value: V | undefined): V | undefined;
|
|
9
|
+
static create<K extends string, V>(key: K, setup: {
|
|
10
|
+
fromString: (v: string | undefined) => V | undefined;
|
|
11
|
+
toString: (v: V) => string;
|
|
12
|
+
storage: Pick<Storage, "getItem" | "setItem" | "removeItem">;
|
|
13
|
+
}): Item<K, V>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export class Item {
|
|
2
|
+
constructor(key, fromString, toString, storage) {
|
|
3
|
+
this.key = key;
|
|
4
|
+
this.fromString = fromString;
|
|
5
|
+
this.toString = toString;
|
|
6
|
+
this.storage = storage;
|
|
7
|
+
}
|
|
8
|
+
get() {
|
|
9
|
+
var _a;
|
|
10
|
+
return this.fromString((_a = this.storage.getItem(this.key)) !== null && _a !== void 0 ? _a : undefined);
|
|
11
|
+
}
|
|
12
|
+
set(value) {
|
|
13
|
+
if (value != undefined && value != null)
|
|
14
|
+
this.storage.setItem(this.key, this.toString(value));
|
|
15
|
+
else
|
|
16
|
+
this.storage.removeItem(this.key);
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
static create(key, setup) {
|
|
20
|
+
return new Item(key, setup.fromString, setup.toString, setup.storage);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=Item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Item.js","sourceRoot":"../","sources":["Client/Auth/Session/Item.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,IAAI;IAChB,YACS,GAAM,EACN,UAAoD,EACpD,QAA0B,EAC1B,OAA4D;QAH5D,QAAG,GAAH,GAAG,CAAG;QACN,eAAU,GAAV,UAAU,CAA0C;QACpD,aAAQ,GAAR,QAAQ,CAAkB;QAC1B,YAAO,GAAP,OAAO,CAAqD;IAClE,CAAC;IACJ,GAAG;;QACF,OAAO,IAAI,CAAC,UAAU,CAAC,MAAA,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,mCAAI,SAAS,CAAC,CAAA;IACpE,CAAC;IACD,GAAG,CAAC,KAAoB;QACvB,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,IAAI,IAAI;YACtC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAA;;YAEpD,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAClC,OAAO,KAAK,CAAA;IACb,CAAC;IAED,MAAM,CAAC,MAAM,CACZ,GAAM,EACN,KAIC;QAED,OAAO,IAAI,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IACtE,CAAC;CACD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as model from "../../../model";
|
|
2
|
+
import { Item } from "./Item";
|
|
3
|
+
export declare namespace Session {
|
|
4
|
+
const roles: Item<"roles", string[]>;
|
|
5
|
+
const features: Item<"features", ("ALLOW_CARD_CREATION_WITH_NEGATIVE_BALANCE" | "FUZZY_SEARCH_COLLECTION_TRAVERSAL" | "BANK_TRANSFERS" | "BATCH_PAYMENTS" | "FIND_AND_AMEND" | "BETA_PORTAL_FEATURES" | "LEGACY_CARD_CREATE" | "LEGACY_CARD_DETAILS" | "LEGACY_CARD_SINGLE" | "LEGACY_ACCOUNT_TABLE" | "LEGACY_USER_TABLE" | "LEGACY_CARD_TABLE" | "SWITCHER_PORTAL_ONLY" | "SWITCHER_PORTAL" | "SWITCHER_POMS_ONLY" | "SWITCHER_POMS")[]>;
|
|
6
|
+
const authentication: Item<"authentication", Partial<model.LoginResponse>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Item } from "./Item";
|
|
2
|
+
export var Session;
|
|
3
|
+
(function (Session) {
|
|
4
|
+
const storage = typeof window == "undefined"
|
|
5
|
+
? (() => {
|
|
6
|
+
const storage = {};
|
|
7
|
+
return {
|
|
8
|
+
removeItem: (key) => {
|
|
9
|
+
delete storage[key];
|
|
10
|
+
},
|
|
11
|
+
setItem: (key, value) => {
|
|
12
|
+
storage[key] = value;
|
|
13
|
+
},
|
|
14
|
+
getItem: (key) => {
|
|
15
|
+
var _a;
|
|
16
|
+
return (_a = storage[key]) !== null && _a !== void 0 ? _a : null;
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
})()
|
|
20
|
+
: window.sessionStorage;
|
|
21
|
+
Session.roles = Item.create("roles", {
|
|
22
|
+
fromString: (v) => v === null || v === void 0 ? void 0 : v.split(","),
|
|
23
|
+
toString: v => v.join(","),
|
|
24
|
+
storage,
|
|
25
|
+
});
|
|
26
|
+
Session.features = Item.create("features", {
|
|
27
|
+
fromString: (v) => v === null || v === void 0 ? void 0 : v.split(","),
|
|
28
|
+
toString: (v) => v.join(","),
|
|
29
|
+
storage,
|
|
30
|
+
});
|
|
31
|
+
Session.authentication = Item.create("authentication", {
|
|
32
|
+
fromString: (v) => (v ? JSON.parse(v) : undefined),
|
|
33
|
+
toString: (v) => JSON.stringify(v),
|
|
34
|
+
storage,
|
|
35
|
+
});
|
|
36
|
+
})(Session || (Session = {}));
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Client/Auth/Session/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,MAAM,KAAW,OAAO,CAkCvB;AAlCD,WAAiB,OAAO;IACvB,MAAM,OAAO,GACZ,OAAO,MAAM,IAAI,WAAW;QAC3B,CAAC,CAAC,CAAC,GAAG,EAAE;YACN,MAAM,OAAO,GAA2B,EAAE,CAAA;YAC1C,OAAO;gBACN,UAAU,EAAE,CAAC,GAAW,EAAE,EAAE;oBAC3B,OAAO,OAAO,CAAC,GAAG,CAAC,CAAA;gBACpB,CAAC;gBACD,OAAO,EAAE,CAAC,GAAW,EAAE,KAAa,EAAE,EAAE;oBACvC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;gBACrB,CAAC;gBACD,OAAO,EAAE,CAAC,GAAW,EAAiB,EAAE;;oBACvC,OAAO,MAAA,OAAO,CAAC,GAAG,CAAC,mCAAI,IAAI,CAAA;gBAC5B,CAAC;aACD,CAAA;QACD,CAAC,CAAC,EAAE;QACN,CAAC,CAAC,MAAM,CAAC,cAAc,CAAA;IAEZ,aAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACzC,UAAU,EAAE,CAAC,CAAqB,EAAE,EAAE,CAAC,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,KAAK,CAAC,GAAG,CAAC;QACpD,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QAC1B,OAAO;KACP,CAAC,CAAA;IACW,gBAAQ,GAAG,IAAI,CAAC,MAAM,CAAoC,UAAU,EAAE;QAClF,UAAU,EAAE,CAAC,CAAqB,EAAE,EAAE,CAAC,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,KAAK,CAAC,GAAG,CAA0B;QAC7E,QAAQ,EAAE,CAAC,CAAwB,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QACnD,OAAO;KACP,CAAC,CAAA;IACW,sBAAc,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE;QAC3D,UAAU,EAAE,CAAC,CAAqB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAkC,CAAC,CAAC,CAAC,SAAS,CAAC;QACxG,QAAQ,EAAE,CAAC,CAA+B,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;QAChE,OAAO;KACP,CAAC,CAAA;AACH,CAAC,EAlCgB,OAAO,KAAP,OAAO,QAkCvB"}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import * as model from "../../model";
|
|
2
|
-
import { PaxpayFeature } from "../../model/PaxpayFeature";
|
|
3
2
|
import { Connection } from "../Connection";
|
|
4
3
|
export declare class Auth {
|
|
5
|
-
#private;
|
|
6
4
|
private connection;
|
|
7
5
|
constructor(connection: Connection);
|
|
8
6
|
static create(connection: Connection): Auth;
|
|
9
7
|
get roles(): string[] | undefined;
|
|
10
8
|
set roles(roles: string[] | undefined);
|
|
11
9
|
hasRole(role: string): boolean;
|
|
12
|
-
get features(): PaxpayFeature[] | undefined;
|
|
13
|
-
set features(features: PaxpayFeature[] | undefined);
|
|
14
|
-
hasFeature(feature: PaxpayFeature): boolean;
|
|
10
|
+
get features(): model.PaxpayFeature[] | undefined;
|
|
11
|
+
set features(features: model.PaxpayFeature[] | undefined);
|
|
12
|
+
hasFeature(feature: model.PaxpayFeature): boolean;
|
|
15
13
|
get data(): Partial<model.LoginResponse>;
|
|
16
14
|
set data(value: Partial<model.LoginResponse> | undefined);
|
|
17
15
|
get token(): string | undefined;
|
|
@@ -1,65 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
|
-
};
|
|
12
|
-
var _Auth_roles, _Auth_features, _Auth_data;
|
|
1
|
+
import { Session } from "./Session";
|
|
13
2
|
export class Auth {
|
|
14
3
|
constructor(connection) {
|
|
15
4
|
this.connection = connection;
|
|
16
|
-
_Auth_roles.set(this, void 0);
|
|
17
|
-
_Auth_features.set(this, void 0);
|
|
18
|
-
_Auth_data.set(this, void 0);
|
|
19
5
|
}
|
|
20
6
|
static create(connection) {
|
|
21
7
|
return new Auth(connection);
|
|
22
8
|
}
|
|
23
9
|
get roles() {
|
|
24
|
-
|
|
25
|
-
return (__classPrivateFieldSet(this, _Auth_roles, (_a = __classPrivateFieldGet(this, _Auth_roles, "f")) !== null && _a !== void 0 ? _a : (_b = window.sessionStorage.getItem("roles")) === null || _b === void 0 ? void 0 : _b.split(","), "f"));
|
|
10
|
+
return Session.roles.get();
|
|
26
11
|
}
|
|
27
12
|
set roles(roles) {
|
|
28
|
-
|
|
29
|
-
if (roles)
|
|
30
|
-
window.sessionStorage.setItem("roles", roles.join(","));
|
|
31
|
-
else
|
|
32
|
-
window.sessionStorage.removeItem("roles");
|
|
13
|
+
Session.roles.set(roles);
|
|
33
14
|
}
|
|
34
15
|
hasRole(role) {
|
|
35
16
|
var _a, _b;
|
|
36
17
|
return (_b = (_a = this.roles) === null || _a === void 0 ? void 0 : _a.includes(role)) !== null && _b !== void 0 ? _b : false;
|
|
37
18
|
}
|
|
38
19
|
get features() {
|
|
39
|
-
|
|
40
|
-
return (__classPrivateFieldSet(this, _Auth_features, (_a = __classPrivateFieldGet(this, _Auth_features, "f")) !== null && _a !== void 0 ? _a : (_b = window.sessionStorage.getItem("features")) === null || _b === void 0 ? void 0 : _b.split(","), "f"));
|
|
20
|
+
return Session.features.get();
|
|
41
21
|
}
|
|
42
22
|
set features(features) {
|
|
43
|
-
|
|
44
|
-
if (features)
|
|
45
|
-
window.sessionStorage.setItem("features", features.join(","));
|
|
46
|
-
else
|
|
47
|
-
window.sessionStorage.removeItem("features");
|
|
23
|
+
Session.features.set(features);
|
|
48
24
|
}
|
|
49
25
|
hasFeature(feature) {
|
|
50
26
|
var _a, _b;
|
|
51
27
|
return (_b = (_a = this.features) === null || _a === void 0 ? void 0 : _a.includes(feature)) !== null && _b !== void 0 ? _b : false;
|
|
52
28
|
}
|
|
53
29
|
get data() {
|
|
54
|
-
var _a
|
|
55
|
-
return (
|
|
30
|
+
var _a;
|
|
31
|
+
return (_a = Session.authentication.get()) !== null && _a !== void 0 ? _a : {};
|
|
56
32
|
}
|
|
57
33
|
set data(value) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
window.sessionStorage.setItem("authData", JSON.stringify(value));
|
|
61
|
-
else
|
|
62
|
-
window.sessionStorage.removeItem("authData");
|
|
34
|
+
var _a;
|
|
35
|
+
(_a = Session.authentication.set(value)) !== null && _a !== void 0 ? _a : {};
|
|
63
36
|
}
|
|
64
37
|
get token() {
|
|
65
38
|
return this.connection.token;
|
|
@@ -69,7 +42,7 @@ export class Auth {
|
|
|
69
42
|
}
|
|
70
43
|
setTempToken(value) {
|
|
71
44
|
this.data = { token: value };
|
|
72
|
-
this.
|
|
45
|
+
this.token = value;
|
|
73
46
|
}
|
|
74
47
|
isLoggedIn() {
|
|
75
48
|
var _a;
|
|
@@ -78,7 +51,7 @@ export class Auth {
|
|
|
78
51
|
async login(request, otp) {
|
|
79
52
|
const result = await this.connection.post("auth/login", request, undefined, otp ? { "x-otp": otp } : {});
|
|
80
53
|
if (!isError(result) && result.token) {
|
|
81
|
-
this.
|
|
54
|
+
this.token = result.token;
|
|
82
55
|
this.data = result;
|
|
83
56
|
}
|
|
84
57
|
return result;
|
|
@@ -92,7 +65,7 @@ export class Auth {
|
|
|
92
65
|
result = await this.connection.get("auth/relog");
|
|
93
66
|
}
|
|
94
67
|
if (!isError(result)) {
|
|
95
|
-
this.
|
|
68
|
+
this.token = result.token;
|
|
96
69
|
this.data = result;
|
|
97
70
|
}
|
|
98
71
|
return result;
|
|
@@ -104,7 +77,7 @@ export class Auth {
|
|
|
104
77
|
async assume(code) {
|
|
105
78
|
const result = await this.connection.get(`auth/assume/org/${code}`);
|
|
106
79
|
if (!isError(result)) {
|
|
107
|
-
this.
|
|
80
|
+
this.token = result.token;
|
|
108
81
|
this.data = result;
|
|
109
82
|
}
|
|
110
83
|
return result;
|
|
@@ -117,10 +90,9 @@ export class Auth {
|
|
|
117
90
|
this.roles = undefined;
|
|
118
91
|
this.features = undefined;
|
|
119
92
|
this.data = undefined;
|
|
120
|
-
this.
|
|
93
|
+
this.token = undefined;
|
|
121
94
|
}
|
|
122
95
|
}
|
|
123
|
-
_Auth_roles = new WeakMap(), _Auth_features = new WeakMap(), _Auth_data = new WeakMap();
|
|
124
96
|
function isError(value) {
|
|
125
97
|
return typeof value == "object" && typeof value.code == "number";
|
|
126
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Client/Auth/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Client/Auth/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAE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AAE,IAAI,KAAI,IAAI,CAAC,IAAI,CAAC,YAAY,CAAA;IACpE,CAAC;IACD,KAAK,CAAC,MAAM,CACX,IAAY;QAEZ,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAA6C,mBAAmB,IAAI,EAAE,CAAC,CAAA;QAC/G,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACrB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;YACzB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAA;SAClB;QACD,OAAO,MAAM,CAAA;IACd,CAAC;IACD,KAAK,CAAC,QAAQ;;QAGb,OAAO,CAAA,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,IAAI,0CAAE,YAAY,0CAAE,IAAI,EAAC,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC5G,CAAC;IAED,KAAK,CAAC,MAAM;QACX,IAAI,CAAC,KAAK,GAAG,SAAS,CAAA;QACtB,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAA;QACzB,IAAI,CAAC,IAAI,GAAG,SAAS,CAAA;QACrB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAA;IACvB,CAAC;CACD;AAED,SAAS,OAAO,CAAC,KAAgC;IAChD,OAAO,OAAO,KAAK,IAAI,QAAQ,IAAI,OAAO,KAAK,CAAC,IAAI,IAAI,QAAQ,CAAA;AACjE,CAAC"}
|
|
@@ -11,6 +11,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
11
11
|
};
|
|
12
12
|
var _Connection_token, _Connection_assumedOrg;
|
|
13
13
|
import { default as fetch } from "isomorphic-fetch";
|
|
14
|
+
import { Session } from "./Auth/Session";
|
|
14
15
|
export class Connection {
|
|
15
16
|
get token() {
|
|
16
17
|
return __classPrivateFieldGet(this, _Connection_token, "f");
|
|
@@ -43,8 +44,8 @@ export class Connection {
|
|
|
43
44
|
"Content-Type": "application/json; charset=utf-8",
|
|
44
45
|
};
|
|
45
46
|
try {
|
|
46
|
-
const data =
|
|
47
|
-
__classPrivateFieldSet(this, _Connection_token, data.token, "f");
|
|
47
|
+
const data = Session.authentication.get();
|
|
48
|
+
__classPrivateFieldSet(this, _Connection_token, data === null || data === void 0 ? void 0 : data.token, "f");
|
|
48
49
|
}
|
|
49
50
|
catch (e) {
|
|
50
51
|
if (this.token)
|
|
@@ -65,13 +66,7 @@ export class Connection {
|
|
|
65
66
|
(parameters
|
|
66
67
|
? "?" +
|
|
67
68
|
Object.entries(parameters)
|
|
68
|
-
.map(
|
|
69
|
-
if (Array.isArray(param[1]))
|
|
70
|
-
return `${param[0]}=${param[1].join(",")}`;
|
|
71
|
-
else if (param[1] != undefined)
|
|
72
|
-
return param.join("=");
|
|
73
|
-
return undefined;
|
|
74
|
-
})
|
|
69
|
+
.map(([key, value]) => Array.isArray(value) ? `${key}=${value.join(",")}` : value != undefined ? `${key}=${value}` : undefined)
|
|
75
70
|
.filter(param => param != undefined)
|
|
76
71
|
.join("&")
|
|
77
72
|
: ""), {
|
|
@@ -85,9 +80,9 @@ export class Connection {
|
|
|
85
80
|
if (caughtErrorResponse)
|
|
86
81
|
return caughtErrorResponse;
|
|
87
82
|
if (response && response.headers.has("x-otp-cookie"))
|
|
88
|
-
window.localStorage.setItem("cookie", (
|
|
83
|
+
window.localStorage.setItem("cookie", (_a = response.headers.get("x-otp-cookie")) !== null && _a !== void 0 ? _a : "");
|
|
89
84
|
if (response && response.status == 403 && response.url.includes("login") && response.headers.has("X-Auth-Token"))
|
|
90
|
-
|
|
85
|
+
Session.authentication.set({ token: (_b = response.headers.get("X-Auth-Token")) !== null && _b !== void 0 ? _b : undefined });
|
|
91
86
|
return !response
|
|
92
87
|
? { code: 503, errors: [{ message: "Service unavailable" }] }
|
|
93
88
|
: response.status == 401 && (await this.unauthorized(this))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Connection.js","sourceRoot":"../","sources":["Client/Connection.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"Connection.js","sourceRoot":"../","sources":["Client/Connection.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAEnD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAGxC,MAAM,OAAO,UAAU;IAItB,IAAI,KAAK;QACR,OAAO,uBAAA,IAAI,yBAAO,CAAA;IACnB,CAAC;IACD,IAAI,KAAK,CAAC,KAAyB;QAClC,uBAAA,IAAI,qBAAU,KAAK,MAAA,CAAA;IACpB,CAAC;IACD,YAA6B,GAAW,EAAE,KAAc;QAA3B,QAAG,GAAH,GAAG,CAAQ;QARxC,oCAAe;QACf,yCAAoB;QAQnB,uBAAA,IAAI,qBAAU,KAAK,MAAA,CAAA;IACpB,CAAC;IAED,IAAI,UAAU;QACb,OAAO,uBAAA,IAAI,8BAAY,CAAA;IACxB,CAAC;IACD,IAAI,UAAU,CAAC,KAAyB;QACvC,uBAAA,IAAI,0BAAe,KAAK,MAAA,CAAA;IACzB,CAAC;IAED,KAAK,CAAC,KAAK,CACV,IAAY,EACZ,MAAc,EACd,OAAa,EACb,UAAgC,EAChC,MAAY;;QAEZ,MAAM,WAAW,GAAG,OAAO,IAAI,OAAO,YAAY,QAAQ,CAAA;QAC1D,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;QACpD,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;QAC7D,IAAI,cAAc,GAA2B,EAAE,mBAAmB,EAAE,UAAU,EAAE,CA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E,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;IACrF,CAAC;IACD,KAAK,CAAC,GAAG,CACR,IAAY,EACZ,OAAY,EACZ,UAAgC,EAChC,MAAY;QAEZ,OAAO,MAAM,IAAI,CAAC,KAAK,CAAkB,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;IACnF,CAAC;IACD,KAAK,CAAC,MAAM,CACX,IAAY,EACZ,OAAa,EACb,UAAgC,EAChC,MAAY;QAEZ,OAAO,MAAM,IAAI,CAAC,KAAK,CAAkB,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;IACtF,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,GAAW,EAAE,KAAyB;QACjD,OAAO,IAAI,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IAClC,CAAC;IACD,MAAM,CAAC,OAAO,CACb,KAAuD;QAEvD,OAAO,OAAO,KAAK,IAAI,QAAQ,IAAI,OAAO,KAAK,CAAC,MAAM,IAAI,QAAQ,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,CAAA;IAC1F,CAAC;CACD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Currency, Date } from "isoly";
|
|
2
|
+
import { isly } from "isly";
|
|
2
3
|
import { AccountState } from "./AccountState";
|
|
3
4
|
import { BookingInfoResponse } from "./BookingInfoResponse";
|
|
4
5
|
import { CardDeliveryResponse } from "./CardDeliveryResponse";
|
|
@@ -6,6 +7,7 @@ import { CardScheduleResponseItem } from "./CardScheduleResponseItem";
|
|
|
6
7
|
import { CardTypeSpecification } from "./CardTypeSpecification";
|
|
7
8
|
import { CardUsage } from "./CardUsage";
|
|
8
9
|
import { FundingAccountSummaryResponse } from "./FundingAccountSummaryResponse";
|
|
10
|
+
import { MerchantResponse } from "./MerchantResponse";
|
|
9
11
|
import { ProviderCode } from "./ProviderCode";
|
|
10
12
|
import { YearMonth } from "./YearMonth";
|
|
11
13
|
export interface CardResponseV2 {
|
|
@@ -32,7 +34,9 @@ export interface CardResponseV2 {
|
|
|
32
34
|
bookingInfo?: BookingInfoResponse;
|
|
33
35
|
delivery?: CardDeliveryResponse;
|
|
34
36
|
batchId?: string;
|
|
37
|
+
merchantRestriction?: MerchantResponse;
|
|
35
38
|
}
|
|
36
39
|
export declare namespace CardResponseV2 {
|
|
37
|
-
|
|
40
|
+
const type: isly.object.ExtendableType<CardResponseV2>;
|
|
41
|
+
const is: isly.Type.IsFunction<CardResponseV2>;
|
|
38
42
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Date } from "isoly";
|
|
1
|
+
import { Currency, Date } from "isoly";
|
|
2
|
+
import { isly } from "isly";
|
|
2
3
|
import { AccountState } from "./AccountState";
|
|
3
4
|
import { BookingInfoResponse } from "./BookingInfoResponse";
|
|
4
5
|
import { CardDeliveryResponse } from "./CardDeliveryResponse";
|
|
@@ -6,38 +7,37 @@ import { CardScheduleResponseItem } from "./CardScheduleResponseItem";
|
|
|
6
7
|
import { CardTypeSpecification } from "./CardTypeSpecification";
|
|
7
8
|
import { CardUsage } from "./CardUsage";
|
|
8
9
|
import { FundingAccountSummaryResponse } from "./FundingAccountSummaryResponse";
|
|
10
|
+
import { MerchantResponse } from "./MerchantResponse";
|
|
9
11
|
import { ProviderCode } from "./ProviderCode";
|
|
10
12
|
import { YearMonth } from "./YearMonth";
|
|
11
13
|
export var CardResponseV2;
|
|
12
14
|
(function (CardResponseV2) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
CardResponseV2.is = is;
|
|
15
|
+
CardResponseV2.type = isly.object({
|
|
16
|
+
cardType: isly.union(CardTypeSpecification.type, isly.string()),
|
|
17
|
+
cardNumber: isly.string(),
|
|
18
|
+
cvv: isly.string().optional(),
|
|
19
|
+
expiryDate: isly.fromIs("YearMonth", YearMonth.is),
|
|
20
|
+
nameOnCard: isly.string().optional(),
|
|
21
|
+
fundingBalance: isly.number(),
|
|
22
|
+
remainingBalance: isly.number(),
|
|
23
|
+
fundingDate: isly.string(),
|
|
24
|
+
balance: isly.number(),
|
|
25
|
+
currency: isly.fromIs("Currency", Currency.is),
|
|
26
|
+
issueDate: isly.string(),
|
|
27
|
+
providerCode: isly.fromIs("ProviderCode", ProviderCode.is),
|
|
28
|
+
providerCardId: isly.string(),
|
|
29
|
+
usage: isly.fromIs("CardUsage", CardUsage.is),
|
|
30
|
+
fundingAccount: isly.fromIs("FundingAccountSummaryResponse", FundingAccountSummaryResponse.is),
|
|
31
|
+
createdBy: isly.string(),
|
|
32
|
+
state: isly.fromIs("AccountState", AccountState.is),
|
|
33
|
+
longTermTokenExpiry: isly.fromIs("Date", Date.is).optional(),
|
|
34
|
+
activationDate: isly.fromIs("Date", Date.is).optional(),
|
|
35
|
+
schedule: isly.array(isly.fromIs("CardScheduleResponseItem", CardScheduleResponseItem.is)).optional(),
|
|
36
|
+
bookingInfo: isly.fromIs("BookingInfoResponse", BookingInfoResponse.is).optional(),
|
|
37
|
+
delivery: isly.fromIs("CardDeliveryResponse", CardDeliveryResponse.is).optional(),
|
|
38
|
+
batchId: isly.string().optional(),
|
|
39
|
+
merchantRestriction: isly.fromIs("MerchantResponse", MerchantResponse.is).optional(),
|
|
40
|
+
});
|
|
41
|
+
CardResponseV2.is = CardResponseV2.type.is;
|
|
42
42
|
})(CardResponseV2 || (CardResponseV2 = {}));
|
|
43
43
|
//# sourceMappingURL=CardResponseV2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardResponseV2.js","sourceRoot":"../","sources":["model/CardResponseV2.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"CardResponseV2.js","sourceRoot":"../","sources":["model/CardResponseV2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AA6BvC,MAAM,KAAW,cAAc,CA4B9B;AA5BD,WAAiB,cAAc;IACjB,mBAAI,GAAG,IAAI,CAAC,MAAM,CAAiB;QAC/C,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;QAC/D,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE;QACzB,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC7B,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,CAAC;QAClD,UAA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C,sBAAsB,EAAE,oBAAoB,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;QACjF,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QACjC,mBAAmB,EAAE,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;KACpF,CAAC,CAAA;IACW,iBAAE,GAAG,eAAA,IAAI,CAAC,EAAE,CAAA;AAC1B,CAAC,EA5BgB,cAAc,KAAd,cAAc,QA4B9B"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { AllowedMccConfig } from "./AllowedMccConfig";
|
|
2
|
-
import { OrganisationBalanceLimitResponse } from "./OrganisationBalanceLimitResponse";
|
|
3
2
|
import { OrganisationFlag } from "./OrganisationFlag";
|
|
4
3
|
import { PaxpayFeature } from "./PaxpayFeature";
|
|
5
4
|
export interface InternalOrganisationConfig {
|
|
6
5
|
flags?: OrganisationFlag[];
|
|
7
|
-
internalBalanceLimit?: OrganisationBalanceLimitResponse;
|
|
8
6
|
features?: PaxpayFeature[];
|
|
9
7
|
allowedMccConfig?: AllowedMccConfig;
|
|
10
|
-
statementAppned?: boolean;
|
|
11
|
-
statementRebuild?: boolean;
|
|
12
8
|
}
|
|
13
9
|
export declare namespace InternalOrganisationConfig {
|
|
14
10
|
function is(value: InternalOrganisationConfig | any): value is InternalOrganisationConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalOrganisationConfig.js","sourceRoot":"../","sources":["model/InternalOrganisationConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InternalOrganisationConfig.js","sourceRoot":"../","sources":["model/InternalOrganisationConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AASrD,MAAM,KAAW,0BAA0B,CAQ1C;AARD,WAAiB,0BAA0B;IAC1C,SAAgB,EAAE,CAAC,KAAuC;QACzD,OAAO,CACN,OAAO,KAAK,IAAI,QAAQ;YACxB,CAAC,KAAK,CAAC,KAAK,IAAI,SAAS;gBACxB,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,gBAAgB,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAC7F,CAAA;IACF,CAAC;IANe,6BAAE,KAMjB,CAAA;AACF,CAAC,EARgB,0BAA0B,KAA1B,0BAA0B,QAQ1C"}
|
package/model/CardResponseV2.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Currency, Date } from "isoly"
|
|
2
|
+
import { isly } from "isly"
|
|
2
3
|
import { AccountState } from "./AccountState"
|
|
3
4
|
import { BookingInfoResponse } from "./BookingInfoResponse"
|
|
4
5
|
import { CardDeliveryResponse } from "./CardDeliveryResponse"
|
|
@@ -6,6 +7,7 @@ import { CardScheduleResponseItem } from "./CardScheduleResponseItem"
|
|
|
6
7
|
import { CardTypeSpecification } from "./CardTypeSpecification"
|
|
7
8
|
import { CardUsage } from "./CardUsage"
|
|
8
9
|
import { FundingAccountSummaryResponse } from "./FundingAccountSummaryResponse"
|
|
10
|
+
import { MerchantResponse } from "./MerchantResponse"
|
|
9
11
|
import { ProviderCode } from "./ProviderCode"
|
|
10
12
|
import { YearMonth } from "./YearMonth"
|
|
11
13
|
|
|
@@ -33,37 +35,35 @@ export interface CardResponseV2 {
|
|
|
33
35
|
bookingInfo?: BookingInfoResponse
|
|
34
36
|
delivery?: CardDeliveryResponse
|
|
35
37
|
batchId?: string
|
|
38
|
+
merchantRestriction?: MerchantResponse
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
export namespace CardResponseV2 {
|
|
39
|
-
export
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
(value.activationDate == undefined || Date.is(value.activationDate))
|
|
67
|
-
)
|
|
68
|
-
}
|
|
42
|
+
export const type = isly.object<CardResponseV2>({
|
|
43
|
+
cardType: isly.union(CardTypeSpecification.type, isly.string()),
|
|
44
|
+
cardNumber: isly.string(),
|
|
45
|
+
cvv: isly.string().optional(),
|
|
46
|
+
expiryDate: isly.fromIs("YearMonth", YearMonth.is),
|
|
47
|
+
nameOnCard: isly.string().optional(),
|
|
48
|
+
fundingBalance: isly.number(),
|
|
49
|
+
remainingBalance: isly.number(),
|
|
50
|
+
fundingDate: isly.string(),
|
|
51
|
+
balance: isly.number(),
|
|
52
|
+
currency: isly.fromIs("Currency", Currency.is),
|
|
53
|
+
issueDate: isly.string(),
|
|
54
|
+
providerCode: isly.fromIs("ProviderCode", ProviderCode.is),
|
|
55
|
+
providerCardId: isly.string(),
|
|
56
|
+
usage: isly.fromIs("CardUsage", CardUsage.is),
|
|
57
|
+
fundingAccount: isly.fromIs("FundingAccountSummaryResponse", FundingAccountSummaryResponse.is),
|
|
58
|
+
createdBy: isly.string(),
|
|
59
|
+
state: isly.fromIs("AccountState", AccountState.is),
|
|
60
|
+
longTermTokenExpiry: isly.fromIs("Date", Date.is).optional(),
|
|
61
|
+
activationDate: isly.fromIs("Date", Date.is).optional(),
|
|
62
|
+
schedule: isly.array(isly.fromIs("CardScheduleResponseItem", CardScheduleResponseItem.is)).optional(),
|
|
63
|
+
bookingInfo: isly.fromIs("BookingInfoResponse", BookingInfoResponse.is).optional(),
|
|
64
|
+
delivery: isly.fromIs("CardDeliveryResponse", CardDeliveryResponse.is).optional(),
|
|
65
|
+
batchId: isly.string().optional(),
|
|
66
|
+
merchantRestriction: isly.fromIs("MerchantResponse", MerchantResponse.is).optional(),
|
|
67
|
+
})
|
|
68
|
+
export const is = type.is
|
|
69
69
|
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { AllowedMccConfig } from "./AllowedMccConfig"
|
|
2
|
-
import { OrganisationBalanceLimitResponse } from "./OrganisationBalanceLimitResponse"
|
|
3
2
|
import { OrganisationFlag } from "./OrganisationFlag"
|
|
4
3
|
import { PaxpayFeature } from "./PaxpayFeature"
|
|
5
4
|
|
|
6
5
|
export interface InternalOrganisationConfig {
|
|
7
6
|
flags?: OrganisationFlag[]
|
|
8
|
-
internalBalanceLimit?: OrganisationBalanceLimitResponse
|
|
9
7
|
features?: PaxpayFeature[]
|
|
10
8
|
allowedMccConfig?: AllowedMccConfig
|
|
11
|
-
statementAppned?: boolean
|
|
12
|
-
statementRebuild?: boolean
|
|
13
9
|
}
|
|
14
10
|
|
|
15
11
|
export namespace InternalOrganisationConfig {
|