fix raqia back compat
This commit is contained in:
parent
6cfe2259cc
commit
ca161fb9f2
2 changed files with 4 additions and 4 deletions
|
|
@ -489,16 +489,16 @@ function insertDispense (client, session, tx, cartridges, transactionId, cb) {
|
||||||
|
|
||||||
exports.addIncomingPhone = function addIncomingPhone (session, tx, notified, cb) {
|
exports.addIncomingPhone = function addIncomingPhone (session, tx, notified, cb) {
|
||||||
var sql = 'UPDATE transactions SET phone=$1, notified=$2 ' +
|
var sql = 'UPDATE transactions SET phone=$1, notified=$2 ' +
|
||||||
'WHERE incoming=$3 AND device_fingerprint=$4 AND session_id=$5'
|
'WHERE incoming=$3 AND device_fingerprint=$4 AND session_id=$5 AND phone IS NULL'
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
connect(function (cerr, client, done) {
|
connect(function (cerr, client, done) {
|
||||||
if (cerr) return reject(cerr)
|
if (cerr) return reject(cerr)
|
||||||
var values = [tx.phone, notified, true, session.fingerprint, tx.sessionId]
|
var values = [tx.phone, notified, true, session.fingerprint, tx.sessionId]
|
||||||
query(client, sql, values, function (err) {
|
query(client, sql, values, function (err, results) {
|
||||||
done(err)
|
done(err)
|
||||||
if (err) return reject(err)
|
if (err) return reject(err)
|
||||||
resolve()
|
resolve({noPhone: results.rowCount === 0})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,7 @@ function phoneCode (req, res) {
|
||||||
function updatePhone (req, res) {
|
function updatePhone (req, res) {
|
||||||
const notified = req.query.notified === 'true'
|
const notified = req.query.notified === 'true'
|
||||||
return plugins.updatePhone(session(req), req.body, notified)
|
return plugins.updatePhone(session(req), req.body, notified)
|
||||||
.then(code => res.json(200))
|
.then(res => res.json(res))
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
res.sendStatus(500)
|
res.sendStatus(500)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue