@riocrypto/common 1.0.507 → 1.0.510

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.
@@ -16,7 +16,6 @@ import { PaymentMethod } from "../types/payment-method";
16
16
  import { PayoutMethod } from "../types/payout-method";
17
17
  import { RioSettings } from "../types/rio-settings";
18
18
  import { RioSettingsUpdate } from "../types/rio-settings-update";
19
- import { SecurityQuestion } from "../types/security-question";
20
19
  import { User } from "../types/user";
21
20
  import { UserInput } from "../types/user-input";
22
21
  import { UserUpdate } from "../types/user-update";
@@ -26,14 +25,14 @@ export declare class RioClient {
26
25
  getOrders(): Promise<Order[]>;
27
26
  getUsers(): Promise<User[]>;
28
27
  getBusinessUsers(): Promise<BusinessUser[]>;
29
- signin(email: string, password: string): Promise<any>;
28
+ signinAdmin(email: string, password: string): Promise<any>;
30
29
  updateUser(update: UserUpdate, userId?: string): Promise<User>;
31
30
  updateBusinessUser(update: BusinessUserUpdate, businessUserId?: string): Promise<BusinessUser>;
32
- updateAdminUserPassword({ password, newPassword, }: {
31
+ updateAdminPassword({ password, newPassword, }: {
33
32
  password: string;
34
33
  newPassword: string;
35
34
  }): Promise<Admin>;
36
- getAdminUser(): Promise<any>;
35
+ getAdmin(): Promise<any>;
37
36
  signoutAdmin(): Promise<void>;
38
37
  getRioSettings(): Promise<RioSettings>;
39
38
  createRioSettings(rioSettings: {
@@ -45,31 +44,18 @@ export declare class RioClient {
45
44
  getBusinessUser(): Promise<BusinessUser>;
46
45
  createUser(user: UserInput): Promise<void>;
47
46
  createBusinessUser(businessUser: BusinessUserInput): Promise<BusinessUser>;
48
- createBrokerCustomer(businessUser: BusinessUserInput): Promise<BusinessUser>;
49
47
  sendPhoneAuthCode(phoneNumber: string): Promise<void>;
50
- authExists(phoneNumber: string): Promise<boolean>;
51
- uploadCOI(businessUserId: string, formData: FormData): Promise<BusinessUser>;
52
- uploadKYCReport(businessUserId: string, formData: FormData): Promise<BusinessUser>;
53
- getSecurityQuestion(): Promise<SecurityQuestion>;
48
+ getAuth(): Promise<Auth>;
54
49
  signout(): Promise<void>;
55
50
  verifyPhoneCode(phoneNumber: string, code: string): Promise<void>;
56
- createAuth(password: string): Promise<void>;
57
51
  createOrder(order: OrderInput): Promise<Order>;
58
52
  getOrder(id: string): Promise<Order>;
59
- initBankPayout(oid: string, accountNumber: string): Promise<BankPayout>;
53
+ createBankPayout(oid: string, accountNumber: string): Promise<BankPayout>;
60
54
  getBankPayout(orderId: string): Promise<BankPayout>;
61
- checkAddress(address: string, crypto: Crypto): Promise<CheckedAddress>;
62
- getSupportedPaymentMethods(fiat: Fiat, country: Country): Promise<PaymentMethod[]>;
63
- getBrokerCustomers(): Promise<BusinessUser[]>;
55
+ createCheckedAddress(address: string, crypto: Crypto): Promise<CheckedAddress>;
56
+ getPaymentMethods(fiat: Fiat, country: Country): Promise<PaymentMethod[]>;
64
57
  getSupportedPayoutMethods(fiat: Fiat, country: Country): Promise<PayoutMethod[]>;
65
- getPartnerLayout(partnerId: string): Promise<Partner>;
66
- createClipCardPayment(orderId: string): Promise<{
67
- paymentId: string;
68
- paymentRequestUrl: string;
69
- }>;
70
- createConektaPayment(orderId: string): Promise<{
71
- checkoutRequestId: string;
72
- }>;
58
+ getPartner(partnerId: string): Promise<Partner>;
73
59
  createKushkiPayment(orderId: string, token: string): Promise<{
74
60
  paymentId: string;
75
61
  }>;
@@ -32,7 +32,7 @@ class RioClient {
32
32
  return data;
33
33
  });
34
34
  }
35
- signin(email, password) {
35
+ signinAdmin(email, password) {
36
36
  return __awaiter(this, void 0, void 0, function* () {
37
37
  const { data } = yield this.axios.post(`/api/admin/signin`, {
38
38
  email,
@@ -53,24 +53,24 @@ class RioClient {
53
53
  return data;
54
54
  });
55
55
  }
56
- updateAdminUserPassword({ password, newPassword, }) {
56
+ updateAdminPassword({ password, newPassword, }) {
57
57
  return __awaiter(this, void 0, void 0, function* () {
58
- const { data } = yield this.axios.patch(`/api/admin`, {
58
+ const { data } = yield this.axios.patch(`/api/auth/admin`, {
59
59
  password,
60
60
  newPassword,
61
61
  });
62
62
  return data;
63
63
  });
64
64
  }
65
- getAdminUser() {
65
+ getAdmin() {
66
66
  return __awaiter(this, void 0, void 0, function* () {
67
- const { data } = yield this.axios.get(`/api/admin`);
67
+ const { data } = yield this.axios.get(`/api/auth/admin`);
68
68
  return data;
69
69
  });
70
70
  }
71
71
  signoutAdmin() {
72
72
  return __awaiter(this, void 0, void 0, function* () {
73
- yield this.axios.post("/api/admin/signout", {});
73
+ yield this.axios.post("/api/admin/auth/signout", {});
74
74
  });
75
75
  }
76
76
  getRioSettings() {
@@ -100,64 +100,38 @@ class RioClient {
100
100
  }
101
101
  getUser() {
102
102
  return __awaiter(this, void 0, void 0, function* () {
103
- const { data } = yield this.axios.get("/api/users/current");
103
+ const { data } = yield this.axios.get("/api/users");
104
104
  return data;
105
105
  });
106
106
  }
107
107
  getBusinessUser() {
108
108
  return __awaiter(this, void 0, void 0, function* () {
109
- const { data } = yield this.axios.get("/api/business/users/current");
109
+ const { data } = yield this.axios.get("/api/business/users");
110
110
  return data;
111
111
  });
112
112
  }
113
113
  createUser(user) {
114
114
  return __awaiter(this, void 0, void 0, function* () {
115
- yield this.axios.post("/api/users/current-auth", user);
115
+ yield this.axios.post("/api/users", user);
116
116
  });
117
117
  }
118
118
  createBusinessUser(businessUser) {
119
119
  return __awaiter(this, void 0, void 0, function* () {
120
- const response = yield this.axios.post("/api/business/users/current-auth", businessUser);
121
- return response.data;
122
- });
123
- }
124
- createBrokerCustomer(businessUser) {
125
- return __awaiter(this, void 0, void 0, function* () {
126
- const response = yield this.axios.post("/api/business/users/broker-customers/current-auth", businessUser);
120
+ const response = yield this.axios.post("/api/business/users", businessUser);
127
121
  return response.data;
128
122
  });
129
123
  }
130
124
  sendPhoneAuthCode(phoneNumber) {
131
125
  return __awaiter(this, void 0, void 0, function* () {
132
- yield this.axios.post("/api/auth/sendCode", {
133
- phoneNumber,
134
- });
135
- });
136
- }
137
- authExists(phoneNumber) {
138
- return __awaiter(this, void 0, void 0, function* () {
139
- const response = yield this.axios.post("/api/auth/exists", {
126
+ yield this.axios.post("/api/auth/phone/send", {
140
127
  phoneNumber,
141
128
  });
142
- return response.data.exists;
143
- });
144
- }
145
- uploadCOI(businessUserId, formData) {
146
- return __awaiter(this, void 0, void 0, function* () {
147
- const { data } = yield this.axios.patch(`/api/business/users/${businessUserId}/coi`, formData);
148
- return data;
149
- });
150
- }
151
- uploadKYCReport(businessUserId, formData) {
152
- return __awaiter(this, void 0, void 0, function* () {
153
- const { data } = yield this.axios.patch(`/api/business/users/${businessUserId}/kyc-report`, formData);
154
- return data;
155
129
  });
156
130
  }
157
- getSecurityQuestion() {
131
+ getAuth() {
158
132
  return __awaiter(this, void 0, void 0, function* () {
159
- const response = yield this.axios.get("/api/auth/security-question", {});
160
- return response.data.question;
133
+ const response = yield this.axios.get("/api/auth");
134
+ return response.data;
161
135
  });
162
136
  }
163
137
  signout() {
@@ -167,19 +141,12 @@ class RioClient {
167
141
  }
168
142
  verifyPhoneCode(phoneNumber, code) {
169
143
  return __awaiter(this, void 0, void 0, function* () {
170
- yield this.axios.post("/api/auth/verifycode", {
144
+ yield this.axios.post("/api/auth/phone/verify", {
171
145
  phoneNumber,
172
146
  code,
173
147
  });
174
148
  });
175
149
  }
176
- createAuth(password) {
177
- return __awaiter(this, void 0, void 0, function* () {
178
- yield this.axios.post("/api/auth", {
179
- password,
180
- });
181
- });
182
- }
183
150
  createOrder(order) {
184
151
  return __awaiter(this, void 0, void 0, function* () {
185
152
  const response = yield this.axios.post("/api/orders", order);
@@ -192,7 +159,7 @@ class RioClient {
192
159
  return response.data;
193
160
  });
194
161
  }
195
- initBankPayout(oid, accountNumber) {
162
+ createBankPayout(oid, accountNumber) {
196
163
  return __awaiter(this, void 0, void 0, function* () {
197
164
  const response = yield this.axios.post(`/api/payouts/bank`, {
198
165
  orderId: oid,
@@ -207,7 +174,7 @@ class RioClient {
207
174
  return response.data;
208
175
  });
209
176
  }
210
- checkAddress(address, crypto) {
177
+ createCheckedAddress(address, crypto) {
211
178
  return __awaiter(this, void 0, void 0, function* () {
212
179
  const response = yield this.axios.post(`/api/kyt/address`, {
213
180
  address,
@@ -216,43 +183,21 @@ class RioClient {
216
183
  return response.data;
217
184
  });
218
185
  }
219
- getSupportedPaymentMethods(fiat, country) {
220
- return __awaiter(this, void 0, void 0, function* () {
221
- const response = yield this.axios.get(`/api/payment-methods/supported?fiat=${fiat}&country=${country}`);
222
- return response.data;
223
- });
224
- }
225
- getBrokerCustomers() {
186
+ getPaymentMethods(fiat, country) {
226
187
  return __awaiter(this, void 0, void 0, function* () {
227
- const response = yield this.axios.get(`/api/business/users/broker-customers`);
188
+ const response = yield this.axios.get(`/api/payment-methods?fiat=${fiat}&country=${country}`);
228
189
  return response.data;
229
190
  });
230
191
  }
231
192
  getSupportedPayoutMethods(fiat, country) {
232
193
  return __awaiter(this, void 0, void 0, function* () {
233
- const response = yield this.axios.get(`/api/payout-methods/supported?fiat=${fiat}&country=${country}`);
194
+ const response = yield this.axios.get(`/api/payout-methods?fiat=${fiat}&country=${country}`);
234
195
  return response.data;
235
196
  });
236
197
  }
237
- getPartnerLayout(partnerId) {
198
+ getPartner(partnerId) {
238
199
  return __awaiter(this, void 0, void 0, function* () {
239
- const { data } = yield this.axios.get(`/api/partners/${partnerId}/layout`);
240
- return data;
241
- });
242
- }
243
- createClipCardPayment(orderId) {
244
- return __awaiter(this, void 0, void 0, function* () {
245
- const { data } = yield this.axios.post(`/api/payments/card/clip`, {
246
- orderId,
247
- });
248
- return data;
249
- });
250
- }
251
- createConektaPayment(orderId) {
252
- return __awaiter(this, void 0, void 0, function* () {
253
- const { data } = yield this.axios.post(`/api/payments/card/conekta`, {
254
- orderId,
255
- });
200
+ const { data } = yield this.axios.get(`/api/partners/${partnerId}`);
256
201
  return data;
257
202
  });
258
203
  }
@@ -275,7 +220,7 @@ class RioClient {
275
220
  }
276
221
  createSPEIPayment(orderId) {
277
222
  return __awaiter(this, void 0, void 0, function* () {
278
- const { data } = yield this.axios.post(`/api/payments/bank/spei`, {
223
+ const { data } = yield this.axios.post(`/api/payments/bank/init/spei`, {
279
224
  orderId,
280
225
  });
281
226
  return data;
@@ -291,7 +236,7 @@ class RioClient {
291
236
  }
292
237
  createSWIFTPayment(orderId) {
293
238
  return __awaiter(this, void 0, void 0, function* () {
294
- const { data } = yield this.axios.post(`/api/payments/bank/swift`, {
239
+ const { data } = yield this.axios.post(`/api/payments/bank/init/swift`, {
295
240
  orderId,
296
241
  });
297
242
  return data;
@@ -299,7 +244,7 @@ class RioClient {
299
244
  }
300
245
  createInterbankPayment(orderId) {
301
246
  return __awaiter(this, void 0, void 0, function* () {
302
- const { data } = yield this.axios.post(`/api/payments/bank/interbank`, {
247
+ const { data } = yield this.axios.post(`/api/payments/bank/init/interbank`, {
303
248
  orderId,
304
249
  });
305
250
  return data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.507",
3
+ "version": "1.0.510",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -21,15 +21,10 @@
21
21
  "typescript": "^4.7.4"
22
22
  },
23
23
  "dependencies": {
24
- "@aws-sdk/client-s3": "^3.297.0",
25
24
  "@types/express": "^4.17.13",
26
25
  "axios": "^0.27.2",
27
- "ccxt": "^3.0.30",
28
- "express": "^4.18.1",
29
- "express-validator": "^6.14.2",
30
- "fireblocks-sdk": "^4.0.0",
26
+ "express-validator": "^6.15.0",
31
27
  "jsonwebtoken": "^8.5.1",
32
- "mongoose": "^7.0.2",
33
28
  "node-nats-streaming": "^0.3.2",
34
29
  "uuid": "^9.0.0"
35
30
  }