Update Customer's data
This commit is contained in:
parent
9877fc8ef0
commit
94de659246
3 changed files with 534 additions and 104 deletions
|
|
@ -29,6 +29,7 @@ const server = require('./server')
|
|||
const transactions = require('./transactions')
|
||||
const customers = require('../customers')
|
||||
const funding = require('./funding')
|
||||
const _ = require('lodash/fp')
|
||||
|
||||
const NEVER = new Date(Date.now() + 100 * T.years)
|
||||
const REAUTHENTICATE_INTERVAL = T.minute
|
||||
|
|
@ -184,9 +185,7 @@ app.get('/api/customer/:id', (req, res, next) => {
|
|||
})
|
||||
|
||||
/**
|
||||
* Endpoint for patching customer's authorizedOverride status
|
||||
*
|
||||
* Possible values: blocked, verified, automatic
|
||||
* Endpoint for patching customer's data
|
||||
*
|
||||
* @param {string} '/api/customer/ Url to handle
|
||||
* @param {object} req Request object
|
||||
|
|
@ -194,11 +193,8 @@ app.get('/api/customer/:id', (req, res, next) => {
|
|||
* @param {function} next Callback
|
||||
*/
|
||||
app.patch('/api/customer/:id', (req, res, next) => {
|
||||
if (!req.query.authorizedOverride) return res.status(400).send({Error: 'Requires authorized'})
|
||||
|
||||
return customers.patch(req.params.id, {
|
||||
authorizedOverride: req.query.authorizedOverride
|
||||
})
|
||||
if (!req.params.id) return res.status(400).send({Error: 'Requires id'})
|
||||
return customers.update(req.params.id, req.query)
|
||||
.then(r => res.send(r))
|
||||
.catch(() => res.status(404).send({Error: 'Not found'}))
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue