ggez-banking-sdk 0.1.178 → 0.1.179

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.
Files changed (51) hide show
  1. package/dist/api/clients/account.d.ts +4 -4
  2. package/dist/api/clients/account.js +10 -11
  3. package/dist/api/clients/auth.d.ts +4 -4
  4. package/dist/api/clients/auth.js +13 -14
  5. package/dist/api/clients/base.d.ts +8 -0
  6. package/dist/api/clients/base.js +12 -0
  7. package/dist/api/clients/blockchain.d.ts +8 -8
  8. package/dist/api/clients/blockchain.js +14 -15
  9. package/dist/api/clients/ipAddressAndLocation.d.ts +17 -7
  10. package/dist/api/clients/ipAddressAndLocation.js +26 -14
  11. package/dist/api/clients/limited.d.ts +4 -4
  12. package/dist/api/clients/limited.js +21 -22
  13. package/dist/api/clients/order.d.ts +4 -4
  14. package/dist/api/clients/order.js +7 -8
  15. package/dist/api/clients/organization.d.ts +4 -4
  16. package/dist/api/clients/organization.js +13 -14
  17. package/dist/api/clients/promotion.d.ts +4 -4
  18. package/dist/api/clients/promotion.js +11 -12
  19. package/dist/api/clients/transaction.d.ts +4 -4
  20. package/dist/api/clients/transaction.js +10 -10
  21. package/dist/api/clients/user.d.ts +4 -4
  22. package/dist/api/clients/user.js +159 -159
  23. package/dist/api/data/result.js +3 -3
  24. package/dist/api/services/account.d.ts +1 -1
  25. package/dist/api/services/account.js +7 -9
  26. package/dist/api/services/auth.d.ts +1 -1
  27. package/dist/api/services/auth.js +4 -4
  28. package/dist/api/services/base.d.ts +2 -1
  29. package/dist/api/services/base.js +15 -17
  30. package/dist/api/services/blockchain.d.ts +2 -2
  31. package/dist/api/services/blockchain.js +6 -6
  32. package/dist/api/services/ipAddressAndLocation.d.ts +1 -1
  33. package/dist/api/services/ipAddressAndLocation.js +3 -3
  34. package/dist/api/services/limited.d.ts +1 -1
  35. package/dist/api/services/limited.js +13 -13
  36. package/dist/api/services/order.d.ts +2 -2
  37. package/dist/api/services/order.js +4 -4
  38. package/dist/api/services/organization.d.ts +2 -2
  39. package/dist/api/services/organization.js +7 -7
  40. package/dist/api/services/promotion.d.ts +2 -2
  41. package/dist/api/services/promotion.js +5 -5
  42. package/dist/api/services/transaction.d.ts +2 -2
  43. package/dist/api/services/transaction.js +5 -5
  44. package/dist/api/services/user.d.ts +2 -2
  45. package/dist/api/services/user.js +66 -66
  46. package/dist/helper/api/responseHelper.d.ts +6 -4
  47. package/dist/helper/api/responseHelper.js +8 -4
  48. package/dist/tsconfig.tsbuildinfo +1 -1
  49. package/dist/types/api/service/base.d.ts +2 -1
  50. package/dist/types/api/service/index.d.ts +1 -0
  51. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
