diff --git a/lib/plugins.js b/lib/plugins.js index 08455d5d..fb770557 100644 --- a/lib/plugins.js +++ b/lib/plugins.js @@ -134,9 +134,9 @@ function loadPlugin (name, config) { function loadOrConfigPlugin (pluginHandle, pluginType, cryptoCode, options, onChangeCallback) { - cryptoCode = cryptoCode || 'BTC' - - const currentName = cachedConfig.exchanges.plugins.current[cryptoCode][pluginType] + const currentName = cryptoCode + ? cachedConfig.exchanges.plugins.current[cryptoCode][pluginType] + : cachedConfig.exchanges.plugins.current[pluginType] currentlyUsedPlugins[cryptoCode] = currentlyUsedPlugins[cryptoCode] || {} @@ -153,8 +153,11 @@ function loadOrConfigPlugin (pluginHandle, pluginType, cryptoCode, options, pluginHandle = loadPlugin(currentName, mergedConfig) currentlyUsedPlugins[cryptoCode] = currentlyUsedPlugins[cryptoCode] || {} currentlyUsedPlugins[cryptoCode][pluginType] = currentName - logger.debug('[%s] plugin(%s) loaded: %s', cryptoCode, pluginType, pluginHandle.NAME || - currentName) + const pluginName = pluginHandle.NAME || currentName + + cryptoCode + ? logger.debug('[%s] plugin(%s) loaded: %s', cryptoCode, pluginType, pluginName) + : logger.debug('plugin(%s) loaded: %s', pluginType, pluginName) } } @@ -429,7 +432,7 @@ function processTxStatus (tx) { .then(res => db.updateTxStatus(tx, res.status)) .catch(err => { console.log(err.stack) - logger.error('[%s] Tx status processing error: %s', cryptoCode, err.message) + logger.error('[%s] Tx status processing error: %s', cryptoCode, err.stack) }) } @@ -757,7 +760,10 @@ exports.startCheckingNotification = function startCheckingNotification () { } exports.getPhoneCode = function getPhoneCode (phone) { - const code = BigNumber.random().toFixed(6).slice(2) + const code = smsPlugin.NAME === 'MockSMS' + ? '123' + : BigNumber.random().toFixed(6).slice(2) + const rec = { sms: { toNumber: phone, diff --git a/lib/postgresql_interface.js b/lib/postgresql_interface.js index 599ed6ca..fdd31cf0 100644 --- a/lib/postgresql_interface.js +++ b/lib/postgresql_interface.js @@ -363,7 +363,7 @@ exports.updateTxStatus = function updateTxStatus (tx, status) { } exports.updateRedeem = function updateRedeem (txId) { - const sql = 'UPDATE cash_out_txs SET redeem=$1 WHERE txId=$2' + const sql = 'UPDATE cash_out_txs SET redeem=$1 WHERE id=$2' const values = [true, txId] return db.none(sql, values) diff --git a/migrations/001-initial.js b/migrations/001-initial.js index e5e3278c..b262991f 100644 --- a/migrations/001-initial.js +++ b/migrations/001-initial.js @@ -14,8 +14,10 @@ var exchanges = { }, plugins: { current: { - ticker: 'bitpay', - transfer: 'bitgo', + BTC: { + ticker: 'bitpay', + transfer: 'bitgo' + }, email: 'smtp2go', sms: 'twilio', notify: []