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) { function validateOfac (deviceId, config, customer) {
if (customer.sanctionsOverride === 'blocked') return false if (!config.sanctionsVerificationActive) return Promise.resolve(true)
if (customer.sanctionsOverride === 'verified') return true if (customer.sanctionsOverride === 'blocked') return Promise.resolve(false)
if (customer.sanctionsOverride === 'verified') return Promise.resolve(true)
return matchOfac(deviceId, customer) return matchOfac(deviceId, customer)
.then(didMatch => !didMatch) .then(didMatch => !didMatch)
} }
function validationPatch (deviceId, config, customer) { function validationPatch (deviceId, config, customer) {
return validateOfac(deviceId, customer) return validateOfac(deviceId, config, customer)
.then(ofacValidation => { .then(ofacValidation => {
if (_.isNil(customer.sanctions) || customer.sanctions !== ofacValidation) { if (_.isNil(customer.sanctions) || customer.sanctions !== ofacValidation) {
return {sanctions: ofacValidation} return {sanctions: ofacValidation}

View file

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

2
package-lock.json generated
View file

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

View file

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