refactor(routes) accomodate new idVerifier plugin structure
This commit is contained in:
parent
f1dfb2158f
commit
bf6b5c0958
1 changed files with 18 additions and 4 deletions
|
|
@ -72,10 +72,22 @@ function deviceEvent(req, res) {
|
||||||
res.json({err: null});
|
res.json({err: null});
|
||||||
}
|
}
|
||||||
|
|
||||||
function idVerify(req, res) {
|
function verifyUser(req, res) {
|
||||||
if (_mock) return res.json({success: true});
|
if (_mock) return res.json({success: true});
|
||||||
|
|
||||||
_idVerifier.verify(req.body, function (err, idResult) {
|
_idVerifier.verifyUser(req.body, function (err, idResult) {
|
||||||
|
if (err) {
|
||||||
|
logger.error(err);
|
||||||
|
return res.json({err: 'Verification failed'});
|
||||||
|
}
|
||||||
|
res.json(idResult);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function verifyTransaction(req, res) {
|
||||||
|
if (_mock) return res.json({success: true});
|
||||||
|
|
||||||
|
_idVerifier.verifyTransaction(req.body, function (err, idResult) {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error(err);
|
logger.error(err);
|
||||||
return res.json({err: 'Verification failed'});
|
return res.json({err: 'Verification failed'});
|
||||||
|
|
@ -122,14 +134,16 @@ function init(config) {
|
||||||
var app = config.app;
|
var app = config.app;
|
||||||
_lamassuConfig.readExchangesConfig(function (err, res) {
|
_lamassuConfig.readExchangesConfig(function (err, res) {
|
||||||
var idVerifyConfig = res.exchanges.plugins.settings.identitymind;
|
var idVerifyConfig = res.exchanges.plugins.settings.identitymind;
|
||||||
_idVerifier = require('lamassu-identitymind').factory(idVerifyConfig);
|
_idVerifier = require('lamassu-identitymind');
|
||||||
|
_idVerifier.init(idVerifyConfig);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/poll', authMiddleware, poll);
|
app.get('/poll', authMiddleware, poll);
|
||||||
app.post('/send', authMiddleware, send);
|
app.post('/send', authMiddleware, send);
|
||||||
app.post('/trade', authMiddleware, trade);
|
app.post('/trade', authMiddleware, trade);
|
||||||
app.post('/event', authMiddleware, deviceEvent);
|
app.post('/event', authMiddleware, deviceEvent);
|
||||||
app.post('/verify_id', authMiddleware, idVerify);
|
app.post('/verify_user', authMiddleware, verifyUser);
|
||||||
|
app.post('/verify_transaction', authMiddleware, verifyTransaction);
|
||||||
app.post('/pair', pair);
|
app.post('/pair', pair);
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue