fix: commissions overrides and coinatmradar

This commit is contained in:
Taranto 2020-10-16 16:16:22 +01:00 committed by Josh Harvey
parent 520efc0c27
commit be7e4c5c10
3 changed files with 30 additions and 20 deletions

View file

@ -14,4 +14,17 @@ function maxDaysThreshold (triggers) {
return _.max(_.map('thresholdDays')(triggers))
}
module.exports = { getBackwardsCompatibleTriggers, hasSanctions, maxDaysThreshold }
function getCashLimit (triggers) {
const withFiat = _.filter(({ triggerType }) => _.includes(['txVolume', 'txAmount'])(triggerType))
const blocking = _.filter(({ requirement }) => _.includes(['block', 'suspend'])(requirement))
return _.compose(_.minBy('threshold'), blocking, withFiat)(triggers)
}
const hasRequirement = requirement => _.compose(_.negate(_.isEmpty), _.find(_.matches({ requirement })))
const hasPhone = hasRequirement('sms')
const hasFacephoto = hasRequirement('facephoto')
const hasIdScan = hasRequirement('idCardData')
module.exports = { getBackwardsCompatibleTriggers, hasSanctions, maxDaysThreshold, getCashLimit, hasPhone, hasFacephoto, hasIdScan }