@riocrypto/common 1.0.503 → 1.0.506
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/build/index.d.ts +0 -41
- package/build/index.js +0 -41
- package/package.json +1 -1
- package/build/client.d.ts +0 -93
- package/build/client.js +0 -109
- package/build/clients/bitstamp-client.d.ts +0 -16
- package/build/clients/bitstamp-client.js +0 -83
- package/build/clients/ccxt-client.d.ts +0 -48
- package/build/clients/ccxt-client.js +0 -201
- package/build/clients/etherscan-client.d.ts +0 -6
- package/build/clients/etherscan-client.js +0 -24
- package/build/clients/fireblocks-client.d.ts +0 -15
- package/build/clients/fireblocks-client.js +0 -140
- package/build/clients/fixer-client.d.ts +0 -8
- package/build/clients/fixer-client.js +0 -34
- package/build/clients/gueno-client.d.ts +0 -10
- package/build/clients/gueno-client.js +0 -44
- package/build/clients/kapstar-client.d.ts +0 -6
- package/build/clients/kapstar-client.js +0 -26
- package/build/clients/kushki-client.d.ts +0 -14
- package/build/clients/kushki-client.js +0 -150
- package/build/clients/rio-client.d.ts +0 -82
- package/build/clients/rio-client.js +0 -315
- package/build/clients/slack-client.d.ts +0 -7
- package/build/clients/slack-client.js +0 -34
- package/build/helpers/get-user-from-client-helper.d.ts +0 -4
- package/build/helpers/get-user-from-client-helper.js +0 -41
- package/build/helpers/get-user-helper.d.ts +0 -4
- package/build/helpers/get-user-helper.js +0 -35
- package/build/middlewares/authorize.d.ts +0 -28
- package/build/middlewares/authorize.js +0 -195
- package/build/middlewares/current-admin-auth.d.ts +0 -15
- package/build/middlewares/current-admin-auth.js +0 -20
- package/build/middlewares/current-auth.d.ts +0 -16
- package/build/middlewares/current-auth.js +0 -20
- package/build/middlewares/error-handler.d.ts +0 -2
- package/build/middlewares/error-handler.js +0 -14
- package/build/middlewares/get-order.d.ts +0 -11
- package/build/middlewares/get-order.js +0 -57
- package/build/middlewares/get-partner.d.ts +0 -10
- package/build/middlewares/get-partner.js +0 -41
- package/build/middlewares/get-user.d.ts +0 -12
- package/build/middlewares/get-user.js +0 -45
- package/build/middlewares/require-admin-api-key.d.ts +0 -2
- package/build/middlewares/require-admin-api-key.js +0 -11
- package/build/middlewares/require-auth.d.ts +0 -2
- package/build/middlewares/require-auth.js +0 -11
- package/build/middlewares/require-priveleges.d.ts +0 -2
- package/build/middlewares/require-priveleges.js +0 -15
- package/build/middlewares/validate-auth.d.ts +0 -2
- package/build/middlewares/validate-auth.js +0 -30
- package/build/middlewares/validate-kyc.d.ts +0 -2
- package/build/middlewares/validate-kyc.js +0 -30
- package/build/middlewares/validate-order.d.ts +0 -0
- package/build/middlewares/validate-order.js +0 -20
- package/build/middlewares/validate-request.d.ts +0 -2
- package/build/middlewares/validate-request.js +0 -13
- package/build/middlewares/verify-admin-api-key.d.ts +0 -9
- package/build/middlewares/verify-admin-api-key.js +0 -11
- package/build/models/admin-auth.d.ts +0 -16
- package/build/models/admin-auth.js +0 -59
- package/build/models/auth.d.ts +0 -24
- package/build/models/auth.js +0 -83
- package/build/models/bank-payout.d.ts +0 -20
- package/build/models/bank-payout.js +0 -44
- package/build/models/business-user.d.ts +0 -57
- package/build/models/business-user.js +0 -111
- package/build/models/ccxt-order.d.ts +0 -16
- package/build/models/ccxt-order.js +0 -37
- package/build/models/checked-address.d.ts +0 -17
- package/build/models/checked-address.js +0 -37
- package/build/models/kushki-payment.d.ts +0 -16
- package/build/models/kushki-payment.js +0 -37
- package/build/models/kyc.d.ts +0 -20
- package/build/models/kyc.js +0 -45
- package/build/models/order.d.ts +0 -67
- package/build/models/order.js +0 -123
- package/build/models/partner.d.ts +0 -35
- package/build/models/partner.js +0 -69
- package/build/models/rio-settings.d.ts +0 -12
- package/build/models/rio-settings.js +0 -29
- package/build/models/user.d.ts +0 -53
- package/build/models/user.js +0 -94
- package/build/services/apiKey.d.ts +0 -3
- package/build/services/apiKey.js +0 -24
- package/build/services/password.d.ts +0 -4
- package/build/services/password.js +0 -32
- package/build/services/s3.d.ts +0 -5
- package/build/services/s3.js +0 -21
|
@@ -1,150 +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.kushkiClient = void 0;
|
|
16
|
-
const axios_1 = __importDefault(require("axios"));
|
|
17
|
-
const user_type_1 = require("../types/user-type");
|
|
18
|
-
class KushkiClient {
|
|
19
|
-
constructor(privateMerchantId, environment) {
|
|
20
|
-
this.privateMerchantId = privateMerchantId;
|
|
21
|
-
this.environment = environment;
|
|
22
|
-
this.baseUrl = `https://api${this.environment === "production" ? "." : "-uat."}kushkipagos.com`;
|
|
23
|
-
}
|
|
24
|
-
createPaymentLink(order, user, token) {
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const body = {
|
|
27
|
-
token,
|
|
28
|
-
amount: {
|
|
29
|
-
currency: order.fiat,
|
|
30
|
-
subtotalIva: 0,
|
|
31
|
-
subtotalIva0: order.amountFiat,
|
|
32
|
-
iva: 0,
|
|
33
|
-
ice: 0,
|
|
34
|
-
},
|
|
35
|
-
contactDetails: {
|
|
36
|
-
firstName: user.firstName,
|
|
37
|
-
lastName: user.lastName,
|
|
38
|
-
email: user.email,
|
|
39
|
-
documentType: "CC",
|
|
40
|
-
phoneNumber: user.phoneNumber,
|
|
41
|
-
},
|
|
42
|
-
orderDetails: {
|
|
43
|
-
siteDomain: "riocrypto.com",
|
|
44
|
-
shippingDetails: {
|
|
45
|
-
name: `${user.firstName} ${user.lastName}`,
|
|
46
|
-
phone: user.phoneNumber,
|
|
47
|
-
address1: user.street1,
|
|
48
|
-
address2: user.street2,
|
|
49
|
-
city: user.city,
|
|
50
|
-
region: user.state,
|
|
51
|
-
country: user.country,
|
|
52
|
-
zipcode: user.postalCode,
|
|
53
|
-
},
|
|
54
|
-
billingDetails: {
|
|
55
|
-
name: `${user.firstName} ${user.lastName}`,
|
|
56
|
-
phone: user.phoneNumber,
|
|
57
|
-
address1: user.street1,
|
|
58
|
-
address2: user.street2,
|
|
59
|
-
city: user.city,
|
|
60
|
-
region: user.state,
|
|
61
|
-
country: user.country,
|
|
62
|
-
zipcode: user.postalCode,
|
|
63
|
-
},
|
|
64
|
-
product: {
|
|
65
|
-
id: order.id,
|
|
66
|
-
title: order.crypto,
|
|
67
|
-
price: order.amountFiat,
|
|
68
|
-
sku: order.id,
|
|
69
|
-
quantity: 1,
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
const response = yield (0, axios_1.default)({
|
|
74
|
-
method: "post",
|
|
75
|
-
url: `${this.baseUrl}/card/v1/charges`,
|
|
76
|
-
headers: {
|
|
77
|
-
"Content-Type": "application/json",
|
|
78
|
-
"Private-Merchant-Id": this.privateMerchantId,
|
|
79
|
-
"Accept-Encoding": "gzip,deflate,compress",
|
|
80
|
-
},
|
|
81
|
-
data: body,
|
|
82
|
-
});
|
|
83
|
-
const data = response.data;
|
|
84
|
-
return data;
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
createBankPaymentToken(order, user) {
|
|
88
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
-
const body = {
|
|
90
|
-
amount: {
|
|
91
|
-
subtotalIva: 0,
|
|
92
|
-
subtotalIva0: order.amountFiat,
|
|
93
|
-
iva: 0,
|
|
94
|
-
},
|
|
95
|
-
callbackUrl: "https://riocrypto.com",
|
|
96
|
-
userType: user.type === user_type_1.UserType.Business ? 1 : 0,
|
|
97
|
-
documentType: "CC",
|
|
98
|
-
documentNumber: "123456789",
|
|
99
|
-
paymentDescription: `Compra de ${order.crypto} en riocrypto.com`,
|
|
100
|
-
email: user.email,
|
|
101
|
-
currency: order.fiat,
|
|
102
|
-
};
|
|
103
|
-
const response = yield (0, axios_1.default)({
|
|
104
|
-
method: "post",
|
|
105
|
-
url: `${this.baseUrl}/transfer/v1/tokens`,
|
|
106
|
-
headers: {
|
|
107
|
-
"Content-Type": "application/json",
|
|
108
|
-
"Private-Merchant-Id": this.privateMerchantId,
|
|
109
|
-
"Accept-Encoding": "gzip,deflate,compress",
|
|
110
|
-
},
|
|
111
|
-
data: body,
|
|
112
|
-
});
|
|
113
|
-
const data = response.data;
|
|
114
|
-
return data;
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
createBankPayment(order, user, token) {
|
|
118
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
const body = {
|
|
120
|
-
token,
|
|
121
|
-
amount: {
|
|
122
|
-
subtotalIva: 0,
|
|
123
|
-
subtotalIva0: order.amountFiat,
|
|
124
|
-
iva: 0,
|
|
125
|
-
},
|
|
126
|
-
contactDetails: {
|
|
127
|
-
fullName: user.type === user_type_1.UserType.Business
|
|
128
|
-
? user.companyName
|
|
129
|
-
: `${user.firstName} ${user.lastName}`,
|
|
130
|
-
email: user.email,
|
|
131
|
-
documentType: "CC",
|
|
132
|
-
phoneNumber: user.phoneNumber,
|
|
133
|
-
},
|
|
134
|
-
};
|
|
135
|
-
const response = yield (0, axios_1.default)({
|
|
136
|
-
method: "post",
|
|
137
|
-
url: `${this.baseUrl}/transfer/v1/init`,
|
|
138
|
-
headers: {
|
|
139
|
-
"Content-Type": "application/json",
|
|
140
|
-
"Private-Merchant-Id": this.privateMerchantId,
|
|
141
|
-
"Accept-Encoding": "gzip,deflate,compress",
|
|
142
|
-
},
|
|
143
|
-
data: body,
|
|
144
|
-
});
|
|
145
|
-
const data = response.data;
|
|
146
|
-
return data;
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
exports.kushkiClient = new KushkiClient(process.env.KUSHKI_PRIVATE_MERCHANT_ID, process.env.KUSHKI_ENV);
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { AxiosInstance, AxiosStatic } from "axios";
|
|
2
|
-
import { Admin } from "../types/admin";
|
|
3
|
-
import { Auth } from "../types/auth";
|
|
4
|
-
import { AuthUpdate } from "../types/auth-update";
|
|
5
|
-
import { BankPayout } from "../types/bank-payout";
|
|
6
|
-
import { BusinessUser } from "../types/business-user";
|
|
7
|
-
import { BusinessUserInput } from "../types/business-user-input";
|
|
8
|
-
import { BusinessUserUpdate } from "../types/business-user-update";
|
|
9
|
-
import { CheckedAddress } from "../types/checked-address";
|
|
10
|
-
import { Country } from "../types/country";
|
|
11
|
-
import { Fiat } from "../types/fiat";
|
|
12
|
-
import { Order } from "../types/order";
|
|
13
|
-
import { OrderInput } from "../types/order-input";
|
|
14
|
-
import { Partner } from "../types/partner";
|
|
15
|
-
import { PaymentMethod } from "../types/payment-method";
|
|
16
|
-
import { PayoutMethod } from "../types/payout-method";
|
|
17
|
-
import { RioSettings } from "../types/rio-settings";
|
|
18
|
-
import { RioSettingsUpdate } from "../types/rio-settings-update";
|
|
19
|
-
import { SecurityQuestion } from "../types/security-question";
|
|
20
|
-
import { User } from "../types/user";
|
|
21
|
-
import { UserInput } from "../types/user-input";
|
|
22
|
-
import { UserUpdate } from "../types/user-update";
|
|
23
|
-
export declare class RioClient {
|
|
24
|
-
private axios;
|
|
25
|
-
constructor(axios: AxiosStatic | AxiosInstance);
|
|
26
|
-
getOrders(): Promise<Order[]>;
|
|
27
|
-
getUsers(): Promise<User[]>;
|
|
28
|
-
getBusinessUsers(): Promise<BusinessUser[]>;
|
|
29
|
-
signin(email: string, password: string): Promise<any>;
|
|
30
|
-
updateUser(update: UserUpdate, userId?: string): Promise<User>;
|
|
31
|
-
updateBusinessUser(update: BusinessUserUpdate, businessUserId?: string): Promise<BusinessUser>;
|
|
32
|
-
updateAdminUserPassword({ password, newPassword, }: {
|
|
33
|
-
password: string;
|
|
34
|
-
newPassword: string;
|
|
35
|
-
}): Promise<Admin>;
|
|
36
|
-
getAdminUser(): Promise<any>;
|
|
37
|
-
signoutAdmin(): Promise<void>;
|
|
38
|
-
getRioSettings(): Promise<RioSettings>;
|
|
39
|
-
createRioSettings(rioSettings: {
|
|
40
|
-
platformFee: number;
|
|
41
|
-
}): Promise<void>;
|
|
42
|
-
updateRioSettings(update: RioSettingsUpdate): Promise<void>;
|
|
43
|
-
confirmBankPayment(orderId: string): Promise<any>;
|
|
44
|
-
getUser(): Promise<User>;
|
|
45
|
-
getBusinessUser(): Promise<BusinessUser>;
|
|
46
|
-
createUser(user: UserInput): Promise<void>;
|
|
47
|
-
createBusinessUser(businessUser: BusinessUserInput): Promise<BusinessUser>;
|
|
48
|
-
createBrokerCustomer(businessUser: BusinessUserInput): Promise<BusinessUser>;
|
|
49
|
-
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>;
|
|
54
|
-
signout(): Promise<void>;
|
|
55
|
-
verifyPhoneCode(phoneNumber: string, code: string): Promise<void>;
|
|
56
|
-
createAuth(password: string): Promise<void>;
|
|
57
|
-
createOrder(order: OrderInput): Promise<Order>;
|
|
58
|
-
getOrder(id: string): Promise<Order>;
|
|
59
|
-
initBankPayout(oid: string, accountNumber: string): Promise<BankPayout>;
|
|
60
|
-
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[]>;
|
|
64
|
-
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
|
-
}>;
|
|
73
|
-
createKushkiPayment(orderId: string, token: string): Promise<{
|
|
74
|
-
paymentId: string;
|
|
75
|
-
}>;
|
|
76
|
-
createKushkiBankPayment(orderId: string): Promise<any>;
|
|
77
|
-
createSPEIPayment(orderId: string): Promise<any>;
|
|
78
|
-
createSPIDPayment(orderId: string): Promise<any>;
|
|
79
|
-
createSWIFTPayment(orderId: string): Promise<any>;
|
|
80
|
-
createInterbankPayment(orderId: string): Promise<any>;
|
|
81
|
-
updateAuth(update: AuthUpdate, id?: string): Promise<Auth>;
|
|
82
|
-
}
|
|
@@ -1,315 +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
|
-
getBusinessUsers() {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
const { data } = yield this.axios.get(`/api/business/users`);
|
|
32
|
-
return data;
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
signin(email, password) {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
const { data } = yield this.axios.post(`/api/admin/signin`, {
|
|
38
|
-
email,
|
|
39
|
-
password,
|
|
40
|
-
});
|
|
41
|
-
return data;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
updateUser(update, userId) {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
const { data } = yield this.axios.patch(`/api/users/${userId}`, update);
|
|
47
|
-
return data;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
updateBusinessUser(update, businessUserId) {
|
|
51
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
const { data } = yield this.axios.patch(`/api/business/users/${businessUserId}`, update);
|
|
53
|
-
return data;
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
updateAdminUserPassword({ password, newPassword, }) {
|
|
57
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
const { data } = yield this.axios.patch(`/api/admin`, {
|
|
59
|
-
password,
|
|
60
|
-
newPassword,
|
|
61
|
-
});
|
|
62
|
-
return data;
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
getAdminUser() {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
const { data } = yield this.axios.get(`/api/admin`);
|
|
68
|
-
return data;
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
signoutAdmin() {
|
|
72
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
yield this.axios.post("/api/admin/signout", {});
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
getRioSettings() {
|
|
77
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
const { data } = yield this.axios.get(`/api/settings`);
|
|
79
|
-
return data;
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
createRioSettings(rioSettings) {
|
|
83
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
yield this.axios.post(`/api/settings`, rioSettings);
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
updateRioSettings(update) {
|
|
88
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
-
const { data } = yield this.axios.patch(`/api/settings`, update);
|
|
90
|
-
return data;
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
confirmBankPayment(orderId) {
|
|
94
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
const { data } = yield this.axios.post(`/api/payments/bank/confirm`, {
|
|
96
|
-
orderId,
|
|
97
|
-
});
|
|
98
|
-
return data;
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
getUser() {
|
|
102
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
const { data } = yield this.axios.get("/api/users/current");
|
|
104
|
-
return data;
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
getBusinessUser() {
|
|
108
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
-
const { data } = yield this.axios.get("/api/business/users/current");
|
|
110
|
-
return data;
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
createUser(user) {
|
|
114
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
yield this.axios.post("/api/users/current-auth", user);
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
createBusinessUser(businessUser) {
|
|
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);
|
|
127
|
-
return response.data;
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
sendPhoneAuthCode(phoneNumber) {
|
|
131
|
-
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", {
|
|
140
|
-
phoneNumber,
|
|
141
|
-
});
|
|
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
|
-
});
|
|
156
|
-
}
|
|
157
|
-
getSecurityQuestion() {
|
|
158
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
-
const response = yield this.axios.get("/api/auth/security-question", {});
|
|
160
|
-
return response.data.question;
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
signout() {
|
|
164
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
-
yield this.axios.post("/api/auth/signout", {});
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
verifyPhoneCode(phoneNumber, code) {
|
|
169
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
170
|
-
yield this.axios.post("/api/auth/verifycode", {
|
|
171
|
-
phoneNumber,
|
|
172
|
-
code,
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
}
|
|
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
|
-
createOrder(order) {
|
|
184
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
185
|
-
const response = yield this.axios.post("/api/orders", order);
|
|
186
|
-
return response.data;
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
getOrder(id) {
|
|
190
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
191
|
-
const response = yield this.axios.get(`/api/orders/${id}`);
|
|
192
|
-
return response.data;
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
initBankPayout(oid, accountNumber) {
|
|
196
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
-
const response = yield this.axios.post(`/api/payouts/bank`, {
|
|
198
|
-
orderId: oid,
|
|
199
|
-
accountNumber,
|
|
200
|
-
});
|
|
201
|
-
return response.data;
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
getBankPayout(orderId) {
|
|
205
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
206
|
-
const response = yield this.axios.get(`/api/payouts/bank?orderId=${orderId}`);
|
|
207
|
-
return response.data;
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
checkAddress(address, crypto) {
|
|
211
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
212
|
-
const response = yield this.axios.post(`/api/kyt/address`, {
|
|
213
|
-
address,
|
|
214
|
-
crypto,
|
|
215
|
-
});
|
|
216
|
-
return response.data;
|
|
217
|
-
});
|
|
218
|
-
}
|
|
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() {
|
|
226
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
227
|
-
const response = yield this.axios.get(`/api/business/users/broker-customers`);
|
|
228
|
-
return response.data;
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
getSupportedPayoutMethods(fiat, country) {
|
|
232
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
233
|
-
const response = yield this.axios.get(`/api/payout-methods/supported?fiat=${fiat}&country=${country}`);
|
|
234
|
-
return response.data;
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
getPartnerLayout(partnerId) {
|
|
238
|
-
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
|
-
});
|
|
256
|
-
return data;
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
createKushkiPayment(orderId, token) {
|
|
260
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
261
|
-
const { data } = yield this.axios.post(`/api/payments/card/kushki`, {
|
|
262
|
-
orderId,
|
|
263
|
-
token,
|
|
264
|
-
});
|
|
265
|
-
return data;
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
createKushkiBankPayment(orderId) {
|
|
269
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
270
|
-
const { data } = yield this.axios.post(`/api/payments/bank/kushki`, {
|
|
271
|
-
orderId,
|
|
272
|
-
});
|
|
273
|
-
return data;
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
createSPEIPayment(orderId) {
|
|
277
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
278
|
-
const { data } = yield this.axios.post(`/api/payments/bank/spei`, {
|
|
279
|
-
orderId,
|
|
280
|
-
});
|
|
281
|
-
return data;
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
createSPIDPayment(orderId) {
|
|
285
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
286
|
-
const { data } = yield this.axios.post(`/api/payments/bank/spid`, {
|
|
287
|
-
orderId,
|
|
288
|
-
});
|
|
289
|
-
return data;
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
createSWIFTPayment(orderId) {
|
|
293
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
294
|
-
const { data } = yield this.axios.post(`/api/payments/bank/swift`, {
|
|
295
|
-
orderId,
|
|
296
|
-
});
|
|
297
|
-
return data;
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
createInterbankPayment(orderId) {
|
|
301
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
302
|
-
const { data } = yield this.axios.post(`/api/payments/bank/interbank`, {
|
|
303
|
-
orderId,
|
|
304
|
-
});
|
|
305
|
-
return data;
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
updateAuth(update, id) {
|
|
309
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
310
|
-
const { data } = yield this.axios.patch(`/api/auth/${id}`, update);
|
|
311
|
-
return data;
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
exports.RioClient = RioClient;
|
|
@@ -1,34 +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.slackClient = void 0;
|
|
16
|
-
const axios_1 = __importDefault(require("axios"));
|
|
17
|
-
class SlackClient {
|
|
18
|
-
constructor(webhookUrl) {
|
|
19
|
-
this.webhookUrl = webhookUrl;
|
|
20
|
-
}
|
|
21
|
-
sendMessage(message) {
|
|
22
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
try {
|
|
24
|
-
yield axios_1.default.post(this.webhookUrl, {
|
|
25
|
-
text: message,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
console.log(error);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.slackClient = new SlackClient(process.env.SLACK_WEBHOOK_URL);
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { AxiosInstance } from "axios";
|
|
2
|
-
import { BusinessUser } from "../types/business-user";
|
|
3
|
-
import { User } from "../types/user";
|
|
4
|
-
export declare const getUserFromClientHelper: (client: AxiosInstance, includeDeleted?: boolean) => Promise<User | BusinessUser | null | undefined>;
|
|
@@ -1,41 +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.getUserFromClientHelper = void 0;
|
|
13
|
-
const rio_client_1 = require("../clients/rio-client");
|
|
14
|
-
const user_attribute_1 = require("../types/user-attribute");
|
|
15
|
-
const getUserFromClientHelper = (client, includeDeleted) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
-
var _a;
|
|
17
|
-
let individualUser;
|
|
18
|
-
let businessUser;
|
|
19
|
-
try {
|
|
20
|
-
individualUser = yield new rio_client_1.RioClient(client).getUser();
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
individualUser = null;
|
|
24
|
-
}
|
|
25
|
-
try {
|
|
26
|
-
businessUser = yield new rio_client_1.RioClient(client).getBusinessUser();
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
businessUser = null;
|
|
30
|
-
}
|
|
31
|
-
const user = individualUser || businessUser;
|
|
32
|
-
if (includeDeleted) {
|
|
33
|
-
return user;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
if ((_a = user === null || user === void 0 ? void 0 : user.attributes) === null || _a === void 0 ? void 0 : _a.includes(user_attribute_1.UserAttribute.deleted)) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
exports.getUserFromClientHelper = getUserFromClientHelper;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Mongoose } from "mongoose";
|
|
2
|
-
import { User as UserType } from "../types/user";
|
|
3
|
-
import { BusinessUser as BusinessUserType } from "../types/business-user";
|
|
4
|
-
export declare const getUserHelper: (id: string, mongoose: Mongoose) => Promise<UserType | BusinessUserType | null>;
|
|
@@ -1,35 +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.getUserHelper = void 0;
|
|
13
|
-
const business_user_1 = require("../models/business-user");
|
|
14
|
-
const user_1 = require("../models/user");
|
|
15
|
-
const getUserHelper = (id, mongoose) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
-
let individualUser;
|
|
17
|
-
let businessUser;
|
|
18
|
-
const User = (0, user_1.buildUser)(mongoose);
|
|
19
|
-
const BusinessUser = (0, business_user_1.buildBusinessUser)(mongoose);
|
|
20
|
-
try {
|
|
21
|
-
individualUser = yield User.findById(id);
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
individualUser = null;
|
|
25
|
-
}
|
|
26
|
-
try {
|
|
27
|
-
businessUser = yield BusinessUser.findById(id);
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
businessUser = null;
|
|
31
|
-
}
|
|
32
|
-
const user = individualUser || businessUser;
|
|
33
|
-
return user;
|
|
34
|
-
});
|
|
35
|
-
exports.getUserHelper = getUserHelper;
|