Provide hard-limit info

This commit is contained in:
goga-m 2017-08-31 15:33:59 +03:00 committed by Josh Harvey
parent 0d8a8547f5
commit 51ebfe6a1d
2 changed files with 18 additions and 1 deletions

View file

@ -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]) => {

View file

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