OFAC flow fix (#137)

* 7.0.1

* OFAC flow fix
This commit is contained in:
Fabio Cigliano 2018-07-31 11:55:35 +02:00 committed by Josh Harvey
parent 49f8b66de0
commit 9fc79f1bb4
4 changed files with 11 additions and 9 deletions

View file

@ -59,16 +59,17 @@ function matchOfac (deviceId, customer) {
})
}
function validateOfac (deviceId, customer) {
if (customer.sanctionsOverride === 'blocked') return false
if (customer.sanctionsOverride === 'verified') return true
function validateOfac (deviceId, config, customer) {
if (!config.sanctionsVerificationActive) return Promise.resolve(true)
if (customer.sanctionsOverride === 'blocked') return Promise.resolve(false)
if (customer.sanctionsOverride === 'verified') return Promise.resolve(true)
return matchOfac(deviceId, customer)
.then(didMatch => !didMatch)
}
function validationPatch (deviceId, config, customer) {
return validateOfac(deviceId, customer)
return validateOfac(deviceId, config, customer)
.then(ofacValidation => {
if (_.isNil(customer.sanctions) || customer.sanctions !== ofacValidation) {
return {sanctions: ofacValidation}

View file

@ -6,6 +6,7 @@ const matcher = require('./matching')
const nameUtils = require('./name-utils')
const options = require('../options')
const _ = require('lodash/fp')
const logger = require('../logger')
const debugLog = require('../pp')(__filename) // KOSTIS TODO: remove
@ -42,13 +43,13 @@ function makeCompatible (nameParts) {
function match (nameParts, birthDateString, options) {
const {debug} = options
if (!structs) {
const message = 'The OFAC data sources have not been loaded yet.'
return Promise.reject(new Error(message))
logger.error(new Error('The OFAC data sources have not been loaded yet.'))
return false
}
// Prepare the input data
const parts = makeCompatible(nameParts)
const fullName = nameUtils.makeFullName(parts)
const words = nameUtils.makeWords(fullName)

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "lamassu-server",
"version": "7.1.0",
"version": "7.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -2,7 +2,7 @@
"name": "lamassu-server",
"description": "bitcoin atm client server protocol module",
"keywords": [],
"version": "7.1.0",
"version": "7.0.1",
"license": "Unlicense",
"author": "Lamassu (https://lamassu.is)",
"dependencies": {