Skip to content

Commit

Permalink
Merge branch 'master' into 166-enhance-enrollment-logic
Browse files Browse the repository at this point in the history
  • Loading branch information
serdiukov-o-nordwhale committed May 5, 2020
2 parents 8f54d19 + 5b89214 commit efe1e2a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/server/verification/api/ZoomAPI.js
Expand Up @@ -81,6 +81,7 @@ class ZoomAPI {
async faceSearch(payload, minimalMatchLevel: number = null) {
const { http, defaultMinimalMatchLevel } = this
const response = await http.post('/search', payload)
console.log({ response })
let minMatchLevel = minimalMatchLevel

if (null === minMatchLevel) {
Expand Down
22 changes: 12 additions & 10 deletions src/server/verification/verificationAPI.js
Expand Up @@ -34,16 +34,16 @@ const setup = (app: Router, verifier: VerificationAPI, storage: StorageAPI) => {
'/verify/face/:enrollmentIdentifier',
passport.authenticate('jwt', { session: false }),
wrapAsync(async (req, res) => {
const { params, query } = req
const { params, query, log, user } = req
const { enrollmentIdentifier } = params
const { signature } = query
const processor = createEnrollmentProcessor(storage)

try {
const processor = createEnrollmentProcessor(storage)
await processor.enqueueDisposal(enrollmentIdentifier, signature)
} catch (exception) {
const { message } = exception

log.error('delete face record failed:', { message, exception, enrollmentIdentifier, user })
res.status(400).json({ success: false, error: message })
return
}
Expand All @@ -67,12 +67,12 @@ const setup = (app: Router, verifier: VerificationAPI, storage: StorageAPI) => {
passport.authenticate('jwt', { session: false }),
wrapAsync(async (req, res) => {
const { user, log, params, body: payload } = req
const enrollmentProcessor = createEnrollmentProcessor(storage)
const { enrollmentIdentifier } = params
let enrollmentResult

try {
const { enrollmentIdentifier } = params
const { skipFaceVerification } = conf
const enrollmentProcessor = createEnrollmentProcessor(storage)

enrollmentProcessor.validate(user, enrollmentIdentifier, payload)

Expand Down Expand Up @@ -116,7 +116,7 @@ const setup = (app: Router, verifier: VerificationAPI, storage: StorageAPI) => {
} catch (exception) {
const { message } = exception

log.error('Face verification error:', message, exception)
log.error('Face verification error:', { message, exception, enrollmentIdentifier })
res.status(400).json({ success: false, error: message })
return
}
Expand Down Expand Up @@ -261,7 +261,7 @@ const setup = (app: Router, verifier: VerificationAPI, storage: StorageAPI) => {
})
isUserSendEtherOutOfSystem = result.some(r => Number(r.value) > 0)
} catch (e) {
log.error('Check user transactions error', { e })
log.error('Check user transactions error', { error: e.message, e })
}

if (isUserSendEtherOutOfSystem) {
Expand All @@ -281,7 +281,7 @@ const setup = (app: Router, verifier: VerificationAPI, storage: StorageAPI) => {
return { ok: 1 }
})
.catch(async e => {
log.error('Failed top wallet tx', e.message, e.stack)
log.error('Failed top wallet tx', { error: e.message, e })
//restore last top wallet in case of error
await storage.updateUser({ identifier: user.loggedInAs, lastTopWallet: user.lastTopWallet })

Expand Down Expand Up @@ -347,7 +347,7 @@ const setup = (app: Router, verifier: VerificationAPI, storage: StorageAPI) => {
)
log.debug('sent new user email validation code', code)
} catch (e) {
log.error('failed sending email verification to user:', e.message, { userRec, code })
log.error('failed sending email verification to user:', { error: e.message, e, userRec, code })
throw e
}
}
Expand Down Expand Up @@ -656,7 +656,9 @@ const setup = (app: Router, verifier: VerificationAPI, storage: StorageAPI) => {
})
}

AdminWallet.checkHanukaBonus(currentUser, storage).catch(e => log.error('checkHnukaBonus failed', e.message, e))
AdminWallet.checkHanukaBonus(currentUser, storage).catch(e =>
log.error('checkHnukaBonus failed', { error: e.message, e })
)

let wallet_token = currentUser.w3Token

Expand Down

0 comments on commit efe1e2a

Please sign in to comment.