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,
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,

View file

@ -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)

View file

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