diff --git a/lib/customers.js b/lib/customers.js index 47cdccd1..a8054047 100644 --- a/lib/customers.js +++ b/lib/customers.js @@ -24,7 +24,7 @@ function getDailyVolume (id) { db.one(`select coalesce(sum(fiat), 0) as total from cash_in_txs where customer_id=$1 and created > now() - interval '1 day'`, [id]), - db.one(`select COALESCE(sum(fiat), 0) as total from cash_out_txs + db.one(`select coalesce(sum(fiat), 0) as total from cash_out_txs where customer_id=$1 and created > now() - interval '1 day'`, [id]) ]).then(([cashInTotal, cashOutTotal]) => { diff --git a/lib/routes.js b/lib/routes.js index b670a30a..24c64b1a 100644 --- a/lib/routes.js +++ b/lib/routes.js @@ -62,6 +62,8 @@ function poll (req, res, next) { idVerificationEnabled: config.idVerificationEnabled, smsVerificationActive: config.smsVerificationActive, smsVerificationThreshold: config.smsVerificationThreshold, + hardLimitVerificationActive: config.hardLimitVerificationActive, + hardLimitVerificationThreshold: config.hardLimitVerificationThreshold, cassettes, twoWayMode: config.cashOutEnabled, zeroConfLimit: config.zeroConfLimit, @@ -188,6 +190,19 @@ function pair (req, res, next) { .catch(next) } +function phoneCode (req, res, next) { + const pi = plugins(req.settings, req.deviceId) + const phone = req.body.phone + + return pi.getPhoneCode(phone) + .then(code => respond(req, res, {code})) + .catch(err => { + if (err.name === 'BadNumberError') throw httpError('Bad number', 410) + throw err + }) + .catch(next) +} + function errorHandler (err, req, res, next) { const statusCode = err.name === 'HTTPError' ? err.code || 500 @@ -283,6 +298,8 @@ app.get('/tx', getPhoneTx) app.use(errorHandler) app.use((req, res) => { + console.log('DEBUG98') + console.log(req.route) res.status(404).json({error: 'No such route'}) })