WIP
This commit is contained in:
parent
f7561acf3c
commit
80e851fb59
9 changed files with 131 additions and 76 deletions
23
lib/compliance.js
Normal file
23
lib/compliance.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
const _ = require('lodash/fp')
|
||||
|
||||
const ofac = require('./ofac/index')
|
||||
|
||||
function matchOfac (customer) {
|
||||
const nameParts = _.flatMap(_.split(/\s+/), [customer.firstName, customer.lastName])
|
||||
const birthDate = customer.dateOfBirth
|
||||
|
||||
const result = ofac.match(nameParts, birthDate)
|
||||
console.log('DEBUG200: %s', result)
|
||||
|
||||
if (result > 0.8) throw new Error('Compliance error')
|
||||
}
|
||||
|
||||
function validateCustomer (config, customer) {
|
||||
if (config.sanctionsVerificationActive) {
|
||||
matchOfac(customer)
|
||||
}
|
||||
|
||||
return customer
|
||||
}
|
||||
|
||||
module.exports = {validateCustomer}
|
||||
Loading…
Add table
Add a link
Reference in a new issue