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',
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)
}