fix: compliance migration

This commit is contained in:
José Oliveira 2021-02-20 14:00:04 +00:00 committed by Josh Harvey
parent 5b81194fc3
commit 3fdac72533

View file

@ -347,7 +347,8 @@ function migrateComplianceTriggers (config) {
idData: 'idCardData', idData: 'idCardData',
idPhoto: 'idCardPhoto', idPhoto: 'idCardPhoto',
facePhoto: 'facephoto', facePhoto: 'facephoto',
sanctions: 'sanctions' sanctions: 'sanctions',
block: 'block'
} }
function createTrigger ( function createTrigger (
@ -359,7 +360,7 @@ function migrateComplianceTriggers (config) {
cashDirection: 'both', cashDirection: 'both',
threshold, threshold,
thresholdDays: 1, thresholdDays: 1,
triggerType: triggerTypes.volume, triggerType: triggerTypes.amount,
requirement requirement
} }
} }
@ -374,7 +375,9 @@ function migrateComplianceTriggers (config) {
'frontCameraVerificationActive', 'frontCameraVerificationActive',
'frontCameraVerificationThreshold', 'frontCameraVerificationThreshold',
'sanctionsVerificationActive', 'sanctionsVerificationActive',
'sanctionsVerificationThreshold' 'sanctionsVerificationThreshold',
'hardLimitVerificationActive',
'hardLimitVerificationThreshold'
] ]
const global = _.fromPairs( const global = _.fromPairs(
@ -407,6 +410,11 @@ function migrateComplianceTriggers (config) {
createTrigger(requirements.sanctions, global.sanctionsVerificationThreshold) createTrigger(requirements.sanctions, global.sanctionsVerificationThreshold)
) )
} }
if (global.hardLimitVerificationActive && _.isNumber(global.hardLimitVerificationThreshold)) {
triggers.push(
createTrigger(requirements.block, global.hardLimitVerificationThreshold)
)
}
return { return {
triggers, triggers,
@ -442,7 +450,7 @@ function migrateAccounts (accounts) {
] ]
const services = _.keyBy('code', 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) const allAccounts = _.mapValues(_.mapValues(_.get('value')))(serviceFields)
return _.pick(accountArray)(allAccounts) return _.pick(accountArray)(allAccounts)
} }