This commit is contained in:
Josh Harvey 2016-07-31 15:08:22 +03:00
parent a64c7be077
commit a5bd4c4311
3 changed files with 18 additions and 10 deletions

View file

@ -134,9 +134,9 @@ function loadPlugin (name, config) {
function loadOrConfigPlugin (pluginHandle, pluginType, cryptoCode, options, function loadOrConfigPlugin (pluginHandle, pluginType, cryptoCode, options,
onChangeCallback) { onChangeCallback) {
cryptoCode = cryptoCode || 'BTC' const currentName = cryptoCode
? cachedConfig.exchanges.plugins.current[cryptoCode][pluginType]
const currentName = cachedConfig.exchanges.plugins.current[cryptoCode][pluginType] : cachedConfig.exchanges.plugins.current[pluginType]
currentlyUsedPlugins[cryptoCode] = currentlyUsedPlugins[cryptoCode] || {} currentlyUsedPlugins[cryptoCode] = currentlyUsedPlugins[cryptoCode] || {}
@ -153,8 +153,11 @@ function loadOrConfigPlugin (pluginHandle, pluginType, cryptoCode, options,
pluginHandle = loadPlugin(currentName, mergedConfig) pluginHandle = loadPlugin(currentName, mergedConfig)
currentlyUsedPlugins[cryptoCode] = currentlyUsedPlugins[cryptoCode] || {} currentlyUsedPlugins[cryptoCode] = currentlyUsedPlugins[cryptoCode] || {}
currentlyUsedPlugins[cryptoCode][pluginType] = currentName currentlyUsedPlugins[cryptoCode][pluginType] = currentName
logger.debug('[%s] plugin(%s) loaded: %s', cryptoCode, pluginType, pluginHandle.NAME || const pluginName = pluginHandle.NAME || currentName
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)) .then(res => db.updateTxStatus(tx, res.status))
.catch(err => { .catch(err => {
console.log(err.stack) 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) { 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 = { const rec = {
sms: { sms: {
toNumber: phone, toNumber: phone,

View file

@ -363,7 +363,7 @@ exports.updateTxStatus = function updateTxStatus (tx, status) {
} }
exports.updateRedeem = function updateRedeem (txId) { 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] const values = [true, txId]
return db.none(sql, values) return db.none(sql, values)

View file

@ -14,8 +14,10 @@ var exchanges = {
}, },
plugins: { plugins: {
current: { current: {
BTC: {
ticker: 'bitpay', ticker: 'bitpay',
transfer: 'bitgo', transfer: 'bitgo'
},
email: 'smtp2go', email: 'smtp2go',
sms: 'twilio', sms: 'twilio',
notify: [] notify: []