From 9fc79f1bb408a573bc37660ad55ef1fd3bd07b17 Mon Sep 17 00:00:00 2001 From: Fabio Cigliano Date: Tue, 31 Jul 2018 11:55:35 +0200 Subject: [PATCH] OFAC flow fix (#137) * 7.0.1 * OFAC flow fix --- lib/compliance.js | 9 +++++---- lib/ofac/index.js | 7 ++++--- package-lock.json | 2 +- package.json | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/compliance.js b/lib/compliance.js index dd416e0c..6cf35b56 100644 --- a/lib/compliance.js +++ b/lib/compliance.js @@ -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} diff --git a/lib/ofac/index.js b/lib/ofac/index.js index 881ecdd8..0669f2d5 100644 --- a/lib/ofac/index.js +++ b/lib/ofac/index.js @@ -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) diff --git a/package-lock.json b/package-lock.json index 3f56a314..fc825dd0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "lamassu-server", - "version": "7.1.0", + "version": "7.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 416d9158..2976196c 100644 --- a/package.json +++ b/package.json @@ -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": {