- ./exchanger-api/plugins - folder with plugins for the exchanger
- ./exchanger-api/config - folder with rest-api configurations
- ./exchanger-admin-web/config - folder with configurations for the client side of the admin panel
- ./exchanger-client-web/config - folder with configurations for the client side
Services
- nginx - service for fast and stable delivery of vue applications, as well as for proxy rest api and ws
- mongodb - service main project database
- redis - service for operational data, as well as for notifying other microservices about a new event;
- nodejs - service main platform
- (s) ex-api-http -service provides REST-API (main service works in cluster mode);
- (s) ex-ws - service provides a WebSocket connection with clients and an admin panel responsible for real-time actions;
- (s) ex-parser-rate - service analyzes the course in different sources, processes them and updates them in the database;
- (s) ex-cron - service checks the status of the server, counts the number of visits, cleans up unnecessary data and creates a backup copy of the database;
- (s) ex-payout-service - service processes applications that are marked as paid or ready for payment (if auto- or semi-automatic exchange is active and the payment systems API is configured);
- (s) ex-notification-service -service sends notifications to the client and the administrator via e-mail and common messengers;
- (s) ex-blacklist-bc - service the service checks and updates the status of the blacklist from the bestchange.org service
- (s) ex-migrate - service checks the relevance of data in the database and brings them to a single standard;
- (s) ex-seed - service uploads basic data to the exchanger;
Payout Module
File structure:
plugins/payouts/__NAME_PAYOUT
- module folder./icon.png
or./icon.jpg
- 1: 1 module icon (150px by 150px recommended)./configure.js
- rules file module configuration also access configuration./index.js
- Module class (module entry point)./template/admin.html
- Module settings page admin template (vue template)./template/admin.js
- client logic js export file (vue js)
configure.js
:
Example file and its functions
module.exports.type = 'payout'; // module type (payout)
module.exports.title = 'Title of payout'; // module header for display in the admin panel (up to 200 characters)
module.exports.name = 'Name service'; // Module name for display in currencies (up to 50 characters)
module.exports.required_npm = []; //array of required npm modules
//xml array of currencies with which this module works
module.exports.allow_XML = [
"CARDUSD",
"WMZ",
];
// default config object (will be set in config / app_config.json)
module.exports.default_config = {
clientID: '',
clientSecret: '',
clientPassword: '',
};
// data types in configuration where 1 public key 2 secret (will not be transmitted to the admin every time)
module.exports.required_config = {
clientID: 1,
clientSecret: 2, // hide
clientPassword: 2, // hide
};
index.js
:
Must have export class
How to work with config:
const id_key = __dirname.split('/').slice(-1)[0];
const config = require('../main_config')(id_key);
const clientID = await config.get('clientID') //get config by key clientID
Example of constructor
constructor(API) {
this.API = API;
this.allowIPs = [];
this.id_key = id_key;
this.web_domain = config.get('domain');
this.schema = config.get('schema');
}
getFields(lang,xml){}
Function
lang
has
Sting:
Param ru, en, etc...
- Short key of language
xml
has Sting:
Param Example of constructor
Should Return Array (when xml is support)
// example
return [{
_id: 'account_p',
name: 'Advanced account USD',
placeholder: 'U000000',
regexp: '^U+[0-9]{6,12}$',
regexp_error: "Account incorrect",
required: true,
}];
NULL
(when xml is not support)
Should Return transfer(order){}
Function
order
has object:
Param
key | Type | Required | Value |
---|---|---|---|
order.uid | Number | YES | order uid |
order.outAmount | Float | YES | order outAmount |
order.outXML | String | YES | XML of currency for withdrawal |
order.outValues | Object | YES | Order requisites |
//example of object order.outValues
order.outValues ={
account_p:'U000000'
}
// key its from getFields ._id
// value entered client
Should Return Promise -> resolve (when transfer success) {Object}
key | Type | Required | Value |
---|---|---|---|
ok | Number | YES | 1 - success |
transaction | String | YES | transaction id or transfer id |
to | String | YES | Wallet id or other requisites who received payment |
currency | String | YES | Currency ISO (example USD) |
amount | Float | YES | amount of transfer |
fee | Float | No | Fee of tx (will add comment for admin) |
note | String | No | Note for order (will show to user) |
Should Return Promise -> reject (when transfer fail) {String}
Message of fail