ggez-banking-sdk 0.3.25 → 0.3.26
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/clients/account.js +10 -10
- package/dist/api/clients/auth.js +26 -26
- package/dist/api/clients/blockchain.js +22 -22
- package/dist/api/clients/ipAddressAndLocation.js +4 -4
- package/dist/api/clients/limited.js +47 -47
- package/dist/api/clients/order.js +7 -7
- package/dist/api/clients/organization.js +26 -26
- package/dist/api/clients/program.js +15 -15
- package/dist/api/clients/promotion.js +3 -3
- package/dist/api/clients/transaction.js +22 -22
- package/dist/api/clients/user.js +356 -356
- package/dist/api/data/account.d.ts +2 -2
- package/dist/api/data/account.js +2 -2
- package/dist/api/data/auth.d.ts +6 -6
- package/dist/api/data/auth.js +9 -9
- package/dist/api/data/blockchain.d.ts +6 -6
- package/dist/api/data/blockchain.js +6 -6
- package/dist/api/data/limited.d.ts +4 -4
- package/dist/api/data/limited.js +4 -4
- package/dist/api/data/order.d.ts +3 -3
- package/dist/api/data/order.js +3 -3
- package/dist/api/data/organization.d.ts +5 -5
- package/dist/api/data/organization.js +9 -9
- package/dist/api/data/program.d.ts +2 -2
- package/dist/api/data/program.js +2 -2
- package/dist/api/data/result.d.ts +5 -5
- package/dist/api/data/result.js +6 -6
- package/dist/api/data/transaction.d.ts +7 -7
- package/dist/api/data/transaction.js +9 -9
- package/dist/api/data/user/address.d.ts +5 -5
- package/dist/api/data/user/address.js +10 -10
- package/dist/api/data/user/auth.d.ts +5 -5
- package/dist/api/data/user/auth.js +10 -10
- package/dist/api/data/user/bankAccount.d.ts +5 -5
- package/dist/api/data/user/bankAccount.js +10 -10
- package/dist/api/data/user/confirmUserSecurity.d.ts +2 -2
- package/dist/api/data/user/confirmUserSecurity.js +2 -2
- package/dist/api/data/user/device.d.ts +7 -7
- package/dist/api/data/user/device.js +12 -12
- package/dist/api/data/user/document.d.ts +4 -4
- package/dist/api/data/user/document.js +4 -4
- package/dist/api/data/user/email.d.ts +9 -9
- package/dist/api/data/user/email.js +14 -14
- package/dist/api/data/user/forgetSecurityData.d.ts +2 -2
- package/dist/api/data/user/forgetSecurityData.js +2 -2
- package/dist/api/data/user/identification.d.ts +4 -4
- package/dist/api/data/user/identification.js +8 -8
- package/dist/api/data/user/personalInfo.d.ts +2 -2
- package/dist/api/data/user/personalInfo.js +4 -4
- package/dist/api/data/user/phone.d.ts +9 -9
- package/dist/api/data/user/phone.js +14 -14
- package/dist/api/data/user/preferences.d.ts +2 -2
- package/dist/api/data/user/preferences.js +4 -4
- package/dist/api/data/user/resetUserSecurity.d.ts +2 -2
- package/dist/api/data/user/resetUserSecurity.js +2 -2
- package/dist/api/data/user/security.d.ts +5 -5
- package/dist/api/data/user/security.js +5 -5
- package/dist/api/data/user/ticket.d.ts +2 -2
- package/dist/api/data/user/ticket.js +4 -4
- package/dist/api/data/user/type.d.ts +2 -2
- package/dist/api/data/user/type.js +4 -4
- package/dist/api/data/user/user.d.ts +4 -4
- package/dist/api/data/user/user.js +8 -8
- package/dist/api/data/user/userDefaults.d.ts +2 -2
- package/dist/api/data/user/userDefaults.js +2 -2
- package/dist/api/data/user/validateLimitedSecurity.d.ts +2 -2
- package/dist/api/data/user/validateLimitedSecurity.js +2 -2
- package/dist/api/data/user/validateSecurityData.d.ts +2 -2
- package/dist/api/data/user/validateSecurityData.js +2 -2
- package/dist/api/data/user/verifyUserSecurity.d.ts +2 -2
- package/dist/api/data/user/verifyUserSecurity.js +2 -2
- package/dist/api/services/account.js +2 -2
- package/dist/api/services/base.js +3 -3
- package/dist/api/services/limited.js +1 -1
- package/dist/api/services/order.js +2 -2
- package/dist/api/services/organization.js +2 -2
- package/dist/api/services/transaction.js +2 -2
- package/dist/api/services/user.js +2 -2
- package/dist/helper/api/axiosHelper.d.ts +7 -7
- package/dist/helper/api/axiosHelper.js +12 -12
- package/dist/helper/api/responseHelper.d.ts +2 -2
- package/dist/helper/api/responseHelper.js +3 -3
- package/dist/helper/api/resultHelper.d.ts +2 -2
- package/dist/helper/api/resultHelper.js +2 -2
- package/dist/helper/cipherHelper.d.ts +11 -11
- package/dist/helper/cipherHelper.js +17 -17
- package/dist/helper/dateTimeHelper.d.ts +4 -4
- package/dist/helper/dateTimeHelper.js +4 -4
- package/dist/helper/deviceHelper.d.ts +2 -2
- package/dist/helper/deviceHelper.js +6 -6
- package/dist/helper/geoHelper.d.ts +3 -3
- package/dist/helper/geoHelper.js +3 -3
- package/dist/helper/storage/cookiesHelper.d.ts +21 -21
- package/dist/helper/storage/cookiesHelper.js +94 -94
- package/dist/helper/storage/localStorageHelper.d.ts +6 -6
- package/dist/helper/storage/localStorageHelper.js +14 -14
- package/dist/helper/storage/storageHelper.d.ts +2 -2
- package/dist/helper/storage/storageHelper.js +2 -2
- package/dist/helper/userHelper.d.ts +13 -13
- package/dist/helper/userHelper.js +35 -35
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosHelper } from "../../helper/api/axiosHelper";
|
|
2
|
-
import {
|
|
2
|
+
import { createDefaultAccountData, fillResultByError } from "../data";
|
|
3
3
|
import { AccountService } from "../services";
|
|
4
4
|
import { BaseClient } from "./base";
|
|
5
5
|
class AccountClient extends BaseClient {
|
|
@@ -7,30 +7,30 @@ class AccountClient extends BaseClient {
|
|
|
7
7
|
constructor(clientData, errorHandler) {
|
|
8
8
|
super(clientData, errorHandler);
|
|
9
9
|
const { token, baseUrl, lang, installationId, userId } = this.clientData;
|
|
10
|
-
const config = AxiosHelper.
|
|
10
|
+
const config = AxiosHelper.getAxiosConfig(token, baseUrl, lang, installationId);
|
|
11
11
|
this.accountService = new AccountService({ config, userId });
|
|
12
12
|
}
|
|
13
13
|
// #region "GET"
|
|
14
14
|
get = async (accountId, options) => {
|
|
15
15
|
try {
|
|
16
16
|
const response = await this.accountService.get(accountId, options);
|
|
17
|
-
return this.responseHelper.
|
|
17
|
+
return this.responseHelper.getResponse(response.data);
|
|
18
18
|
}
|
|
19
19
|
catch (error) {
|
|
20
|
-
const result =
|
|
21
|
-
const accountData =
|
|
22
|
-
return this.responseHelper.
|
|
20
|
+
const result = fillResultByError(error);
|
|
21
|
+
const accountData = createDefaultAccountData({ result });
|
|
22
|
+
return this.responseHelper.getErrorResponse(accountData, "get");
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
getLimits = async (accountId, options) => {
|
|
26
26
|
try {
|
|
27
27
|
const response = await this.accountService.getLimits(accountId, options);
|
|
28
|
-
return this.responseHelper.
|
|
28
|
+
return this.responseHelper.getResponse(response.data);
|
|
29
29
|
}
|
|
30
30
|
catch (error) {
|
|
31
|
-
const result =
|
|
32
|
-
const accountData =
|
|
33
|
-
return this.responseHelper.
|
|
31
|
+
const result = fillResultByError(error);
|
|
32
|
+
const accountData = createDefaultAccountData({ result });
|
|
33
|
+
return this.responseHelper.getErrorResponse(accountData, "getLimits");
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
}
|
package/dist/api/clients/auth.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosHelper } from "../../helper/api/axiosHelper";
|
|
2
|
-
import {
|
|
2
|
+
import { fillGenerateLimitedTokenData, fillLoginDeviceCredentialsData, fillLoginGoogleCredentialsData, fillLoginUserCredentialsData, fillResult, fillResultByError, createDefaultTokenData, } from "../data";
|
|
3
3
|
import { AuthService } from "../services";
|
|
4
4
|
import { BaseClient } from "./base";
|
|
5
5
|
class AuthClient extends BaseClient {
|
|
@@ -8,61 +8,61 @@ class AuthClient extends BaseClient {
|
|
|
8
8
|
constructor(clientData, errorHandler) {
|
|
9
9
|
super(clientData, errorHandler);
|
|
10
10
|
const { baseUrl, nodeUrl, lang, programId, userId } = this.clientData;
|
|
11
|
-
const config = AxiosHelper.
|
|
11
|
+
const config = AxiosHelper.getAuthAxiosConfig(baseUrl, lang, "");
|
|
12
12
|
this.authService = new AuthService({ config, nodeUrl, userId });
|
|
13
13
|
this.programId = programId;
|
|
14
14
|
}
|
|
15
15
|
// #region "POST"
|
|
16
16
|
loginUserCredentials = async (data, options) => {
|
|
17
17
|
try {
|
|
18
|
-
const credentialsData =
|
|
18
|
+
const credentialsData = fillLoginUserCredentialsData(this.programId, data);
|
|
19
19
|
const response = await this.authService.login(credentialsData, options);
|
|
20
|
-
response.data.result =
|
|
21
|
-
return this.responseHelper.
|
|
20
|
+
response.data.result = fillResult(response.data);
|
|
21
|
+
return this.responseHelper.getResponse(response.data);
|
|
22
22
|
}
|
|
23
23
|
catch (error) {
|
|
24
|
-
const result =
|
|
25
|
-
const tokenData =
|
|
26
|
-
return this.responseHelper.
|
|
24
|
+
const result = fillResultByError(error);
|
|
25
|
+
const tokenData = createDefaultTokenData({ result });
|
|
26
|
+
return this.responseHelper.getErrorResponse(tokenData, "loginUserCredentials");
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
loginDeviceCredentials = async (data, options) => {
|
|
30
30
|
try {
|
|
31
|
-
const credentialsData =
|
|
31
|
+
const credentialsData = fillLoginDeviceCredentialsData(this.programId, data);
|
|
32
32
|
const response = await this.authService.login(credentialsData, options);
|
|
33
|
-
response.data.result =
|
|
34
|
-
return this.responseHelper.
|
|
33
|
+
response.data.result = fillResult(response.data);
|
|
34
|
+
return this.responseHelper.getResponse(response.data);
|
|
35
35
|
}
|
|
36
36
|
catch (error) {
|
|
37
|
-
const result =
|
|
38
|
-
const tokenData =
|
|
39
|
-
return this.responseHelper.
|
|
37
|
+
const result = fillResultByError(error);
|
|
38
|
+
const tokenData = createDefaultTokenData({ result });
|
|
39
|
+
return this.responseHelper.getErrorResponse(tokenData, "loginDeviceCredentials");
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
loginGoogleCredentials = async (data, options) => {
|
|
43
43
|
try {
|
|
44
|
-
const credentialsData =
|
|
44
|
+
const credentialsData = fillLoginGoogleCredentialsData(this.programId, data);
|
|
45
45
|
const response = await this.authService.login(credentialsData, options);
|
|
46
|
-
response.data.result =
|
|
47
|
-
return this.responseHelper.
|
|
46
|
+
response.data.result = fillResult(response.data);
|
|
47
|
+
return this.responseHelper.getResponse(response.data);
|
|
48
48
|
}
|
|
49
49
|
catch (error) {
|
|
50
|
-
const result =
|
|
51
|
-
const tokenData =
|
|
52
|
-
return this.responseHelper.
|
|
50
|
+
const result = fillResultByError(error);
|
|
51
|
+
const tokenData = createDefaultTokenData({ result });
|
|
52
|
+
return this.responseHelper.getErrorResponse(tokenData, "loginGoogleCredentials");
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
generateLimitedToken = async (data, options) => {
|
|
56
56
|
try {
|
|
57
|
-
const tokenData =
|
|
57
|
+
const tokenData = fillGenerateLimitedTokenData(data);
|
|
58
58
|
const response = await this.authService.generateLimitedToken(tokenData, options);
|
|
59
|
-
response.data.result =
|
|
60
|
-
return this.responseHelper.
|
|
59
|
+
response.data.result = fillResult(response.data);
|
|
60
|
+
return this.responseHelper.getResponse(response.data);
|
|
61
61
|
}
|
|
62
62
|
catch (error) {
|
|
63
|
-
const result =
|
|
64
|
-
const tokenData =
|
|
65
|
-
return this.responseHelper.
|
|
63
|
+
const result = fillResultByError(error);
|
|
64
|
+
const tokenData = createDefaultTokenData({ result });
|
|
65
|
+
return this.responseHelper.getErrorResponse(tokenData, "generateLimitedToken");
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosHelper } from "../../helper/api/axiosHelper";
|
|
2
|
-
import {
|
|
2
|
+
import { createDefaultBlockchainData, fillBlockchainDelegateData, fillBlockchainMultiSendData, fillBlockchainSendData, fillBlockchainUndelegateData, fillResultByError, } from "../data";
|
|
3
3
|
import { BlockchainService } from "../services";
|
|
4
4
|
import { BaseClient } from "./base";
|
|
5
5
|
class BlockchainClient extends BaseClient {
|
|
@@ -7,56 +7,56 @@ class BlockchainClient extends BaseClient {
|
|
|
7
7
|
constructor(clientData, errorHandler) {
|
|
8
8
|
super(clientData, errorHandler);
|
|
9
9
|
const { token, baseUrl, lang, installationId, userId } = clientData;
|
|
10
|
-
const config = AxiosHelper.
|
|
10
|
+
const config = AxiosHelper.getAxiosConfig(token, baseUrl, lang, installationId);
|
|
11
11
|
this.blockchainService = new BlockchainService({ config, userId });
|
|
12
12
|
}
|
|
13
13
|
// #region "POST"
|
|
14
14
|
send = async (data, options) => {
|
|
15
15
|
try {
|
|
16
|
-
const blockchainSendData =
|
|
16
|
+
const blockchainSendData = fillBlockchainSendData(data);
|
|
17
17
|
const response = await this.blockchainService.send(blockchainSendData, options);
|
|
18
|
-
return this.responseHelper.
|
|
18
|
+
return this.responseHelper.getResponse(response.data);
|
|
19
19
|
}
|
|
20
20
|
catch (error) {
|
|
21
|
-
const result =
|
|
22
|
-
const blockchainData =
|
|
23
|
-
return this.responseHelper.
|
|
21
|
+
const result = fillResultByError(error);
|
|
22
|
+
const blockchainData = createDefaultBlockchainData({ result });
|
|
23
|
+
return this.responseHelper.getErrorResponse(blockchainData, "send");
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
multiSend = async (data, options) => {
|
|
27
27
|
try {
|
|
28
|
-
const blockchainMultiSendData =
|
|
28
|
+
const blockchainMultiSendData = fillBlockchainMultiSendData(data);
|
|
29
29
|
const response = await this.blockchainService.multiSend(blockchainMultiSendData, options);
|
|
30
|
-
return this.responseHelper.
|
|
30
|
+
return this.responseHelper.getResponse(response.data);
|
|
31
31
|
}
|
|
32
32
|
catch (error) {
|
|
33
|
-
const result =
|
|
34
|
-
const blockchainData =
|
|
35
|
-
return this.responseHelper.
|
|
33
|
+
const result = fillResultByError(error);
|
|
34
|
+
const blockchainData = createDefaultBlockchainData({ result });
|
|
35
|
+
return this.responseHelper.getErrorResponse(blockchainData, "multiSend");
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
delegate = async (data, options) => {
|
|
39
39
|
try {
|
|
40
|
-
const blockchainDelegateData =
|
|
40
|
+
const blockchainDelegateData = fillBlockchainDelegateData(data);
|
|
41
41
|
const response = await this.blockchainService.delegate(blockchainDelegateData, options);
|
|
42
|
-
return this.responseHelper.
|
|
42
|
+
return this.responseHelper.getResponse(response.data);
|
|
43
43
|
}
|
|
44
44
|
catch (error) {
|
|
45
|
-
const result =
|
|
46
|
-
const blockchainData =
|
|
47
|
-
return this.responseHelper.
|
|
45
|
+
const result = fillResultByError(error);
|
|
46
|
+
const blockchainData = createDefaultBlockchainData({ result });
|
|
47
|
+
return this.responseHelper.getErrorResponse(blockchainData, "delegate");
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
undelegate = async (data, options) => {
|
|
51
51
|
try {
|
|
52
|
-
const blockchainUndelegateData =
|
|
52
|
+
const blockchainUndelegateData = fillBlockchainUndelegateData(data);
|
|
53
53
|
const response = await this.blockchainService.undelegate(blockchainUndelegateData, options);
|
|
54
|
-
return this.responseHelper.
|
|
54
|
+
return this.responseHelper.getResponse(response.data);
|
|
55
55
|
}
|
|
56
56
|
catch (error) {
|
|
57
|
-
const result =
|
|
58
|
-
const blockchainData =
|
|
59
|
-
return this.responseHelper.
|
|
57
|
+
const result = fillResultByError(error);
|
|
58
|
+
const blockchainData = createDefaultBlockchainData({ result });
|
|
59
|
+
return this.responseHelper.getErrorResponse(blockchainData, "undelegate");
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
}
|
|
@@ -7,7 +7,7 @@ class IPAddressAndLocationClient extends BaseClient {
|
|
|
7
7
|
constructor(clientData, errorHandler) {
|
|
8
8
|
super(clientData, errorHandler);
|
|
9
9
|
const { token, baseUrl, lang, installationId, userId } = clientData;
|
|
10
|
-
const config = AxiosHelper.
|
|
10
|
+
const config = AxiosHelper.getAxiosConfig(token, baseUrl, lang, installationId);
|
|
11
11
|
this.ipAddressAndLocationService = new IPAddressAndLocationService({
|
|
12
12
|
config,
|
|
13
13
|
userId,
|
|
@@ -16,7 +16,7 @@ class IPAddressAndLocationClient extends BaseClient {
|
|
|
16
16
|
// #region "GET"
|
|
17
17
|
getGeoCoordinates = () => {
|
|
18
18
|
try {
|
|
19
|
-
return GeoHelper.
|
|
19
|
+
return GeoHelper.getGeoCoordinates(this.ipAddressAndLocationService);
|
|
20
20
|
}
|
|
21
21
|
catch (error) {
|
|
22
22
|
return { latitude: 0, longitude: 0, position_description: "N/A, N/A" };
|
|
@@ -24,7 +24,7 @@ class IPAddressAndLocationClient extends BaseClient {
|
|
|
24
24
|
};
|
|
25
25
|
getIPAddress = () => {
|
|
26
26
|
try {
|
|
27
|
-
return GeoHelper.
|
|
27
|
+
return GeoHelper.getIPAddress(this.ipAddressAndLocationService);
|
|
28
28
|
}
|
|
29
29
|
catch (error) {
|
|
30
30
|
return "";
|
|
@@ -32,7 +32,7 @@ class IPAddressAndLocationClient extends BaseClient {
|
|
|
32
32
|
};
|
|
33
33
|
getGeoCoordinatesAndIPAddress = () => {
|
|
34
34
|
try {
|
|
35
|
-
return GeoHelper.
|
|
35
|
+
return GeoHelper.getGeoCoordinatesAndIPAddress(this.ipAddressAndLocationService);
|
|
36
36
|
}
|
|
37
37
|
catch (error) {
|
|
38
38
|
return { geo_coordinates: { latitude: 0, longitude: 0 }, ip_address: "" };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosHelper } from "../../helper/api/axiosHelper";
|
|
2
|
-
import {
|
|
2
|
+
import { fillCheckForgetPasswordData, fillConfirmEmailData, fillConfirmForgetPasswordData, fillConfirmPhoneData, createDefaultConfirmUserSecurity, createDefaultForgetSecurityData, fillResultByError, fillValidateEmailData, fillValidateForgetPasswordData, createDefaultValidateLimitedSecurity, fillValidatePhoneData, fillVerifyEmailData, fillVerifyPhoneData, createDefaultVerifyUserSecurity, } from "../data";
|
|
3
3
|
import { LimitedService } from "../services";
|
|
4
4
|
import { BaseClient } from "./base";
|
|
5
5
|
class LimitedClient extends BaseClient {
|
|
@@ -7,7 +7,7 @@ class LimitedClient extends BaseClient {
|
|
|
7
7
|
constructor(clientData, errorHandler) {
|
|
8
8
|
super(clientData, errorHandler);
|
|
9
9
|
const { token, baseUrl, nodeUrl, lang, userId } = this.clientData;
|
|
10
|
-
const config = AxiosHelper.
|
|
10
|
+
const config = AxiosHelper.getAxiosConfig(token, baseUrl, lang);
|
|
11
11
|
this.limitedService = new LimitedService({
|
|
12
12
|
config,
|
|
13
13
|
nodeUrl,
|
|
@@ -17,114 +17,114 @@ class LimitedClient extends BaseClient {
|
|
|
17
17
|
// #region "POST"
|
|
18
18
|
checkForgetPassword = async (data, options) => {
|
|
19
19
|
try {
|
|
20
|
-
const forgetSecurityData =
|
|
20
|
+
const forgetSecurityData = fillCheckForgetPasswordData(data);
|
|
21
21
|
const response = await this.limitedService.checkForgetSecurityData(forgetSecurityData, options);
|
|
22
|
-
return this.responseHelper.
|
|
22
|
+
return this.responseHelper.getResponse(response.data);
|
|
23
23
|
}
|
|
24
24
|
catch (error) {
|
|
25
|
-
const result =
|
|
26
|
-
const forgetSecurityData =
|
|
27
|
-
return this.responseHelper.
|
|
25
|
+
const result = fillResultByError(error);
|
|
26
|
+
const forgetSecurityData = createDefaultForgetSecurityData({ result });
|
|
27
|
+
return this.responseHelper.getErrorResponse(forgetSecurityData, "checkForgetPassword");
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
validateForgetPassword = async (data, options) => {
|
|
31
31
|
try {
|
|
32
|
-
const forgetSecurityData =
|
|
32
|
+
const forgetSecurityData = fillValidateForgetPasswordData(data);
|
|
33
33
|
const response = await this.limitedService.validateForgetSecurityData(forgetSecurityData, options);
|
|
34
|
-
return this.responseHelper.
|
|
34
|
+
return this.responseHelper.getResponse(response.data);
|
|
35
35
|
}
|
|
36
36
|
catch (error) {
|
|
37
|
-
const result =
|
|
38
|
-
const forgetSecurityData =
|
|
39
|
-
return this.responseHelper.
|
|
37
|
+
const result = fillResultByError(error);
|
|
38
|
+
const forgetSecurityData = createDefaultForgetSecurityData({ result });
|
|
39
|
+
return this.responseHelper.getErrorResponse(forgetSecurityData, "validateForgetPassword");
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
confirmForgetPassword = async (data, options) => {
|
|
43
43
|
try {
|
|
44
|
-
const forgetSecurityData =
|
|
44
|
+
const forgetSecurityData = fillConfirmForgetPasswordData(data);
|
|
45
45
|
const response = await this.limitedService.confirmForgetSecurityData(forgetSecurityData, options);
|
|
46
|
-
return this.responseHelper.
|
|
46
|
+
return this.responseHelper.getResponse(response.data);
|
|
47
47
|
}
|
|
48
48
|
catch (error) {
|
|
49
|
-
const result =
|
|
50
|
-
const forgetSecurityData =
|
|
51
|
-
return this.responseHelper.
|
|
49
|
+
const result = fillResultByError(error);
|
|
50
|
+
const forgetSecurityData = createDefaultForgetSecurityData({ result });
|
|
51
|
+
return this.responseHelper.getErrorResponse(forgetSecurityData, "confirmForgetPassword");
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
validateEmail = async (data, options) => {
|
|
55
55
|
try {
|
|
56
|
-
const validateLimitedSecurity =
|
|
56
|
+
const validateLimitedSecurity = fillValidateEmailData(data);
|
|
57
57
|
const response = await this.limitedService.validateSecurityData(validateLimitedSecurity, options);
|
|
58
|
-
return this.responseHelper.
|
|
58
|
+
return this.responseHelper.getResponse(response.data);
|
|
59
59
|
}
|
|
60
60
|
catch (error) {
|
|
61
|
-
const result =
|
|
62
|
-
const forgetSecurityData =
|
|
61
|
+
const result = fillResultByError(error);
|
|
62
|
+
const forgetSecurityData = createDefaultValidateLimitedSecurity({
|
|
63
63
|
result,
|
|
64
64
|
});
|
|
65
|
-
return this.responseHelper.
|
|
65
|
+
return this.responseHelper.getErrorResponse(forgetSecurityData, "validateEmail");
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
validatePhone = async (data, options) => {
|
|
69
69
|
try {
|
|
70
|
-
const validateLimitedSecurity =
|
|
70
|
+
const validateLimitedSecurity = fillValidatePhoneData(data);
|
|
71
71
|
const response = await this.limitedService.validateSecurityData(validateLimitedSecurity, options);
|
|
72
|
-
return this.responseHelper.
|
|
72
|
+
return this.responseHelper.getResponse(response.data);
|
|
73
73
|
}
|
|
74
74
|
catch (error) {
|
|
75
|
-
const result =
|
|
76
|
-
const forgetSecurityData =
|
|
75
|
+
const result = fillResultByError(error);
|
|
76
|
+
const forgetSecurityData = createDefaultValidateLimitedSecurity({
|
|
77
77
|
result,
|
|
78
78
|
});
|
|
79
|
-
return this.responseHelper.
|
|
79
|
+
return this.responseHelper.getErrorResponse(forgetSecurityData, "validatePhone");
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
verifyEmail = async (data, options) => {
|
|
83
83
|
try {
|
|
84
|
-
const verifyUserSecurity =
|
|
84
|
+
const verifyUserSecurity = fillVerifyEmailData(data);
|
|
85
85
|
const response = await this.limitedService.verifySecurityData(verifyUserSecurity, options);
|
|
86
|
-
return this.responseHelper.
|
|
86
|
+
return this.responseHelper.getResponse(response.data);
|
|
87
87
|
}
|
|
88
88
|
catch (error) {
|
|
89
|
-
const result =
|
|
90
|
-
const verifySecurityData =
|
|
91
|
-
return this.responseHelper.
|
|
89
|
+
const result = fillResultByError(error);
|
|
90
|
+
const verifySecurityData = createDefaultVerifyUserSecurity({ result });
|
|
91
|
+
return this.responseHelper.getErrorResponse(verifySecurityData, "verifyEmail");
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
verifyPhone = async (data, options) => {
|
|
95
95
|
try {
|
|
96
|
-
const verifyUserSecurity =
|
|
96
|
+
const verifyUserSecurity = fillVerifyPhoneData(data);
|
|
97
97
|
const response = await this.limitedService.verifySecurityData(verifyUserSecurity, options);
|
|
98
|
-
return this.responseHelper.
|
|
98
|
+
return this.responseHelper.getResponse(response.data);
|
|
99
99
|
}
|
|
100
100
|
catch (error) {
|
|
101
|
-
const result =
|
|
102
|
-
const verifySecurityData =
|
|
103
|
-
return this.responseHelper.
|
|
101
|
+
const result = fillResultByError(error);
|
|
102
|
+
const verifySecurityData = createDefaultVerifyUserSecurity({ result });
|
|
103
|
+
return this.responseHelper.getErrorResponse(verifySecurityData, "verifyPhone");
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
106
|
confirmEmail = async (data, options) => {
|
|
107
107
|
try {
|
|
108
|
-
const confirmUserSecurity =
|
|
108
|
+
const confirmUserSecurity = fillConfirmEmailData(data);
|
|
109
109
|
const response = await this.limitedService.confirmSecurityData(confirmUserSecurity, options);
|
|
110
|
-
return this.responseHelper.
|
|
110
|
+
return this.responseHelper.getResponse(response.data);
|
|
111
111
|
}
|
|
112
112
|
catch (error) {
|
|
113
|
-
const result =
|
|
114
|
-
const confirmUserSecurity =
|
|
115
|
-
return this.responseHelper.
|
|
113
|
+
const result = fillResultByError(error);
|
|
114
|
+
const confirmUserSecurity = createDefaultConfirmUserSecurity({ result });
|
|
115
|
+
return this.responseHelper.getErrorResponse(confirmUserSecurity, "confirmEmail");
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
118
|
confirmPhone = async (data, options) => {
|
|
119
119
|
try {
|
|
120
|
-
const confirmUserSecurity =
|
|
120
|
+
const confirmUserSecurity = fillConfirmPhoneData(data);
|
|
121
121
|
const response = await this.limitedService.confirmSecurityData(confirmUserSecurity, options);
|
|
122
|
-
return this.responseHelper.
|
|
122
|
+
return this.responseHelper.getResponse(response.data);
|
|
123
123
|
}
|
|
124
124
|
catch (error) {
|
|
125
|
-
const result =
|
|
126
|
-
const confirmUserSecurity =
|
|
127
|
-
return this.responseHelper.
|
|
125
|
+
const result = fillResultByError(error);
|
|
126
|
+
const confirmUserSecurity = createDefaultConfirmUserSecurity({ result });
|
|
127
|
+
return this.responseHelper.getErrorResponse(confirmUserSecurity, "confirmPhone");
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
130
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosHelper } from "../../helper/api/axiosHelper";
|
|
2
|
-
import {
|
|
2
|
+
import { fillCreateOrderData, createDefaultOrderData, fillResultByError, } from "../data";
|
|
3
3
|
import { OrderService } from "../services";
|
|
4
4
|
import { BaseClient } from "./base";
|
|
5
5
|
class OrderClient extends BaseClient {
|
|
@@ -7,20 +7,20 @@ class OrderClient extends BaseClient {
|
|
|
7
7
|
constructor(clientData, errorHandler) {
|
|
8
8
|
super(clientData, errorHandler);
|
|
9
9
|
const { token, baseUrl, lang, installationId, userId } = clientData;
|
|
10
|
-
const config = AxiosHelper.
|
|
10
|
+
const config = AxiosHelper.getAxiosConfig(token, baseUrl, lang, installationId);
|
|
11
11
|
this.orderService = new OrderService({ config, userId });
|
|
12
12
|
}
|
|
13
13
|
// #region "POST"
|
|
14
14
|
createOrder = async (data, options) => {
|
|
15
15
|
try {
|
|
16
|
-
const createOrderData =
|
|
16
|
+
const createOrderData = fillCreateOrderData(data);
|
|
17
17
|
const response = await this.orderService.create(createOrderData, options);
|
|
18
|
-
return this.responseHelper.
|
|
18
|
+
return this.responseHelper.getResponse(response.data);
|
|
19
19
|
}
|
|
20
20
|
catch (error) {
|
|
21
|
-
const result =
|
|
22
|
-
const orderData =
|
|
23
|
-
return this.responseHelper.
|
|
21
|
+
const result = fillResultByError(error);
|
|
22
|
+
const orderData = createDefaultOrderData({ result });
|
|
23
|
+
return this.responseHelper.getErrorResponse(orderData, "createOrder");
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxiosHelper } from "../../helper/api/axiosHelper";
|
|
2
|
-
import {
|
|
2
|
+
import { fillCreateOrganizationData, fillCreateOrganizationDocumentData, createDefaultOrganizationData, fillUpdateOrganizationData, } from "../data/organization";
|
|
3
3
|
import { OrganizationService } from "../services";
|
|
4
|
-
import {
|
|
4
|
+
import { createDefaultDocumentData, fillResultByError } from "../data";
|
|
5
5
|
import { BaseClient } from "./base";
|
|
6
6
|
class OrganizationClient extends BaseClient {
|
|
7
7
|
organizationService;
|
|
@@ -9,7 +9,7 @@ class OrganizationClient extends BaseClient {
|
|
|
9
9
|
constructor(clientData, errorHandler) {
|
|
10
10
|
super(clientData, errorHandler);
|
|
11
11
|
const { token, baseUrl, userId, lang, installationId } = clientData;
|
|
12
|
-
const config = AxiosHelper.
|
|
12
|
+
const config = AxiosHelper.getAxiosConfig(token, baseUrl, lang, installationId);
|
|
13
13
|
this.organizationService = new OrganizationService({ config, userId });
|
|
14
14
|
this.userId = userId;
|
|
15
15
|
}
|
|
@@ -17,52 +17,52 @@ class OrganizationClient extends BaseClient {
|
|
|
17
17
|
getOrganization = async (id, options) => {
|
|
18
18
|
try {
|
|
19
19
|
const response = await this.organizationService.get(id, options);
|
|
20
|
-
return this.responseHelper.
|
|
20
|
+
return this.responseHelper.getResponse(response.data);
|
|
21
21
|
}
|
|
22
22
|
catch (error) {
|
|
23
|
-
const result =
|
|
24
|
-
const organization =
|
|
25
|
-
return this.responseHelper.
|
|
23
|
+
const result = fillResultByError(error);
|
|
24
|
+
const organization = createDefaultOrganizationData({ result });
|
|
25
|
+
return this.responseHelper.getErrorResponse(organization, "getOrganization");
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
// #endregion
|
|
29
29
|
// #region "POST"
|
|
30
30
|
createOrganization = async (data, options) => {
|
|
31
31
|
try {
|
|
32
|
-
const organizationData =
|
|
32
|
+
const organizationData = fillCreateOrganizationData(data, this.userId);
|
|
33
33
|
const response = await this.organizationService.create(organizationData, options);
|
|
34
|
-
return this.responseHelper.
|
|
34
|
+
return this.responseHelper.getResponse(response.data);
|
|
35
35
|
}
|
|
36
36
|
catch (error) {
|
|
37
|
-
const result =
|
|
38
|
-
const organization =
|
|
39
|
-
return this.responseHelper.
|
|
37
|
+
const result = fillResultByError(error);
|
|
38
|
+
const organization = createDefaultOrganizationData({ result });
|
|
39
|
+
return this.responseHelper.getErrorResponse(organization, "createOrganization");
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
uploadDocument = async (data, options) => {
|
|
43
43
|
try {
|
|
44
|
-
const documentData =
|
|
44
|
+
const documentData = fillCreateOrganizationDocumentData(data);
|
|
45
45
|
const response = await this.organizationService.createDocument(data.id, documentData, options);
|
|
46
|
-
return this.responseHelper.
|
|
46
|
+
return this.responseHelper.getResponse(response.data);
|
|
47
47
|
}
|
|
48
48
|
catch (error) {
|
|
49
|
-
const result =
|
|
50
|
-
const documentData =
|
|
51
|
-
return this.responseHelper.
|
|
49
|
+
const result = fillResultByError(error);
|
|
50
|
+
const documentData = createDefaultDocumentData({ result });
|
|
51
|
+
return this.responseHelper.getErrorResponse(documentData, "uploadDocument");
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
// #endregion
|
|
55
55
|
// #region "PUT"
|
|
56
56
|
updateOrganization = async (data, options) => {
|
|
57
57
|
try {
|
|
58
|
-
const organizationData =
|
|
58
|
+
const organizationData = fillUpdateOrganizationData(data, this.userId);
|
|
59
59
|
const response = await this.organizationService.update(data.id, organizationData, options);
|
|
60
|
-
return this.responseHelper.
|
|
60
|
+
return this.responseHelper.getResponse(response.data);
|
|
61
61
|
}
|
|
62
62
|
catch (error) {
|
|
63
|
-
const result =
|
|
64
|
-
const organization =
|
|
65
|
-
return this.responseHelper.
|
|
63
|
+
const result = fillResultByError(error);
|
|
64
|
+
const organization = createDefaultOrganizationData({ result });
|
|
65
|
+
return this.responseHelper.getErrorResponse(organization, "updateOrganization");
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
// #endregion
|
|
@@ -70,12 +70,12 @@ class OrganizationClient extends BaseClient {
|
|
|
70
70
|
deleteOrganization = async (id, options) => {
|
|
71
71
|
try {
|
|
72
72
|
const response = await this.organizationService.delete(id, options);
|
|
73
|
-
return this.responseHelper.
|
|
73
|
+
return this.responseHelper.getResponse(response.data);
|
|
74
74
|
}
|
|
75
75
|
catch (error) {
|
|
76
|
-
const result =
|
|
77
|
-
const organization =
|
|
78
|
-
return this.responseHelper.
|
|
76
|
+
const result = fillResultByError(error);
|
|
77
|
+
const organization = createDefaultOrganizationData({ result });
|
|
78
|
+
return this.responseHelper.getErrorResponse(organization, "deleteOrganization");
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
81
|
}
|