@riocrypto/common-server 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/clients/bitstamp-client.d.ts +16 -0
- package/build/clients/bitstamp-client.js +83 -0
- package/build/clients/ccxt-client.d.ts +48 -0
- package/build/clients/ccxt-client.js +201 -0
- package/build/clients/etherscan-client.d.ts +6 -0
- package/build/clients/etherscan-client.js +24 -0
- package/build/clients/fireblocks-client.d.ts +15 -0
- package/build/clients/fireblocks-client.js +140 -0
- package/build/clients/fixer-client.d.ts +8 -0
- package/build/clients/fixer-client.js +34 -0
- package/build/clients/gueno-client.d.ts +10 -0
- package/build/clients/gueno-client.js +44 -0
- package/build/clients/kapstar-client.d.ts +6 -0
- package/build/clients/kapstar-client.js +26 -0
- package/build/clients/kushki-client.d.ts +14 -0
- package/build/clients/kushki-client.js +150 -0
- package/build/clients/rio-client.d.ts +82 -0
- package/build/clients/rio-client.js +315 -0
- package/build/clients/slack-client.d.ts +7 -0
- package/build/clients/slack-client.js +34 -0
- package/build/errors/address-check-failed-error.d.ts +8 -0
- package/build/errors/address-check-failed-error.js +15 -0
- package/build/errors/admin-already-exists-error.d.ts +8 -0
- package/build/errors/admin-already-exists-error.js +15 -0
- package/build/errors/admin-not-found-error.d.ts +8 -0
- package/build/errors/admin-not-found-error.js +15 -0
- package/build/errors/admin-only-error.d.ts +8 -0
- package/build/errors/admin-only-error.js +15 -0
- package/build/errors/api-key-not-found-error.d.ts +8 -0
- package/build/errors/api-key-not-found-error.js +15 -0
- package/build/errors/auth-already-exists-error.d.ts +8 -0
- package/build/errors/auth-already-exists-error.js +15 -0
- package/build/errors/auth-not-found-error.d.ts +8 -0
- package/build/errors/auth-not-found-error.js +15 -0
- package/build/errors/authorization-failed-error.d.ts +8 -0
- package/build/errors/authorization-failed-error.js +15 -0
- package/build/errors/custom-error.d.ts +8 -0
- package/build/errors/custom-error.js +10 -0
- package/build/errors/database-connection-error.d.ts +9 -0
- package/build/errors/database-connection-error.js +16 -0
- package/build/errors/insufficient-liquidity-error.d.ts +8 -0
- package/build/errors/insufficient-liquidity-error.js +19 -0
- package/build/errors/invalid-order-size-error.d.ts +8 -0
- package/build/errors/invalid-order-size-error.js +15 -0
- package/build/errors/message-failed-error.d.ts +8 -0
- package/build/errors/message-failed-error.js +15 -0
- package/build/errors/missing-kyc-approval-error.d.ts +8 -0
- package/build/errors/missing-kyc-approval-error.js +15 -0
- package/build/errors/missing-password-error.d.ts +8 -0
- package/build/errors/missing-password-error.js +15 -0
- package/build/errors/missing-security-question-error.d.ts +8 -0
- package/build/errors/missing-security-question-error.js +15 -0
- package/build/errors/missing-user-error.d.ts +8 -0
- package/build/errors/missing-user-error.js +15 -0
- package/build/errors/not-authorized-error.d.ts +8 -0
- package/build/errors/not-authorized-error.js +15 -0
- package/build/errors/not-broker-error.d.ts +8 -0
- package/build/errors/not-broker-error.js +17 -0
- package/build/errors/not-found-error.d.ts +8 -0
- package/build/errors/not-found-error.js +15 -0
- package/build/errors/partner-already-exists-error.d.ts +8 -0
- package/build/errors/partner-already-exists-error.js +15 -0
- package/build/errors/partner-not-found-error.d.ts +8 -0
- package/build/errors/partner-not-found-error.js +15 -0
- package/build/errors/password-already-used-error.d.ts +8 -0
- package/build/errors/password-already-used-error.js +15 -0
- package/build/errors/request-validation-error.d.ts +11 -0
- package/build/errors/request-validation-error.js +18 -0
- package/build/errors/rio-settings-already-exists-error.d.ts +8 -0
- package/build/errors/rio-settings-already-exists-error.js +15 -0
- package/build/errors/rio-settings-not-found-error.d.ts +8 -0
- package/build/errors/rio-settings-not-found-error.js +15 -0
- package/build/errors/user-already-exists-error.d.ts +8 -0
- package/build/errors/user-already-exists-error.js +15 -0
- package/build/errors/verification-failed-error.d.ts +8 -0
- package/build/errors/verification-failed-error.js +15 -0
- package/build/errors/wrong-order-state-error.d.ts +8 -0
- package/build/errors/wrong-order-state-error.js +17 -0
- package/build/errors/wrong-password-error.d.ts +8 -0
- package/build/errors/wrong-password-error.js +15 -0
- package/build/errors/wrong-processor-error.d.ts +8 -0
- package/build/errors/wrong-processor-error.js +15 -0
- package/build/errors/wrong-security-answer-error.d.ts +8 -0
- package/build/errors/wrong-security-answer-error.js +15 -0
- package/build/events/admin-created-event.d.ts +8 -0
- package/build/events/admin-created-event.js +2 -0
- package/build/events/admin-deleted-event.d.ts +7 -0
- package/build/events/admin-deleted-event.js +2 -0
- package/build/events/bank-payout-initialized-event.d.ts +12 -0
- package/build/events/bank-payout-initialized-event.js +2 -0
- package/build/events/base-listener.d.ts +18 -0
- package/build/events/base-listener.js +30 -0
- package/build/events/base-publisher.d.ts +13 -0
- package/build/events/base-publisher.js +20 -0
- package/build/events/business-kyc-failed-event.d.ts +7 -0
- package/build/events/business-kyc-failed-event.js +2 -0
- package/build/events/business-kyc-passed-event.d.ts +7 -0
- package/build/events/business-kyc-passed-event.js +2 -0
- package/build/events/checked-address-created-event.d.ts +11 -0
- package/build/events/checked-address-created-event.js +2 -0
- package/build/events/checked-address-updated-event.d.ts +10 -0
- package/build/events/checked-address-updated-event.js +2 -0
- package/build/events/clip-card-payment-created-event.d.ts +8 -0
- package/build/events/clip-card-payment-created-event.js +2 -0
- package/build/events/clip-card-payment-failed-event.d.ts +7 -0
- package/build/events/clip-card-payment-failed-event.js +2 -0
- package/build/events/deposit-address-created-event.d.ts +8 -0
- package/build/events/deposit-address-created-event.js +2 -0
- package/build/events/deposit-address-failed-event.d.ts +7 -0
- package/build/events/deposit-address-failed-event.js +2 -0
- package/build/events/deposit-completed-event.d.ts +9 -0
- package/build/events/deposit-completed-event.js +2 -0
- package/build/events/deposit-registered-event.d.ts +9 -0
- package/build/events/deposit-registered-event.js +2 -0
- package/build/events/dlocal-bank-payment-created-event.d.ts +9 -0
- package/build/events/dlocal-bank-payment-created-event.js +2 -0
- package/build/events/dlocal-bank-payment-failed-event.d.ts +7 -0
- package/build/events/dlocal-bank-payment-failed-event.js +2 -0
- package/build/events/fees-failed-event.d.ts +7 -0
- package/build/events/fees-failed-event.js +2 -0
- package/build/events/kyc-failed-event.d.ts +7 -0
- package/build/events/kyc-failed-event.js +2 -0
- package/build/events/kyc-passed-event.d.ts +7 -0
- package/build/events/kyc-passed-event.js +2 -0
- package/build/events/liquidity-fill-failed-event.d.ts +7 -0
- package/build/events/liquidity-fill-failed-event.js +2 -0
- package/build/events/liquidity-filled-event.d.ts +11 -0
- package/build/events/liquidity-filled-event.js +2 -0
- package/build/events/liquidity-routed-event.d.ts +9 -0
- package/build/events/liquidity-routed-event.js +2 -0
- package/build/events/liquidity-routing-failed-event.d.ts +7 -0
- package/build/events/liquidity-routing-failed-event.js +2 -0
- package/build/events/liquidity-transfer-failed-event.d.ts +7 -0
- package/build/events/liquidity-transfer-failed-event.js +2 -0
- package/build/events/liquidity-transfered-event.d.ts +9 -0
- package/build/events/liquidity-transfered-event.js +2 -0
- package/build/events/order-created-event.d.ts +39 -0
- package/build/events/order-created-event.js +2 -0
- package/build/events/order-deleted-event.d.ts +7 -0
- package/build/events/order-deleted-event.js +2 -0
- package/build/events/order-updated-event.d.ts +37 -0
- package/build/events/order-updated-event.js +2 -0
- package/build/events/partner-created-event.d.ts +14 -0
- package/build/events/partner-created-event.js +2 -0
- package/build/events/partner-updated-event.d.ts +19 -0
- package/build/events/partner-updated-event.js +2 -0
- package/build/events/payment-complete-event.d.ts +9 -0
- package/build/events/payment-complete-event.js +2 -0
- package/build/events/payment-created-event.d.ts +8 -0
- package/build/events/payment-created-event.js +2 -0
- package/build/events/payment-failed-event.d.ts +7 -0
- package/build/events/payment-failed-event.js +2 -0
- package/build/events/processor-routed-event.d.ts +9 -0
- package/build/events/processor-routed-event.js +2 -0
- package/build/events/processor-routing-failed-event.d.ts +7 -0
- package/build/events/processor-routing-failed-event.js +2 -0
- package/build/events/quote-failed-event.d.ts +7 -0
- package/build/events/quote-failed-event.js +2 -0
- package/build/events/rio-settings-created-event.d.ts +8 -0
- package/build/events/rio-settings-created-event.js +2 -0
- package/build/events/rio-settings-updated-event.d.ts +8 -0
- package/build/events/rio-settings-updated-event.js +2 -0
- package/build/events/subjects.d.ts +60 -0
- package/build/events/subjects.js +64 -0
- package/build/events/user-created-event.d.ts +25 -0
- package/build/events/user-created-event.js +2 -0
- package/build/events/user-deleted-event.d.ts +7 -0
- package/build/events/user-deleted-event.js +2 -0
- package/build/events/user-disabled-event.d.ts +7 -0
- package/build/events/user-disabled-event.js +2 -0
- package/build/events/user-updated-event.d.ts +23 -0
- package/build/events/user-updated-event.js +2 -0
- package/build/events/wyre-ach-payment-created-event.d.ts +9 -0
- package/build/events/wyre-ach-payment-created-event.js +2 -0
- package/build/events/wyre-payment-method-created-event.d.ts +11 -0
- package/build/events/wyre-payment-method-created-event.js +2 -0
- package/build/events/wyre-transfer-completed-event.d.ts +9 -0
- package/build/events/wyre-transfer-completed-event.js +2 -0
- package/build/events/wyre-transfer-created-event.d.ts +9 -0
- package/build/events/wyre-transfer-created-event.js +2 -0
- package/build/events/wyre-transfer-failed-event.d.ts +9 -0
- package/build/events/wyre-transfer-failed-event.js +2 -0
- package/build/events/wyre-user-created-event.d.ts +9 -0
- package/build/events/wyre-user-created-event.js +2 -0
- package/build/helpers/get-user-helper.d.ts +4 -0
- package/build/helpers/get-user-helper.js +35 -0
- package/build/index.d.ts +91 -0
- package/build/index.js +107 -0
- package/build/middlewares/authorize.d.ts +28 -0
- package/build/middlewares/authorize.js +195 -0
- package/build/middlewares/current-admin-auth.d.ts +15 -0
- package/build/middlewares/current-admin-auth.js +20 -0
- package/build/middlewares/current-auth.d.ts +16 -0
- package/build/middlewares/current-auth.js +20 -0
- package/build/middlewares/error-handler.d.ts +2 -0
- package/build/middlewares/error-handler.js +14 -0
- package/build/middlewares/get-order.d.ts +11 -0
- package/build/middlewares/get-order.js +57 -0
- package/build/middlewares/get-partner.d.ts +10 -0
- package/build/middlewares/get-partner.js +41 -0
- package/build/middlewares/get-user.d.ts +12 -0
- package/build/middlewares/get-user.js +45 -0
- package/build/middlewares/require-admin-api-key.d.ts +2 -0
- package/build/middlewares/require-admin-api-key.js +11 -0
- package/build/middlewares/require-auth.d.ts +2 -0
- package/build/middlewares/require-auth.js +11 -0
- package/build/middlewares/require-priveleges.d.ts +2 -0
- package/build/middlewares/require-priveleges.js +15 -0
- package/build/middlewares/validate-auth.d.ts +2 -0
- package/build/middlewares/validate-auth.js +30 -0
- package/build/middlewares/validate-kyc.d.ts +2 -0
- package/build/middlewares/validate-kyc.js +30 -0
- package/build/middlewares/validate-order.d.ts +0 -0
- package/build/middlewares/validate-order.js +20 -0
- package/build/middlewares/validate-request.d.ts +2 -0
- package/build/middlewares/validate-request.js +13 -0
- package/build/middlewares/verify-admin-api-key.d.ts +9 -0
- package/build/middlewares/verify-admin-api-key.js +11 -0
- package/build/models/admin-auth.d.ts +16 -0
- package/build/models/admin-auth.js +59 -0
- package/build/models/auth.d.ts +24 -0
- package/build/models/auth.js +83 -0
- package/build/models/bank-payout.d.ts +20 -0
- package/build/models/bank-payout.js +44 -0
- package/build/models/business-user.d.ts +57 -0
- package/build/models/business-user.js +111 -0
- package/build/models/ccxt-order.d.ts +16 -0
- package/build/models/ccxt-order.js +37 -0
- package/build/models/checked-address.d.ts +17 -0
- package/build/models/checked-address.js +37 -0
- package/build/models/kushki-payment.d.ts +16 -0
- package/build/models/kushki-payment.js +37 -0
- package/build/models/kyc.d.ts +20 -0
- package/build/models/kyc.js +45 -0
- package/build/models/order.d.ts +67 -0
- package/build/models/order.js +123 -0
- package/build/models/partner.d.ts +35 -0
- package/build/models/partner.js +69 -0
- package/build/models/rio-settings.d.ts +12 -0
- package/build/models/rio-settings.js +29 -0
- package/build/models/user.d.ts +53 -0
- package/build/models/user.js +94 -0
- package/build/services/apiKey.d.ts +3 -0
- package/build/services/apiKey.js +24 -0
- package/build/services/password.d.ts +4 -0
- package/build/services/password.js +32 -0
- package/build/services/s3.d.ts +5 -0
- package/build/services/s3.js +21 -0
- package/build/types/address-check-result.d.ts +4 -0
- package/build/types/address-check-result.js +8 -0
- package/build/types/admin.d.ts +4 -0
- package/build/types/admin.js +2 -0
- package/build/types/api-key.d.ts +5 -0
- package/build/types/api-key.js +2 -0
- package/build/types/auth-update.d.ts +8 -0
- package/build/types/auth-update.js +2 -0
- package/build/types/auth.d.ts +6 -0
- package/build/types/auth.js +2 -0
- package/build/types/authorization-type.d.ts +8 -0
- package/build/types/authorization-type.js +12 -0
- package/build/types/bank-payout.d.ts +7 -0
- package/build/types/bank-payout.js +2 -0
- package/build/types/business-user-input.d.ts +27 -0
- package/build/types/business-user-input.js +2 -0
- package/build/types/business-user-update.d.ts +26 -0
- package/build/types/business-user-update.js +2 -0
- package/build/types/business-user.d.ts +30 -0
- package/build/types/business-user.js +2 -0
- package/build/types/ccxt-liquidity-provider.d.ts +5 -0
- package/build/types/ccxt-liquidity-provider.js +9 -0
- package/build/types/checked-address.d.ts +7 -0
- package/build/types/checked-address.js +2 -0
- package/build/types/clip-payment-status.d.ts +3 -0
- package/build/types/clip-payment-status.js +7 -0
- package/build/types/country.d.ts +57 -0
- package/build/types/country.js +256 -0
- package/build/types/crypto.d.ts +6 -0
- package/build/types/crypto.js +38 -0
- package/build/types/dlocal-payment-method.d.ts +4 -0
- package/build/types/dlocal-payment-method.js +8 -0
- package/build/types/fees.d.ts +9 -0
- package/build/types/fees.js +2 -0
- package/build/types/fiat.d.ts +6 -0
- package/build/types/fiat.js +45 -0
- package/build/types/kyc-status.d.ts +7 -0
- package/build/types/kyc-status.js +11 -0
- package/build/types/language.d.ts +6 -0
- package/build/types/language.js +10 -0
- package/build/types/liquidity-provider.d.ts +9 -0
- package/build/types/liquidity-provider.js +13 -0
- package/build/types/order-input.d.ts +31 -0
- package/build/types/order-input.js +2 -0
- package/build/types/order-status.d.ts +21 -0
- package/build/types/order-status.js +51 -0
- package/build/types/order.d.ts +37 -0
- package/build/types/order.js +2 -0
- package/build/types/partner-auth.d.ts +5 -0
- package/build/types/partner-auth.js +2 -0
- package/build/types/partner-stats.d.ts +5 -0
- package/build/types/partner-stats.js +2 -0
- package/build/types/partner-status.d.ts +6 -0
- package/build/types/partner-status.js +10 -0
- package/build/types/partner-update.d.ts +10 -0
- package/build/types/partner-update.js +2 -0
- package/build/types/partner.d.ts +15 -0
- package/build/types/partner.js +2 -0
- package/build/types/payment-method.d.ts +5 -0
- package/build/types/payment-method.js +9 -0
- package/build/types/payout-method.d.ts +3 -0
- package/build/types/payout-method.js +7 -0
- package/build/types/platform-fee-range.d.ts +5 -0
- package/build/types/platform-fee-range.js +2 -0
- package/build/types/processor.d.ts +12 -0
- package/build/types/processor.js +16 -0
- package/build/types/quote.d.ts +21 -0
- package/build/types/quote.js +2 -0
- package/build/types/rio-env.d.ts +6 -0
- package/build/types/rio-env.js +10 -0
- package/build/types/rio-settings-update.d.ts +4 -0
- package/build/types/rio-settings-update.js +2 -0
- package/build/types/rio-settings.d.ts +4 -0
- package/build/types/rio-settings.js +2 -0
- package/build/types/security-question.d.ts +7 -0
- package/build/types/security-question.js +11 -0
- package/build/types/side.d.ts +4 -0
- package/build/types/side.js +8 -0
- package/build/types/us-state.d.ts +61 -0
- package/build/types/us-state.js +65 -0
- package/build/types/user-attribute.d.ts +10 -0
- package/build/types/user-attribute.js +14 -0
- package/build/types/user-input.d.ts +26 -0
- package/build/types/user-input.js +2 -0
- package/build/types/user-type.d.ts +4 -0
- package/build/types/user-type.js +8 -0
- package/build/types/user-update.d.ts +25 -0
- package/build/types/user-update.js +2 -0
- package/build/types/user.d.ts +30 -0
- package/build/types/user.js +2 -0
- package/build/types/users-stats.d.ts +3 -0
- package/build/types/users-stats.js +2 -0
- package/build/types/wyre-address.d.ts +9 -0
- package/build/types/wyre-address.js +2 -0
- package/build/types/wyre-order-status.d.ts +7 -0
- package/build/types/wyre-order-status.js +11 -0
- package/build/types/wyre-payment-method.d.ts +40 -0
- package/build/types/wyre-payment-method.js +2 -0
- package/build/types/wyre-webhook-notification.d.ts +12 -0
- package/build/types/wyre-webhook-notification.js +2 -0
- package/package.json +36 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BusinessUser } from "../types/business-user";
|
|
2
|
+
import { Order } from "../types/order";
|
|
3
|
+
import { User } from "../types/user";
|
|
4
|
+
declare class KushkiClient {
|
|
5
|
+
private privateMerchantId;
|
|
6
|
+
private environment;
|
|
7
|
+
private baseUrl;
|
|
8
|
+
constructor(privateMerchantId: string, environment: "sandbox" | "production");
|
|
9
|
+
createPaymentLink(order: Order, user: User, token: string): Promise<any>;
|
|
10
|
+
createBankPaymentToken(order: Order, user: User | BusinessUser): Promise<any>;
|
|
11
|
+
createBankPayment(order: Order, user: User | BusinessUser, token: string): Promise<any>;
|
|
12
|
+
}
|
|
13
|
+
export declare const kushkiClient: KushkiClient;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,150 @@
|
|
|
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);
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,315 @@
|
|
|
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;
|
|
@@ -0,0 +1,34 @@
|
|
|
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);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddressCheckFailed = void 0;
|
|
4
|
+
const custom_error_1 = require("./custom-error");
|
|
5
|
+
class AddressCheckFailed extends custom_error_1.CustomError {
|
|
6
|
+
constructor() {
|
|
7
|
+
super("Address check failed");
|
|
8
|
+
this.statusCode = 400;
|
|
9
|
+
Object.setPrototypeOf(this, AddressCheckFailed.prototype);
|
|
10
|
+
}
|
|
11
|
+
serializeErrors() {
|
|
12
|
+
return [{ message: "Address check failed" }];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.AddressCheckFailed = AddressCheckFailed;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AdminAlreadyExistsError = void 0;
|
|
4
|
+
const custom_error_1 = require("./custom-error");
|
|
5
|
+
class AdminAlreadyExistsError extends custom_error_1.CustomError {
|
|
6
|
+
constructor() {
|
|
7
|
+
super("Admin with provided email already exists");
|
|
8
|
+
this.statusCode = 409;
|
|
9
|
+
Object.setPrototypeOf(this, AdminAlreadyExistsError.prototype);
|
|
10
|
+
}
|
|
11
|
+
serializeErrors() {
|
|
12
|
+
return [{ message: "Admin with provided email already exists" }];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.AdminAlreadyExistsError = AdminAlreadyExistsError;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AdminNotFoundError = void 0;
|
|
4
|
+
const custom_error_1 = require("./custom-error");
|
|
5
|
+
class AdminNotFoundError extends custom_error_1.CustomError {
|
|
6
|
+
constructor() {
|
|
7
|
+
super("Admin not found");
|
|
8
|
+
this.statusCode = 404;
|
|
9
|
+
Object.setPrototypeOf(this, AdminNotFoundError.prototype);
|
|
10
|
+
}
|
|
11
|
+
serializeErrors() {
|
|
12
|
+
return [{ message: "Admin not found" }];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.AdminNotFoundError = AdminNotFoundError;
|