rewoking getCommissionPercentage function

This commit is contained in:
Fabio Cigliano 2018-11-26 11:31:08 +13:00 committed by Josh Harvey
parent 03279c8d2c
commit 5815a606f2
3 changed files with 16 additions and 8 deletions

View file

@ -32,13 +32,13 @@ const PONG_TTL = '1 week'
const tradesQueues = {}
function plugins (settings, deviceId) {
function getCommissionForTx (tx) {
const direction = _.get('direction', tx)
const cryptoCode = _.get('cryptoCode', tx)
function getCommissionPercentage (cryptoCode) {
const cryptoConfig = configManager.scoped(cryptoCode, deviceId, settings.config)
if (direction === 'cashIn') return /* cashInCommission */ BN(cryptoConfig.cashInCommission).div(100)
if (direction === 'cashOut') return /* cashOutCommission */ BN(cryptoConfig.cashOutCommission).div(100)
return {
cashIn: BN(cryptoConfig.cashInCommission).div(100),
cashOut: BN(cryptoConfig.cashOutCommission).div(100)
}
}
function buildRates (tickers) {
@ -793,7 +793,7 @@ function plugins (settings, deviceId) {
sell,
notificationsEnabled,
notifyOperator,
getCommissionForTx
getCommissionPercentage
}
}