ggez-banking-sdk 0.0.2 → 0.0.4
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/package.json +10 -2
- package/README.md +0 -0
- package/dist/bank-system/constants/enum.d.ts +0 -1057
- package/dist/bank-system/constants/enum.js +0 -1110
- package/dist/bank-system/constants/index.d.ts +0 -1
- package/dist/bank-system/constants/index.js +0 -17
- package/dist/bank-system/content/accountCurrencies.d.ts +0 -12
- package/dist/bank-system/content/accountCurrencies.js +0 -37
- package/dist/bank-system/content/countries.d.ts +0 -24
- package/dist/bank-system/content/countries.js +0 -6472
- package/dist/bank-system/content/currencies.d.ts +0 -32
- package/dist/bank-system/content/currencies.js +0 -5836
- package/dist/bank-system/content/index.d.ts +0 -4
- package/dist/bank-system/content/index.js +0 -12
- package/dist/bank-system/content/state.d.ts +0 -6
- package/dist/bank-system/content/state.js +0 -350
- package/dist/bank-system/helper/data.d.ts +0 -46
- package/dist/bank-system/helper/data.js +0 -57
- package/dist/bank-system/helper/dataStructure.d.ts +0 -3220
- package/dist/bank-system/helper/dataStructure.js +0 -1051
- package/dist/bank-system/helper/index.d.ts +0 -28
- package/dist/bank-system/helper/index.js +0 -394
- package/dist/bank-system/interfaces/accountInterface.d.ts +0 -26
- package/dist/bank-system/interfaces/accountInterface.js +0 -2
- package/dist/bank-system/interfaces/bankingSystemInterface.d.ts +0 -306
- package/dist/bank-system/interfaces/bankingSystemInterface.js +0 -2
- package/dist/bank-system/interfaces/deviceInterface.d.ts +0 -34
- package/dist/bank-system/interfaces/deviceInterface.js +0 -2
- package/dist/bank-system/interfaces/index.d.ts +0 -4
- package/dist/bank-system/interfaces/index.js +0 -20
- package/dist/bank-system/interfaces/interface.d.ts +0 -460
- package/dist/bank-system/interfaces/interface.js +0 -2
- package/dist/bank-system/interfaces/organizationInterface.d.ts +0 -118
- package/dist/bank-system/interfaces/organizationInterface.js +0 -2
- package/dist/bank-system/interfaces/signInterface.d.ts +0 -89
- package/dist/bank-system/interfaces/signInterface.js +0 -2
- package/dist/bank-system/interfaces/transactionInterface.d.ts +0 -17
- package/dist/bank-system/interfaces/transactionInterface.js +0 -2
- package/dist/bank-system/restApi/index.d.ts +0 -8
- package/dist/bank-system/restApi/index.js +0 -41
- package/dist/bank-system/services/account.d.ts +0 -33
- package/dist/bank-system/services/account.js +0 -129
- package/dist/bank-system/services/addresses.d.ts +0 -48
- package/dist/bank-system/services/addresses.js +0 -130
- package/dist/bank-system/services/auth.d.ts +0 -71
- package/dist/bank-system/services/auth.js +0 -250
- package/dist/bank-system/services/bankAccount.d.ts +0 -48
- package/dist/bank-system/services/bankAccount.js +0 -131
- package/dist/bank-system/services/device.d.ts +0 -46
- package/dist/bank-system/services/device.js +0 -212
- package/dist/bank-system/services/document.d.ts +0 -15
- package/dist/bank-system/services/document.js +0 -58
- package/dist/bank-system/services/email.d.ts +0 -70
- package/dist/bank-system/services/email.js +0 -175
- package/dist/bank-system/services/history.d.ts +0 -14
- package/dist/bank-system/services/history.js +0 -55
- package/dist/bank-system/services/identification.d.ts +0 -37
- package/dist/bank-system/services/identification.js +0 -107
- package/dist/bank-system/services/index.d.ts +0 -17
- package/dist/bank-system/services/index.js +0 -35
- package/dist/bank-system/services/organization.d.ts +0 -28
- package/dist/bank-system/services/organization.js +0 -129
- package/dist/bank-system/services/personalInfo.d.ts +0 -26
- package/dist/bank-system/services/personalInfo.js +0 -91
- package/dist/bank-system/services/phone.d.ts +0 -70
- package/dist/bank-system/services/phone.js +0 -175
- package/dist/bank-system/services/security.d.ts +0 -114
- package/dist/bank-system/services/security.js +0 -267
- package/dist/bank-system/services/token.d.ts +0 -11
- package/dist/bank-system/services/token.js +0 -83
- package/dist/bank-system/services/transaction.d.ts +0 -9
- package/dist/bank-system/services/transaction.js +0 -62
- package/dist/bank-system/services/verifyAndConfirm.d.ts +0 -116
- package/dist/bank-system/services/verifyAndConfirm.js +0 -308
- package/dist/bank-system/utils/chainAddressMasking.d.ts +0 -2
- package/dist/bank-system/utils/chainAddressMasking.js +0 -12
- package/dist/bank-system/utils/copyText.d.ts +0 -5
- package/dist/bank-system/utils/copyText.js +0 -22
- package/dist/bank-system/utils/countryAndCurrencyData.d.ts +0 -11
- package/dist/bank-system/utils/countryAndCurrencyData.js +0 -22
- package/dist/bank-system/utils/enumToOption.d.ts +0 -4
- package/dist/bank-system/utils/enumToOption.js +0 -18
- package/dist/bank-system/utils/fillDeviceDetails.d.ts +0 -23
- package/dist/bank-system/utils/fillDeviceDetails.js +0 -44
- package/dist/bank-system/utils/generateOneLiner.d.ts +0 -1
- package/dist/bank-system/utils/generateOneLiner.js +0 -17
- package/dist/bank-system/utils/generateSourceId.d.ts +0 -1
- package/dist/bank-system/utils/generateSourceId.js +0 -13
- package/dist/bank-system/utils/getCountryName.d.ts +0 -1
- package/dist/bank-system/utils/getCountryName.js +0 -16
- package/dist/bank-system/utils/getEnumName.d.ts +0 -1
- package/dist/bank-system/utils/getEnumName.js +0 -10
- package/dist/bank-system/utils/getStateByCountryCode.d.ts +0 -1
- package/dist/bank-system/utils/getStateByCountryCode.js +0 -15
- package/dist/bank-system/utils/handleEncryption/decryptData.d.ts +0 -15
- package/dist/bank-system/utils/handleEncryption/decryptData.js +0 -78
- package/dist/bank-system/utils/handleEncryption/encryptData.d.ts +0 -2
- package/dist/bank-system/utils/handleEncryption/encryptData.js +0 -37
- package/dist/bank-system/utils/handleEncryption/index.d.ts +0 -4
- package/dist/bank-system/utils/handleEncryption/index.js +0 -12
- package/dist/bank-system/utils/handleEncryption/key.d.ts +0 -13
- package/dist/bank-system/utils/handleEncryption/key.js +0 -40
- package/dist/bank-system/utils/index.d.ts +0 -15
- package/dist/bank-system/utils/index.js +0 -42
- package/dist/bank-system/utils/info.d.ts +0 -8
- package/dist/bank-system/utils/info.js +0 -79
- package/dist/bank-system/utils/maskingFunction.d.ts +0 -1
- package/dist/bank-system/utils/maskingFunction.js +0 -28
- package/dist/bank-system/utils/regex.d.ts +0 -106
- package/dist/bank-system/utils/regex.js +0 -110
- package/dist/bank-system/utils/sortUserInfo.d.ts +0 -1
- package/dist/bank-system/utils/sortUserInfo.js +0 -43
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -54
- package/dist/keplr-config/chainInfo.d.ts +0 -8
- package/dist/keplr-config/chainInfo.js +0 -111
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.useAuth = void 0;
|
|
16
|
-
const token_1 = require("./token");
|
|
17
|
-
const restApi_1 = __importDefault(require("../restApi"));
|
|
18
|
-
const helper_1 = __importDefault(require("../helper"));
|
|
19
|
-
const dataStructure_1 = __importDefault(require("../helper/dataStructure"));
|
|
20
|
-
// https://dapi.ggez.one/Service/V1/user
|
|
21
|
-
const useAuth = (baseUrl, nodeUrl, userInfo, tokenData, programId, geoCoordinates, lang) => {
|
|
22
|
-
let endPointUser = "V1/user";
|
|
23
|
-
const { checkResponse, headerConfig, convertDataToUrlEncoded } = (0, helper_1.default)(userInfo);
|
|
24
|
-
const { dataSignInUrlEncoded, dataSignInUrlEncodedWithGoogle, dataSignInDeviceEncoded, } = convertDataToUrlEncoded();
|
|
25
|
-
const { checkUserResponseAuth, errorHandler } = checkResponse();
|
|
26
|
-
const { dataSignUpApi, dataSignUpWithGoogle } = (0, dataStructure_1.default)();
|
|
27
|
-
const { CreateLimitedToken } = (0, token_1.useToken)(userInfo, nodeUrl, programId, "", geoCoordinates);
|
|
28
|
-
const GetUser = (installationId, token, userId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
-
var _a, _b, _c;
|
|
30
|
-
try {
|
|
31
|
-
let endPoint = `${endPointUser}/${userId}`;
|
|
32
|
-
let headersData = {
|
|
33
|
-
header: true,
|
|
34
|
-
isUrlEncoded: false,
|
|
35
|
-
token: token,
|
|
36
|
-
lang: lang,
|
|
37
|
-
installationId: installationId,
|
|
38
|
-
};
|
|
39
|
-
let headers = headerConfig(headersData);
|
|
40
|
-
const response = yield restApi_1.default.restApi(baseUrl, "GET", endPoint, headers);
|
|
41
|
-
checkUserResponseAuth(response, false, "GetUser");
|
|
42
|
-
return {
|
|
43
|
-
response: response,
|
|
44
|
-
newUser: {},
|
|
45
|
-
message: (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.friendly_message) !== null && _c !== void 0 ? _c : "Get User Successfully",
|
|
46
|
-
status: "success",
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
return {
|
|
51
|
-
response: error.response,
|
|
52
|
-
newUser: null,
|
|
53
|
-
message: error.message,
|
|
54
|
-
status: "failed",
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
const SignUpApi = (values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
-
var _d, _e, _f, _g;
|
|
60
|
-
let data = dataSignUpApi(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
|
|
61
|
-
let token;
|
|
62
|
-
let { message, response, status } = yield CreateLimitedToken(tokenData);
|
|
63
|
-
if (status == "success") {
|
|
64
|
-
token = (_d = response === null || response === void 0 ? void 0 : response.data) === null || _d === void 0 ? void 0 : _d.access_token;
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
errorHandler(message, "SignUpApi", response);
|
|
68
|
-
// throw new Error(response);
|
|
69
|
-
}
|
|
70
|
-
let headersData = {
|
|
71
|
-
header: true,
|
|
72
|
-
isUrlEncoded: false,
|
|
73
|
-
token: token,
|
|
74
|
-
lang: lang,
|
|
75
|
-
};
|
|
76
|
-
let headers = headerConfig(headersData);
|
|
77
|
-
try {
|
|
78
|
-
const response = yield restApi_1.default.restApi(baseUrl, "POST", endPointUser, headers, data);
|
|
79
|
-
checkUserResponseAuth(response, true, "SignUpApi");
|
|
80
|
-
return {
|
|
81
|
-
response: response,
|
|
82
|
-
newUser: {},
|
|
83
|
-
message: (_g = (_f = (_e = response === null || response === void 0 ? void 0 : response.data) === null || _e === void 0 ? void 0 : _e.result) === null || _f === void 0 ? void 0 : _f.friendly_message) !== null && _g !== void 0 ? _g : "SignUp Api Successfully",
|
|
84
|
-
status: "success",
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
catch (error) {
|
|
88
|
-
return {
|
|
89
|
-
response: error.response,
|
|
90
|
-
newUser: null,
|
|
91
|
-
message: error.message,
|
|
92
|
-
status: "failed",
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
const LoginRequest = (values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
97
|
-
var _h, _j, _k;
|
|
98
|
-
let data = dataSignInUrlEncoded(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }), programId);
|
|
99
|
-
let headersData = {
|
|
100
|
-
header: true,
|
|
101
|
-
isUrlEncoded: true,
|
|
102
|
-
token: null,
|
|
103
|
-
lang: lang,
|
|
104
|
-
};
|
|
105
|
-
let headers = headerConfig(headersData);
|
|
106
|
-
try {
|
|
107
|
-
const response = yield restApi_1.default.restApi(baseUrl, "POST", "oauth/token", headers, data);
|
|
108
|
-
if (response.data.access_token) {
|
|
109
|
-
return {
|
|
110
|
-
response: response,
|
|
111
|
-
newUser: {},
|
|
112
|
-
message: (_k = (_j = (_h = response === null || response === void 0 ? void 0 : response.data) === null || _h === void 0 ? void 0 : _h.result) === null || _j === void 0 ? void 0 : _j.friendly_message) !== null && _k !== void 0 ? _k : "Login Request Successfully",
|
|
113
|
-
status: "success",
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
return {
|
|
117
|
-
response: response,
|
|
118
|
-
newUser: null,
|
|
119
|
-
message: response.data.error,
|
|
120
|
-
status: "failed",
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
catch (error) {
|
|
124
|
-
return {
|
|
125
|
-
response: error.response,
|
|
126
|
-
newUser: null,
|
|
127
|
-
message: error.message,
|
|
128
|
-
status: "failed",
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
const LoginDeviceCredential = (values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
133
|
-
var _l, _m, _o;
|
|
134
|
-
let data = dataSignInDeviceEncoded(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }), programId);
|
|
135
|
-
let headersData = {
|
|
136
|
-
header: true,
|
|
137
|
-
isUrlEncoded: true,
|
|
138
|
-
token: null,
|
|
139
|
-
lang: lang,
|
|
140
|
-
};
|
|
141
|
-
let headers = headerConfig(headersData);
|
|
142
|
-
try {
|
|
143
|
-
const response = yield restApi_1.default.restApi(baseUrl, "POST", "oauth/token", headers, data);
|
|
144
|
-
if (response.data.access_token) {
|
|
145
|
-
return {
|
|
146
|
-
response: response,
|
|
147
|
-
newUser: {},
|
|
148
|
-
message: (_o = (_m = (_l = response === null || response === void 0 ? void 0 : response.data) === null || _l === void 0 ? void 0 : _l.result) === null || _m === void 0 ? void 0 : _m.friendly_message) !== null && _o !== void 0 ? _o : "Login Device Credential Successfully",
|
|
149
|
-
status: "success",
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
return {
|
|
153
|
-
response: response,
|
|
154
|
-
newUser: null,
|
|
155
|
-
message: response.data.error,
|
|
156
|
-
status: "failed",
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
catch (error) {
|
|
160
|
-
return {
|
|
161
|
-
response: error.response,
|
|
162
|
-
newUser: null,
|
|
163
|
-
message: error.message,
|
|
164
|
-
status: "failed",
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
const SignUpWithGoogle = (values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
169
|
-
var _p, _q, _r, _s;
|
|
170
|
-
let data = dataSignUpWithGoogle(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
|
|
171
|
-
let token;
|
|
172
|
-
let { message, response, status } = yield CreateLimitedToken(tokenData);
|
|
173
|
-
if (status == "success") {
|
|
174
|
-
token = (_p = response === null || response === void 0 ? void 0 : response.data) === null || _p === void 0 ? void 0 : _p.access_token;
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
errorHandler(message, "SignUpApi", response);
|
|
178
|
-
}
|
|
179
|
-
let headersData = {
|
|
180
|
-
header: true,
|
|
181
|
-
isUrlEncoded: false,
|
|
182
|
-
token: token,
|
|
183
|
-
lang: lang,
|
|
184
|
-
};
|
|
185
|
-
let headers = headerConfig(headersData);
|
|
186
|
-
try {
|
|
187
|
-
const response = yield restApi_1.default.restApi(baseUrl, "POST", endPointUser, headers, data);
|
|
188
|
-
checkUserResponseAuth(response, true, "SignUpWithGoogle");
|
|
189
|
-
return {
|
|
190
|
-
response: response,
|
|
191
|
-
newUser: {},
|
|
192
|
-
message: (_s = (_r = (_q = response === null || response === void 0 ? void 0 : response.data) === null || _q === void 0 ? void 0 : _q.result) === null || _r === void 0 ? void 0 : _r.friendly_message) !== null && _s !== void 0 ? _s : "SignUp With Google Successfully",
|
|
193
|
-
status: "success",
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
catch (error) {
|
|
197
|
-
return {
|
|
198
|
-
response: error.response,
|
|
199
|
-
newUser: null,
|
|
200
|
-
message: error.message,
|
|
201
|
-
status: "failed",
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
const LoginWithGoogle = (values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
206
|
-
var _t, _u, _v;
|
|
207
|
-
let data = dataSignInUrlEncodedWithGoogle(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }), programId);
|
|
208
|
-
let headersData = {
|
|
209
|
-
header: true,
|
|
210
|
-
isUrlEncoded: true,
|
|
211
|
-
token: null,
|
|
212
|
-
lang: lang,
|
|
213
|
-
};
|
|
214
|
-
let headers = headerConfig(headersData);
|
|
215
|
-
try {
|
|
216
|
-
const response = yield restApi_1.default.restApi(baseUrl, "POST", "oauth/token", headers, data);
|
|
217
|
-
if (response.data.access_token) {
|
|
218
|
-
return {
|
|
219
|
-
response: response,
|
|
220
|
-
newUser: {},
|
|
221
|
-
message: (_v = (_u = (_t = response === null || response === void 0 ? void 0 : response.data) === null || _t === void 0 ? void 0 : _t.result) === null || _u === void 0 ? void 0 : _u.friendly_message) !== null && _v !== void 0 ? _v : "Login Request Successfully",
|
|
222
|
-
status: "success",
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
return {
|
|
226
|
-
response: response,
|
|
227
|
-
newUser: null,
|
|
228
|
-
message: response.data.error,
|
|
229
|
-
status: "failed",
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
catch (error) {
|
|
233
|
-
return {
|
|
234
|
-
response: error.response,
|
|
235
|
-
newUser: null,
|
|
236
|
-
message: error.message,
|
|
237
|
-
status: "failed",
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
|
-
return {
|
|
242
|
-
GetUser,
|
|
243
|
-
SignUpApi,
|
|
244
|
-
LoginRequest,
|
|
245
|
-
LoginDeviceCredential,
|
|
246
|
-
SignUpWithGoogle,
|
|
247
|
-
LoginWithGoogle,
|
|
248
|
-
};
|
|
249
|
-
};
|
|
250
|
-
exports.useAuth = useAuth;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { CreateBankAccountInterFace, UpdateBankAccountInterFace, DeleteBankAccountInterFace, MakeBankAccountPrimaryInterFace } from "../interfaces/bankingSystemInterface";
|
|
2
|
-
import { IGeoCoordinates, UserInfo } from "../interfaces/interface";
|
|
3
|
-
export declare const useBankAccount: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, geoCoordinates: IGeoCoordinates, lang?: string) => {
|
|
4
|
-
CreateBankAccount: (values: CreateBankAccountInterFace) => Promise<{
|
|
5
|
-
response: import("axios").AxiosResponse<any, any>;
|
|
6
|
-
newUser: any;
|
|
7
|
-
message: any;
|
|
8
|
-
status: string;
|
|
9
|
-
} | {
|
|
10
|
-
response: any;
|
|
11
|
-
newUser: any;
|
|
12
|
-
message: any;
|
|
13
|
-
status: string;
|
|
14
|
-
}>;
|
|
15
|
-
MakeBankAccountPrimary: (values: MakeBankAccountPrimaryInterFace) => Promise<{
|
|
16
|
-
response: import("axios").AxiosResponse<any, any>;
|
|
17
|
-
newUser: any;
|
|
18
|
-
message: any;
|
|
19
|
-
status: string;
|
|
20
|
-
} | {
|
|
21
|
-
response: any;
|
|
22
|
-
newUser: any;
|
|
23
|
-
message: any;
|
|
24
|
-
status: string;
|
|
25
|
-
}>;
|
|
26
|
-
UpdateBankAccount: (values: UpdateBankAccountInterFace) => Promise<{
|
|
27
|
-
response: import("axios").AxiosResponse<any, any>;
|
|
28
|
-
newUser: any;
|
|
29
|
-
message: any;
|
|
30
|
-
status: string;
|
|
31
|
-
} | {
|
|
32
|
-
response: any;
|
|
33
|
-
newUser: any;
|
|
34
|
-
message: any;
|
|
35
|
-
status: string;
|
|
36
|
-
}>;
|
|
37
|
-
DeleteBankAccount: (values: DeleteBankAccountInterFace) => Promise<{
|
|
38
|
-
response: import("axios").AxiosResponse<any, any>;
|
|
39
|
-
newUser: any;
|
|
40
|
-
message: any;
|
|
41
|
-
status: string;
|
|
42
|
-
} | {
|
|
43
|
-
response: any;
|
|
44
|
-
newUser: any;
|
|
45
|
-
message: any;
|
|
46
|
-
status: string;
|
|
47
|
-
}>;
|
|
48
|
-
};
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.useBankAccount = void 0;
|
|
16
|
-
const dataStructure_1 = __importDefault(require("../helper/dataStructure"));
|
|
17
|
-
const restApi_1 = __importDefault(require("../restApi"));
|
|
18
|
-
const helper_1 = __importDefault(require("../helper"));
|
|
19
|
-
const useBankAccount = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
|
|
20
|
-
const { dataBank } = (0, dataStructure_1.default)();
|
|
21
|
-
const { createDataBank, deleteDataBank, primaryDataBank, updateDataBank } = dataBank();
|
|
22
|
-
const { checkResponse, headerConfig } = (0, helper_1.default)(userInfo);
|
|
23
|
-
const { checkGlobalResponse } = checkResponse();
|
|
24
|
-
let endPointBank = `v1/user/bank_account/${userId}`;
|
|
25
|
-
const headerConfigBankAccount = () => {
|
|
26
|
-
let headersData = {
|
|
27
|
-
header: true,
|
|
28
|
-
isUrlEncoded: false,
|
|
29
|
-
token: token,
|
|
30
|
-
lang: lang,
|
|
31
|
-
};
|
|
32
|
-
let headers = headerConfig(headersData);
|
|
33
|
-
return headers;
|
|
34
|
-
};
|
|
35
|
-
// BankAccount
|
|
36
|
-
const CreateBankAccount = (values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
-
var _a, _b, _c;
|
|
38
|
-
let data = createDataBank(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
|
|
39
|
-
try {
|
|
40
|
-
const response = yield restApi_1.default.restApi(baseUrl, "POST", endPointBank, headerConfigBankAccount(), data);
|
|
41
|
-
let { newUserInfo } = checkGlobalResponse("bank_account", response, "CreateBankAccount", "create");
|
|
42
|
-
return {
|
|
43
|
-
response: response,
|
|
44
|
-
newUser: newUserInfo,
|
|
45
|
-
message: (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.friendly_message) !== null && _c !== void 0 ? _c : "Bank Account Created Successfully",
|
|
46
|
-
status: "success",
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
return {
|
|
51
|
-
response: error.response,
|
|
52
|
-
newUser: null,
|
|
53
|
-
message: error.message,
|
|
54
|
-
status: "failed",
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
const UpdateBankAccount = (values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
-
var _d, _e, _f;
|
|
60
|
-
let data = updateDataBank(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
|
|
61
|
-
try {
|
|
62
|
-
const response = yield restApi_1.default.restApi(baseUrl, "PUT", endPointBank, headerConfigBankAccount(), data);
|
|
63
|
-
let { newUserInfo } = checkGlobalResponse("bank_account", response, "UpdateBankAccount", "update");
|
|
64
|
-
return {
|
|
65
|
-
response: response,
|
|
66
|
-
newUser: newUserInfo,
|
|
67
|
-
message: (_f = (_e = (_d = response === null || response === void 0 ? void 0 : response.data) === null || _d === void 0 ? void 0 : _d.result) === null || _e === void 0 ? void 0 : _e.friendly_message) !== null && _f !== void 0 ? _f : "Bank Account Updated Successfully",
|
|
68
|
-
status: "success",
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
return {
|
|
73
|
-
response: error.response,
|
|
74
|
-
newUser: null,
|
|
75
|
-
message: error.message,
|
|
76
|
-
status: "failed",
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
const MakeBankAccountPrimary = (values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
81
|
-
var _g, _h, _j;
|
|
82
|
-
let data = primaryDataBank(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
|
|
83
|
-
try {
|
|
84
|
-
const response = yield restApi_1.default.restApi(baseUrl, "PUT", endPointBank, headerConfigBankAccount(), data);
|
|
85
|
-
let { newUserInfo } = checkGlobalResponse("bank_account", response, "UpdateBankAccount", "updatePrimary");
|
|
86
|
-
return {
|
|
87
|
-
response: response,
|
|
88
|
-
newUser: newUserInfo,
|
|
89
|
-
message: (_j = (_h = (_g = response === null || response === void 0 ? void 0 : response.data) === null || _g === void 0 ? void 0 : _g.result) === null || _h === void 0 ? void 0 : _h.friendly_message) !== null && _j !== void 0 ? _j : "Primary Bank Account Updated Successfully",
|
|
90
|
-
status: "success",
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
return {
|
|
95
|
-
response: error.response,
|
|
96
|
-
newUser: null,
|
|
97
|
-
message: error.message,
|
|
98
|
-
status: "failed",
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
const DeleteBankAccount = (values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
103
|
-
var _k, _l, _m;
|
|
104
|
-
let data = deleteDataBank(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
|
|
105
|
-
try {
|
|
106
|
-
const response = yield restApi_1.default.restApi(baseUrl, "DELETE", endPointBank, headerConfigBankAccount(), data);
|
|
107
|
-
let { newUserInfo } = checkGlobalResponse("bank_account", response, "DeleteBankAccount", "delete");
|
|
108
|
-
return {
|
|
109
|
-
response: response,
|
|
110
|
-
newUser: newUserInfo,
|
|
111
|
-
message: (_m = (_l = (_k = response === null || response === void 0 ? void 0 : response.data) === null || _k === void 0 ? void 0 : _k.result) === null || _l === void 0 ? void 0 : _l.friendly_message) !== null && _m !== void 0 ? _m : "Bank Account Deleted Successfully",
|
|
112
|
-
status: "success",
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
catch (error) {
|
|
116
|
-
return {
|
|
117
|
-
response: error.response,
|
|
118
|
-
newUser: null,
|
|
119
|
-
message: error.message,
|
|
120
|
-
status: "failed",
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
return {
|
|
125
|
-
CreateBankAccount,
|
|
126
|
-
MakeBankAccountPrimary,
|
|
127
|
-
UpdateBankAccount,
|
|
128
|
-
DeleteBankAccount,
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
|
-
exports.useBankAccount = useBankAccount;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { CreateDeviceInterface, UpdateDeviceInterface, DeleteDeviceInterface, VerifyDeviceInterface, ConfirmDeviceInterface, LogoutDeviceInterface } from "../interfaces/deviceInterface";
|
|
2
|
-
import { IGeoCoordinates, UserInfo } from "../interfaces/interface";
|
|
3
|
-
export declare const useDevice: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, lang?: string, geoCoordinates?: IGeoCoordinates) => {
|
|
4
|
-
CreateDevice: (values: CreateDeviceInterface, access_token?: string, user_id?: string) => Promise<{
|
|
5
|
-
response: any;
|
|
6
|
-
newUser: any;
|
|
7
|
-
message: any;
|
|
8
|
-
status: string;
|
|
9
|
-
}>;
|
|
10
|
-
UpdateDevice: (values: UpdateDeviceInterface, access_token?: string, user_id?: string) => Promise<{
|
|
11
|
-
response: any;
|
|
12
|
-
newUser: any;
|
|
13
|
-
message: any;
|
|
14
|
-
status: string;
|
|
15
|
-
}>;
|
|
16
|
-
DeleteDevice: (values: DeleteDeviceInterface) => Promise<{
|
|
17
|
-
response: any;
|
|
18
|
-
newUser: any;
|
|
19
|
-
message: any;
|
|
20
|
-
status: string;
|
|
21
|
-
}>;
|
|
22
|
-
VerifyDevice: (values: VerifyDeviceInterface) => Promise<{
|
|
23
|
-
response: any;
|
|
24
|
-
newUser: any;
|
|
25
|
-
message: any;
|
|
26
|
-
status: string;
|
|
27
|
-
}>;
|
|
28
|
-
ConfirmDevice: (values: ConfirmDeviceInterface) => Promise<{
|
|
29
|
-
response: any;
|
|
30
|
-
newUser: any;
|
|
31
|
-
message: any;
|
|
32
|
-
status: string;
|
|
33
|
-
}>;
|
|
34
|
-
GetUserDeviceLoginHistory: () => Promise<{
|
|
35
|
-
response: any;
|
|
36
|
-
newUser: any;
|
|
37
|
-
message: any;
|
|
38
|
-
status: string;
|
|
39
|
-
}>;
|
|
40
|
-
LogoutDevice: (values: LogoutDeviceInterface) => Promise<{
|
|
41
|
-
response: any;
|
|
42
|
-
newUser: any;
|
|
43
|
-
message: any;
|
|
44
|
-
status: string;
|
|
45
|
-
}>;
|
|
46
|
-
};
|