WIP -- fix back compat with raqia

This commit is contained in:
Josh Harvey 2016-05-14 02:12:30 +03:00
parent ca161fb9f2
commit 190efd4d70
2 changed files with 5 additions and 3 deletions

View file

@ -489,12 +489,14 @@ 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 AND phone IS NULL' 'WHERE incoming=$3 AND device_fingerprint=$4 AND session_id=$5 ' +
'AND stage=$6 AND authority=$7 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, 'initial_request', 'pending']
query(client, sql, values, function (err, results) { query(client, sql, values, function (err, results) {
done(err) done(err)
if (err) return reject(err) if (err) return reject(err)

View file

@ -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(res => res.json(res)) .then(r => res.json(r))
.catch(err => { .catch(err => {
logger.error(err) logger.error(err)
res.sendStatus(500) res.sendStatus(500)