ggez-banking-sdk 0.4.8 → 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/api.js +0 -2
- package/dist/api/proxy/auth.js +1 -3
- package/dist/api/proxy/organization.d.ts +1 -0
- package/dist/api/proxy/organization.js +5 -2
- package/dist/api/service/base.d.ts +2 -2
- package/dist/api/service/base.js +8 -6
- package/dist/api/service/user.d.ts +1 -1
- package/dist/api/service/user.js +128 -128
- package/dist/helper/api/axiosHelper.js +2 -2
- package/dist/helper/storage/cookiesHelper.d.ts +2 -0
- package/dist/helper/storage/cookiesHelper.js +22 -0
- package/dist/types/api/context/clientContext.d.ts +0 -6
- package/package.json +1 -1
package/dist/api/api.js
CHANGED
package/dist/api/proxy/auth.js
CHANGED
|
@@ -10,9 +10,7 @@ class AuthProxy extends BaseProxy {
|
|
|
10
10
|
}
|
|
11
11
|
async login(data) {
|
|
12
12
|
const response = await this.authService.login(data);
|
|
13
|
-
if (ResultHelper.isApproved(response
|
|
14
|
-
this.context.setToken(response.data.access_token);
|
|
15
|
-
this.context.setUserId(Number(response.data.user_id));
|
|
13
|
+
if (ResultHelper.isApproved(response.data.result)) {
|
|
16
14
|
await this.cookiesHelper.setCredentialCookiesByTokenData(response.data);
|
|
17
15
|
}
|
|
18
16
|
return response;
|
|
@@ -3,6 +3,7 @@ import { BaseProxy } from "./base";
|
|
|
3
3
|
declare class OrganizationProxy extends BaseProxy {
|
|
4
4
|
private organizationService;
|
|
5
5
|
constructor(data: BaseProxyParameters);
|
|
6
|
+
userId(): Promise<number>;
|
|
6
7
|
getOrganization: (id: number) => Promise<import("../..").ApiResponse<import("../..").OrganizationData>>;
|
|
7
8
|
createOrganization: (data: ICreateOrganizationData) => Promise<import("../..").ApiResponse<import("../..").OrganizationData>>;
|
|
8
9
|
uploadDocument: (data: IUploadOrganizationDocumentData) => Promise<import("../..").ApiResponse<import("../..").DocumentData>>;
|
|
@@ -7,6 +7,9 @@ class OrganizationProxy extends BaseProxy {
|
|
|
7
7
|
super(data);
|
|
8
8
|
this.organizationService = new OrganizationService(data);
|
|
9
9
|
}
|
|
10
|
+
async userId() {
|
|
11
|
+
return this.cookiesHelper.getUserId();
|
|
12
|
+
}
|
|
10
13
|
// #region "GET"
|
|
11
14
|
getOrganization = async (id) => {
|
|
12
15
|
return this.organizationService.get(id);
|
|
@@ -14,7 +17,7 @@ class OrganizationProxy extends BaseProxy {
|
|
|
14
17
|
// #endregion
|
|
15
18
|
// #region "POST"
|
|
16
19
|
createOrganization = async (data) => {
|
|
17
|
-
const organizationData = fillCreateOrganizationData(data, this.
|
|
20
|
+
const organizationData = fillCreateOrganizationData(data, await this.userId());
|
|
18
21
|
return this.organizationService.create(organizationData);
|
|
19
22
|
};
|
|
20
23
|
uploadDocument = async (data) => {
|
|
@@ -24,7 +27,7 @@ class OrganizationProxy extends BaseProxy {
|
|
|
24
27
|
// #endregion
|
|
25
28
|
// #region "PUT"
|
|
26
29
|
updateOrganization = async (data) => {
|
|
27
|
-
const organizationData = fillUpdateOrganizationData(data, this.
|
|
30
|
+
const organizationData = fillUpdateOrganizationData(data, await this.userId());
|
|
28
31
|
return this.organizationService.update(data.id, organizationData);
|
|
29
32
|
};
|
|
30
33
|
// #endregion
|
|
@@ -3,11 +3,11 @@ 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
|
+
import { ApiResponse, CookiesHelper, ErrorHandler } from "../..";
|
|
7
7
|
declare abstract class BaseService {
|
|
8
8
|
protected abstract endpoint: string;
|
|
9
9
|
protected context: ClientContextProvider;
|
|
10
|
-
|
|
10
|
+
protected cookiesHelper: CookiesHelper;
|
|
11
11
|
protected axiosInstance: AxiosInstance;
|
|
12
12
|
protected errorHandler: ErrorHandler;
|
|
13
13
|
constructor(data: BaseServiceParameters);
|
package/dist/api/service/base.js
CHANGED
|
@@ -13,20 +13,22 @@ class BaseService {
|
|
|
13
13
|
this.errorHandler = data.errorHandler;
|
|
14
14
|
this.axiosInstance = axios.create();
|
|
15
15
|
this.axiosInstance.interceptors.request.use((req) => this.onRequest(req));
|
|
16
|
-
this.axiosInstance.interceptors.response.use((
|
|
16
|
+
this.axiosInstance.interceptors.response.use((res) => this.onResponse(res), (err) => this.onError(err));
|
|
17
17
|
}
|
|
18
|
+
// #region "Interceptors Handlers"
|
|
18
19
|
async onRequest(req) {
|
|
19
20
|
await AxiosHelper.injectBaseHeaders(req, this.context, this.cookiesHelper, this.endpoint);
|
|
20
21
|
AxiosHelper.injectBaseBodyProperties(req);
|
|
21
22
|
return req;
|
|
22
23
|
}
|
|
23
|
-
onResponse(
|
|
24
|
-
return ResponseHelper.onResponse(
|
|
24
|
+
onResponse(res) {
|
|
25
|
+
return ResponseHelper.onResponse(res);
|
|
25
26
|
}
|
|
26
|
-
onError(
|
|
27
|
-
this.errorHandler(
|
|
28
|
-
return ResponseHelper.onError(
|
|
27
|
+
onError(err) {
|
|
28
|
+
this.errorHandler(err);
|
|
29
|
+
return ResponseHelper.onError(err);
|
|
29
30
|
}
|
|
31
|
+
// #endregion
|
|
30
32
|
async GET(url, options) {
|
|
31
33
|
const response = await this.axiosInstance.get(url, {
|
|
32
34
|
params: options?.params,
|
|
@@ -9,7 +9,7 @@ import type { VerifyUserSecurity } from "../../types/banking/user/verifyUserSecu
|
|
|
9
9
|
declare class UserService extends BaseService {
|
|
10
10
|
protected endpoint: string;
|
|
11
11
|
constructor(data: UserServiceParameters);
|
|
12
|
-
private
|
|
12
|
+
private userId;
|
|
13
13
|
getUser(): Promise<import("../..").ApiResponse<UserData>>;
|
|
14
14
|
getTermsAndConditions(): Promise<import("../..").ApiResponse<UserData>>;
|
|
15
15
|
getSecurity(): Promise<import("../..").ApiResponse<UserData>>;
|
package/dist/api/service/user.js
CHANGED
|
@@ -14,88 +14,88 @@ class UserService extends BaseService {
|
|
|
14
14
|
return req;
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
return
|
|
17
|
+
async userId() {
|
|
18
|
+
return await this.cookiesHelper.getUserId();
|
|
19
19
|
}
|
|
20
20
|
// #region "GET"
|
|
21
|
-
getUser() {
|
|
22
|
-
const url = this.resolveURL(`/${this.
|
|
21
|
+
async getUser() {
|
|
22
|
+
const url = this.resolveURL(`/${await this.userId()}`);
|
|
23
23
|
return this.GET(url);
|
|
24
24
|
}
|
|
25
|
-
getTermsAndConditions() {
|
|
26
|
-
const url = this.resolveURL(`${UserEndpoints.TermsAndConditions}/${this.
|
|
25
|
+
async getTermsAndConditions() {
|
|
26
|
+
const url = this.resolveURL(`${UserEndpoints.TermsAndConditions}/${await this.userId()}`);
|
|
27
27
|
return this.GET(url);
|
|
28
28
|
}
|
|
29
|
-
getSecurity() {
|
|
30
|
-
const url = this.resolveURL(`${UserEndpoints.Security}/${this.
|
|
29
|
+
async getSecurity() {
|
|
30
|
+
const url = this.resolveURL(`${UserEndpoints.Security}/${await this.userId()}`);
|
|
31
31
|
return this.GET(url);
|
|
32
32
|
}
|
|
33
|
-
getPhone() {
|
|
34
|
-
const url = this.resolveURL(`${UserEndpoints.Phone}/${this.
|
|
33
|
+
async getPhone() {
|
|
34
|
+
const url = this.resolveURL(`${UserEndpoints.Phone}/${await this.userId()}`);
|
|
35
35
|
return this.GET(url);
|
|
36
36
|
}
|
|
37
|
-
getPreferences() {
|
|
38
|
-
const url = this.resolveURL(`${UserEndpoints.Preferences}/${this.
|
|
37
|
+
async getPreferences() {
|
|
38
|
+
const url = this.resolveURL(`${UserEndpoints.Preferences}/${await this.userId()}`);
|
|
39
39
|
return this.GET(url);
|
|
40
40
|
}
|
|
41
|
-
getPersonalInfo() {
|
|
42
|
-
const url = this.resolveURL(`${UserEndpoints.PersonalInfo}/${this.
|
|
41
|
+
async getPersonalInfo() {
|
|
42
|
+
const url = this.resolveURL(`${UserEndpoints.PersonalInfo}/${await this.userId()}`);
|
|
43
43
|
return this.GET(url);
|
|
44
44
|
}
|
|
45
|
-
getLatestHistory() {
|
|
46
|
-
const url = this.resolveURL(`${UserEndpoints.HistoryLatest}/${this.
|
|
45
|
+
async getLatestHistory() {
|
|
46
|
+
const url = this.resolveURL(`${UserEndpoints.HistoryLatest}/${await this.userId()}`);
|
|
47
47
|
return this.GET(url);
|
|
48
48
|
}
|
|
49
|
-
getIdentification() {
|
|
50
|
-
const url = this.resolveURL(`${UserEndpoints.Identification}/${this.
|
|
49
|
+
async getIdentification() {
|
|
50
|
+
const url = this.resolveURL(`${UserEndpoints.Identification}/${await this.userId()}`);
|
|
51
51
|
return this.GET(url, { flags: { showSensitiveData: true } });
|
|
52
52
|
}
|
|
53
|
-
getHistory() {
|
|
54
|
-
const url = this.resolveURL(`${UserEndpoints.HistoryLatest}/${this.
|
|
53
|
+
async getHistory() {
|
|
54
|
+
const url = this.resolveURL(`${UserEndpoints.HistoryLatest}/${await this.userId()}`);
|
|
55
55
|
return this.GET(url);
|
|
56
56
|
}
|
|
57
|
-
getGroup() {
|
|
58
|
-
const url = this.resolveURL(`${UserEndpoints.Group}/${this.
|
|
57
|
+
async getGroup() {
|
|
58
|
+
const url = this.resolveURL(`${UserEndpoints.Group}/${await this.userId()}`);
|
|
59
59
|
return this.GET(url);
|
|
60
60
|
}
|
|
61
|
-
getExternalAuth() {
|
|
62
|
-
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${this.
|
|
61
|
+
async getExternalAuth() {
|
|
62
|
+
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${await this.userId()}`);
|
|
63
63
|
return this.GET(url);
|
|
64
64
|
}
|
|
65
|
-
getEmail() {
|
|
66
|
-
const url = this.resolveURL(`${UserEndpoints.Email}/${this.
|
|
65
|
+
async getEmail() {
|
|
66
|
+
const url = this.resolveURL(`${UserEndpoints.Email}/${await this.userId()}`);
|
|
67
67
|
return this.GET(url);
|
|
68
68
|
}
|
|
69
|
-
getDocuments() {
|
|
70
|
-
const url = this.resolveURL(`${UserEndpoints.Documents}/${this.
|
|
69
|
+
async getDocuments() {
|
|
70
|
+
const url = this.resolveURL(`${UserEndpoints.Documents}/${await this.userId()}`);
|
|
71
71
|
return this.GET(url);
|
|
72
72
|
}
|
|
73
|
-
getCurrency() {
|
|
74
|
-
const url = this.resolveURL(`${UserEndpoints.Currency}/${this.
|
|
73
|
+
async getCurrency() {
|
|
74
|
+
const url = this.resolveURL(`${UserEndpoints.Currency}/${await this.userId()}`);
|
|
75
75
|
return this.GET(url);
|
|
76
76
|
}
|
|
77
|
-
getCreditCard() {
|
|
78
|
-
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${this.
|
|
77
|
+
async getCreditCard() {
|
|
78
|
+
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${await this.userId()}`);
|
|
79
79
|
return this.GET(url);
|
|
80
80
|
}
|
|
81
|
-
getBankAccount() {
|
|
82
|
-
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${this.
|
|
81
|
+
async getBankAccount() {
|
|
82
|
+
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${await this.userId()}`);
|
|
83
83
|
return this.GET(url, { flags: { showSensitiveData: true } });
|
|
84
84
|
}
|
|
85
|
-
getAddress() {
|
|
86
|
-
const url = this.resolveURL(`${UserEndpoints.Address}/${this.
|
|
85
|
+
async getAddress() {
|
|
86
|
+
const url = this.resolveURL(`${UserEndpoints.Address}/${await this.userId()}`);
|
|
87
87
|
return this.GET(url, { flags: { showSensitiveData: true } });
|
|
88
88
|
}
|
|
89
|
-
getAccount() {
|
|
90
|
-
const url = this.resolveURL(`${UserEndpoints.Account}/${this.
|
|
89
|
+
async getAccount() {
|
|
90
|
+
const url = this.resolveURL(`${UserEndpoints.Account}/${await this.userId()}`);
|
|
91
91
|
return this.GET(url);
|
|
92
92
|
}
|
|
93
|
-
getDeviceHistory() {
|
|
94
|
-
const url = this.resolveURL(`${UserEndpoints.DeviceHistory}/${this.
|
|
93
|
+
async getDeviceHistory() {
|
|
94
|
+
const url = this.resolveURL(`${UserEndpoints.DeviceHistory}/${await this.userId()}`);
|
|
95
95
|
return this.GET(url);
|
|
96
96
|
}
|
|
97
|
-
getActivity() {
|
|
98
|
-
const url = this.resolveURL(`${UserEndpoints.Activity}/${this.
|
|
97
|
+
async getActivity() {
|
|
98
|
+
const url = this.resolveURL(`${UserEndpoints.Activity}/${await this.userId()}`);
|
|
99
99
|
return this.GET(url);
|
|
100
100
|
}
|
|
101
101
|
// #endregion
|
|
@@ -104,180 +104,180 @@ class UserService extends BaseService {
|
|
|
104
104
|
const url = this.resolveURL();
|
|
105
105
|
return this.POST(url, payload);
|
|
106
106
|
}
|
|
107
|
-
createPhone(payload) {
|
|
108
|
-
const url = this.resolveURL(`${UserEndpoints.Phone}/${this.
|
|
107
|
+
async createPhone(payload) {
|
|
108
|
+
const url = this.resolveURL(`${UserEndpoints.Phone}/${await this.userId()}`);
|
|
109
109
|
return this.POST(url, payload);
|
|
110
110
|
}
|
|
111
|
-
createDevice(payload) {
|
|
112
|
-
const url = this.resolveURL(`${UserEndpoints.Device}/${this.
|
|
111
|
+
async createDevice(payload) {
|
|
112
|
+
const url = this.resolveURL(`${UserEndpoints.Device}/${await this.userId()}`);
|
|
113
113
|
return this.POST(url, payload);
|
|
114
114
|
}
|
|
115
|
-
createIdentification(payload) {
|
|
116
|
-
const url = this.resolveURL(`${UserEndpoints.Identification}/${this.
|
|
115
|
+
async createIdentification(payload) {
|
|
116
|
+
const url = this.resolveURL(`${UserEndpoints.Identification}/${await this.userId()}`);
|
|
117
117
|
return this.POST(url, payload);
|
|
118
118
|
}
|
|
119
|
-
createExternalAuth(payload) {
|
|
120
|
-
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${this.
|
|
119
|
+
async createExternalAuth(payload) {
|
|
120
|
+
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${await this.userId()}`);
|
|
121
121
|
return this.POST(url, payload);
|
|
122
122
|
}
|
|
123
|
-
createEmail(payload) {
|
|
124
|
-
const url = this.resolveURL(`${UserEndpoints.Email}/${this.
|
|
123
|
+
async createEmail(payload) {
|
|
124
|
+
const url = this.resolveURL(`${UserEndpoints.Email}/${await this.userId()}`);
|
|
125
125
|
return this.POST(url, payload);
|
|
126
126
|
}
|
|
127
|
-
createCurrency(payload) {
|
|
128
|
-
const url = this.resolveURL(`${UserEndpoints.Currency}/${this.
|
|
127
|
+
async createCurrency(payload) {
|
|
128
|
+
const url = this.resolveURL(`${UserEndpoints.Currency}/${await this.userId()}`);
|
|
129
129
|
return this.POST(url, payload);
|
|
130
130
|
}
|
|
131
|
-
createCreditCard(payload) {
|
|
132
|
-
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${this.
|
|
131
|
+
async createCreditCard(payload) {
|
|
132
|
+
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${await this.userId()}`);
|
|
133
133
|
return this.POST(url, payload);
|
|
134
134
|
}
|
|
135
|
-
createBankAccount(payload) {
|
|
136
|
-
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${this.
|
|
135
|
+
async createBankAccount(payload) {
|
|
136
|
+
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${await this.userId()}`);
|
|
137
137
|
return this.POST(url, payload);
|
|
138
138
|
}
|
|
139
|
-
createAddress(payload) {
|
|
140
|
-
const url = this.resolveURL(`${UserEndpoints.Address}/${this.
|
|
139
|
+
async createAddress(payload) {
|
|
140
|
+
const url = this.resolveURL(`${UserEndpoints.Address}/${await this.userId()}`);
|
|
141
141
|
return this.POST(url, payload);
|
|
142
142
|
}
|
|
143
|
-
createTicket(payload) {
|
|
144
|
-
const url = this.resolveURL(`${UserEndpoints.Ticket}/${this.
|
|
143
|
+
async createTicket(payload) {
|
|
144
|
+
const url = this.resolveURL(`${UserEndpoints.Ticket}/${await this.userId()}`);
|
|
145
145
|
return this.POST(url, payload);
|
|
146
146
|
}
|
|
147
|
-
securityAccess(payload) {
|
|
148
|
-
const url = this.resolveURL(`${UserEndpoints.SecurityAccess}/${this.
|
|
147
|
+
async securityAccess(payload) {
|
|
148
|
+
const url = this.resolveURL(`${UserEndpoints.SecurityAccess}/${await this.userId()}`);
|
|
149
149
|
return this.POST(url, payload);
|
|
150
150
|
}
|
|
151
|
-
uploadDocument(payload) {
|
|
152
|
-
const url = this.resolveURL(`${UserEndpoints.Document}/${this.
|
|
151
|
+
async uploadDocument(payload) {
|
|
152
|
+
const url = this.resolveURL(`${UserEndpoints.Document}/${await this.userId()}`);
|
|
153
153
|
return this.POST(url, payload);
|
|
154
154
|
}
|
|
155
|
-
confirmSecurityData(payload) {
|
|
156
|
-
const url = this.resolveURL(`${UserEndpoints.SecurityConfirm}/${this.
|
|
155
|
+
async confirmSecurityData(payload) {
|
|
156
|
+
const url = this.resolveURL(`${UserEndpoints.SecurityConfirm}/${await this.userId()}`);
|
|
157
157
|
return this.POST(url, payload);
|
|
158
158
|
}
|
|
159
|
-
validateSecurityData(payload) {
|
|
160
|
-
const url = this.resolveURL(`${UserEndpoints.SecurityValidate}/${this.
|
|
159
|
+
async validateSecurityData(payload) {
|
|
160
|
+
const url = this.resolveURL(`${UserEndpoints.SecurityValidate}/${await this.userId()}`);
|
|
161
161
|
return this.POST(url, payload);
|
|
162
162
|
}
|
|
163
|
-
verifySecurityData(payload) {
|
|
164
|
-
const url = this.resolveURL(`${UserEndpoints.SecurityVerify}/${this.
|
|
163
|
+
async verifySecurityData(payload) {
|
|
164
|
+
const url = this.resolveURL(`${UserEndpoints.SecurityVerify}/${await this.userId()}`);
|
|
165
165
|
return this.POST(url, payload);
|
|
166
166
|
}
|
|
167
|
-
resetSecurityData(payload) {
|
|
168
|
-
const url = this.resolveURL(`${UserEndpoints.SecurityReset}/${this.
|
|
167
|
+
async resetSecurityData(payload) {
|
|
168
|
+
const url = this.resolveURL(`${UserEndpoints.SecurityReset}/${await this.userId()}`);
|
|
169
169
|
return this.POST(url, payload);
|
|
170
170
|
}
|
|
171
|
-
enrollGoogleAuth(payload) {
|
|
172
|
-
const url = this.resolveURL(`${UserEndpoints.AuthEnroll}/${this.
|
|
171
|
+
async enrollGoogleAuth(payload) {
|
|
172
|
+
const url = this.resolveURL(`${UserEndpoints.AuthEnroll}/${await this.userId()}`);
|
|
173
173
|
return this.POST(url, payload);
|
|
174
174
|
}
|
|
175
|
-
activateGoogleAuth(payload) {
|
|
176
|
-
const url = this.resolveURL(`${UserEndpoints.AuthActivate}/${this.
|
|
175
|
+
async activateGoogleAuth(payload) {
|
|
176
|
+
const url = this.resolveURL(`${UserEndpoints.AuthActivate}/${await this.userId()}`);
|
|
177
177
|
return this.POST(url, payload);
|
|
178
178
|
}
|
|
179
|
-
deactivateGoogleAuth(payload) {
|
|
180
|
-
const url = this.resolveURL(`${UserEndpoints.AuthDeactivate}/${this.
|
|
179
|
+
async deactivateGoogleAuth(payload) {
|
|
180
|
+
const url = this.resolveURL(`${UserEndpoints.AuthDeactivate}/${await this.userId()}`);
|
|
181
181
|
return this.POST(url, payload);
|
|
182
182
|
}
|
|
183
|
-
deleteGoogleAuth(payload) {
|
|
184
|
-
const url = this.resolveURL(`${UserEndpoints.AuthDelete}/${this.
|
|
183
|
+
async deleteGoogleAuth(payload) {
|
|
184
|
+
const url = this.resolveURL(`${UserEndpoints.AuthDelete}/${await this.userId()}`);
|
|
185
185
|
return this.POST(url, payload);
|
|
186
186
|
}
|
|
187
187
|
// #endregion
|
|
188
188
|
// #region "PUT"
|
|
189
|
-
updateUser(payload) {
|
|
190
|
-
const url = this.resolveURL(`/${this.
|
|
189
|
+
async updateUser(payload) {
|
|
190
|
+
const url = this.resolveURL(`/${await this.userId()}`);
|
|
191
191
|
return this.PUT(url, payload);
|
|
192
192
|
}
|
|
193
|
-
updateSecurity(payload) {
|
|
194
|
-
const url = this.resolveURL(`${UserEndpoints.Security}/${this.
|
|
193
|
+
async updateSecurity(payload) {
|
|
194
|
+
const url = this.resolveURL(`${UserEndpoints.Security}/${await this.userId()}`);
|
|
195
195
|
return this.PUT(url, payload);
|
|
196
196
|
}
|
|
197
|
-
updatePreferences(payload) {
|
|
198
|
-
const url = this.resolveURL(`${UserEndpoints.Preferences}/${this.
|
|
197
|
+
async updatePreferences(payload) {
|
|
198
|
+
const url = this.resolveURL(`${UserEndpoints.Preferences}/${await this.userId()}`);
|
|
199
199
|
return this.PUT(url, payload);
|
|
200
200
|
}
|
|
201
|
-
updateDevice(payload) {
|
|
202
|
-
const url = this.resolveURL(`${UserEndpoints.Device}/${this.
|
|
201
|
+
async updateDevice(payload) {
|
|
202
|
+
const url = this.resolveURL(`${UserEndpoints.Device}/${await this.userId()}`);
|
|
203
203
|
return this.PUT(url, payload);
|
|
204
204
|
}
|
|
205
|
-
logoutDevice(payload) {
|
|
206
|
-
const url = this.resolveURL(`${UserEndpoints.DeviceLogout}/${this.
|
|
205
|
+
async logoutDevice(payload) {
|
|
206
|
+
const url = this.resolveURL(`${UserEndpoints.DeviceLogout}/${await this.userId()}`);
|
|
207
207
|
return this.PUT(url, payload);
|
|
208
208
|
}
|
|
209
|
-
updatePhone(payload) {
|
|
210
|
-
const url = this.resolveURL(`${UserEndpoints.Phone}/${this.
|
|
209
|
+
async updatePhone(payload) {
|
|
210
|
+
const url = this.resolveURL(`${UserEndpoints.Phone}/${await this.userId()}`);
|
|
211
211
|
return this.PUT(url, payload);
|
|
212
212
|
}
|
|
213
|
-
updatePersonalInfo(payload) {
|
|
214
|
-
const url = this.resolveURL(`${UserEndpoints.PersonalInfo}/${this.
|
|
213
|
+
async updatePersonalInfo(payload) {
|
|
214
|
+
const url = this.resolveURL(`${UserEndpoints.PersonalInfo}/${await this.userId()}`);
|
|
215
215
|
return this.PUT(url, payload);
|
|
216
216
|
}
|
|
217
|
-
updateIdentification(payload) {
|
|
218
|
-
const url = this.resolveURL(`${UserEndpoints.Identification}/${this.
|
|
217
|
+
async updateIdentification(payload) {
|
|
218
|
+
const url = this.resolveURL(`${UserEndpoints.Identification}/${await this.userId()}`);
|
|
219
219
|
return this.PUT(url, payload);
|
|
220
220
|
}
|
|
221
|
-
updateExternalAuth(payload) {
|
|
222
|
-
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${this.
|
|
221
|
+
async updateExternalAuth(payload) {
|
|
222
|
+
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${await this.userId()}`);
|
|
223
223
|
return this.PUT(url, payload);
|
|
224
224
|
}
|
|
225
|
-
updateEmail(payload) {
|
|
226
|
-
const url = this.resolveURL(`${UserEndpoints.Email}/${this.
|
|
225
|
+
async updateEmail(payload) {
|
|
226
|
+
const url = this.resolveURL(`${UserEndpoints.Email}/${await this.userId()}`);
|
|
227
227
|
return this.PUT(url, payload);
|
|
228
228
|
}
|
|
229
|
-
updateCreditCard(payload) {
|
|
230
|
-
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${this.
|
|
229
|
+
async updateCreditCard(payload) {
|
|
230
|
+
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${await this.userId()}`);
|
|
231
231
|
return this.PUT(url, payload);
|
|
232
232
|
}
|
|
233
|
-
updateBankAccount(payload) {
|
|
234
|
-
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${this.
|
|
233
|
+
async updateBankAccount(payload) {
|
|
234
|
+
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${await this.userId()}`);
|
|
235
235
|
return this.PUT(url, payload);
|
|
236
236
|
}
|
|
237
|
-
updateAddress(payload) {
|
|
238
|
-
const url = this.resolveURL(`${UserEndpoints.Address}/${this.
|
|
237
|
+
async updateAddress(payload) {
|
|
238
|
+
const url = this.resolveURL(`${UserEndpoints.Address}/${await this.userId()}`);
|
|
239
239
|
return this.PUT(url, payload);
|
|
240
240
|
}
|
|
241
|
-
updateUserType(payload) {
|
|
242
|
-
const url = this.resolveURL(`${UserEndpoints.Type}/${this.
|
|
241
|
+
async updateUserType(payload) {
|
|
242
|
+
const url = this.resolveURL(`${UserEndpoints.Type}/${await this.userId()}`);
|
|
243
243
|
return this.PUT(url, payload);
|
|
244
244
|
}
|
|
245
245
|
// #endregion
|
|
246
246
|
// #region "DELETE"
|
|
247
|
-
deleteUser() {
|
|
248
|
-
const url = this.resolveURL(`/${this.
|
|
247
|
+
async deleteUser() {
|
|
248
|
+
const url = this.resolveURL(`/${await this.userId()}`);
|
|
249
249
|
return this.DELETE(url);
|
|
250
250
|
}
|
|
251
|
-
deleteCreditCard() {
|
|
252
|
-
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${this.
|
|
251
|
+
async deleteCreditCard() {
|
|
252
|
+
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${await this.userId()}`);
|
|
253
253
|
return this.DELETE(url);
|
|
254
254
|
}
|
|
255
|
-
deleteAddress(payload) {
|
|
256
|
-
const url = this.resolveURL(`${UserEndpoints.Address}/${this.
|
|
255
|
+
async deleteAddress(payload) {
|
|
256
|
+
const url = this.resolveURL(`${UserEndpoints.Address}/${await this.userId()}`);
|
|
257
257
|
return this.DELETE(url, payload);
|
|
258
258
|
}
|
|
259
|
-
deleteDevice(payload) {
|
|
260
|
-
const url = this.resolveURL(`${UserEndpoints.Device}/${this.
|
|
259
|
+
async deleteDevice(payload) {
|
|
260
|
+
const url = this.resolveURL(`${UserEndpoints.Device}/${await this.userId()}`);
|
|
261
261
|
return this.DELETE(url, payload);
|
|
262
262
|
}
|
|
263
|
-
deleteBankAccount(payload) {
|
|
264
|
-
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${this.
|
|
263
|
+
async deleteBankAccount(payload) {
|
|
264
|
+
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${await this.userId()}`);
|
|
265
265
|
return this.DELETE(url, payload);
|
|
266
266
|
}
|
|
267
|
-
deleteIdentification(payload) {
|
|
268
|
-
const url = this.resolveURL(`${UserEndpoints.Identification}/${this.
|
|
267
|
+
async deleteIdentification(payload) {
|
|
268
|
+
const url = this.resolveURL(`${UserEndpoints.Identification}/${await this.userId()}`);
|
|
269
269
|
return this.DELETE(url, payload);
|
|
270
270
|
}
|
|
271
|
-
deleteEmail(payload) {
|
|
272
|
-
const url = this.resolveURL(`${UserEndpoints.Email}/${this.
|
|
271
|
+
async deleteEmail(payload) {
|
|
272
|
+
const url = this.resolveURL(`${UserEndpoints.Email}/${await this.userId()}`);
|
|
273
273
|
return this.DELETE(url, payload);
|
|
274
274
|
}
|
|
275
|
-
deletePhone(payload) {
|
|
276
|
-
const url = this.resolveURL(`${UserEndpoints.Phone}/${this.
|
|
275
|
+
async deletePhone(payload) {
|
|
276
|
+
const url = this.resolveURL(`${UserEndpoints.Phone}/${await this.userId()}`);
|
|
277
277
|
return this.DELETE(url, payload);
|
|
278
278
|
}
|
|
279
|
-
deleteExternalAuth() {
|
|
280
|
-
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${this.
|
|
279
|
+
async deleteExternalAuth() {
|
|
280
|
+
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${await this.userId()}`);
|
|
281
281
|
return this.DELETE(url);
|
|
282
282
|
}
|
|
283
283
|
}
|
|
@@ -42,8 +42,8 @@ class AxiosHelper {
|
|
|
42
42
|
config.headers[key] = value;
|
|
43
43
|
};
|
|
44
44
|
static injectBaseHeaders = async (req, context, cookiesHelper, endpoint) => {
|
|
45
|
-
const token =
|
|
46
|
-
const userId =
|
|
45
|
+
const token = await cookiesHelper.getAccessToken();
|
|
46
|
+
const userId = await cookiesHelper.getUserId();
|
|
47
47
|
const lang = context.getLang();
|
|
48
48
|
const iid = await cookiesHelper.getIID();
|
|
49
49
|
const baseURL = context.getBaseUrl();
|
|
@@ -36,6 +36,8 @@ declare class CookiesHelper {
|
|
|
36
36
|
getDEK(): Promise<string>;
|
|
37
37
|
setDEK(deviceEncryptionKey: string, USR: USR): Promise<void>;
|
|
38
38
|
validateDEK(DEK: string): Promise<boolean>;
|
|
39
|
+
getUserId(): Promise<number>;
|
|
40
|
+
getDeviceId(): Promise<number>;
|
|
39
41
|
getUSR(): Promise<USR | null>;
|
|
40
42
|
setUSR(deviceId: string, userId: string): Promise<void>;
|
|
41
43
|
validateUSR(USR: string): Promise<boolean>;
|
|
@@ -218,6 +218,28 @@ class CookiesHelper {
|
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
// #endregion
|
|
221
|
+
// #region "User ID / Device ID"
|
|
222
|
+
async getUserId() {
|
|
223
|
+
try {
|
|
224
|
+
const USR = await this.getUSR();
|
|
225
|
+
return Number(USR?.user_id || 0);
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
this.errorHandler(error);
|
|
229
|
+
return 0;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
async getDeviceId() {
|
|
233
|
+
try {
|
|
234
|
+
const USR = await this.getUSR();
|
|
235
|
+
return Number(USR?.device_id || 0);
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
this.errorHandler(error);
|
|
239
|
+
return 0;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
// #endregion
|
|
221
243
|
// #region "USR"
|
|
222
244
|
async getUSR() {
|
|
223
245
|
try {
|
|
@@ -22,11 +22,5 @@ interface ClientContextProvider {
|
|
|
22
22
|
getProgramId(): number;
|
|
23
23
|
getLang(): string;
|
|
24
24
|
setLang(lang: string): void;
|
|
25
|
-
getInstallationId(): string;
|
|
26
|
-
setInstallationId(installationId: string): void;
|
|
27
|
-
getToken(): string;
|
|
28
|
-
setToken(token: string): void;
|
|
29
|
-
getUserId(): number;
|
|
30
|
-
setUserId(userId: number): void;
|
|
31
25
|
}
|
|
32
26
|
export type { InitialContext, ClientContextProvider };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ggez-banking-sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"description": "A Node.js package to handle GGEZ Banking API endpoints, Simplify the process of managing CRUD operations with this efficient and easy-to-use package.",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|