@riocrypto/common-server 1.0.1096 → 1.0.1097
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.
|
@@ -143,6 +143,7 @@ const getPlatformFees = (mongoose, conversionRateToUSD, amountFiat, fiat, proces
|
|
|
143
143
|
platformFeeFiat = amountFiat * netPlatformFee;
|
|
144
144
|
}
|
|
145
145
|
if ((fiat === common_1.Fiat.MXN && processor === common_1.Processor.SPEI) ||
|
|
146
|
+
(fiat === common_1.Fiat.MXN && processor === common_1.Processor.Bitso) ||
|
|
146
147
|
(fiat === common_1.Fiat.USD && processor === common_1.Processor.SPID)) {
|
|
147
148
|
if (country === common_1.Country.Mexico) {
|
|
148
149
|
platformFeeFiatTax = platformFeeFiat * 0.16;
|
package/build/index.d.ts
CHANGED
|
@@ -51,7 +51,6 @@ export * from "./clients/gueno-client";
|
|
|
51
51
|
export * from "./clients/fireblocks-client";
|
|
52
52
|
export * from "./clients/kapstar-client";
|
|
53
53
|
export * from "./clients/etherscan-client";
|
|
54
|
-
export * from "./clients/rio-client";
|
|
55
54
|
export * from "./clients/secret-manager-client";
|
|
56
55
|
export * from "./clients/gcloud-storage-client";
|
|
57
56
|
export * from "./clients/currency-api-client";
|
package/build/index.js
CHANGED
|
@@ -67,7 +67,6 @@ __exportStar(require("./clients/gueno-client"), exports);
|
|
|
67
67
|
__exportStar(require("./clients/fireblocks-client"), exports);
|
|
68
68
|
__exportStar(require("./clients/kapstar-client"), exports);
|
|
69
69
|
__exportStar(require("./clients/etherscan-client"), exports);
|
|
70
|
-
__exportStar(require("./clients/rio-client"), exports);
|
|
71
70
|
__exportStar(require("./clients/secret-manager-client"), exports);
|
|
72
71
|
__exportStar(require("./clients/gcloud-storage-client"), exports);
|
|
73
72
|
__exportStar(require("./clients/currency-api-client"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1097",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@aws-sdk/client-s3": "^3.297.0",
|
|
26
26
|
"@everapi/currencyapi-js": "^1.0.6",
|
|
27
27
|
"@google-cloud/storage": "^6.9.5",
|
|
28
|
-
"@riocrypto/common": "^1.0.
|
|
28
|
+
"@riocrypto/common": "^1.0.936",
|
|
29
29
|
"@types/express": "^4.17.13",
|
|
30
30
|
"axios": "^0.27.2",
|
|
31
31
|
"ccxt": "^3.0.30",
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Admin, Auth, AuthUpdate, BankPayout, CheckedAddress, Country, Fiat, Order, OrderInput, PaymentMethod, PayoutMethod, RioSettings, RioSettingsUpdate, SecurityQuestion, User, UserInput, UserUpdate } from "@riocrypto/common";
|
|
2
|
-
import { AxiosInstance, AxiosStatic } from "axios";
|
|
3
|
-
export declare class RioClient {
|
|
4
|
-
private axios;
|
|
5
|
-
constructor(axios: AxiosStatic | AxiosInstance);
|
|
6
|
-
getOrders(): Promise<Order[]>;
|
|
7
|
-
getUsers(): Promise<User[]>;
|
|
8
|
-
signin(email: string, password: string): Promise<any>;
|
|
9
|
-
updateUser(update: UserUpdate, userId?: string): Promise<User>;
|
|
10
|
-
updateAdminUserPassword({ password, newPassword, }: {
|
|
11
|
-
password: string;
|
|
12
|
-
newPassword: string;
|
|
13
|
-
}): Promise<Admin>;
|
|
14
|
-
getAdminUser(): Promise<any>;
|
|
15
|
-
signoutAdmin(): Promise<void>;
|
|
16
|
-
getRioSettings(): Promise<RioSettings>;
|
|
17
|
-
createRioSettings(rioSettings: {
|
|
18
|
-
platformFee: number;
|
|
19
|
-
}): Promise<void>;
|
|
20
|
-
updateRioSettings(update: RioSettingsUpdate): Promise<void>;
|
|
21
|
-
confirmBankPayment(orderId: string): Promise<any>;
|
|
22
|
-
getUser(): Promise<User>;
|
|
23
|
-
createUser(user: UserInput): Promise<void>;
|
|
24
|
-
createBrokerCustomer(userInput: UserInput): Promise<User>;
|
|
25
|
-
sendPhoneAuthCode(phoneNumber: string): Promise<void>;
|
|
26
|
-
authExists(phoneNumber: string): Promise<boolean>;
|
|
27
|
-
uploadCOI(userId: string, formData: FormData): Promise<User>;
|
|
28
|
-
uploadKYCReport(userId: string, formData: FormData): Promise<User>;
|
|
29
|
-
getSecurityQuestion(): Promise<SecurityQuestion>;
|
|
30
|
-
signout(): Promise<void>;
|
|
31
|
-
verifyPhoneCode(phoneNumber: string, code: string): Promise<void>;
|
|
32
|
-
createAuth(password: string): Promise<void>;
|
|
33
|
-
createOrder(order: OrderInput): Promise<Order>;
|
|
34
|
-
getOrder(id: string): Promise<Order>;
|
|
35
|
-
initBankPayout(oid: string, accountNumber: string): Promise<BankPayout>;
|
|
36
|
-
getBankPayout(orderId: string): Promise<BankPayout>;
|
|
37
|
-
checkAddress(address: string, crypto: Crypto): Promise<CheckedAddress>;
|
|
38
|
-
getSupportedPaymentMethods(fiat: Fiat, country: Country): Promise<PaymentMethod[]>;
|
|
39
|
-
getSupportedPayoutMethods(fiat: Fiat, country: Country): Promise<PayoutMethod[]>;
|
|
40
|
-
createClipCardPayment(orderId: string): Promise<{
|
|
41
|
-
paymentId: string;
|
|
42
|
-
paymentRequestUrl: string;
|
|
43
|
-
}>;
|
|
44
|
-
createConektaPayment(orderId: string): Promise<{
|
|
45
|
-
checkoutRequestId: string;
|
|
46
|
-
}>;
|
|
47
|
-
createKushkiPayment(orderId: string, token: string): Promise<{
|
|
48
|
-
paymentId: string;
|
|
49
|
-
}>;
|
|
50
|
-
createKushkiBankPayment(orderId: string): Promise<any>;
|
|
51
|
-
createSPEIPayment(orderId: string): Promise<any>;
|
|
52
|
-
createSPIDPayment(orderId: string): Promise<any>;
|
|
53
|
-
createSWIFTPayment(orderId: string): Promise<any>;
|
|
54
|
-
createInterbankPayment(orderId: string): Promise<any>;
|
|
55
|
-
updateAuth(update: AuthUpdate, id?: string): Promise<Auth>;
|
|
56
|
-
}
|
|
@@ -1,279 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.RioClient = void 0;
|
|
13
|
-
class RioClient {
|
|
14
|
-
constructor(axios) {
|
|
15
|
-
this.axios = axios;
|
|
16
|
-
}
|
|
17
|
-
getOrders() {
|
|
18
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
const { data } = yield this.axios.get(`/api/orders`);
|
|
20
|
-
return data;
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
getUsers() {
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
const { data } = yield this.axios.get(`/api/users`);
|
|
26
|
-
return data;
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
signin(email, password) {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
const { data } = yield this.axios.post(`/api/admin/signin`, {
|
|
32
|
-
email,
|
|
33
|
-
password,
|
|
34
|
-
});
|
|
35
|
-
return data;
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
updateUser(update, userId) {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
const { data } = yield this.axios.patch(`/api/users/${userId}`, update);
|
|
41
|
-
return data;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
updateAdminUserPassword({ password, newPassword, }) {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
const { data } = yield this.axios.patch(`/api/admin`, {
|
|
47
|
-
password,
|
|
48
|
-
newPassword,
|
|
49
|
-
});
|
|
50
|
-
return data;
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
getAdminUser() {
|
|
54
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
const { data } = yield this.axios.get(`/api/admin`);
|
|
56
|
-
return data;
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
signoutAdmin() {
|
|
60
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
yield this.axios.post("/api/admin/signout", {});
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
getRioSettings() {
|
|
65
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
const { data } = yield this.axios.get(`/api/settings`);
|
|
67
|
-
return data;
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
createRioSettings(rioSettings) {
|
|
71
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
yield this.axios.post(`/api/settings`, rioSettings);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
updateRioSettings(update) {
|
|
76
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
const { data } = yield this.axios.patch(`/api/settings`, update);
|
|
78
|
-
return data;
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
confirmBankPayment(orderId) {
|
|
82
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
const { data } = yield this.axios.post(`/api/payments/bank/confirm`, {
|
|
84
|
-
orderId,
|
|
85
|
-
});
|
|
86
|
-
return data;
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
getUser() {
|
|
90
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
const { data } = yield this.axios.get("/api/users/current");
|
|
92
|
-
return data;
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
createUser(user) {
|
|
96
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
-
yield this.axios.post("/api/users/current-auth", user);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
createBrokerCustomer(userInput) {
|
|
101
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
-
const response = yield this.axios.post("/api/users/broker-customers/current-auth", userInput);
|
|
103
|
-
return response.data;
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
sendPhoneAuthCode(phoneNumber) {
|
|
107
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
yield this.axios.post("/api/auth/sendCode", {
|
|
109
|
-
phoneNumber,
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
authExists(phoneNumber) {
|
|
114
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
const response = yield this.axios.post("/api/auth/exists", {
|
|
116
|
-
phoneNumber,
|
|
117
|
-
});
|
|
118
|
-
return response.data.exists;
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
uploadCOI(userId, formData) {
|
|
122
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
-
const { data } = yield this.axios.patch(`/api/users/${userId}/coi`, formData);
|
|
124
|
-
return data;
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
uploadKYCReport(userId, formData) {
|
|
128
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
-
const { data } = yield this.axios.patch(`/api/users/${userId}/kyc-report`, formData);
|
|
130
|
-
return data;
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
getSecurityQuestion() {
|
|
134
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
135
|
-
const response = yield this.axios.get("/api/auth/security-question", {});
|
|
136
|
-
return response.data.question;
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
signout() {
|
|
140
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
-
yield this.axios.post("/api/auth/signout", {});
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
verifyPhoneCode(phoneNumber, code) {
|
|
145
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
-
yield this.axios.post("/api/auth/verifycode", {
|
|
147
|
-
phoneNumber,
|
|
148
|
-
code,
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
createAuth(password) {
|
|
153
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
-
yield this.axios.post("/api/auth", {
|
|
155
|
-
password,
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
createOrder(order) {
|
|
160
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
-
const response = yield this.axios.post("/api/orders", order);
|
|
162
|
-
return response.data;
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
getOrder(id) {
|
|
166
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
167
|
-
const response = yield this.axios.get(`/api/orders/${id}`);
|
|
168
|
-
return response.data;
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
initBankPayout(oid, accountNumber) {
|
|
172
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
-
const response = yield this.axios.post(`/api/payouts/bank`, {
|
|
174
|
-
orderId: oid,
|
|
175
|
-
accountNumber,
|
|
176
|
-
});
|
|
177
|
-
return response.data;
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
getBankPayout(orderId) {
|
|
181
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
-
const response = yield this.axios.get(`/api/payouts/bank?orderId=${orderId}`);
|
|
183
|
-
return response.data;
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
checkAddress(address, crypto) {
|
|
187
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
188
|
-
const response = yield this.axios.post(`/api/kyt/address`, {
|
|
189
|
-
address,
|
|
190
|
-
crypto,
|
|
191
|
-
});
|
|
192
|
-
return response.data;
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
getSupportedPaymentMethods(fiat, country) {
|
|
196
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
-
const response = yield this.axios.get(`/api/payment-methods/supported?fiat=${fiat}&country=${country}`);
|
|
198
|
-
return response.data;
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
getSupportedPayoutMethods(fiat, country) {
|
|
202
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
203
|
-
const response = yield this.axios.get(`/api/payout-methods/supported?fiat=${fiat}&country=${country}`);
|
|
204
|
-
return response.data;
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
createClipCardPayment(orderId) {
|
|
208
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
209
|
-
const { data } = yield this.axios.post(`/api/payments/card/clip`, {
|
|
210
|
-
orderId,
|
|
211
|
-
});
|
|
212
|
-
return data;
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
createConektaPayment(orderId) {
|
|
216
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
217
|
-
const { data } = yield this.axios.post(`/api/payments/card/conekta`, {
|
|
218
|
-
orderId,
|
|
219
|
-
});
|
|
220
|
-
return data;
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
createKushkiPayment(orderId, token) {
|
|
224
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
225
|
-
const { data } = yield this.axios.post(`/api/payments/card/kushki`, {
|
|
226
|
-
orderId,
|
|
227
|
-
token,
|
|
228
|
-
});
|
|
229
|
-
return data;
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
createKushkiBankPayment(orderId) {
|
|
233
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
234
|
-
const { data } = yield this.axios.post(`/api/payments/bank/kushki`, {
|
|
235
|
-
orderId,
|
|
236
|
-
});
|
|
237
|
-
return data;
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
createSPEIPayment(orderId) {
|
|
241
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
242
|
-
const { data } = yield this.axios.post(`/api/payments/bank/spei`, {
|
|
243
|
-
orderId,
|
|
244
|
-
});
|
|
245
|
-
return data;
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
createSPIDPayment(orderId) {
|
|
249
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
250
|
-
const { data } = yield this.axios.post(`/api/payments/bank/spid`, {
|
|
251
|
-
orderId,
|
|
252
|
-
});
|
|
253
|
-
return data;
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
createSWIFTPayment(orderId) {
|
|
257
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
258
|
-
const { data } = yield this.axios.post(`/api/payments/bank/swift`, {
|
|
259
|
-
orderId,
|
|
260
|
-
});
|
|
261
|
-
return data;
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
createInterbankPayment(orderId) {
|
|
265
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
266
|
-
const { data } = yield this.axios.post(`/api/payments/bank/interbank`, {
|
|
267
|
-
orderId,
|
|
268
|
-
});
|
|
269
|
-
return data;
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
updateAuth(update, id) {
|
|
273
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
274
|
-
const { data } = yield this.axios.patch(`/api/auth/${id}`, update);
|
|
275
|
-
return data;
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
exports.RioClient = RioClient;
|