refactor: pass suspension days as param

This commit is contained in:
José Oliveira 2021-02-26 11:41:55 +00:00 committed by Josh Harvey
parent 28ee05a24a
commit ca86a70d42

View file

@ -335,6 +335,9 @@ function migrateTermsAndConditions (config) {
} }
function migrateComplianceTriggers (config) { function migrateComplianceTriggers (config) {
const suspensionDays = 1
const triggerTypes = { const triggerTypes = {
amount: 'txAmount', amount: 'txAmount',
velocity: 'txVelocity', velocity: 'txVelocity',
@ -353,18 +356,19 @@ function migrateComplianceTriggers (config) {
function createTrigger ( function createTrigger (
requirement, requirement,
threshold threshold,
suspensionDays = null
) { ) {
const triggerConfig = { const triggerConfig = {
id: uuid.v4(), id: uuid.v4(),
direction: 'both', direction: 'both',
suspensionDays: null, suspensionDays: suspensionDays,
threshold, threshold,
thresholdDays: 1, thresholdDays: 1,
triggerType: triggerTypes.volume, triggerType: triggerTypes.volume,
requirement requirement
} }
if (requirement === 'suspend') triggerConfig.suspensionDays = 1
return triggerConfig return triggerConfig
} }
@ -416,7 +420,7 @@ function migrateComplianceTriggers (config) {
} }
if (global.hardLimitVerificationActive && _.isNumber(global.hardLimitVerificationThreshold)) { if (global.hardLimitVerificationActive && _.isNumber(global.hardLimitVerificationThreshold)) {
triggers.push( triggers.push(
createTrigger(requirements.suspend, global.hardLimitVerificationThreshold) createTrigger(requirements.suspend, global.hardLimitVerificationThreshold, suspensionDays)
) )
} }
return { return {