Chore: merge compliance notification code changes
This commit is contained in:
parent
fc39d9b1a3
commit
757db75d1a
7 changed files with 36 additions and 21 deletions
|
|
@ -10,6 +10,7 @@ const customers = require('../customers')
|
|||
const httpError = require('../route-helpers').httpError
|
||||
const plugins = require('../plugins')
|
||||
const Tx = require('../tx')
|
||||
const respond = require('../respond')
|
||||
|
||||
function addOrUpdateCustomer (req) {
|
||||
const customerData = req.body
|
||||
|
|
@ -52,7 +53,7 @@ function getCustomerWithPhoneCode (req, res, next) {
|
|||
return pi.getPhoneCode(phone)
|
||||
.then(code => {
|
||||
return addOrUpdateCustomer(req)
|
||||
.then(customer => res.status(200).json({ code, customer }))
|
||||
.then(customer => respond(req, res, { code, customer }))
|
||||
})
|
||||
.catch(err => {
|
||||
if (err.name === 'BadNumberError') throw httpError('Bad number', 401)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue