fix balance notification
This commit is contained in:
parent
ec09aaeb7d
commit
6ee2566588
2 changed files with 5 additions and 3 deletions
|
|
@ -7,7 +7,7 @@ var db = require('../lib/postgresql_interface')
|
|||
function getBalances () {
|
||||
return [
|
||||
{fiatBalance: 23.2345, fiatCode: 'USD', cryptoCode: 'BTC'},
|
||||
{fiatBalance: 22, fiatCode: 'USD', cryptoCode: 'ETH'}
|
||||
{fiatBalance: 23, fiatCode: 'USD', cryptoCode: 'ETH'}
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ var numeral = require('numeral')
|
|||
var db = null
|
||||
var getBalances = null
|
||||
|
||||
var LOW_BALANCE_THRESHOLD = 1000
|
||||
var LOW_BALANCE_THRESHOLD = null
|
||||
var STALE_STATE = 2 * 60 * 1000
|
||||
var NETWORK_DOWN_TIME = 60 * 1000
|
||||
|
||||
|
|
@ -13,6 +13,8 @@ function init (_db, _getBalances, config) {
|
|||
db = _db
|
||||
getBalances = _getBalances
|
||||
|
||||
console.log('DEBUG2')
|
||||
console.log(config)
|
||||
if (config && config.lowBalanceThreshold) {
|
||||
LOW_BALANCE_THRESHOLD = config.lowBalanceThreshold
|
||||
}
|
||||
|
|
@ -30,7 +32,7 @@ function sameState (a, b) {
|
|||
}
|
||||
|
||||
function checkBalance (rec) {
|
||||
return rec.fiatBalance < LOW_BALANCE_THRESHOLD
|
||||
return LOW_BALANCE_THRESHOLD && rec.fiatBalance < LOW_BALANCE_THRESHOLD
|
||||
? {code: 'lowBalance', cryptoCode: rec.cryptoCode, fiatBalance: rec.fiatBalance, fiatCode: rec.fiatCode}
|
||||
: null
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue