ggez-banking-sdk 0.4.6 → 0.4.8
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 +17 -15
- package/dist/api/context/defaultClientContextProvider.js +1 -1
- 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 +6 -7
- 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 +11 -7
- 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 +21 -12
- package/dist/api/proxy/order.d.ts +2 -3
- package/dist/api/proxy/order.js +5 -4
- package/dist/api/proxy/organization.d.ts +2 -5
- package/dist/api/proxy/organization.js +9 -8
- 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 +5 -4
- package/dist/api/proxy/transaction.d.ts +2 -3
- package/dist/api/proxy/transaction.js +13 -8
- package/dist/api/proxy/user.d.ts +2 -3
- package/dist/api/proxy/user.js +191 -50
- package/dist/api/service/base.d.ts +3 -1
- package/dist/api/service/base.js +3 -1
- package/dist/helper/api/axiosHelper.js +2 -2
- package/dist/types/api/api.d.ts +2 -3
- package/dist/types/api/common/index.d.ts +9 -0
- package/dist/types/api/context/clientContext.d.ts +1 -1
- 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,26 +16,29 @@ 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
|
-
installationId: clientData.installationId,
|
|
26
25
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
26
|
+
const proxyData = {
|
|
27
|
+
context: this.context,
|
|
28
|
+
errorHandler,
|
|
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);
|
|
40
42
|
}
|
|
41
43
|
async logout() {
|
|
42
44
|
this.context.setToken("");
|
|
@@ -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,13 +1,12 @@
|
|
|
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);
|
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,22 +3,26 @@ 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) => {
|
|
12
|
-
|
|
12
|
+
const blockchainData = fillBlockchainSendData(data);
|
|
13
|
+
return this.blockchainService.send(blockchainData);
|
|
13
14
|
};
|
|
14
15
|
multiSend = async (data) => {
|
|
15
|
-
|
|
16
|
+
const blockchainData = fillBlockchainMultiSendData(data);
|
|
17
|
+
return this.blockchainService.multiSend(blockchainData);
|
|
16
18
|
};
|
|
17
19
|
delegate = async (data) => {
|
|
18
|
-
|
|
20
|
+
const blockchainData = fillBlockchainDelegateData(data);
|
|
21
|
+
return this.blockchainService.delegate(blockchainData);
|
|
19
22
|
};
|
|
20
23
|
undelegate = async (data) => {
|
|
21
|
-
|
|
24
|
+
const blockchainData = fillBlockchainUndelegateData(data);
|
|
25
|
+
return this.blockchainService.undelegate(blockchainData);
|
|
22
26
|
};
|
|
23
27
|
}
|
|
24
28
|
export { BlockchainProxy };
|
|
@@ -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,37 +3,46 @@ 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) => {
|
|
12
|
-
|
|
12
|
+
const forgetSecurityData = fillCheckForgetPasswordData(data);
|
|
13
|
+
return this.limitedService.checkForgetSecurityData(forgetSecurityData);
|
|
13
14
|
};
|
|
14
15
|
validateForgetPassword = async (data) => {
|
|
15
|
-
|
|
16
|
+
const forgetSecurityData = fillValidateForgetPasswordData(data);
|
|
17
|
+
return this.limitedService.validateForgetSecurityData(forgetSecurityData);
|
|
16
18
|
};
|
|
17
19
|
confirmForgetPassword = async (data) => {
|
|
18
|
-
|
|
20
|
+
const forgetSecurityData = fillConfirmForgetPasswordData(data);
|
|
21
|
+
return this.limitedService.confirmForgetSecurityData(forgetSecurityData);
|
|
19
22
|
};
|
|
20
23
|
validateEmail = async (data) => {
|
|
21
|
-
|
|
24
|
+
const validateSecurityData = fillValidateEmailData(data);
|
|
25
|
+
return this.limitedService.validateSecurityData(validateSecurityData);
|
|
22
26
|
};
|
|
23
27
|
validatePhone = async (data) => {
|
|
24
|
-
|
|
28
|
+
const validateSecurityData = fillValidatePhoneData(data);
|
|
29
|
+
return this.limitedService.validateSecurityData(validateSecurityData);
|
|
25
30
|
};
|
|
26
31
|
verifyEmail = async (data) => {
|
|
27
|
-
|
|
32
|
+
const verifySecurityData = fillVerifyEmailData(data);
|
|
33
|
+
return this.limitedService.verifySecurityData(verifySecurityData);
|
|
28
34
|
};
|
|
29
35
|
verifyPhone = async (data) => {
|
|
30
|
-
|
|
36
|
+
const verifySecurityData = fillVerifyPhoneData(data);
|
|
37
|
+
return this.limitedService.verifySecurityData(verifySecurityData);
|
|
31
38
|
};
|
|
32
39
|
confirmEmail = async (data) => {
|
|
33
|
-
|
|
40
|
+
const confirmSecurityData = fillConfirmEmailData(data);
|
|
41
|
+
return this.limitedService.confirmSecurityData(confirmSecurityData);
|
|
34
42
|
};
|
|
35
43
|
confirmPhone = async (data) => {
|
|
36
|
-
|
|
44
|
+
const confirmSecurityData = fillConfirmPhoneData(data);
|
|
45
|
+
return this.limitedService.confirmSecurityData(confirmSecurityData);
|
|
37
46
|
};
|
|
38
47
|
}
|
|
39
48
|
export { LimitedProxy };
|
|
@@ -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,13 +3,14 @@ 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) => {
|
|
12
|
-
|
|
12
|
+
const orderData = fillCreateOrderData(data);
|
|
13
|
+
return this.orderService.create(orderData);
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
16
|
export { OrderProxy };
|
|
@@ -1,11 +1,8 @@
|
|
|
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);
|
|
9
6
|
getOrganization: (id: number) => Promise<import("../..").ApiResponse<import("../..").OrganizationData>>;
|
|
10
7
|
createOrganization: (data: ICreateOrganizationData) => Promise<import("../..").ApiResponse<import("../..").OrganizationData>>;
|
|
11
8
|
uploadDocument: (data: IUploadOrganizationDocumentData) => Promise<import("../..").ApiResponse<import("../..").DocumentData>>;
|
|
@@ -2,12 +2,10 @@ 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
|
-
this.organizationService = new OrganizationService({ context, errorHandler });
|
|
6
|
+
constructor(data) {
|
|
7
|
+
super(data);
|
|
8
|
+
this.organizationService = new OrganizationService(data);
|
|
11
9
|
}
|
|
12
10
|
// #region "GET"
|
|
13
11
|
getOrganization = async (id) => {
|
|
@@ -16,15 +14,18 @@ class OrganizationProxy extends BaseProxy {
|
|
|
16
14
|
// #endregion
|
|
17
15
|
// #region "POST"
|
|
18
16
|
createOrganization = async (data) => {
|
|
19
|
-
|
|
17
|
+
const organizationData = fillCreateOrganizationData(data, this.context.getUserId());
|
|
18
|
+
return this.organizationService.create(organizationData);
|
|
20
19
|
};
|
|
21
20
|
uploadDocument = async (data) => {
|
|
22
|
-
|
|
21
|
+
const documentData = fillCreateOrganizationDocumentData(data);
|
|
22
|
+
return this.organizationService.createDocument(data.id, documentData);
|
|
23
23
|
};
|
|
24
24
|
// #endregion
|
|
25
25
|
// #region "PUT"
|
|
26
26
|
updateOrganization = async (data) => {
|
|
27
|
-
|
|
27
|
+
const organizationData = fillUpdateOrganizationData(data, this.context.getUserId());
|
|
28
|
+
return this.organizationService.update(data.id, organizationData);
|
|
28
29
|
};
|
|
29
30
|
// #endregion
|
|
30
31
|
// #region "DELETE"
|
|
@@ -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) => {
|
|
@@ -16,7 +16,8 @@ class PromotionProxy extends BaseProxy {
|
|
|
16
16
|
// #endregion
|
|
17
17
|
// #region "PUT"
|
|
18
18
|
incrementPromotionParticipants = async (data) => {
|
|
19
|
-
|
|
19
|
+
const giftRewards = data;
|
|
20
|
+
return this.promotionService.incrementPromotionParticipants(giftRewards);
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
23
|
export { PromotionProxy };
|
|
@@ -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,27 +3,32 @@ 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) => {
|
|
12
|
-
|
|
12
|
+
const transactionInquiry = fillTransactionInquiryData(params);
|
|
13
|
+
return this.transactionService.inquiry(transactionInquiry);
|
|
13
14
|
};
|
|
14
15
|
// #endregion
|
|
15
16
|
// #region "POST"
|
|
16
17
|
createSystemTransaction = async (data) => {
|
|
17
|
-
|
|
18
|
+
const transactionData = fillCreateSystemTransactionData(data);
|
|
19
|
+
return this.transactionService.create(transactionData);
|
|
18
20
|
};
|
|
19
21
|
createBlockchainTransaction = async (data) => {
|
|
20
|
-
|
|
22
|
+
const transactionData = fillCreateBlockchainTransactionData(data);
|
|
23
|
+
return this.transactionService.create(transactionData);
|
|
21
24
|
};
|
|
22
25
|
createBlockchainTransferTransaction = async (data) => {
|
|
23
|
-
|
|
26
|
+
const transactionData = fillCreateBlockchainTransferTransactionData(data);
|
|
27
|
+
return this.transactionService.create(transactionData);
|
|
24
28
|
};
|
|
25
29
|
createGatewayCryptoTransaction = async (data) => {
|
|
26
|
-
|
|
30
|
+
const transactionData = fillCreateGatewayCryptoTransactionData(data);
|
|
31
|
+
return this.transactionService.create(transactionData);
|
|
27
32
|
};
|
|
28
33
|
}
|
|
29
34
|
export { TransactionProxy };
|
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();
|
|
@@ -30,65 +30,206 @@ class UserProxy extends BaseProxy {
|
|
|
30
30
|
getDeviceHistory = async () => this.userService.getDeviceHistory();
|
|
31
31
|
// #endregion
|
|
32
32
|
// #region "POST"
|
|
33
|
-
createUser = async (data) =>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
createUser = async (data) => {
|
|
34
|
+
const userData = fillCreateUserData(data);
|
|
35
|
+
return this.userService.createUser(userData);
|
|
36
|
+
};
|
|
37
|
+
createUserWithGoogle = async (data) => {
|
|
38
|
+
const userData = await fillCreateUserWithGoogleData(data);
|
|
39
|
+
return this.userService.createUser(userData);
|
|
40
|
+
};
|
|
41
|
+
createPhone = async (data) => {
|
|
42
|
+
const userData = fillCreatePhoneData(data);
|
|
43
|
+
return this.userService.createPhone(userData);
|
|
44
|
+
};
|
|
45
|
+
createIdentification = async (data) => {
|
|
46
|
+
const userData = fillCreateIdentificationData(data);
|
|
47
|
+
return this.userService.createIdentification(userData);
|
|
48
|
+
};
|
|
37
49
|
createExternalAuth = async (data) => this.userService.createExternalAuth(data);
|
|
38
|
-
createEmail = async (data) =>
|
|
50
|
+
createEmail = async (data) => {
|
|
51
|
+
const userData = fillCreateEmailData(data);
|
|
52
|
+
return this.userService.createEmail(userData);
|
|
53
|
+
};
|
|
39
54
|
createCurrency = async (data) => this.userService.createCurrency(data);
|
|
40
55
|
createCreditCard = async (data) => this.userService.createCreditCard(data);
|
|
41
|
-
createTicket = async (data) =>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
56
|
+
createTicket = async (data) => {
|
|
57
|
+
const userData = fillCreateTicketData(data);
|
|
58
|
+
return this.userService.createTicket(userData);
|
|
59
|
+
};
|
|
60
|
+
createBankAccount = async (data) => {
|
|
61
|
+
const userData = fillCreateBankAccountData(data);
|
|
62
|
+
return this.userService.createBankAccount(userData);
|
|
63
|
+
};
|
|
64
|
+
createAddress = async (data) => {
|
|
65
|
+
const userData = fillCreateAddressData(data);
|
|
66
|
+
return this.userService.createAddress(userData);
|
|
67
|
+
};
|
|
68
|
+
createDevice = async (data) => {
|
|
69
|
+
const userData = fillCreateDeviceData(data);
|
|
70
|
+
return this.userService.createDevice(userData);
|
|
71
|
+
};
|
|
45
72
|
securityAccess = async (data) => this.userService.securityAccess(data);
|
|
46
|
-
uploadDocument = async (data) =>
|
|
47
|
-
|
|
73
|
+
uploadDocument = async (data) => {
|
|
74
|
+
const documentData = fillUploadDocumentData(data);
|
|
75
|
+
return this.userService.uploadDocument(documentData);
|
|
76
|
+
};
|
|
77
|
+
updateProfilePicture = async (data) => {
|
|
78
|
+
const documentData = fillUploadProfilePictureData(data);
|
|
79
|
+
return this.userService.uploadDocument(documentData);
|
|
80
|
+
};
|
|
48
81
|
verifySecurityData = async (data) => this.userService.verifySecurityData(data);
|
|
49
|
-
verifyEmail = async (data) =>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
82
|
+
verifyEmail = async (data) => {
|
|
83
|
+
const verifySecurityData = fillVerifyEmailData(data);
|
|
84
|
+
return this.userService.verifySecurityData(verifySecurityData);
|
|
85
|
+
};
|
|
86
|
+
sendEmailOTP = async (data) => {
|
|
87
|
+
const verifySecurityData = fillSendEmailOTPData(data);
|
|
88
|
+
return this.userService.verifySecurityData(verifySecurityData);
|
|
89
|
+
};
|
|
90
|
+
verifyPhone = async (data) => {
|
|
91
|
+
const verifySecurityData = fillVerifyPhoneData(data);
|
|
92
|
+
return this.userService.verifySecurityData(verifySecurityData);
|
|
93
|
+
};
|
|
94
|
+
sendPhoneOTP = async (data) => {
|
|
95
|
+
const verifySecurityData = fillSendPhoneOTPData(data);
|
|
96
|
+
return this.userService.verifySecurityData(verifySecurityData);
|
|
97
|
+
};
|
|
98
|
+
verifyDevice = async (data) => {
|
|
99
|
+
const verifySecurityData = fillVerifyDeviceData(data);
|
|
100
|
+
return this.userService.verifySecurityData(verifySecurityData);
|
|
101
|
+
};
|
|
54
102
|
confirmSecurityData = async (data) => this.userService.confirmSecurityData(data);
|
|
55
|
-
confirmEmail = async (data) =>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
103
|
+
confirmEmail = async (data) => {
|
|
104
|
+
const confirmSecurityData = fillConfirmEmailData(data);
|
|
105
|
+
return this.userService.confirmSecurityData(confirmSecurityData);
|
|
106
|
+
};
|
|
107
|
+
confirmPhone = async (data) => {
|
|
108
|
+
const confirmSecurityData = fillConfirmPhoneData(data);
|
|
109
|
+
return this.userService.confirmSecurityData(confirmSecurityData);
|
|
110
|
+
};
|
|
111
|
+
confirmDevice = async (data) => {
|
|
112
|
+
const confirmSecurityData = fillConfirmDeviceData(data);
|
|
113
|
+
return this.userService.confirmSecurityData(confirmSecurityData);
|
|
114
|
+
};
|
|
115
|
+
resetSecurityData = async (data) => {
|
|
116
|
+
const securityData = data;
|
|
117
|
+
return this.userService.resetSecurityData(securityData);
|
|
118
|
+
};
|
|
59
119
|
enrollGoogleAuth = async () => this.userService.enrollGoogleAuth(fillEnrollGoogleAuthData());
|
|
60
|
-
activateGoogleAuth = async (data) =>
|
|
61
|
-
|
|
62
|
-
|
|
120
|
+
activateGoogleAuth = async (data) => {
|
|
121
|
+
const userData = fillActivateGoogleAuthData(data);
|
|
122
|
+
return this.userService.activateGoogleAuth(userData);
|
|
123
|
+
};
|
|
124
|
+
deleteGoogleAuth = async (data) => {
|
|
125
|
+
const userData = fillDeleteGoogleAuthData(data);
|
|
126
|
+
return this.userService.deleteGoogleAuth(userData);
|
|
127
|
+
};
|
|
128
|
+
deactivateGoogleAuth = async (data) => {
|
|
129
|
+
const userData = fillDeactivateGoogleAuthData(data);
|
|
130
|
+
return this.userService.deactivateGoogleAuth(userData);
|
|
131
|
+
};
|
|
63
132
|
// #endregion
|
|
64
133
|
// #region "PUT"
|
|
65
134
|
updateUser = async (data) => this.userService.updateUser(data);
|
|
66
|
-
resetPassword = async (data) =>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
135
|
+
resetPassword = async (data) => {
|
|
136
|
+
const resetSecurityData = fillResetPasswordData(data);
|
|
137
|
+
return this.userService.resetSecurityData(resetSecurityData);
|
|
138
|
+
};
|
|
139
|
+
resetSecurityCode = async (data) => {
|
|
140
|
+
const resetSecurityData = fillResetSecurityCodeData(data);
|
|
141
|
+
return this.userService.resetSecurityData(resetSecurityData);
|
|
142
|
+
};
|
|
143
|
+
resetSecurityQuestions = async (data) => {
|
|
144
|
+
const resetSecurityData = fillResetSecurityQuestionsData(data);
|
|
145
|
+
return this.userService.resetSecurityData(resetSecurityData);
|
|
146
|
+
};
|
|
147
|
+
validateSecurityCode = async (data) => {
|
|
148
|
+
const validateSecurityData = fillValidateSecurityCodeData(data);
|
|
149
|
+
return this.userService.validateSecurityData(validateSecurityData);
|
|
150
|
+
};
|
|
151
|
+
updatePreferences = async (data) => {
|
|
152
|
+
const userData = fillUpdatePreferencesData(data);
|
|
153
|
+
return this.userService.updatePreferences(userData);
|
|
154
|
+
};
|
|
155
|
+
updatePhone = async (data) => {
|
|
156
|
+
const userData = fillUpdatePhoneData(data);
|
|
157
|
+
return this.userService.updatePhone(userData);
|
|
158
|
+
};
|
|
159
|
+
makePhonePrimary = async (data) => {
|
|
160
|
+
const userData = fillMakePhonePrimaryData(data);
|
|
161
|
+
return this.userService.updatePhone(userData);
|
|
162
|
+
};
|
|
163
|
+
updatePersonalInfo = async (data) => {
|
|
164
|
+
const userData = fillUpdatePersonalInfoData(data);
|
|
165
|
+
return this.userService.updatePersonalInfo(userData);
|
|
166
|
+
};
|
|
167
|
+
updateIdentification = async (data) => {
|
|
168
|
+
const userData = fillUpdateIdentificationData(data);
|
|
169
|
+
return this.userService.updateIdentification(userData);
|
|
170
|
+
};
|
|
75
171
|
updateExternalAuth = async (data) => this.userService.updateExternalAuth(data);
|
|
76
|
-
updateEmail = async (data) =>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
172
|
+
updateEmail = async (data) => {
|
|
173
|
+
const userData = fillUpdateEmailData(data);
|
|
174
|
+
return this.userService.updateEmail(userData);
|
|
175
|
+
};
|
|
176
|
+
makeEmailPrimary = async (data) => {
|
|
177
|
+
const userData = fillMakeEmailPrimaryData(data);
|
|
178
|
+
return this.userService.updateEmail(userData);
|
|
179
|
+
};
|
|
180
|
+
updateBankAccount = async (data) => {
|
|
181
|
+
const userData = fillUpdateBankAccountData(data);
|
|
182
|
+
return this.userService.updateBankAccount(userData);
|
|
183
|
+
};
|
|
184
|
+
makeBankAccountPrimary = async (data) => {
|
|
185
|
+
const userData = fillMakeBankAccountPrimaryData(data);
|
|
186
|
+
return this.userService.updateBankAccount(userData);
|
|
187
|
+
};
|
|
188
|
+
updateAddress = async (data) => {
|
|
189
|
+
const userData = fillUpdateAddressData(data);
|
|
190
|
+
return this.userService.updateAddress(userData);
|
|
191
|
+
};
|
|
192
|
+
makeAddressPrimary = async (data) => {
|
|
193
|
+
const userData = fillMakeAddressPrimaryData(data);
|
|
194
|
+
return this.userService.updateAddress(userData);
|
|
195
|
+
};
|
|
196
|
+
updateDevice = async (data) => {
|
|
197
|
+
const userData = fillUpdateDeviceData(data);
|
|
198
|
+
return this.userService.updateDevice(userData);
|
|
199
|
+
};
|
|
200
|
+
logoutDevice = async (data) => {
|
|
201
|
+
const userData = fillLogoutDeviceData(data);
|
|
202
|
+
return this.userService.logoutDevice(userData);
|
|
203
|
+
};
|
|
204
|
+
updateUserType = async (data) => {
|
|
205
|
+
const userData = fillUpdateUserTypeData(data);
|
|
206
|
+
return this.userService.updateUserType(userData);
|
|
207
|
+
};
|
|
85
208
|
// #endregion
|
|
86
209
|
// #region "DELETE"
|
|
87
|
-
deleteAddress = async (data) =>
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
210
|
+
deleteAddress = async (data) => {
|
|
211
|
+
const userData = fillDeleteAddressData(data);
|
|
212
|
+
return this.userService.deleteAddress(userData);
|
|
213
|
+
};
|
|
214
|
+
deleteBankAccount = async (data) => {
|
|
215
|
+
const userData = fillDeleteBankAccountData(data);
|
|
216
|
+
return this.userService.deleteBankAccount(userData);
|
|
217
|
+
};
|
|
218
|
+
deleteDevice = async (data) => {
|
|
219
|
+
const userData = fillDeleteDeviceData(data);
|
|
220
|
+
return this.userService.deleteDevice(userData);
|
|
221
|
+
};
|
|
222
|
+
deleteEmail = async (data) => {
|
|
223
|
+
const userData = fillDeleteEmailData(data);
|
|
224
|
+
return this.userService.deleteEmail(userData);
|
|
225
|
+
};
|
|
226
|
+
deleteIdentification = async (data) => {
|
|
227
|
+
const userData = fillDeleteIdentificationData(data);
|
|
228
|
+
return this.userService.deleteIdentification(userData);
|
|
229
|
+
};
|
|
230
|
+
deletePhone = async (data) => {
|
|
231
|
+
const userData = fillDeletePhoneData(data);
|
|
232
|
+
return this.userService.deletePhone(userData);
|
|
233
|
+
};
|
|
93
234
|
}
|
|
94
235
|
export { UserProxy };
|
|
@@ -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, ErrorHandler } from "../..";
|
|
6
7
|
declare abstract class BaseService {
|
|
7
8
|
protected abstract endpoint: string;
|
|
8
9
|
protected context: ClientContextProvider;
|
|
10
|
+
private cookiesHelper;
|
|
9
11
|
protected axiosInstance: AxiosInstance;
|
|
10
12
|
protected errorHandler: ErrorHandler;
|
|
11
13
|
constructor(data: BaseServiceParameters);
|
package/dist/api/service/base.js
CHANGED
|
@@ -4,17 +4,19 @@ 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
16
|
this.axiosInstance.interceptors.response.use((response) => this.onResponse(response), (error) => this.onError(error));
|
|
15
17
|
}
|
|
16
18
|
async onRequest(req) {
|
|
17
|
-
AxiosHelper.injectBaseHeaders(req, this.context, this.endpoint);
|
|
19
|
+
await AxiosHelper.injectBaseHeaders(req, this.context, this.cookiesHelper, this.endpoint);
|
|
18
20
|
AxiosHelper.injectBaseBodyProperties(req);
|
|
19
21
|
return req;
|
|
20
22
|
}
|
|
@@ -41,11 +41,11 @@ class AxiosHelper {
|
|
|
41
41
|
config.headers = {};
|
|
42
42
|
config.headers[key] = value;
|
|
43
43
|
};
|
|
44
|
-
static injectBaseHeaders = (req, context, endpoint) => {
|
|
44
|
+
static injectBaseHeaders = async (req, context, cookiesHelper, endpoint) => {
|
|
45
45
|
const token = context.getToken();
|
|
46
46
|
const userId = context.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)
|
package/dist/types/api/api.d.ts
CHANGED
|
@@ -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 };
|
|
@@ -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.8",
|
|
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
|