fix: compliance fixes

This commit is contained in:
Taranto 2020-10-02 14:33:21 +01:00 committed by Josh Harvey
parent c45241471e
commit 118852a433
5 changed files with 10 additions and 8 deletions

View file

@ -45,9 +45,9 @@ function loadSanctions (settings) {
return Promise.resolve() return Promise.resolve()
.then(() => { .then(() => {
const triggers = configManager.getTriggers(settings.config) const triggers = configManager.getTriggers(settings.config)
const compatTriggers = complianceTriggers.getBackwardsCompatibleTriggers(triggers) const hasSanctions = complianceTriggers.hasSanctions(triggers)
if (!compatTriggers.sanctions) return if (!hasSanctions) return
logger.info('Loading sanctions DB...') logger.info('Loading sanctions DB...')
return ofacUpdate.update() return ofacUpdate.update()

View file

@ -6,4 +6,8 @@ function getBackwardsCompatibleTriggers (triggers) {
return _.mapValues(_.compose(_.get('threshold'), _.minBy('threshold')))(grouped) return _.mapValues(_.compose(_.get('threshold'), _.minBy('threshold')))(grouped)
} }
module.exports = { getBackwardsCompatibleTriggers} function hasSanctions (triggers) {
return _.some(_.matches({ requirement: 'sanctions' }))(triggers)
}
module.exports = { getBackwardsCompatibleTriggers, hasSanctions }

View file

@ -50,9 +50,9 @@ function initialSanctionsDownload () {
function updateAndLoadSanctions () { function updateAndLoadSanctions () {
const triggers = configManager.getTriggers(settings().config) const triggers = configManager.getTriggers(settings().config)
const compatTriggers = complianceTriggers.getBackwardsCompatibleTriggers(triggers) const hasSanctions = complianceTriggers.hasSanctions(triggers)
if (!compatTriggers.sanctions) return Promise.resolve() if (!hasSanctions) return Promise.resolve()
logger.info('Updating sanctions database...') logger.info('Updating sanctions database...')
return sanctionsUpdater.update() return sanctionsUpdater.update()

View file

@ -278,7 +278,7 @@ function updateCustomer (req, res, next) {
// machines before 7.5 expect customer with sanctions result // machines before 7.5 expect customer with sanctions result
const isOlderMachineVersion = !machineVersion || semver.lt(machineVersion, '7.5.0-beta.0') const isOlderMachineVersion = !machineVersion || semver.lt(machineVersion, '7.5.0-beta.0')
Promise.resolve({}) return Promise.resolve({})
.then(emptyObj => { .then(emptyObj => {
if (!isOlderMachineVersion) return Promise.resolve(emptyObj) if (!isOlderMachineVersion) return Promise.resolve(emptyObj)
return compliance.validationPatch(req.deviceId, !!compatTriggers.sanctions, mergedCustomer) return compliance.validationPatch(req.deviceId, !!compatTriggers.sanctions, mergedCustomer)
@ -287,7 +287,6 @@ function updateCustomer (req, res, next) {
.then(newPatch => customers.updatePhotoCard(id, newPatch)) .then(newPatch => customers.updatePhotoCard(id, newPatch))
.then(newPatch => customers.updateFrontCamera(id, newPatch)) .then(newPatch => customers.updateFrontCamera(id, newPatch))
.then(newPatch => customers.update(id, newPatch, null, txId)) .then(newPatch => customers.update(id, newPatch, null, txId))
}) })
.then(customer => respond(req, res, { customer })) .then(customer => respond(req, res, { customer }))
.catch(next) .catch(next)

View file

@ -89,7 +89,6 @@ const Autocomplete = ({
size={size} size={size}
fullWidth={fullWidth} fullWidth={fullWidth}
textAlign={textAlign} textAlign={textAlign}
autoFocus={autoFocus}
/> />
) )
}} }}