ggez-banking-sdk 0.4.7 → 0.4.9
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/dist/api/api.js +15 -17
- package/dist/api/proxy/account.d.ts +2 -3
- package/dist/api/proxy/account.js +3 -3
- package/dist/api/proxy/auth.d.ts +4 -8
- package/dist/api/proxy/auth.js +7 -10
- package/dist/api/proxy/base.d.ts +5 -2
- package/dist/api/proxy/base.js +6 -2
- package/dist/api/proxy/blockchain.d.ts +2 -3
- package/dist/api/proxy/blockchain.js +3 -3
- package/dist/api/proxy/ipAddressAndLocation.d.ts +2 -3
- package/dist/api/proxy/ipAddressAndLocation.js +3 -3
- package/dist/api/proxy/limited.d.ts +2 -3
- package/dist/api/proxy/limited.js +3 -3
- package/dist/api/proxy/order.d.ts +2 -3
- package/dist/api/proxy/order.js +3 -3
- package/dist/api/proxy/organization.d.ts +3 -5
- package/dist/api/proxy/organization.js +8 -10
- package/dist/api/proxy/program.d.ts +2 -3
- package/dist/api/proxy/program.js +3 -3
- package/dist/api/proxy/promotion.d.ts +2 -3
- package/dist/api/proxy/promotion.js +3 -3
- package/dist/api/proxy/transaction.d.ts +2 -3
- package/dist/api/proxy/transaction.js +3 -3
- package/dist/api/proxy/user.d.ts +2 -3
- package/dist/api/proxy/user.js +3 -3
- package/dist/api/service/base.d.ts +3 -1
- package/dist/api/service/base.js +11 -7
- package/dist/api/service/user.d.ts +1 -1
- package/dist/api/service/user.js +128 -128
- package/dist/helper/api/axiosHelper.js +4 -4
- package/dist/helper/storage/cookiesHelper.d.ts +2 -0
- package/dist/helper/storage/cookiesHelper.js +22 -0
- package/dist/types/api/common/index.d.ts +9 -0
- package/dist/types/api/context/clientContext.d.ts +0 -6
- package/dist/types/api/index.d.ts +2 -0
- package/dist/types/api/proxy/index.d.ts +9 -0
- package/dist/types/api/proxy/index.js +1 -0
- package/dist/types/api/service/base.d.ts +3 -10
- package/dist/types/api/service/index.d.ts +0 -1
- package/dist/types/helper/api/axiosHelper.d.ts +2 -1
- package/dist/types/helper/geoHelper.d.ts +1 -1
- package/package.json +1 -1
- package/dist/types/api/service/openPayd.d.ts +0 -3
- /package/dist/types/api/{service/openPayd.js → common/index.js} +0 -0
package/dist/api/api.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CookiesHelper } from "../helper/storage/cookiesHelper";
|
|
2
2
|
import { AccountProxy, AuthProxy, BlockchainProxy, IPAddressAndLocationProxy, LimitedProxy, OrderProxy, OrganizationProxy, ProgramProxy, PromotionProxy, TransactionProxy, UserProxy, } from "./proxy";
|
|
3
|
-
import { AuthService } from "./service";
|
|
4
3
|
import { DefaultClientContextProvider } from "./context";
|
|
5
4
|
class API {
|
|
6
5
|
context;
|
|
@@ -17,32 +16,31 @@ class API {
|
|
|
17
16
|
user;
|
|
18
17
|
cookiesHelper;
|
|
19
18
|
constructor(clientData, errorHandler) {
|
|
19
|
+
this.cookiesHelper = new CookiesHelper(clientData.programId, clientData.domain, errorHandler);
|
|
20
20
|
this.context = new DefaultClientContextProvider({
|
|
21
21
|
baseUrl: clientData.baseUrl,
|
|
22
22
|
nodeUrl: clientData.nodeUrl,
|
|
23
23
|
programId: clientData.programId,
|
|
24
24
|
lang: clientData.lang,
|
|
25
25
|
});
|
|
26
|
-
|
|
27
|
-
const authService = new AuthService({
|
|
26
|
+
const proxyData = {
|
|
28
27
|
context: this.context,
|
|
29
28
|
errorHandler,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
40
|
-
this.
|
|
41
|
-
this.
|
|
29
|
+
cookiesHelper: this.cookiesHelper,
|
|
30
|
+
};
|
|
31
|
+
this.auth = new AuthProxy(proxyData);
|
|
32
|
+
this.account = new AccountProxy(proxyData);
|
|
33
|
+
this.blockchain = new BlockchainProxy(proxyData);
|
|
34
|
+
this.order = new OrderProxy(proxyData);
|
|
35
|
+
this.limited = new LimitedProxy(proxyData);
|
|
36
|
+
this.organization = new OrganizationProxy(proxyData);
|
|
37
|
+
this.program = new ProgramProxy(proxyData);
|
|
38
|
+
this.promotion = new PromotionProxy(proxyData);
|
|
39
|
+
this.ipAddress = new IPAddressAndLocationProxy(proxyData);
|
|
40
|
+
this.transaction = new TransactionProxy(proxyData);
|
|
41
|
+
this.user = new UserProxy(proxyData);
|
|
42
42
|
}
|
|
43
43
|
async logout() {
|
|
44
|
-
this.context.setToken("");
|
|
45
|
-
this.context.setUserId(0);
|
|
46
44
|
await this.cookiesHelper.clearCredentialCookies();
|
|
47
45
|
}
|
|
48
46
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ClientContextProvider } from "../../types/api/context/clientContext";
|
|
1
|
+
import type { BaseProxyParameters } from "../../types";
|
|
3
2
|
import { BaseProxy } from "./base";
|
|
4
3
|
declare class AccountProxy extends BaseProxy {
|
|
5
4
|
private accountService;
|
|
6
|
-
constructor(
|
|
5
|
+
constructor(data: BaseProxyParameters);
|
|
7
6
|
get: (accountId: number) => Promise<import("../..").ApiResponse<import("../..").AccountData>>;
|
|
8
7
|
getLimits: (accountId: number) => Promise<import("../..").ApiResponse<import("../..").AccountData>>;
|
|
9
8
|
}
|
|
@@ -2,9 +2,9 @@ import { AccountService } from "../service/account";
|
|
|
2
2
|
import { BaseProxy } from "./base";
|
|
3
3
|
class AccountProxy extends BaseProxy {
|
|
4
4
|
accountService;
|
|
5
|
-
constructor(
|
|
6
|
-
super(
|
|
7
|
-
this.accountService = new AccountService(
|
|
5
|
+
constructor(data) {
|
|
6
|
+
super(data);
|
|
7
|
+
this.accountService = new AccountService(data);
|
|
8
8
|
}
|
|
9
9
|
// #region "GET"
|
|
10
10
|
get = async (accountId) => {
|
package/dist/api/proxy/auth.d.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import type { AuthService } from "../service/auth";
|
|
2
|
-
import type { ClientContextProvider } from "../../types/api/context/clientContext";
|
|
3
1
|
import type { IGenerateLimitedTokenData } from "../../types/api/data/auth";
|
|
4
|
-
import type { ILoginDeviceCredentialsData, ILoginGoogleCredentialsData, ILoginUserCredentialsData } from "../../types";
|
|
5
|
-
import {
|
|
6
|
-
declare class AuthProxy {
|
|
7
|
-
private context;
|
|
2
|
+
import type { BaseProxyParameters, ILoginDeviceCredentialsData, ILoginGoogleCredentialsData, ILoginUserCredentialsData } from "../../types";
|
|
3
|
+
import { BaseProxy } from "./base";
|
|
4
|
+
declare class AuthProxy extends BaseProxy {
|
|
8
5
|
private authService;
|
|
9
|
-
|
|
10
|
-
constructor(context: ClientContextProvider, authService: AuthService, cookiesHelper: CookiesHelper);
|
|
6
|
+
constructor(data: BaseProxyParameters);
|
|
11
7
|
private login;
|
|
12
8
|
loginUserCredentials(data: ILoginUserCredentialsData): Promise<import("../..").ApiResponse<import("../..").TokenData>>;
|
|
13
9
|
loginDeviceCredentials(data: ILoginDeviceCredentialsData): Promise<import("../..").ApiResponse<import("../..").TokenData>>;
|
package/dist/api/proxy/auth.js
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
+
import { AuthService } from "../service/auth";
|
|
1
2
|
import { ResultHelper } from "../../helper/api/resultHelper";
|
|
2
3
|
import { fillLoginDeviceCredentialsData, fillLoginGoogleCredentialsData, fillLoginUserCredentialsData, } from "../data";
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
import { BaseProxy } from "./base";
|
|
5
|
+
class AuthProxy extends BaseProxy {
|
|
5
6
|
authService;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this.
|
|
9
|
-
this.authService = authService;
|
|
10
|
-
this.cookiesHelper = cookiesHelper;
|
|
7
|
+
constructor(data) {
|
|
8
|
+
super(data);
|
|
9
|
+
this.authService = new AuthService(data);
|
|
11
10
|
}
|
|
12
11
|
async login(data) {
|
|
13
12
|
const response = await this.authService.login(data);
|
|
14
|
-
if (ResultHelper.isApproved(response
|
|
15
|
-
this.context.setToken(response.data.access_token);
|
|
16
|
-
this.context.setUserId(Number(response.data.user_id));
|
|
13
|
+
if (ResultHelper.isApproved(response.data.result)) {
|
|
17
14
|
await this.cookiesHelper.setCredentialCookiesByTokenData(response.data);
|
|
18
15
|
}
|
|
19
16
|
return response;
|
package/dist/api/proxy/base.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CookiesHelper } from "../..";
|
|
2
|
+
import type { BaseProxyParameters, ClientContextProvider, ErrorHandler } from "../../types";
|
|
2
3
|
declare abstract class BaseProxy {
|
|
4
|
+
protected context: ClientContextProvider;
|
|
3
5
|
protected errorHandler: ErrorHandler;
|
|
4
|
-
|
|
6
|
+
protected cookiesHelper: CookiesHelper;
|
|
7
|
+
constructor(data: BaseProxyParameters);
|
|
5
8
|
}
|
|
6
9
|
export { BaseProxy };
|
package/dist/api/proxy/base.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
class BaseProxy {
|
|
2
|
+
context;
|
|
2
3
|
errorHandler;
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
cookiesHelper;
|
|
5
|
+
constructor(data) {
|
|
6
|
+
this.context = data.context;
|
|
7
|
+
this.errorHandler = data.errorHandler;
|
|
8
|
+
this.cookiesHelper = data.cookiesHelper;
|
|
5
9
|
}
|
|
6
10
|
}
|
|
7
11
|
export { BaseProxy };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ClientContextProvider } from "../../types/api/context/clientContext";
|
|
1
|
+
import type { BaseProxyParameters, IBlockchainDelegateRequestData, IBlockchainMultiSendRequestData, IBlockchainSendRequestData, IBlockchainUndelegateRequestData } from "../../types";
|
|
3
2
|
import { BaseProxy } from "./base";
|
|
4
3
|
declare class BlockchainProxy extends BaseProxy {
|
|
5
4
|
private blockchainService;
|
|
6
|
-
constructor(
|
|
5
|
+
constructor(data: BaseProxyParameters);
|
|
7
6
|
send: (data: IBlockchainSendRequestData) => Promise<import("../..").ApiResponse<import("../..").BlockchainData>>;
|
|
8
7
|
multiSend: (data: IBlockchainMultiSendRequestData) => Promise<import("../..").ApiResponse<import("../..").BlockchainData>>;
|
|
9
8
|
delegate: (data: IBlockchainDelegateRequestData) => Promise<import("../..").ApiResponse<import("../..").BlockchainData>>;
|
|
@@ -3,9 +3,9 @@ import { BlockchainService } from "../service/blockchain";
|
|
|
3
3
|
import { BaseProxy } from "./base";
|
|
4
4
|
class BlockchainProxy extends BaseProxy {
|
|
5
5
|
blockchainService;
|
|
6
|
-
constructor(
|
|
7
|
-
super(
|
|
8
|
-
this.blockchainService = new BlockchainService(
|
|
6
|
+
constructor(data) {
|
|
7
|
+
super(data);
|
|
8
|
+
this.blockchainService = new BlockchainService(data);
|
|
9
9
|
}
|
|
10
10
|
// #region "POST"
|
|
11
11
|
send = async (data) => {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ClientContextProvider } from "../../types/api/context/clientContext";
|
|
1
|
+
import type { BaseProxyParameters } from "../../types";
|
|
3
2
|
import { BaseProxy } from "./base";
|
|
4
3
|
declare class IPAddressAndLocationProxy extends BaseProxy {
|
|
5
4
|
private ipAddressAndLocationService;
|
|
6
|
-
constructor(
|
|
5
|
+
constructor(data: BaseProxyParameters);
|
|
7
6
|
getGeoCoordinates: () => Promise<import("../..").GeoCoordinates>;
|
|
8
7
|
getIPAddress: () => Promise<string>;
|
|
9
8
|
getGeoCoordinatesAndIPAddress: () => Promise<{
|
|
@@ -3,9 +3,9 @@ import { IPAddressAndLocationService } from "../service/ipAddressAndLocation";
|
|
|
3
3
|
import { BaseProxy } from "./base";
|
|
4
4
|
class IPAddressAndLocationProxy extends BaseProxy {
|
|
5
5
|
ipAddressAndLocationService;
|
|
6
|
-
constructor(
|
|
7
|
-
super(
|
|
8
|
-
this.ipAddressAndLocationService = new IPAddressAndLocationService(
|
|
6
|
+
constructor(data) {
|
|
7
|
+
super(data);
|
|
8
|
+
this.ipAddressAndLocationService = new IPAddressAndLocationService(data);
|
|
9
9
|
}
|
|
10
10
|
// #region "GET"
|
|
11
11
|
getGeoCoordinates = () => {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { IConfirmEmailData, IConfirmPhoneData, IValidateEmailData, IValidatePhoneData, IVerifyEmailData, IVerifyPhoneData, IValidateForgetPasswordData, IConfirmForgetPasswordData,
|
|
2
|
-
import type { ClientContextProvider } from "../../types/api/context/clientContext";
|
|
1
|
+
import type { IConfirmEmailData, IConfirmPhoneData, IValidateEmailData, IValidatePhoneData, IVerifyEmailData, IVerifyPhoneData, IValidateForgetPasswordData, IConfirmForgetPasswordData, ICheckForgetPasswordData, BaseProxyParameters } from "../../types";
|
|
3
2
|
import { BaseProxy } from "./base";
|
|
4
3
|
declare class LimitedProxy extends BaseProxy {
|
|
5
4
|
private limitedService;
|
|
6
|
-
constructor(
|
|
5
|
+
constructor(data: BaseProxyParameters);
|
|
7
6
|
checkForgetPassword: (data: ICheckForgetPasswordData) => Promise<import("../..").ApiResponse<import("../..").ForgetSecurityData>>;
|
|
8
7
|
validateForgetPassword: (data: IValidateForgetPasswordData) => Promise<import("../..").ApiResponse<import("../..").ForgetSecurityData>>;
|
|
9
8
|
confirmForgetPassword: (data: IConfirmForgetPasswordData) => Promise<import("../..").ApiResponse<import("../..").ForgetSecurityData>>;
|
|
@@ -3,9 +3,9 @@ import { LimitedService } from "../service/limited";
|
|
|
3
3
|
import { BaseProxy } from "./base";
|
|
4
4
|
class LimitedProxy extends BaseProxy {
|
|
5
5
|
limitedService;
|
|
6
|
-
constructor(
|
|
7
|
-
super(
|
|
8
|
-
this.limitedService = new LimitedService(
|
|
6
|
+
constructor(data) {
|
|
7
|
+
super(data);
|
|
8
|
+
this.limitedService = new LimitedService(data);
|
|
9
9
|
}
|
|
10
10
|
// #region "POST"
|
|
11
11
|
checkForgetPassword = async (data) => {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ClientContextProvider } from "../../types/api/context/clientContext";
|
|
1
|
+
import type { BaseProxyParameters, ICreateOrderData } from "../../types";
|
|
3
2
|
import { BaseProxy } from "./base";
|
|
4
3
|
declare class OrderProxy extends BaseProxy {
|
|
5
4
|
private orderService;
|
|
6
|
-
constructor(
|
|
5
|
+
constructor(data: BaseProxyParameters);
|
|
7
6
|
createOrder: (data: ICreateOrderData) => Promise<import("../..").ApiResponse<import("../..").OrderData>>;
|
|
8
7
|
}
|
|
9
8
|
export { OrderProxy };
|
package/dist/api/proxy/order.js
CHANGED
|
@@ -3,9 +3,9 @@ import { OrderService } from "../service/order";
|
|
|
3
3
|
import { BaseProxy } from "./base";
|
|
4
4
|
class OrderProxy extends BaseProxy {
|
|
5
5
|
orderService;
|
|
6
|
-
constructor(
|
|
7
|
-
super(
|
|
8
|
-
this.orderService = new OrderService(
|
|
6
|
+
constructor(data) {
|
|
7
|
+
super(data);
|
|
8
|
+
this.orderService = new OrderService(data);
|
|
9
9
|
}
|
|
10
10
|
// #region "POST"
|
|
11
11
|
createOrder = async (data) => {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ICreateOrganizationData, IUpdateOrganizationData, IUploadOrganizationDocumentData } from "../../types";
|
|
3
|
-
import type { ClientContextProvider } from "../../types/api/context/clientContext";
|
|
1
|
+
import type { BaseProxyParameters, ICreateOrganizationData, IUpdateOrganizationData, IUploadOrganizationDocumentData } from "../../types";
|
|
4
2
|
import { BaseProxy } from "./base";
|
|
5
3
|
declare class OrganizationProxy extends BaseProxy {
|
|
6
|
-
private context;
|
|
7
4
|
private organizationService;
|
|
8
|
-
constructor(
|
|
5
|
+
constructor(data: BaseProxyParameters);
|
|
6
|
+
userId(): Promise<number>;
|
|
9
7
|
getOrganization: (id: number) => Promise<import("../..").ApiResponse<import("../..").OrganizationData>>;
|
|
10
8
|
createOrganization: (data: ICreateOrganizationData) => Promise<import("../..").ApiResponse<import("../..").OrganizationData>>;
|
|
11
9
|
uploadDocument: (data: IUploadOrganizationDocumentData) => Promise<import("../..").ApiResponse<import("../..").DocumentData>>;
|
|
@@ -2,15 +2,13 @@ import { fillCreateOrganizationData, fillCreateOrganizationDocumentData, fillUpd
|
|
|
2
2
|
import { OrganizationService } from "../service/organization";
|
|
3
3
|
import { BaseProxy } from "./base";
|
|
4
4
|
class OrganizationProxy extends BaseProxy {
|
|
5
|
-
context;
|
|
6
5
|
organizationService;
|
|
7
|
-
constructor(
|
|
8
|
-
super(
|
|
9
|
-
this.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
6
|
+
constructor(data) {
|
|
7
|
+
super(data);
|
|
8
|
+
this.organizationService = new OrganizationService(data);
|
|
9
|
+
}
|
|
10
|
+
async userId() {
|
|
11
|
+
return this.cookiesHelper.getUserId();
|
|
14
12
|
}
|
|
15
13
|
// #region "GET"
|
|
16
14
|
getOrganization = async (id) => {
|
|
@@ -19,7 +17,7 @@ class OrganizationProxy extends BaseProxy {
|
|
|
19
17
|
// #endregion
|
|
20
18
|
// #region "POST"
|
|
21
19
|
createOrganization = async (data) => {
|
|
22
|
-
const organizationData = fillCreateOrganizationData(data, this.
|
|
20
|
+
const organizationData = fillCreateOrganizationData(data, await this.userId());
|
|
23
21
|
return this.organizationService.create(organizationData);
|
|
24
22
|
};
|
|
25
23
|
uploadDocument = async (data) => {
|
|
@@ -29,7 +27,7 @@ class OrganizationProxy extends BaseProxy {
|
|
|
29
27
|
// #endregion
|
|
30
28
|
// #region "PUT"
|
|
31
29
|
updateOrganization = async (data) => {
|
|
32
|
-
const organizationData = fillUpdateOrganizationData(data, this.
|
|
30
|
+
const organizationData = fillUpdateOrganizationData(data, await this.userId());
|
|
33
31
|
return this.organizationService.update(data.id, organizationData);
|
|
34
32
|
};
|
|
35
33
|
// #endregion
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ClientContextProvider } from "../../types/api/context/clientContext";
|
|
1
|
+
import type { BaseProxyParameters } from "../../types";
|
|
3
2
|
import { BaseProxy } from "./base";
|
|
4
3
|
declare class ProgramProxy extends BaseProxy {
|
|
5
4
|
private programService;
|
|
6
|
-
constructor(
|
|
5
|
+
constructor(data: BaseProxyParameters);
|
|
7
6
|
getSystemFeatures: () => Promise<import("../..").ApiResponse<import("../../types/banking/program").ProgramData>>;
|
|
8
7
|
getBin: () => Promise<import("../..").ApiResponse<import("../../types/banking/program").ProgramData>>;
|
|
9
8
|
getSignUp: () => Promise<import("../..").ApiResponse<import("../../types/banking/program").ProgramData>>;
|
|
@@ -2,9 +2,9 @@ import { ProgramService } from "../service/program";
|
|
|
2
2
|
import { BaseProxy } from "./base";
|
|
3
3
|
class ProgramProxy extends BaseProxy {
|
|
4
4
|
programService;
|
|
5
|
-
constructor(
|
|
6
|
-
super(
|
|
7
|
-
this.programService = new ProgramService(
|
|
5
|
+
constructor(data) {
|
|
6
|
+
super(data);
|
|
7
|
+
this.programService = new ProgramService(data);
|
|
8
8
|
}
|
|
9
9
|
getSystemFeatures = async () => this.programService.getSystemFeatures();
|
|
10
10
|
getBin = async () => this.programService.getBin();
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ClientContextProvider } from "../../types/api/context/clientContext";
|
|
1
|
+
import type { BaseProxyParameters, GGEZGiftRewards } from "../../types";
|
|
3
2
|
import { BaseProxy } from "./base";
|
|
4
3
|
declare class PromotionProxy extends BaseProxy {
|
|
5
4
|
private promotionService;
|
|
6
|
-
constructor(
|
|
5
|
+
constructor(data: BaseProxyParameters);
|
|
7
6
|
getPromotionByCode: (code: string) => Promise<import("../..").ApiResponse<import("../..").PromotionDetails>>;
|
|
8
7
|
getTwitterSpotlightPostIds: () => Promise<import("../..").ApiResponse<import("../..").TwitterSpotlightPostIdsResult>>;
|
|
9
8
|
incrementPromotionParticipants: (data: GGEZGiftRewards) => Promise<import("../..").ApiResponse<import("../..").PromotionIncrementResult>>;
|
|
@@ -2,9 +2,9 @@ import { PromotionService } from "../service/promotion";
|
|
|
2
2
|
import { BaseProxy } from "./base";
|
|
3
3
|
class PromotionProxy extends BaseProxy {
|
|
4
4
|
promotionService;
|
|
5
|
-
constructor(
|
|
6
|
-
super(
|
|
7
|
-
this.promotionService = new PromotionService(
|
|
5
|
+
constructor(data) {
|
|
6
|
+
super(data);
|
|
7
|
+
this.promotionService = new PromotionService(data);
|
|
8
8
|
}
|
|
9
9
|
// #region "GET"
|
|
10
10
|
getPromotionByCode = async (code) => {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ClientContextProvider } from "../../types/api/context/clientContext";
|
|
1
|
+
import type { BaseProxyParameters, IInquiryTransactionData, ICreateSystemTransactionData, ICreateGatewayCryptoTransactionData, ICreateBlockchainTransactionData, ICreateBlockchainTransferTransactionData } from "../../types";
|
|
3
2
|
import { BaseProxy } from "./base";
|
|
4
3
|
declare class TransactionProxy extends BaseProxy {
|
|
5
4
|
private transactionService;
|
|
6
|
-
constructor(
|
|
5
|
+
constructor(data: BaseProxyParameters);
|
|
7
6
|
inquiryTransaction: (params: IInquiryTransactionData) => Promise<import("../..").ApiResponse<import("../..").TransactionResultInquiry>>;
|
|
8
7
|
createSystemTransaction: (data: ICreateSystemTransactionData) => Promise<import("../..").ApiResponse<import("../..").TransactionData>>;
|
|
9
8
|
createBlockchainTransaction: (data: ICreateBlockchainTransactionData) => Promise<import("../..").ApiResponse<import("../..").TransactionData>>;
|
|
@@ -3,9 +3,9 @@ import { TransactionService } from "../service/transaction";
|
|
|
3
3
|
import { BaseProxy } from "./base";
|
|
4
4
|
class TransactionProxy extends BaseProxy {
|
|
5
5
|
transactionService;
|
|
6
|
-
constructor(
|
|
7
|
-
super(
|
|
8
|
-
this.transactionService = new TransactionService(
|
|
6
|
+
constructor(data) {
|
|
7
|
+
super(data);
|
|
8
|
+
this.transactionService = new TransactionService(data);
|
|
9
9
|
}
|
|
10
10
|
// #region "GET"
|
|
11
11
|
inquiryTransaction = async (params) => {
|
package/dist/api/proxy/user.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BaseProxyParameters, IActivateGoogleAuthData, IConfirmDeviceData, IConfirmEmailData, IConfirmPhoneData, ICreateAddressData, ICreateBankAccountData, ICreateDeviceData, ICreateEmailData, ICreateIdentificationData, ICreatePhoneData, ICreateTicketData, ICreateUserData, ICreateUserWithGoogleData, IDeactivateGoogleAuthData, IDeleteAddressData, IDeleteBankAccountData, IDeleteDeviceData, IDeleteEmailData, IDeleteGoogleAuthData, IDeleteIdentificationData, IDeletePhoneData, ILogoutDeviceData, IMakeAddressPrimaryData, IMakeBankAccountPrimaryData, IMakeEmailPrimaryData, IMakePhonePrimaryData, IResetPasswordData, IResetSecurityCodeData, IResetSecurityQuestionsData, ISendEmailOTPData, ISendPhoneOTPData, IUpdateAddressData, IUpdateBankAccountData, IUpdateDeviceData, IUpdateEmailData, IUpdateIdentificationData, IUpdatePersonalInfoData, IUpdatePhoneData, IUpdatePreferencesData, IUploadDocumentData, IUploadProfilePictureData, IValidateSecurityCodeData, IVerifyDeviceData, IVerifyEmailData, IVerifyPhoneData } from "../../types";
|
|
2
2
|
import type { ResetUserSecurity } from "../../types/banking/user/resetUserSecurity";
|
|
3
3
|
import type { IUpdateUserTypeData } from "../../types/api/data/user/type";
|
|
4
|
-
import type { ClientContextProvider } from "../../types/api/context/clientContext";
|
|
5
4
|
import { BaseProxy } from "./base";
|
|
6
5
|
declare class UserProxy extends BaseProxy {
|
|
7
6
|
private userService;
|
|
8
|
-
constructor(
|
|
7
|
+
constructor(data: BaseProxyParameters);
|
|
9
8
|
getUser: () => Promise<import("../..").ApiResponse<import("../..").UserData>>;
|
|
10
9
|
getTermsAndConditions: () => Promise<import("../..").ApiResponse<import("../..").UserData>>;
|
|
11
10
|
getSecurity: () => Promise<import("../..").ApiResponse<import("../..").UserData>>;
|
package/dist/api/proxy/user.js
CHANGED
|
@@ -3,9 +3,9 @@ import { UserService } from "../service/user";
|
|
|
3
3
|
import { BaseProxy } from "./base";
|
|
4
4
|
class UserProxy extends BaseProxy {
|
|
5
5
|
userService;
|
|
6
|
-
constructor(
|
|
7
|
-
super(
|
|
8
|
-
this.userService = new UserService(
|
|
6
|
+
constructor(data) {
|
|
7
|
+
super(data);
|
|
8
|
+
this.userService = new UserService(data);
|
|
9
9
|
}
|
|
10
10
|
// #region "GET"
|
|
11
11
|
getUser = async () => this.userService.getUser();
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
|
-
import type {
|
|
2
|
+
import type { BaseServiceParameters } from "../../types/api/service/base";
|
|
3
3
|
import type { ClientContextProvider } from "../../types/api/context/clientContext";
|
|
4
4
|
import type { RequestFlag } from "../../types/helper/api/requestBuilder";
|
|
5
5
|
import type { BaseResult } from "../../types/banking/common/baseresult";
|
|
6
|
+
import { ApiResponse, CookiesHelper, ErrorHandler } from "../..";
|
|
6
7
|
declare abstract class BaseService {
|
|
7
8
|
protected abstract endpoint: string;
|
|
8
9
|
protected context: ClientContextProvider;
|
|
10
|
+
protected cookiesHelper: CookiesHelper;
|
|
9
11
|
protected axiosInstance: AxiosInstance;
|
|
10
12
|
protected errorHandler: ErrorHandler;
|
|
11
13
|
constructor(data: BaseServiceParameters);
|
package/dist/api/service/base.js
CHANGED
|
@@ -4,27 +4,31 @@ import { ResponseHelper } from "../../helper/api/responseHelper";
|
|
|
4
4
|
import { HeaderKeys } from "../../constant/constant";
|
|
5
5
|
class BaseService {
|
|
6
6
|
context;
|
|
7
|
+
cookiesHelper;
|
|
7
8
|
axiosInstance;
|
|
8
9
|
errorHandler;
|
|
9
10
|
constructor(data) {
|
|
10
11
|
this.context = data.context;
|
|
12
|
+
this.cookiesHelper = data.cookiesHelper;
|
|
11
13
|
this.errorHandler = data.errorHandler;
|
|
12
14
|
this.axiosInstance = axios.create();
|
|
13
15
|
this.axiosInstance.interceptors.request.use((req) => this.onRequest(req));
|
|
14
|
-
this.axiosInstance.interceptors.response.use((
|
|
16
|
+
this.axiosInstance.interceptors.response.use((res) => this.onResponse(res), (err) => this.onError(err));
|
|
15
17
|
}
|
|
18
|
+
// #region "Interceptors Handlers"
|
|
16
19
|
async onRequest(req) {
|
|
17
|
-
AxiosHelper.injectBaseHeaders(req, this.context, this.endpoint);
|
|
20
|
+
await AxiosHelper.injectBaseHeaders(req, this.context, this.cookiesHelper, this.endpoint);
|
|
18
21
|
AxiosHelper.injectBaseBodyProperties(req);
|
|
19
22
|
return req;
|
|
20
23
|
}
|
|
21
|
-
onResponse(
|
|
22
|
-
return ResponseHelper.onResponse(
|
|
24
|
+
onResponse(res) {
|
|
25
|
+
return ResponseHelper.onResponse(res);
|
|
23
26
|
}
|
|
24
|
-
onError(
|
|
25
|
-
this.errorHandler(
|
|
26
|
-
return ResponseHelper.onError(
|
|
27
|
+
onError(err) {
|
|
28
|
+
this.errorHandler(err);
|
|
29
|
+
return ResponseHelper.onError(err);
|
|
27
30
|
}
|
|
31
|
+
// #endregion
|
|
28
32
|
async GET(url, options) {
|
|
29
33
|
const response = await this.axiosInstance.get(url, {
|
|
30
34
|
params: options?.params,
|
|
@@ -9,7 +9,7 @@ import type { VerifyUserSecurity } from "../../types/banking/user/verifyUserSecu
|
|
|
9
9
|
declare class UserService extends BaseService {
|
|
10
10
|
protected endpoint: string;
|
|
11
11
|
constructor(data: UserServiceParameters);
|
|
12
|
-
private
|
|
12
|
+
private userId;
|
|
13
13
|
getUser(): Promise<import("../..").ApiResponse<UserData>>;
|
|
14
14
|
getTermsAndConditions(): Promise<import("../..").ApiResponse<UserData>>;
|
|
15
15
|
getSecurity(): Promise<import("../..").ApiResponse<UserData>>;
|
package/dist/api/service/user.js
CHANGED
|
@@ -14,88 +14,88 @@ class UserService extends BaseService {
|
|
|
14
14
|
return req;
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
return
|
|
17
|
+
async userId() {
|
|
18
|
+
return await this.cookiesHelper.getUserId();
|
|
19
19
|
}
|
|
20
20
|
// #region "GET"
|
|
21
|
-
getUser() {
|
|
22
|
-
const url = this.resolveURL(`/${this.
|
|
21
|
+
async getUser() {
|
|
22
|
+
const url = this.resolveURL(`/${await this.userId()}`);
|
|
23
23
|
return this.GET(url);
|
|
24
24
|
}
|
|
25
|
-
getTermsAndConditions() {
|
|
26
|
-
const url = this.resolveURL(`${UserEndpoints.TermsAndConditions}/${this.
|
|
25
|
+
async getTermsAndConditions() {
|
|
26
|
+
const url = this.resolveURL(`${UserEndpoints.TermsAndConditions}/${await this.userId()}`);
|
|
27
27
|
return this.GET(url);
|
|
28
28
|
}
|
|
29
|
-
getSecurity() {
|
|
30
|
-
const url = this.resolveURL(`${UserEndpoints.Security}/${this.
|
|
29
|
+
async getSecurity() {
|
|
30
|
+
const url = this.resolveURL(`${UserEndpoints.Security}/${await this.userId()}`);
|
|
31
31
|
return this.GET(url);
|
|
32
32
|
}
|
|
33
|
-
getPhone() {
|
|
34
|
-
const url = this.resolveURL(`${UserEndpoints.Phone}/${this.
|
|
33
|
+
async getPhone() {
|
|
34
|
+
const url = this.resolveURL(`${UserEndpoints.Phone}/${await this.userId()}`);
|
|
35
35
|
return this.GET(url);
|
|
36
36
|
}
|
|
37
|
-
getPreferences() {
|
|
38
|
-
const url = this.resolveURL(`${UserEndpoints.Preferences}/${this.
|
|
37
|
+
async getPreferences() {
|
|
38
|
+
const url = this.resolveURL(`${UserEndpoints.Preferences}/${await this.userId()}`);
|
|
39
39
|
return this.GET(url);
|
|
40
40
|
}
|
|
41
|
-
getPersonalInfo() {
|
|
42
|
-
const url = this.resolveURL(`${UserEndpoints.PersonalInfo}/${this.
|
|
41
|
+
async getPersonalInfo() {
|
|
42
|
+
const url = this.resolveURL(`${UserEndpoints.PersonalInfo}/${await this.userId()}`);
|
|
43
43
|
return this.GET(url);
|
|
44
44
|
}
|
|
45
|
-
getLatestHistory() {
|
|
46
|
-
const url = this.resolveURL(`${UserEndpoints.HistoryLatest}/${this.
|
|
45
|
+
async getLatestHistory() {
|
|
46
|
+
const url = this.resolveURL(`${UserEndpoints.HistoryLatest}/${await this.userId()}`);
|
|
47
47
|
return this.GET(url);
|
|
48
48
|
}
|
|
49
|
-
getIdentification() {
|
|
50
|
-
const url = this.resolveURL(`${UserEndpoints.Identification}/${this.
|
|
49
|
+
async getIdentification() {
|
|
50
|
+
const url = this.resolveURL(`${UserEndpoints.Identification}/${await this.userId()}`);
|
|
51
51
|
return this.GET(url, { flags: { showSensitiveData: true } });
|
|
52
52
|
}
|
|
53
|
-
getHistory() {
|
|
54
|
-
const url = this.resolveURL(`${UserEndpoints.HistoryLatest}/${this.
|
|
53
|
+
async getHistory() {
|
|
54
|
+
const url = this.resolveURL(`${UserEndpoints.HistoryLatest}/${await this.userId()}`);
|
|
55
55
|
return this.GET(url);
|
|
56
56
|
}
|
|
57
|
-
getGroup() {
|
|
58
|
-
const url = this.resolveURL(`${UserEndpoints.Group}/${this.
|
|
57
|
+
async getGroup() {
|
|
58
|
+
const url = this.resolveURL(`${UserEndpoints.Group}/${await this.userId()}`);
|
|
59
59
|
return this.GET(url);
|
|
60
60
|
}
|
|
61
|
-
getExternalAuth() {
|
|
62
|
-
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${this.
|
|
61
|
+
async getExternalAuth() {
|
|
62
|
+
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${await this.userId()}`);
|
|
63
63
|
return this.GET(url);
|
|
64
64
|
}
|
|
65
|
-
getEmail() {
|
|
66
|
-
const url = this.resolveURL(`${UserEndpoints.Email}/${this.
|
|
65
|
+
async getEmail() {
|
|
66
|
+
const url = this.resolveURL(`${UserEndpoints.Email}/${await this.userId()}`);
|
|
67
67
|
return this.GET(url);
|
|
68
68
|
}
|
|
69
|
-
getDocuments() {
|
|
70
|
-
const url = this.resolveURL(`${UserEndpoints.Documents}/${this.
|
|
69
|
+
async getDocuments() {
|
|
70
|
+
const url = this.resolveURL(`${UserEndpoints.Documents}/${await this.userId()}`);
|
|
71
71
|
return this.GET(url);
|
|
72
72
|
}
|
|
73
|
-
getCurrency() {
|
|
74
|
-
const url = this.resolveURL(`${UserEndpoints.Currency}/${this.
|
|
73
|
+
async getCurrency() {
|
|
74
|
+
const url = this.resolveURL(`${UserEndpoints.Currency}/${await this.userId()}`);
|
|
75
75
|
return this.GET(url);
|
|
76
76
|
}
|
|
77
|
-
getCreditCard() {
|
|
78
|
-
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${this.
|
|
77
|
+
async getCreditCard() {
|
|
78
|
+
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${await this.userId()}`);
|
|
79
79
|
return this.GET(url);
|
|
80
80
|
}
|
|
81
|
-
getBankAccount() {
|
|
82
|
-
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${this.
|
|
81
|
+
async getBankAccount() {
|
|
82
|
+
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${await this.userId()}`);
|
|
83
83
|
return this.GET(url, { flags: { showSensitiveData: true } });
|
|
84
84
|
}
|
|
85
|
-
getAddress() {
|
|
86
|
-
const url = this.resolveURL(`${UserEndpoints.Address}/${this.
|
|
85
|
+
async getAddress() {
|
|
86
|
+
const url = this.resolveURL(`${UserEndpoints.Address}/${await this.userId()}`);
|
|
87
87
|
return this.GET(url, { flags: { showSensitiveData: true } });
|
|
88
88
|
}
|
|
89
|
-
getAccount() {
|
|
90
|
-
const url = this.resolveURL(`${UserEndpoints.Account}/${this.
|
|
89
|
+
async getAccount() {
|
|
90
|
+
const url = this.resolveURL(`${UserEndpoints.Account}/${await this.userId()}`);
|
|
91
91
|
return this.GET(url);
|
|
92
92
|
}
|
|
93
|
-
getDeviceHistory() {
|
|
94
|
-
const url = this.resolveURL(`${UserEndpoints.DeviceHistory}/${this.
|
|
93
|
+
async getDeviceHistory() {
|
|
94
|
+
const url = this.resolveURL(`${UserEndpoints.DeviceHistory}/${await this.userId()}`);
|
|
95
95
|
return this.GET(url);
|
|
96
96
|
}
|
|
97
|
-
getActivity() {
|
|
98
|
-
const url = this.resolveURL(`${UserEndpoints.Activity}/${this.
|
|
97
|
+
async getActivity() {
|
|
98
|
+
const url = this.resolveURL(`${UserEndpoints.Activity}/${await this.userId()}`);
|
|
99
99
|
return this.GET(url);
|
|
100
100
|
}
|
|
101
101
|
// #endregion
|
|
@@ -104,180 +104,180 @@ class UserService extends BaseService {
|
|
|
104
104
|
const url = this.resolveURL();
|
|
105
105
|
return this.POST(url, payload);
|
|
106
106
|
}
|
|
107
|
-
createPhone(payload) {
|
|
108
|
-
const url = this.resolveURL(`${UserEndpoints.Phone}/${this.
|
|
107
|
+
async createPhone(payload) {
|
|
108
|
+
const url = this.resolveURL(`${UserEndpoints.Phone}/${await this.userId()}`);
|
|
109
109
|
return this.POST(url, payload);
|
|
110
110
|
}
|
|
111
|
-
createDevice(payload) {
|
|
112
|
-
const url = this.resolveURL(`${UserEndpoints.Device}/${this.
|
|
111
|
+
async createDevice(payload) {
|
|
112
|
+
const url = this.resolveURL(`${UserEndpoints.Device}/${await this.userId()}`);
|
|
113
113
|
return this.POST(url, payload);
|
|
114
114
|
}
|
|
115
|
-
createIdentification(payload) {
|
|
116
|
-
const url = this.resolveURL(`${UserEndpoints.Identification}/${this.
|
|
115
|
+
async createIdentification(payload) {
|
|
116
|
+
const url = this.resolveURL(`${UserEndpoints.Identification}/${await this.userId()}`);
|
|
117
117
|
return this.POST(url, payload);
|
|
118
118
|
}
|
|
119
|
-
createExternalAuth(payload) {
|
|
120
|
-
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${this.
|
|
119
|
+
async createExternalAuth(payload) {
|
|
120
|
+
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${await this.userId()}`);
|
|
121
121
|
return this.POST(url, payload);
|
|
122
122
|
}
|
|
123
|
-
createEmail(payload) {
|
|
124
|
-
const url = this.resolveURL(`${UserEndpoints.Email}/${this.
|
|
123
|
+
async createEmail(payload) {
|
|
124
|
+
const url = this.resolveURL(`${UserEndpoints.Email}/${await this.userId()}`);
|
|
125
125
|
return this.POST(url, payload);
|
|
126
126
|
}
|
|
127
|
-
createCurrency(payload) {
|
|
128
|
-
const url = this.resolveURL(`${UserEndpoints.Currency}/${this.
|
|
127
|
+
async createCurrency(payload) {
|
|
128
|
+
const url = this.resolveURL(`${UserEndpoints.Currency}/${await this.userId()}`);
|
|
129
129
|
return this.POST(url, payload);
|
|
130
130
|
}
|
|
131
|
-
createCreditCard(payload) {
|
|
132
|
-
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${this.
|
|
131
|
+
async createCreditCard(payload) {
|
|
132
|
+
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${await this.userId()}`);
|
|
133
133
|
return this.POST(url, payload);
|
|
134
134
|
}
|
|
135
|
-
createBankAccount(payload) {
|
|
136
|
-
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${this.
|
|
135
|
+
async createBankAccount(payload) {
|
|
136
|
+
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${await this.userId()}`);
|
|
137
137
|
return this.POST(url, payload);
|
|
138
138
|
}
|
|
139
|
-
createAddress(payload) {
|
|
140
|
-
const url = this.resolveURL(`${UserEndpoints.Address}/${this.
|
|
139
|
+
async createAddress(payload) {
|
|
140
|
+
const url = this.resolveURL(`${UserEndpoints.Address}/${await this.userId()}`);
|
|
141
141
|
return this.POST(url, payload);
|
|
142
142
|
}
|
|
143
|
-
createTicket(payload) {
|
|
144
|
-
const url = this.resolveURL(`${UserEndpoints.Ticket}/${this.
|
|
143
|
+
async createTicket(payload) {
|
|
144
|
+
const url = this.resolveURL(`${UserEndpoints.Ticket}/${await this.userId()}`);
|
|
145
145
|
return this.POST(url, payload);
|
|
146
146
|
}
|
|
147
|
-
securityAccess(payload) {
|
|
148
|
-
const url = this.resolveURL(`${UserEndpoints.SecurityAccess}/${this.
|
|
147
|
+
async securityAccess(payload) {
|
|
148
|
+
const url = this.resolveURL(`${UserEndpoints.SecurityAccess}/${await this.userId()}`);
|
|
149
149
|
return this.POST(url, payload);
|
|
150
150
|
}
|
|
151
|
-
uploadDocument(payload) {
|
|
152
|
-
const url = this.resolveURL(`${UserEndpoints.Document}/${this.
|
|
151
|
+
async uploadDocument(payload) {
|
|
152
|
+
const url = this.resolveURL(`${UserEndpoints.Document}/${await this.userId()}`);
|
|
153
153
|
return this.POST(url, payload);
|
|
154
154
|
}
|
|
155
|
-
confirmSecurityData(payload) {
|
|
156
|
-
const url = this.resolveURL(`${UserEndpoints.SecurityConfirm}/${this.
|
|
155
|
+
async confirmSecurityData(payload) {
|
|
156
|
+
const url = this.resolveURL(`${UserEndpoints.SecurityConfirm}/${await this.userId()}`);
|
|
157
157
|
return this.POST(url, payload);
|
|
158
158
|
}
|
|
159
|
-
validateSecurityData(payload) {
|
|
160
|
-
const url = this.resolveURL(`${UserEndpoints.SecurityValidate}/${this.
|
|
159
|
+
async validateSecurityData(payload) {
|
|
160
|
+
const url = this.resolveURL(`${UserEndpoints.SecurityValidate}/${await this.userId()}`);
|
|
161
161
|
return this.POST(url, payload);
|
|
162
162
|
}
|
|
163
|
-
verifySecurityData(payload) {
|
|
164
|
-
const url = this.resolveURL(`${UserEndpoints.SecurityVerify}/${this.
|
|
163
|
+
async verifySecurityData(payload) {
|
|
164
|
+
const url = this.resolveURL(`${UserEndpoints.SecurityVerify}/${await this.userId()}`);
|
|
165
165
|
return this.POST(url, payload);
|
|
166
166
|
}
|
|
167
|
-
resetSecurityData(payload) {
|
|
168
|
-
const url = this.resolveURL(`${UserEndpoints.SecurityReset}/${this.
|
|
167
|
+
async resetSecurityData(payload) {
|
|
168
|
+
const url = this.resolveURL(`${UserEndpoints.SecurityReset}/${await this.userId()}`);
|
|
169
169
|
return this.POST(url, payload);
|
|
170
170
|
}
|
|
171
|
-
enrollGoogleAuth(payload) {
|
|
172
|
-
const url = this.resolveURL(`${UserEndpoints.AuthEnroll}/${this.
|
|
171
|
+
async enrollGoogleAuth(payload) {
|
|
172
|
+
const url = this.resolveURL(`${UserEndpoints.AuthEnroll}/${await this.userId()}`);
|
|
173
173
|
return this.POST(url, payload);
|
|
174
174
|
}
|
|
175
|
-
activateGoogleAuth(payload) {
|
|
176
|
-
const url = this.resolveURL(`${UserEndpoints.AuthActivate}/${this.
|
|
175
|
+
async activateGoogleAuth(payload) {
|
|
176
|
+
const url = this.resolveURL(`${UserEndpoints.AuthActivate}/${await this.userId()}`);
|
|
177
177
|
return this.POST(url, payload);
|
|
178
178
|
}
|
|
179
|
-
deactivateGoogleAuth(payload) {
|
|
180
|
-
const url = this.resolveURL(`${UserEndpoints.AuthDeactivate}/${this.
|
|
179
|
+
async deactivateGoogleAuth(payload) {
|
|
180
|
+
const url = this.resolveURL(`${UserEndpoints.AuthDeactivate}/${await this.userId()}`);
|
|
181
181
|
return this.POST(url, payload);
|
|
182
182
|
}
|
|
183
|
-
deleteGoogleAuth(payload) {
|
|
184
|
-
const url = this.resolveURL(`${UserEndpoints.AuthDelete}/${this.
|
|
183
|
+
async deleteGoogleAuth(payload) {
|
|
184
|
+
const url = this.resolveURL(`${UserEndpoints.AuthDelete}/${await this.userId()}`);
|
|
185
185
|
return this.POST(url, payload);
|
|
186
186
|
}
|
|
187
187
|
// #endregion
|
|
188
188
|
// #region "PUT"
|
|
189
|
-
updateUser(payload) {
|
|
190
|
-
const url = this.resolveURL(`/${this.
|
|
189
|
+
async updateUser(payload) {
|
|
190
|
+
const url = this.resolveURL(`/${await this.userId()}`);
|
|
191
191
|
return this.PUT(url, payload);
|
|
192
192
|
}
|
|
193
|
-
updateSecurity(payload) {
|
|
194
|
-
const url = this.resolveURL(`${UserEndpoints.Security}/${this.
|
|
193
|
+
async updateSecurity(payload) {
|
|
194
|
+
const url = this.resolveURL(`${UserEndpoints.Security}/${await this.userId()}`);
|
|
195
195
|
return this.PUT(url, payload);
|
|
196
196
|
}
|
|
197
|
-
updatePreferences(payload) {
|
|
198
|
-
const url = this.resolveURL(`${UserEndpoints.Preferences}/${this.
|
|
197
|
+
async updatePreferences(payload) {
|
|
198
|
+
const url = this.resolveURL(`${UserEndpoints.Preferences}/${await this.userId()}`);
|
|
199
199
|
return this.PUT(url, payload);
|
|
200
200
|
}
|
|
201
|
-
updateDevice(payload) {
|
|
202
|
-
const url = this.resolveURL(`${UserEndpoints.Device}/${this.
|
|
201
|
+
async updateDevice(payload) {
|
|
202
|
+
const url = this.resolveURL(`${UserEndpoints.Device}/${await this.userId()}`);
|
|
203
203
|
return this.PUT(url, payload);
|
|
204
204
|
}
|
|
205
|
-
logoutDevice(payload) {
|
|
206
|
-
const url = this.resolveURL(`${UserEndpoints.DeviceLogout}/${this.
|
|
205
|
+
async logoutDevice(payload) {
|
|
206
|
+
const url = this.resolveURL(`${UserEndpoints.DeviceLogout}/${await this.userId()}`);
|
|
207
207
|
return this.PUT(url, payload);
|
|
208
208
|
}
|
|
209
|
-
updatePhone(payload) {
|
|
210
|
-
const url = this.resolveURL(`${UserEndpoints.Phone}/${this.
|
|
209
|
+
async updatePhone(payload) {
|
|
210
|
+
const url = this.resolveURL(`${UserEndpoints.Phone}/${await this.userId()}`);
|
|
211
211
|
return this.PUT(url, payload);
|
|
212
212
|
}
|
|
213
|
-
updatePersonalInfo(payload) {
|
|
214
|
-
const url = this.resolveURL(`${UserEndpoints.PersonalInfo}/${this.
|
|
213
|
+
async updatePersonalInfo(payload) {
|
|
214
|
+
const url = this.resolveURL(`${UserEndpoints.PersonalInfo}/${await this.userId()}`);
|
|
215
215
|
return this.PUT(url, payload);
|
|
216
216
|
}
|
|
217
|
-
updateIdentification(payload) {
|
|
218
|
-
const url = this.resolveURL(`${UserEndpoints.Identification}/${this.
|
|
217
|
+
async updateIdentification(payload) {
|
|
218
|
+
const url = this.resolveURL(`${UserEndpoints.Identification}/${await this.userId()}`);
|
|
219
219
|
return this.PUT(url, payload);
|
|
220
220
|
}
|
|
221
|
-
updateExternalAuth(payload) {
|
|
222
|
-
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${this.
|
|
221
|
+
async updateExternalAuth(payload) {
|
|
222
|
+
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${await this.userId()}`);
|
|
223
223
|
return this.PUT(url, payload);
|
|
224
224
|
}
|
|
225
|
-
updateEmail(payload) {
|
|
226
|
-
const url = this.resolveURL(`${UserEndpoints.Email}/${this.
|
|
225
|
+
async updateEmail(payload) {
|
|
226
|
+
const url = this.resolveURL(`${UserEndpoints.Email}/${await this.userId()}`);
|
|
227
227
|
return this.PUT(url, payload);
|
|
228
228
|
}
|
|
229
|
-
updateCreditCard(payload) {
|
|
230
|
-
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${this.
|
|
229
|
+
async updateCreditCard(payload) {
|
|
230
|
+
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${await this.userId()}`);
|
|
231
231
|
return this.PUT(url, payload);
|
|
232
232
|
}
|
|
233
|
-
updateBankAccount(payload) {
|
|
234
|
-
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${this.
|
|
233
|
+
async updateBankAccount(payload) {
|
|
234
|
+
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${await this.userId()}`);
|
|
235
235
|
return this.PUT(url, payload);
|
|
236
236
|
}
|
|
237
|
-
updateAddress(payload) {
|
|
238
|
-
const url = this.resolveURL(`${UserEndpoints.Address}/${this.
|
|
237
|
+
async updateAddress(payload) {
|
|
238
|
+
const url = this.resolveURL(`${UserEndpoints.Address}/${await this.userId()}`);
|
|
239
239
|
return this.PUT(url, payload);
|
|
240
240
|
}
|
|
241
|
-
updateUserType(payload) {
|
|
242
|
-
const url = this.resolveURL(`${UserEndpoints.Type}/${this.
|
|
241
|
+
async updateUserType(payload) {
|
|
242
|
+
const url = this.resolveURL(`${UserEndpoints.Type}/${await this.userId()}`);
|
|
243
243
|
return this.PUT(url, payload);
|
|
244
244
|
}
|
|
245
245
|
// #endregion
|
|
246
246
|
// #region "DELETE"
|
|
247
|
-
deleteUser() {
|
|
248
|
-
const url = this.resolveURL(`/${this.
|
|
247
|
+
async deleteUser() {
|
|
248
|
+
const url = this.resolveURL(`/${await this.userId()}`);
|
|
249
249
|
return this.DELETE(url);
|
|
250
250
|
}
|
|
251
|
-
deleteCreditCard() {
|
|
252
|
-
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${this.
|
|
251
|
+
async deleteCreditCard() {
|
|
252
|
+
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${await this.userId()}`);
|
|
253
253
|
return this.DELETE(url);
|
|
254
254
|
}
|
|
255
|
-
deleteAddress(payload) {
|
|
256
|
-
const url = this.resolveURL(`${UserEndpoints.Address}/${this.
|
|
255
|
+
async deleteAddress(payload) {
|
|
256
|
+
const url = this.resolveURL(`${UserEndpoints.Address}/${await this.userId()}`);
|
|
257
257
|
return this.DELETE(url, payload);
|
|
258
258
|
}
|
|
259
|
-
deleteDevice(payload) {
|
|
260
|
-
const url = this.resolveURL(`${UserEndpoints.Device}/${this.
|
|
259
|
+
async deleteDevice(payload) {
|
|
260
|
+
const url = this.resolveURL(`${UserEndpoints.Device}/${await this.userId()}`);
|
|
261
261
|
return this.DELETE(url, payload);
|
|
262
262
|
}
|
|
263
|
-
deleteBankAccount(payload) {
|
|
264
|
-
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${this.
|
|
263
|
+
async deleteBankAccount(payload) {
|
|
264
|
+
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${await this.userId()}`);
|
|
265
265
|
return this.DELETE(url, payload);
|
|
266
266
|
}
|
|
267
|
-
deleteIdentification(payload) {
|
|
268
|
-
const url = this.resolveURL(`${UserEndpoints.Identification}/${this.
|
|
267
|
+
async deleteIdentification(payload) {
|
|
268
|
+
const url = this.resolveURL(`${UserEndpoints.Identification}/${await this.userId()}`);
|
|
269
269
|
return this.DELETE(url, payload);
|
|
270
270
|
}
|
|
271
|
-
deleteEmail(payload) {
|
|
272
|
-
const url = this.resolveURL(`${UserEndpoints.Email}/${this.
|
|
271
|
+
async deleteEmail(payload) {
|
|
272
|
+
const url = this.resolveURL(`${UserEndpoints.Email}/${await this.userId()}`);
|
|
273
273
|
return this.DELETE(url, payload);
|
|
274
274
|
}
|
|
275
|
-
deletePhone(payload) {
|
|
276
|
-
const url = this.resolveURL(`${UserEndpoints.Phone}/${this.
|
|
275
|
+
async deletePhone(payload) {
|
|
276
|
+
const url = this.resolveURL(`${UserEndpoints.Phone}/${await this.userId()}`);
|
|
277
277
|
return this.DELETE(url, payload);
|
|
278
278
|
}
|
|
279
|
-
deleteExternalAuth() {
|
|
280
|
-
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${this.
|
|
279
|
+
async deleteExternalAuth() {
|
|
280
|
+
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${await this.userId()}`);
|
|
281
281
|
return this.DELETE(url);
|
|
282
282
|
}
|
|
283
283
|
}
|
|
@@ -41,11 +41,11 @@ class AxiosHelper {
|
|
|
41
41
|
config.headers = {};
|
|
42
42
|
config.headers[key] = value;
|
|
43
43
|
};
|
|
44
|
-
static injectBaseHeaders = (req, context, endpoint) => {
|
|
45
|
-
const token =
|
|
46
|
-
const userId =
|
|
44
|
+
static injectBaseHeaders = async (req, context, cookiesHelper, endpoint) => {
|
|
45
|
+
const token = await cookiesHelper.getAccessToken();
|
|
46
|
+
const userId = await cookiesHelper.getUserId();
|
|
47
47
|
const lang = context.getLang();
|
|
48
|
-
const iid =
|
|
48
|
+
const iid = await cookiesHelper.getIID();
|
|
49
49
|
const baseURL = context.getBaseUrl();
|
|
50
50
|
const nodeUrl = context.getNodeUrl();
|
|
51
51
|
if (token)
|
|
@@ -36,6 +36,8 @@ declare class CookiesHelper {
|
|
|
36
36
|
getDEK(): Promise<string>;
|
|
37
37
|
setDEK(deviceEncryptionKey: string, USR: USR): Promise<void>;
|
|
38
38
|
validateDEK(DEK: string): Promise<boolean>;
|
|
39
|
+
getUserId(): Promise<number>;
|
|
40
|
+
getDeviceId(): Promise<number>;
|
|
39
41
|
getUSR(): Promise<USR | null>;
|
|
40
42
|
setUSR(deviceId: string, userId: string): Promise<void>;
|
|
41
43
|
validateUSR(USR: string): Promise<boolean>;
|
|
@@ -218,6 +218,28 @@ class CookiesHelper {
|
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
// #endregion
|
|
221
|
+
// #region "User ID / Device ID"
|
|
222
|
+
async getUserId() {
|
|
223
|
+
try {
|
|
224
|
+
const USR = await this.getUSR();
|
|
225
|
+
return Number(USR?.user_id || 0);
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
this.errorHandler(error);
|
|
229
|
+
return 0;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
async getDeviceId() {
|
|
233
|
+
try {
|
|
234
|
+
const USR = await this.getUSR();
|
|
235
|
+
return Number(USR?.device_id || 0);
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
this.errorHandler(error);
|
|
239
|
+
return 0;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
// #endregion
|
|
221
243
|
// #region "USR"
|
|
222
244
|
async getUSR() {
|
|
223
245
|
try {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseResult } from "../../banking/common/baseresult";
|
|
2
|
+
type ErrorHandler = (error: unknown) => void;
|
|
3
|
+
type ApiResponse<T extends BaseResult> = {
|
|
4
|
+
data: T;
|
|
5
|
+
success: boolean;
|
|
6
|
+
message: string;
|
|
7
|
+
error: string | null;
|
|
8
|
+
};
|
|
9
|
+
export type { ApiResponse, ErrorHandler };
|
|
@@ -22,11 +22,5 @@ interface ClientContextProvider {
|
|
|
22
22
|
getProgramId(): number;
|
|
23
23
|
getLang(): string;
|
|
24
24
|
setLang(lang: string): void;
|
|
25
|
-
getInstallationId(): string;
|
|
26
|
-
setInstallationId(installationId: string): void;
|
|
27
|
-
getToken(): string;
|
|
28
|
-
setToken(token: string): void;
|
|
29
|
-
getUserId(): number;
|
|
30
|
-
setUserId(userId: number): void;
|
|
31
25
|
}
|
|
32
26
|
export type { InitialContext, ClientContextProvider };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CookiesHelper } from "../../../helper";
|
|
2
|
+
import { ErrorHandler } from "../common";
|
|
3
|
+
import { ClientContextProvider } from "../context";
|
|
4
|
+
type BaseProxyParameters = {
|
|
5
|
+
context: ClientContextProvider;
|
|
6
|
+
errorHandler: ErrorHandler;
|
|
7
|
+
cookiesHelper: CookiesHelper;
|
|
8
|
+
};
|
|
9
|
+
export type { BaseProxyParameters };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import type { ClientContextProvider } from "../context/clientContext";
|
|
2
|
-
import
|
|
2
|
+
import { CookiesHelper, ErrorHandler } from "../../..";
|
|
3
3
|
type BaseServiceParameters = {
|
|
4
4
|
context: ClientContextProvider;
|
|
5
5
|
errorHandler: ErrorHandler;
|
|
6
|
+
cookiesHelper: CookiesHelper;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
-
type ApiResponse<T extends BaseResult> = {
|
|
9
|
-
data: T;
|
|
10
|
-
success: boolean;
|
|
11
|
-
message: string;
|
|
12
|
-
error: string | null;
|
|
13
|
-
};
|
|
14
|
-
export type { ApiResponse };
|
|
15
|
-
export { BaseServiceParameters, ErrorHandler };
|
|
8
|
+
export { BaseServiceParameters };
|
|
@@ -4,7 +4,6 @@ export type * from "./base";
|
|
|
4
4
|
export type * from "./blockchain";
|
|
5
5
|
export type * from "./ipAddressAndLocation";
|
|
6
6
|
export type * from "./limited";
|
|
7
|
-
export type * from "./openPayd";
|
|
8
7
|
export type * from "./order";
|
|
9
8
|
export type * from "./organization";
|
|
10
9
|
export type * from "./program";
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { AxiosRequestConfig, InternalAxiosRequestConfig } from "axios";
|
|
2
2
|
import { GeoCoordinates } from "../../banking/common";
|
|
3
3
|
import { ClientContextProvider } from "../..";
|
|
4
|
+
import { CookiesHelper } from "../../..";
|
|
4
5
|
type TGetAxiosConfig = (token: string, baseURL: string, lang?: string, installationId?: string) => AxiosRequestConfig;
|
|
5
6
|
type TGetAuthAxiosConfig = (baseURL: string, lang: string, installationId: string) => AxiosRequestConfig;
|
|
6
7
|
type TAddAxiosConfigHeader = (config: AxiosRequestConfig, key: string, value: string) => void;
|
|
7
8
|
type TInjectRequest<D> = (req: InternalAxiosRequestConfig<D>) => InternalAxiosRequestConfig<D>;
|
|
8
9
|
type InjectRequiredHeaders<D> = (req: InternalAxiosRequestConfig, userId: number) => InternalAxiosRequestConfig<D>;
|
|
9
|
-
type InjectBaseHeaders<D> = (req: InternalAxiosRequestConfig, context: ClientContextProvider, endpoint: string) => InternalAxiosRequestConfig<D
|
|
10
|
+
type InjectBaseHeaders<D> = (req: InternalAxiosRequestConfig, context: ClientContextProvider, cookiesHelper: CookiesHelper, endpoint: string) => Promise<InternalAxiosRequestConfig<D>>;
|
|
10
11
|
type TInjectGeoCoordinates = <D extends {
|
|
11
12
|
geo_coordinates: GeoCoordinates;
|
|
12
13
|
}>(req: InternalAxiosRequestConfig<D>, geoCoordinates: GeoCoordinates) => InternalAxiosRequestConfig<D>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GeoCoordinates } from "../banking/common";
|
|
2
|
-
import type { ApiResponse } from "../api/service/base";
|
|
3
2
|
import type { IPAddressStringResult } from "../api/service/ipAddressAndLocation";
|
|
3
|
+
import { ApiResponse } from "../api/common";
|
|
4
4
|
type IPAddressAndLocation = {
|
|
5
5
|
ip_address: string;
|
|
6
6
|
country: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ggez-banking-sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"description": "A Node.js package to handle GGEZ Banking API endpoints, Simplify the process of managing CRUD operations with this efficient and easy-to-use package.",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
File without changes
|