ggez-banking-sdk 0.1.148 → 0.1.150
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/services/blockchain.js +5 -5
- package/dist/api/services/limited.js +5 -5
- package/dist/constants/constants.d.ts +23 -18
- package/dist/constants/constants.js +30 -18
- package/dist/helper/userHelper.d.ts +2 -1
- package/dist/helper/userHelper.js +26 -0
- package/dist/types/helper/userHelper.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Endpoints } from "../../constants";
|
|
1
|
+
import { BlockchainEndpoints, Endpoints } from "../../constants";
|
|
2
2
|
import { BaseService } from "./base";
|
|
3
3
|
class BlockchainService extends BaseService {
|
|
4
4
|
endpoint = Endpoints.Blockchain;
|
|
@@ -7,19 +7,19 @@ class BlockchainService extends BaseService {
|
|
|
7
7
|
}
|
|
8
8
|
// #region "POST"
|
|
9
9
|
async send(payload) {
|
|
10
|
-
const url = this.resolveURL();
|
|
10
|
+
const url = this.resolveURL(BlockchainEndpoints.Send);
|
|
11
11
|
return this.POST(url, payload);
|
|
12
12
|
}
|
|
13
13
|
async multiSend(payload) {
|
|
14
|
-
const url = this.resolveURL();
|
|
14
|
+
const url = this.resolveURL(BlockchainEndpoints.MultiSend);
|
|
15
15
|
return this.POST(url, payload);
|
|
16
16
|
}
|
|
17
17
|
async delegate(payload) {
|
|
18
|
-
const url = this.resolveURL();
|
|
18
|
+
const url = this.resolveURL(BlockchainEndpoints.Delegate);
|
|
19
19
|
return this.POST(url, payload);
|
|
20
20
|
}
|
|
21
21
|
async undelegate(payload) {
|
|
22
|
-
const url = this.resolveURL();
|
|
22
|
+
const url = this.resolveURL(BlockchainEndpoints.Undelegate);
|
|
23
23
|
return this.POST(url, payload);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -23,23 +23,23 @@ class LimitedService extends BaseService {
|
|
|
23
23
|
}
|
|
24
24
|
// #region "POST"
|
|
25
25
|
async validateForgetSecurityData(data) {
|
|
26
|
-
const url = this.resolveURL(
|
|
26
|
+
const url = this.resolveURL(LimitedEndpoints.SecurityForgetValidate);
|
|
27
27
|
return await this.POST(url, data);
|
|
28
28
|
}
|
|
29
29
|
async confirmForgetSecurityData(data) {
|
|
30
|
-
const url = this.resolveURL(
|
|
30
|
+
const url = this.resolveURL(LimitedEndpoints.SecurityForgetConfirm);
|
|
31
31
|
return await this.POST(url, data);
|
|
32
32
|
}
|
|
33
33
|
async validateSecurityData(data) {
|
|
34
|
-
const url = this.resolveURL(
|
|
34
|
+
const url = this.resolveURL(LimitedEndpoints.SecurityValidate);
|
|
35
35
|
return await this.POST(url, data);
|
|
36
36
|
}
|
|
37
37
|
async verifySecurityData(data) {
|
|
38
|
-
const url = this.resolveURL(
|
|
38
|
+
const url = this.resolveURL(LimitedEndpoints.SecurityVerify);
|
|
39
39
|
return await this.POST(url, data);
|
|
40
40
|
}
|
|
41
41
|
async confirmSecurityData(data) {
|
|
42
|
-
const url = this.resolveURL(
|
|
42
|
+
const url = this.resolveURL(LimitedEndpoints.SecurityConfirm);
|
|
43
43
|
return await this.POST(url, data);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
declare const Endpoints: {
|
|
2
|
-
readonly Blockchain: "v1/blockchain";
|
|
3
2
|
readonly Account: "v1/account";
|
|
4
|
-
readonly Transaction: "v1/transaction";
|
|
5
|
-
readonly Promotion: "api/promotion";
|
|
6
|
-
readonly User: "v1/user";
|
|
7
|
-
readonly Organization: "v1/organization";
|
|
8
|
-
readonly Order: "v1/order";
|
|
9
|
-
readonly LimitedSecurity: "v1/limited/security";
|
|
10
|
-
readonly Limited: "v1/limited";
|
|
11
3
|
readonly Auth: "oauth/token";
|
|
4
|
+
readonly Blockchain: "v1/blockchain";
|
|
12
5
|
readonly IPAddress: "v1/myipaddress";
|
|
6
|
+
readonly Limited: "v1/limited";
|
|
7
|
+
readonly Order: "v1/order";
|
|
8
|
+
readonly Organization: "v1/organization";
|
|
9
|
+
readonly Promotion: "api/promotion";
|
|
10
|
+
readonly Transaction: "v1/transaction";
|
|
11
|
+
readonly User: "v1/user";
|
|
13
12
|
};
|
|
14
13
|
declare const AccountEndpoints: {
|
|
15
14
|
Limits: string;
|
|
16
15
|
};
|
|
16
|
+
declare const BlockchainEndpoints: {
|
|
17
|
+
readonly Send: "/send";
|
|
18
|
+
readonly MultiSend: "/multisend";
|
|
19
|
+
readonly Delegate: "/delegate";
|
|
20
|
+
readonly Undelegate: "/undelegate";
|
|
21
|
+
};
|
|
17
22
|
declare const LimitedEndpoints: {
|
|
18
23
|
readonly Security: "/security";
|
|
19
24
|
readonly SecurityValidate: "/security/validate";
|
|
@@ -63,11 +68,10 @@ declare const UserEndpoints: {
|
|
|
63
68
|
readonly AuthDelete: "/auth/delete";
|
|
64
69
|
readonly HistoryLatest: "/history/latest";
|
|
65
70
|
};
|
|
66
|
-
declare const
|
|
67
|
-
readonly
|
|
68
|
-
readonly
|
|
69
|
-
readonly
|
|
70
|
-
readonly DELETE: "DELETE";
|
|
71
|
+
declare const GrantType: {
|
|
72
|
+
readonly UserCredential: "user_credential";
|
|
73
|
+
readonly DeviceCredential: "device_credential";
|
|
74
|
+
readonly LimitedCredential: "limited_credential";
|
|
71
75
|
};
|
|
72
76
|
declare const HeaderKeys: {
|
|
73
77
|
readonly Authorization: "Authorization";
|
|
@@ -82,10 +86,11 @@ declare const HeaderKeys: {
|
|
|
82
86
|
readonly GenerateJwt: "generate_jwt";
|
|
83
87
|
readonly AllowControlAllowCredentials: "Allow-Control-Allow-Credentials";
|
|
84
88
|
};
|
|
85
|
-
declare const
|
|
86
|
-
readonly
|
|
87
|
-
readonly
|
|
88
|
-
readonly
|
|
89
|
+
declare const HTTPMethod: {
|
|
90
|
+
readonly GET: "GET";
|
|
91
|
+
readonly POST: "POST";
|
|
92
|
+
readonly PUT: "PUT";
|
|
93
|
+
readonly DELETE: "DELETE";
|
|
89
94
|
};
|
|
90
95
|
declare const CookieKeys: {
|
|
91
96
|
readonly DEK: "DEK";
|
|
@@ -94,4 +99,4 @@ declare const CookieKeys: {
|
|
|
94
99
|
readonly access_token: "access_token";
|
|
95
100
|
readonly jwt_token: "jwt_token";
|
|
96
101
|
};
|
|
97
|
-
export {
|
|
102
|
+
export { Endpoints, AccountEndpoints, BlockchainEndpoints, LimitedEndpoints, OrganizationEndpoints, TransactionEndpoints, UserEndpoints, GrantType, HeaderKeys, HTTPMethod, CookieKeys, };
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
// #region "Endpoints"
|
|
2
2
|
const Endpoints = {
|
|
3
|
-
Blockchain: "v1/blockchain",
|
|
4
3
|
Account: "v1/account",
|
|
5
|
-
Transaction: "v1/transaction",
|
|
6
|
-
Promotion: "api/promotion",
|
|
7
|
-
User: "v1/user",
|
|
8
|
-
Organization: "v1/organization",
|
|
9
|
-
Order: "v1/order",
|
|
10
|
-
LimitedSecurity: "v1/limited/security",
|
|
11
|
-
Limited: "v1/limited",
|
|
12
4
|
Auth: "oauth/token",
|
|
5
|
+
Blockchain: "v1/blockchain",
|
|
13
6
|
IPAddress: "v1/myipaddress",
|
|
7
|
+
Limited: "v1/limited",
|
|
8
|
+
Order: "v1/order",
|
|
9
|
+
Organization: "v1/organization",
|
|
10
|
+
Promotion: "api/promotion",
|
|
11
|
+
Transaction: "v1/transaction",
|
|
12
|
+
User: "v1/user",
|
|
14
13
|
};
|
|
15
14
|
const AccountEndpoints = {
|
|
16
15
|
Limits: "/limits",
|
|
17
16
|
};
|
|
17
|
+
const BlockchainEndpoints = {
|
|
18
|
+
Send: "/send",
|
|
19
|
+
MultiSend: "/multisend",
|
|
20
|
+
Delegate: "/delegate",
|
|
21
|
+
Undelegate: "/undelegate",
|
|
22
|
+
};
|
|
18
23
|
const LimitedEndpoints = {
|
|
19
24
|
Security: "/security",
|
|
20
25
|
SecurityValidate: "/security/validate",
|
|
@@ -66,11 +71,10 @@ const UserEndpoints = {
|
|
|
66
71
|
};
|
|
67
72
|
// #endregion
|
|
68
73
|
// #region "API"
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
DELETE: "DELETE",
|
|
74
|
+
const GrantType = {
|
|
75
|
+
UserCredential: "user_credential",
|
|
76
|
+
DeviceCredential: "device_credential",
|
|
77
|
+
LimitedCredential: "limited_credential",
|
|
74
78
|
};
|
|
75
79
|
const HeaderKeys = {
|
|
76
80
|
Authorization: "Authorization",
|
|
@@ -85,10 +89,11 @@ const HeaderKeys = {
|
|
|
85
89
|
GenerateJwt: "generate_jwt",
|
|
86
90
|
AllowControlAllowCredentials: "Allow-Control-Allow-Credentials",
|
|
87
91
|
};
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
+
const HTTPMethod = {
|
|
93
|
+
GET: "GET",
|
|
94
|
+
POST: "POST",
|
|
95
|
+
PUT: "PUT",
|
|
96
|
+
DELETE: "DELETE",
|
|
92
97
|
};
|
|
93
98
|
// #endregion
|
|
94
99
|
// #region "Cookies"
|
|
@@ -100,4 +105,11 @@ const CookieKeys = {
|
|
|
100
105
|
jwt_token: "jwt_token",
|
|
101
106
|
};
|
|
102
107
|
// #endregion
|
|
103
|
-
export {
|
|
108
|
+
export {
|
|
109
|
+
// #region "Endpoints"
|
|
110
|
+
Endpoints, AccountEndpoints, BlockchainEndpoints, LimitedEndpoints, OrganizationEndpoints, TransactionEndpoints, UserEndpoints,
|
|
111
|
+
// #endregion
|
|
112
|
+
// #region "API"
|
|
113
|
+
GrantType, HeaderKeys, HTTPMethod,
|
|
114
|
+
// #endregion
|
|
115
|
+
CookieKeys, };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { TModifyListByEntity, TModifyByDocumentData, TSortByID, TSortByIsPrimary, TSortByVerificationStatus, TSortEntity, TModifyOrganizationByDocumentData, TModifyProfilePicture } from "../types";
|
|
1
|
+
import type { TModifyListByEntity, TModifyByDocumentData, TSortByID, TSortByIsPrimary, TSortByVerificationStatus, TSortEntity, TModifyOrganizationByDocumentData, TModifyProfilePicture, TModifySecurity } from "../types";
|
|
2
2
|
declare class UserHelper {
|
|
3
3
|
static ModifyListByEntity: TModifyListByEntity;
|
|
4
4
|
static ModifyByDocumentData: TModifyByDocumentData;
|
|
5
5
|
static ModifyOrganizationByDocumentData: TModifyOrganizationByDocumentData;
|
|
6
6
|
static ModifyProfilePicture: TModifyProfilePicture;
|
|
7
|
+
static ModifySecurity: TModifySecurity;
|
|
7
8
|
static SortEntity: TSortEntity;
|
|
8
9
|
static SortByIsPrimary: TSortByIsPrimary;
|
|
9
10
|
static SortByVerificationStatus: TSortByVerificationStatus;
|
|
@@ -57,6 +57,32 @@ class UserHelper {
|
|
|
57
57
|
};
|
|
58
58
|
return modifiedPersonalInfo;
|
|
59
59
|
};
|
|
60
|
+
static ModifySecurity = (userSecurity, resetUserSecurity) => {
|
|
61
|
+
if (!resetUserSecurity?.reset_security_data)
|
|
62
|
+
return userSecurity;
|
|
63
|
+
const { reset_password, reset_security_questions, reset_security_code } = resetUserSecurity.reset_security_data;
|
|
64
|
+
if (reset_security_questions) {
|
|
65
|
+
return {
|
|
66
|
+
...userSecurity,
|
|
67
|
+
secret_question_1: reset_security_questions.secret_question_1,
|
|
68
|
+
secret_answer_1: reset_security_questions.secret_answer_1,
|
|
69
|
+
secret_question_2: reset_security_questions.secret_question_2,
|
|
70
|
+
secret_answer_2: reset_security_questions.secret_answer_2,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if (reset_security_code) {
|
|
74
|
+
return {
|
|
75
|
+
...userSecurity,
|
|
76
|
+
security_code: reset_security_code.new_security_code,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if (reset_password) {
|
|
80
|
+
return {
|
|
81
|
+
...userSecurity,
|
|
82
|
+
password: reset_password.new_password,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
};
|
|
60
86
|
// #endregion
|
|
61
87
|
// #region "Sort"
|
|
62
88
|
static SortEntity = (entityList) => {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { DocumentData, OrganizationData, PersonalInfo, UserData } from "..";
|
|
1
|
+
import { DocumentData, OrganizationData, PersonalInfo, ResetUserSecurity, UserData, UserSecurity } from "..";
|
|
2
2
|
type TEntity = UserData[keyof Pick<UserData, "addresses" | "bank_account" | "email" | "phone" | "identification">][0];
|
|
3
3
|
type TModifyListByEntity = <K extends TEntity>(entityList: K[], entity: K) => K[];
|
|
4
4
|
type TModifyByDocumentData = <K extends TEntity>(entityList: K[], entity: DocumentData) => K[];
|
|
5
5
|
type TModifyOrganizationByDocumentData = (organizationList: OrganizationData[], documentData: DocumentData) => OrganizationData[];
|
|
6
6
|
type TModifyProfilePicture = (personal_info: PersonalInfo, documentData: DocumentData) => PersonalInfo;
|
|
7
|
-
|
|
7
|
+
type TModifySecurity = (userSecurity: UserSecurity, resetUserSecurity: ResetUserSecurity) => UserSecurity;
|
|
8
|
+
export { TEntity, TModifyListByEntity, TModifyByDocumentData, TModifyOrganizationByDocumentData, TModifyProfilePicture, TModifySecurity, };
|
|
8
9
|
type BaseEntity = {
|
|
9
10
|
id: number;
|
|
10
11
|
is_primary: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ggez-banking-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.150",
|
|
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",
|