feat: new compliance options

This commit is contained in:
Taranto 2020-09-14 23:25:35 +01:00 committed by Josh Harvey
parent ccf7eacfad
commit f2080c32e9
23 changed files with 161 additions and 121 deletions

View file

@ -59,8 +59,10 @@ function matchOfac (deviceId, customer) {
})
}
function validateOfac (deviceId, config, customer) {
if (!config.sanctionsVerificationActive) return Promise.resolve(true)
// BACKWARDS_COMPATIBILITY 7.5
// machines before 7.5 need to test sanctionsActive here
function validateOfac (deviceId, sanctionsActive, customer) {
if (!sanctionsActive) return Promise.resolve(true)
if (customer.sanctionsOverride === 'blocked') return Promise.resolve(false)
if (customer.sanctionsOverride === 'verified') return Promise.resolve(true)
@ -68,8 +70,8 @@ function validateOfac (deviceId, config, customer) {
.then(didMatch => !didMatch)
}
function validationPatch (deviceId, config, customer) {
return validateOfac(deviceId, config, customer)
function validationPatch (deviceId, sanctionsActive, customer) {
return validateOfac(deviceId, sanctionsActive, customer)
.then(ofacValidation => {
if (_.isNil(customer.sanctions) || customer.sanctions !== ofacValidation) {
return {sanctions: ofacValidation}