From 3fdac72533aff6ce44fd9f354f2dc30e7b6cc446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Oliveira?= Date: Sat, 20 Feb 2021 14:00:04 +0000 Subject: [PATCH] fix: compliance migration --- lib/config-migration.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/config-migration.js b/lib/config-migration.js index 27eb1aea..579613b8 100644 --- a/lib/config-migration.js +++ b/lib/config-migration.js @@ -347,7 +347,8 @@ function migrateComplianceTriggers (config) { idData: 'idCardData', idPhoto: 'idCardPhoto', facePhoto: 'facephoto', - sanctions: 'sanctions' + sanctions: 'sanctions', + block: 'block' } function createTrigger ( @@ -359,7 +360,7 @@ function migrateComplianceTriggers (config) { cashDirection: 'both', threshold, thresholdDays: 1, - triggerType: triggerTypes.volume, + triggerType: triggerTypes.amount, requirement } } @@ -374,7 +375,9 @@ function migrateComplianceTriggers (config) { 'frontCameraVerificationActive', 'frontCameraVerificationThreshold', 'sanctionsVerificationActive', - 'sanctionsVerificationThreshold' + 'sanctionsVerificationThreshold', + 'hardLimitVerificationActive', + 'hardLimitVerificationThreshold' ] const global = _.fromPairs( @@ -407,6 +410,11 @@ function migrateComplianceTriggers (config) { createTrigger(requirements.sanctions, global.sanctionsVerificationThreshold) ) } + if (global.hardLimitVerificationActive && _.isNumber(global.hardLimitVerificationThreshold)) { + triggers.push( + createTrigger(requirements.block, global.hardLimitVerificationThreshold) + ) + } return { triggers, @@ -442,7 +450,7 @@ function migrateAccounts (accounts) { ] const services = _.keyBy('code', accounts) - const serviceFields = _.mapValues(service => _.keyBy('code', service.fields))(services) + const serviceFields = _.mapValues(({ fields }) => _.keyBy('code', fields))(services) const allAccounts = _.mapValues(_.mapValues(_.get('value')))(serviceFields) return _.pick(accountArray)(allAccounts) }