- import type { AccountClientData } from "../../types";
2
- declare class AccountClient {
3
- private readonly clientData;
1
+ import type { AccountClientData, ErrorHandler } from "../../types";
2
+ import { BaseClient } from "./base";
3
+ declare class AccountClient extends BaseClient {
4
4
  private accountService;
5
- constructor(clientData: AccountClientData);
5
+ constructor(clientData: AccountClientData, errorHandler: ErrorHandler);
6
6
  Get: (accountId: number) => Promise<{
7
7
  data: import("../../types").AccountData;
8
8
  success: boolean;
@@ -1,37 +1,36 @@
1
1
  import { AxiosHelper } from "../../helper";
2
- import { ResponseHelper } from "../../helper";
3
2
  import { FillAccountData, FillResultByError } from "../data";
4
3
  import { AccountService } from "../services";
5
- class AccountClient {
6
- clientData;
4
+ import { BaseClient } from "./base";
5
+ class AccountClient extends BaseClient {
7
6
  accountService;
8
- constructor(clientData) {
9
- this.clientData = clientData;
10
- const { token, baseUrl, lang, installationId, userId } = clientData;
7
+ constructor(clientData, errorHandler) {
8
+ super(clientData, errorHandler);
9
+ const { token, baseUrl, lang, installationId, userId } = this.clientData;
11
10
  const config = AxiosHelper.GetAxiosConfig(token, baseUrl, lang, installationId);
12
- this.accountService = new AccountService({ config, userId });
11
+ this.accountService = new AccountService({ config, userId }, errorHandler);
13
12
  }
14
13
  // #region "GET"
15
14
  Get = async (accountId) => {
16
15
  try {
17
16
  const response = await this.accountService.get(accountId);
18
- return ResponseHelper.GetResponse(response.data);
17
+ return this.responseHelper.GetResponse(response.data);
19
18
  }
20
19
  catch (error) {
21
20
  const result = FillResultByError(error);
22
21
  const accountData = FillAccountData("result", result);
23
- return ResponseHelper.GetErrorResponse(accountData, "Get");
22
+ return this.responseHelper.GetErrorResponse(accountData, "Get");
24
23
  }
25
24
  };
26
25
  GetLimits = async (accountId) => {
27
26
  try {
28
27
  const response = await this.accountService.getLimits(accountId);
29
- return ResponseHelper.GetResponse(response.data);
28
+ return this.responseHelper.GetResponse(response.data);
30
29
  }
31
30
  catch (error) {
32
31
  const result = FillResultByError(error);
33
32
  const accountData = FillAccountData("result", result);
34
- return ResponseHelper.GetErrorResponse(accountData, "GetLimits");
33
+ return this.responseHelper.GetErrorResponse(accountData, "GetLimits");
35
34
  }
36
35
  };
37
36
  }
@@ -1,9 +1,9 @@
1
- import type { AuthClientData, IGenerateLimitedTokenData, ILoginDeviceCredentialsData, ILoginGoogleCredentialsData, ILoginUserCredentialsData } from "../../types";
2
- declare class AuthClient {
3
- private readonly clientData;
1
+ import type { AuthClientData, ErrorHandler, IGenerateLimitedTokenData, ILoginDeviceCredentialsData, ILoginGoogleCredentialsData, ILoginUserCredentialsData } from "../../types";
2
+ import { BaseClient } from "./base";
3
+ declare class AuthClient extends BaseClient {
4
4
  private programId;
5
5
  private authService;
6
- constructor(clientData: AuthClientData);
6
+ constructor(clientData: AuthClientData, errorHandler: ErrorHandler);
7
7
  LoginUserCredentials: (data: ILoginUserCredentialsData) => Promise<{
8
8
  data: import("../../types").TokenData;
9
9
  success: boolean;
@@ -1,16 +1,15 @@
1
1
  import { AxiosHelper } from "../../helper";
2
- import { ResponseHelper } from "../../helper";
3
2
  import { FillGenerateLimitedTokenData, FillLoginDeviceCredentialsData, FillLoginGoogleCredentialsData, FillLoginUserCredentialsData, FillResult, FillResultByError, FillTokenData, } from "../data";
4
3
  import { AuthService } from "../services";
5
- class AuthClient {
6
- clientData;
4
+ import { BaseClient } from "./base";
5
+ class AuthClient extends BaseClient {
7
6
  programId;
8
7
  authService;
9
- constructor(clientData) {
10
- this.clientData = clientData;
8
+ constructor(clientData, errorHandler) {
9
+ super(clientData, errorHandler);
11
10
  const { baseUrl, nodeUrl, lang, programId, userId } = this.clientData;
12
11
  const config = AxiosHelper.GetAuthAxiosConfig(baseUrl, lang, "");
13
- this.authService = new AuthService({ config, nodeUrl, userId });
12
+ this.authService = new AuthService({ config, nodeUrl, userId }, this.errorHandler);
14
13
  this.programId = programId;
15
14
  }
16
15
  // #region "POST"
@@ -19,12 +18,12 @@ class AuthClient {
19
18
  const credentialsData = FillLoginUserCredentialsData(this.programId, data);
20
19
  const response = await this.authService.login(credentialsData);
21
20
  response.data.result = FillResult(response.data);
22
- return ResponseHelper.GetResponse(response.data);
21
+ return this.responseHelper.GetResponse(response.data);
23
22
  }
24
23
  catch (error) {
25
24
  const result = FillResultByError(error);
26
25
  const tokenData = FillTokenData("result", result);
27
- return ResponseHelper.GetErrorResponse(tokenData, "LoginUserCredentials");
26
+ return this.responseHelper.GetErrorResponse(tokenData, "LoginUserCredentials");
28
27
  }
29
28
  };
30
29
  LoginDeviceCredentials = async (data) => {
@@ -32,12 +31,12 @@ class AuthClient {
32
31
  const credentialsData = FillLoginDeviceCredentialsData(this.programId, data);
33
32
  const response = await this.authService.login(credentialsData);
34
33
  response.data.result = FillResult(response.data);
35
- return ResponseHelper.GetResponse(response.data);
34
+ return this.responseHelper.GetResponse(response.data);
36
35
  }
37
36
  catch (error) {
38
37
  const result = FillResultByError(error);
39
38
  const tokenData = FillTokenData("result", result);
40
- return ResponseHelper.GetErrorResponse(tokenData, "LoginDeviceCredentials");
39
+ return this.responseHelper.GetErrorResponse(tokenData, "LoginDeviceCredentials");
41
40
  }
42
41
  };
43
42
  LoginGoogleCredentials = async (data) => {
@@ -45,12 +44,12 @@ class AuthClient {
45
44
  const credentialsData = FillLoginGoogleCredentialsData(this.programId, data);
46
45
  const response = await this.authService.login(credentialsData);
47
46
  response.data.result = FillResult(response.data);
48
- return ResponseHelper.GetResponse(response.data);
47
+ return this.responseHelper.GetResponse(response.data);
49
48
  }
50
49
  catch (error) {
51
50
  const result = FillResultByError(error);
52
51
  const tokenData = FillTokenData("result", result);
53
- return ResponseHelper.GetErrorResponse(tokenData, "LoginGoogleCredentials");
52
+ return this.responseHelper.GetErrorResponse(tokenData, "LoginGoogleCredentials");
54
53
  }
55
54
  };
56
55
  GenerateLimitedToken = async (data) => {
@@ -58,12 +57,12 @@ class AuthClient {
58
57
  const tokenData = FillGenerateLimitedTokenData(data);
59
58
  const response = await this.authService.generateLimitedToken(tokenData);
60
59
  response.data.result = FillResult(response.data);
61
- return ResponseHelper.GetResponse(response.data);
60
+ return this.responseHelper.GetResponse(response.data);
62
61
  }
63
62
  catch (error) {
64
63
  const result = FillResultByError(error);
65
64
  const tokenData = FillTokenData("result", result);
66
- return ResponseHelper.GetErrorResponse(tokenData, "GenerateLimitedToken");
65
+ return this.responseHelper.GetErrorResponse(tokenData, "GenerateLimitedToken");
67
66
  }
68
67
  };
69
68
  }
@@ -0,0 +1,8 @@
1
+ import { ErrorHandler, ResponseHelper } from "../..";
2
+ declare abstract class BaseClient {
3
+ protected clientData: any;
4
+ protected errorHandler: (error: any) => void;
5
+ protected responseHelper: ResponseHelper;
6
+ constructor(clientData: any, errorHandler: ErrorHandler);
7
+ }
8
+ export { BaseClient };
@@ -0,0 +1,12 @@
1
+ import { ResponseHelper } from "../..";
2
+ class BaseClient {
3
+ clientData;
4
+ errorHandler;
5
+ responseHelper;
6
+ constructor(clientData, errorHandler) {
7
+ this.clientData = clientData;
8
+ this.errorHandler = errorHandler;
9
+ this.responseHelper = new ResponseHelper(errorHandler);
10
+ }
11
+ }
12
+ export { BaseClient };
@@ -1,28 +1,28 @@
1
- import type { BlockchainClientData, IBlockchainDelegateRequestData, IBlockchainMultiSendRequestData, IBlockchainSendRequestData, IBlockchainUndelegateRequestData } from "../../types/api";
2
- declare class BlockchainClient {
3
- private readonly clientData;
1
+ import type { BlockchainClientData, ErrorHandler, IBlockchainDelegateRequestData, IBlockchainMultiSendRequestData, IBlockchainSendRequestData, IBlockchainUndelegateRequestData } from "../../types";
2
+ import { BaseClient } from "./base";
3
+ declare class BlockchainClient extends BaseClient {
4
4
  private blockchainService;
5
- constructor(clientData: BlockchainClientData);
5
+ constructor(clientData: BlockchainClientData, errorHandler: ErrorHandler);
6
6
  Send: (data: IBlockchainSendRequestData) => Promise<{
7
- data: import("../..").BlockchainData;
7
+ data: import("../../types").BlockchainData;
8
8
  success: boolean;
9
9
  message: string;
10
10
  error: any;
11
11
  }>;
12
12
  MultiSend: (data: IBlockchainMultiSendRequestData) => Promise<{
13
- data: import("../..").BlockchainData;
13
+ data: import("../../types").BlockchainData;
14
14
  success: boolean;
15
15
  message: string;
16
16
  error: any;
17
17
  }>;
18
18
  Delegate: (data: IBlockchainDelegateRequestData) => Promise<{
19
- data: import("../..").BlockchainData;
19
+ data: import("../../types").BlockchainData;
20
20
  success: boolean;
21
21
  message: string;
22
22
  error: any;
23
23
  }>;
24
24
  Undelegate: (data: IBlockchainUndelegateRequestData) => Promise<{
25
- data: import("../..").BlockchainData;
25
+ data: import("../../types").BlockchainData;
26
26
  success: boolean;
27
27
  message: string;
28
28
  error: any;
@@ -1,63 +1,62 @@
1
1
  import { AxiosHelper } from "../../helper";
2
- import { ResponseHelper } from "../../helper";
3
2
  import { FillBlockchainData, FillBlockchainDelegateData, FillBlockchainMultiSendData, FillBlockchainSendData, FillBlockchainUndelegateData, FillResultByError, } from "../data";
4
- import { BlockchainService } from "../services/blockchain";
5
- class BlockchainClient {
6
- clientData;
3
+ import { BlockchainService } from "../services";
4
+ import { BaseClient } from "./base";
5
+ class BlockchainClient extends BaseClient {
7
6
  blockchainService;
8
- constructor(clientData) {
9
- this.clientData = clientData;
7
+ constructor(clientData, errorHandler) {
8
+ super(clientData, errorHandler);
10
9
  const { token, baseUrl, lang, installationId, userId } = clientData;
11
10
  const config = AxiosHelper.GetAxiosConfig(token, baseUrl, lang, installationId);
12
- this.blockchainService = new BlockchainService({ config, userId });
11
+ this.blockchainService = new BlockchainService({ config, userId }, this.errorHandler);
13
12
  }
14
13
  // #region "POST"
15
14
  Send = async (data) => {
16
15
  try {
17
16
  const blockchainSendData = FillBlockchainSendData(data);
18
17
  const response = await this.blockchainService.send(blockchainSendData);
19
- return ResponseHelper.GetResponse(response.data);
18
+ return this.responseHelper.GetResponse(response.data);
20
19
  }
21
20
  catch (error) {
22
21
  const result = FillResultByError(error);
23
22
  const blockchainData = FillBlockchainData("result", result);
24
- return ResponseHelper.GetErrorResponse(blockchainData, "Send");
23
+ return this.responseHelper.GetErrorResponse(blockchainData, "Send");
25
24
  }
26
25
  };
27
26
  MultiSend = async (data) => {
28
27
  try {
29
28
  const blockchainMultiSendData = FillBlockchainMultiSendData(data);
30
29
  const response = await this.blockchainService.multiSend(blockchainMultiSendData);
31
- return ResponseHelper.GetResponse(response.data);
30
+ return this.responseHelper.GetResponse(response.data);
32
31
  }
33
32
  catch (error) {
34
33
  const result = FillResultByError(error);
35
34
  const blockchainData = FillBlockchainData("result", result);
36
- return ResponseHelper.GetErrorResponse(blockchainData, "MultiSend");
35
+ return this.responseHelper.GetErrorResponse(blockchainData, "MultiSend");
37
36
  }
38
37
  };
39
38
  Delegate = async (data) => {
40
39
  try {
41
40
  const blockchainDelegateData = FillBlockchainDelegateData(data);
42
41
  const response = await this.blockchainService.delegate(blockchainDelegateData);
43
- return ResponseHelper.GetResponse(response.data);
42
+ return this.responseHelper.GetResponse(response.data);
44
43
  }
45
44
  catch (error) {
46
45
  const result = FillResultByError(error);
47
46
  const blockchainData = FillBlockchainData("result", result);
48
- return ResponseHelper.GetErrorResponse(blockchainData, "Delegate");
47
+ return this.responseHelper.GetErrorResponse(blockchainData, "Delegate");
49
48
  }
50
49
  };
51
50
  Undelegate = async (data) => {
52
51
  try {
53
52
  const blockchainUndelegateData = FillBlockchainUndelegateData(data);
54
53
  const response = await this.blockchainService.undelegate(blockchainUndelegateData);
55
- return ResponseHelper.GetResponse(response.data);
54
+ return this.responseHelper.GetResponse(response.data);
56
55
  }
57
56
  catch (error) {
58
57
  const result = FillResultByError(error);
59
58
  const blockchainData = FillBlockchainData("result", result);
60
- return ResponseHelper.GetErrorResponse(blockchainData, "Undelegate");
59
+ return this.responseHelper.GetErrorResponse(blockchainData, "Undelegate");
61
60
  }
62
61
  };
63
62
  }
@@ -1,13 +1,23 @@
1
- import { IPAddressAndLocationClientData } from "../../types";
2
- declare class IPAddressAndLocationClient {
3
- private readonly clientData;
1
+ import { ErrorHandler, IPAddressAndLocationClientData } from "../../types";
2
+ import { BaseClient } from "./base";
3
+ declare class IPAddressAndLocationClient extends BaseClient {
4
4
  private ipAddressAndLocationService;
5
- constructor(clientData: IPAddressAndLocationClientData);
6
- GetGeoCoordinates: () => Promise<import("../../types").GeoCoordinates>;
7
- GetIPAddress: () => Promise<string>;
5
+ constructor(clientData: IPAddressAndLocationClientData, errorHandler: ErrorHandler);
6
+ GetGeoCoordinates: () => Promise<import("../../types").GeoCoordinates> | {
7
+ latitude: number;
8
+ longitude: number;
9
+ position_description: string;
10
+ };
11
+ GetIPAddress: () => Promise<string> | "";
8
12
  GetGeoCoordinatesAndIPAddress: () => Promise<{
9
13
  geo_coordinates: import("../../types").GeoCoordinates;
10
14
  ip_address: string;
11
- }>;
15
+ }> | {
16
+ geo_coordinates: {
17
+ latitude: number;
18
+ longitude: number;
19
+ };
20
+ ip_address: string;
21
+ };
12
22
  }
13
23
  export { IPAddressAndLocationClient };
@@ -1,29 +1,41 @@
1
1
  import { IPAddressAndLocationService } from "../services";
2
2
  import { AxiosHelper, GeoHelper } from "../../helper";
3
- class IPAddressAndLocationClient {
4
- clientData;
3
+ import { BaseClient } from "./base";
4
+ class IPAddressAndLocationClient extends BaseClient {
5
5
  ipAddressAndLocationService;
6
- constructor(clientData) {
7
- this.clientData = clientData;
6
+ constructor(clientData, errorHandler) {
7
+ super(clientData, errorHandler);
8
8
  const { token, baseUrl, lang, installationId, userId } = clientData;
9
9
  const config = AxiosHelper.GetAxiosConfig(token, baseUrl, lang, installationId);
10
10
  this.ipAddressAndLocationService = new IPAddressAndLocationService({
11
11
  config,
12
12
  userId,
13
- });
13
+ }, this.errorHandler);
14
14
  }
15
15
  // #region "GET"
16
- GetGeoCoordinates = async () => {
17
- const data = await GeoHelper.GetGeoCoordinates(this.ipAddressAndLocationService);
18
- return data;
16
+ GetGeoCoordinates = () => {
17
+ try {
18
+ return GeoHelper.GetGeoCoordinates(this.ipAddressAndLocationService);
19
+ }
20
+ catch (error) {
21
+ return { latitude: 0, longitude: 0, position_description: "N/A, N/A" };
22
+ }
19
23
  };
20
- GetIPAddress = async () => {
21
- const data = await GeoHelper.GetIPAddress(this.ipAddressAndLocationService);
22
- return data;
24
+ GetIPAddress = () => {
25
+ try {
26
+ return GeoHelper.GetIPAddress(this.ipAddressAndLocationService);
27
+ }
28
+ catch (error) {
29
+ return "";
30
+ }
23
31
  };
24
- GetGeoCoordinatesAndIPAddress = async () => {
25
- const data = await GeoHelper.GetGeoCoordinatesAndIPAddress(this.ipAddressAndLocationService);
26
- return data;
32
+ GetGeoCoordinatesAndIPAddress = () => {
33
+ try {
34
+ return GeoHelper.GetGeoCoordinatesAndIPAddress(this.ipAddressAndLocationService);
35
+ }
36
+ catch (error) {
37
+ return { geo_coordinates: { latitude: 0, longitude: 0 }, ip_address: "" };
38
+ }
27
39
  };
28
40
  }
29
41
  export { IPAddressAndLocationClient };
@@ -1,8 +1,8 @@
1
- import type { IConfirmEmailData, IConfirmPhoneData, IValidateEmailData, IValidatePhoneData, IVerifyEmailData, IVerifyPhoneData, LimitedClientData, IValidateForgetPasswordData, IConfirmForgetPasswordData } from "../../types";
2
- declare class LimitedClient {
3
- private readonly clientData;
1
+ import type { IConfirmEmailData, IConfirmPhoneData, IValidateEmailData, IValidatePhoneData, IVerifyEmailData, IVerifyPhoneData, LimitedClientData, IValidateForgetPasswordData, IConfirmForgetPasswordData, ErrorHandler } from "../../types";
2
+ import { BaseClient } from "./base";
3
+ declare class LimitedClient extends BaseClient {
4
4
  private limitedService;
5
- constructor(clientData: LimitedClientData);
5
+ constructor(clientData: LimitedClientData, errorHandler: ErrorHandler);
6
6
  ValidateForgetPassword: (data: IValidateForgetPasswordData) => Promise<{
7
7
  data: import("../../types").ForgetSecurityData;
8
8
  success: boolean;
@@ -1,115 +1,114 @@
1
1
  import { AxiosHelper } from "../../helper";
2
- import { ResponseHelper } from "../../helper";
3
2
  import { FillConfirmEmailData, FillConfirmForgetPasswordData, FillConfirmPhoneData, FillConfirmUserSecurityData, FillForgetSecurityData, FillResultByError, FillValidateEmailData, FillValidateForgetPasswordData, FillValidateLimitedSecurityData, FillValidatePhoneData, FillVerifyEmailData, FillVerifyPhoneData, FillVerifyUserSecurityData, } from "../data";
4
3
  import { LimitedService } from "../services";
5
- class LimitedClient {
6
- clientData;
4
+ import { BaseClient } from "./base";
5
+ class LimitedClient extends BaseClient {
7
6
  limitedService;
8
- constructor(clientData) {
9
- this.clientData = clientData;
7
+ constructor(clientData, errorHandler) {
8
+ super(clientData, errorHandler);
10
9
  const { token, baseUrl, nodeUrl, lang, userId } = this.clientData;
11
10
  const config = AxiosHelper.GetAxiosConfig(token, baseUrl, lang);
12
11
  this.limitedService = new LimitedService({
13
12
  config,
14
13
  nodeUrl,
15
14
  userId,
16
- });
15
+ }, this.errorHandler);
17
16
  }
18
17
  // #region "POST"
19
18
  ValidateForgetPassword = async (data) => {
20
19
  try {
21
20
  const forgetSecurityData = FillValidateForgetPasswordData(data);
22
21
  const response = await this.limitedService.validateForgetSecurityData(forgetSecurityData);
23
- return ResponseHelper.GetResponse(response.data);
22
+ return this.responseHelper.GetResponse(response.data);
24
23
  }
25
24
  catch (error) {
26
25
  const result = FillResultByError(error);
27
26
  const forgetSecurityData = FillForgetSecurityData("result", result);
28
- return ResponseHelper.GetErrorResponse(forgetSecurityData, "ValidateForgetPassword");
27
+ return this.responseHelper.GetErrorResponse(forgetSecurityData, "ValidateForgetPassword");
29
28
  }
30
29
  };
31
30
  ConfirmForgetPassword = async (data) => {
32
31
  try {
33
32
  const forgetSecurityData = FillConfirmForgetPasswordData(data);
34
33
  const response = await this.limitedService.confirmForgetSecurityData(forgetSecurityData);
35
- return ResponseHelper.GetResponse(response.data);
34
+ return this.responseHelper.GetResponse(response.data);
36
35
  }
37
36
  catch (error) {
38
37
  const result = FillResultByError(error);
39
38
  const forgetSecurityData = FillForgetSecurityData("result", result);
40
- return ResponseHelper.GetErrorResponse(forgetSecurityData, "ConfirmForgetPassword");
39
+ return this.responseHelper.GetErrorResponse(forgetSecurityData, "ConfirmForgetPassword");
41
40
  }
42
41
  };
43
42
  ValidateEmail = async (data) => {
44
43
  try {
45
44
  const validateLimitedSecurity = FillValidateEmailData(data);
46
45
  const response = await this.limitedService.validateSecurityData(validateLimitedSecurity);
47
- return ResponseHelper.GetResponse(response.data);
46
+ return this.responseHelper.GetResponse(response.data);
48
47
  }
49
48
  catch (error) {
50
49
  const result = FillResultByError(error);
51
50
  const forgetSecurityData = FillValidateLimitedSecurityData("result", result);
52
- return ResponseHelper.GetErrorResponse(forgetSecurityData, "ConfirmForgetPassword");
51
+ return this.responseHelper.GetErrorResponse(forgetSecurityData, "ConfirmForgetPassword");
53
52
  }
54
53
  };
55
54
  ValidatePhone = async (data) => {
56
55
  try {
57
56
  const validateLimitedSecurity = FillValidatePhoneData(data);
58
57
  const response = await this.limitedService.validateSecurityData(validateLimitedSecurity);
59
- return ResponseHelper.GetResponse(response.data);
58
+ return this.responseHelper.GetResponse(response.data);
60
59
  }
61
60
  catch (error) {
62
61
  const result = FillResultByError(error);
63
62
  const forgetSecurityData = FillValidateLimitedSecurityData("result", result);
64
- return ResponseHelper.GetErrorResponse(forgetSecurityData, "ValidatePhone");
63
+ return this.responseHelper.GetErrorResponse(forgetSecurityData, "ValidatePhone");
65
64
  }
66
65
  };
67
66
  VerifyEmail = async (data) => {
68
67
  try {
69
68
  const verifyUserSecurity = FillVerifyEmailData(data);
70
69
  const response = await this.limitedService.verifySecurityData(verifyUserSecurity);
71
- return ResponseHelper.GetResponse(response.data);
70
+ return this.responseHelper.GetResponse(response.data);
72
71
  }
73
72
  catch (error) {
74
73
  const result = FillResultByError(error);
75
74
  const verifySecurityData = FillVerifyUserSecurityData("result", result);
76
- return ResponseHelper.GetErrorResponse(verifySecurityData, "VerifyEmail");
75
+ return this.responseHelper.GetErrorResponse(verifySecurityData, "VerifyEmail");
77
76
  }
78
77
  };
79
78
  VerifyPhone = async (data) => {
80
79
  try {
81
80
  const verifyUserSecurity = FillVerifyPhoneData(data);
82
81
  const response = await this.limitedService.verifySecurityData(verifyUserSecurity);
83
- return ResponseHelper.GetResponse(response.data);
82
+ return this.responseHelper.GetResponse(response.data);
84
83
  }
85
84
  catch (error) {
86
85
  const result = FillResultByError(error);
87
86
  const verifySecurityData = FillVerifyUserSecurityData("result", result);
88
- return ResponseHelper.GetErrorResponse(verifySecurityData, "VerifyPhone");
87
+ return this.responseHelper.GetErrorResponse(verifySecurityData, "VerifyPhone");
89
88
  }
90
89
  };
91
90
  ConfirmEmail = async (data) => {
92
91
  try {
93
92
  const confirmUserSecurity = FillConfirmEmailData(data);
94
93
  const response = await this.limitedService.confirmSecurityData(confirmUserSecurity);
95
- return ResponseHelper.GetResponse(response.data);
94
+ return this.responseHelper.GetResponse(response.data);
96
95
  }
97
96
  catch (error) {
98
97
  const result = FillResultByError(error);
99
98
  const confirmUserSecurity = FillConfirmUserSecurityData("result", result);
100
- return ResponseHelper.GetErrorResponse(confirmUserSecurity, "ConfirmEmail");
99
+ return this.responseHelper.GetErrorResponse(confirmUserSecurity, "ConfirmEmail");
101
100
  }
102
101
  };
103
102
  ConfirmPhone = async (data) => {
104
103
  try {
105
104
  const confirmUserSecurity = FillConfirmPhoneData(data);
106
105
  const response = await this.limitedService.confirmSecurityData(confirmUserSecurity);
107
- return ResponseHelper.GetResponse(response.data);
106
+ return this.responseHelper.GetResponse(response.data);
108
107
  }
109
108
  catch (error) {
110
109
  const result = FillResultByError(error);
111
110
  const confirmUserSecurity = FillConfirmUserSecurityData("result", result);
112
- return ResponseHelper.GetErrorResponse(confirmUserSecurity, "ConfirmPhone");
111
+ return this.responseHelper.GetErrorResponse(confirmUserSecurity, "ConfirmPhone");
113
112
  }
114
113
  };
115
114
  }
@@ -1,8 +1,8 @@
1
- import { ICreateOrderData, OrderClientData } from "../../types";
2
- declare class OrderClient {
3
- private readonly clientData;
1
+ import { ErrorHandler, ICreateOrderData, OrderClientData } from "../../types";
2
+ import { BaseClient } from "./base";
3
+ declare class OrderClient extends BaseClient {
4
4
  private orderService;
5
- constructor(clientData: OrderClientData);
5
+ constructor(clientData: OrderClientData, errorHandler: ErrorHandler);
6
6
  CreateOrder: (data: ICreateOrderData) => Promise<{
7
7
  data: import("../../types").OrderData;
8
8
  success: boolean;
@@ -1,27 +1,26 @@
1
1
  import { AxiosHelper } from "../../helper";
2
- import { ResponseHelper } from "../../helper";
3
2
  import { FillCreateOrderData, FillOrderData, FillResultByError } from "../data";
4
3
  import { OrderService } from "../services";
5
- class OrderClient {
6
- clientData;
4
+ import { BaseClient } from "./base";
5
+ class OrderClient extends BaseClient {
7
6
  orderService;
8
- constructor(clientData) {
9
- this.clientData = clientData;
7
+ constructor(clientData, errorHandler) {
8
+ super(clientData, errorHandler);
10
9
  const { token, baseUrl, lang, installationId, userId } = clientData;
11
10
  const config = AxiosHelper.GetAxiosConfig(token, baseUrl, lang, installationId);
12
- this.orderService = new OrderService({ config, userId });
11
+ this.orderService = new OrderService({ config, userId }, this.errorHandler);
13
12
  }
14
13
  // #region "POST"
15
14
  CreateOrder = async (data) => {
16
15
  try {
17
16
  const createOrderData = FillCreateOrderData(data);
18
17
  const response = await this.orderService.create(createOrderData);
19
- return ResponseHelper.GetResponse(response.data);
18
+ return this.responseHelper.GetResponse(response.data);
20
19
  }
21
20
  catch (error) {
22
21
  const result = FillResultByError(error);
23
22
  const orderData = FillOrderData("result", result);
24
- return ResponseHelper.GetErrorResponse(orderData, "CreateOrder");
23
+ return this.responseHelper.GetErrorResponse(orderData, "CreateOrder");
25
24
  }
26
25
  };
27
26
  }
@@ -1,10 +1,10 @@
1
- import type { OrganizationClientData } from "../../types";
1
+ import type { ErrorHandler, OrganizationClientData } from "../../types";
2
2
  import type { ICreateOrganizationData, IUpdateOrganizationData, IUploadOrganizationDocumentData } from "../../types";
3
- declare class OrganizationClient {
4
- private readonly clientData;
3
+ import { BaseClient } from "./base";
4
+ declare class OrganizationClient extends BaseClient {
5
5
  private organizationService;
6
6
  private userId;
7
- constructor(clientData: OrganizationClientData);
7
+ constructor(clientData: OrganizationClientData, errorHandler: ErrorHandler);
8
8
  CreateOrganization: (data: ICreateOrganizationData) => Promise<{
9
9
  data: import("../../types").OrganizationData;
10
10
  success: boolean;