chore: server code formatting
This commit is contained in:
parent
aedabcbdee
commit
68517170e2
234 changed files with 9824 additions and 6195 deletions
|
|
@ -1,26 +1,35 @@
|
|||
const _ = require('lodash/fp')
|
||||
|
||||
function getBackwardsCompatibleTriggers (triggers) {
|
||||
const filtered = _.filter(_.matches({ triggerType: 'txVolume', direction: 'both', thresholdDays: 1 }))(triggers)
|
||||
function getBackwardsCompatibleTriggers(triggers) {
|
||||
const filtered = _.filter(
|
||||
_.matches({ triggerType: 'txVolume', direction: 'both', thresholdDays: 1 }),
|
||||
)(triggers)
|
||||
const grouped = _.groupBy(_.prop('requirement'))(filtered)
|
||||
return _.mapValues(_.compose(_.get('threshold'), _.minBy('threshold')))(grouped)
|
||||
return _.mapValues(_.compose(_.get('threshold'), _.minBy('threshold')))(
|
||||
grouped,
|
||||
)
|
||||
}
|
||||
|
||||
function hasSanctions (triggers) {
|
||||
function hasSanctions(triggers) {
|
||||
return _.some(_.matches({ requirement: 'sanctions' }))(triggers)
|
||||
}
|
||||
|
||||
function maxDaysThreshold (triggers) {
|
||||
function maxDaysThreshold(triggers) {
|
||||
return _.max(_.map('thresholdDays')(triggers))
|
||||
}
|
||||
|
||||
function getCashLimit (triggers) {
|
||||
const withFiat = _.filter(({ triggerType }) => _.includes(triggerType, ['txVolume', 'txAmount']))
|
||||
const blocking = _.filter(({ requirement }) => _.includes(requirement, ['block', 'suspend']))
|
||||
function getCashLimit(triggers) {
|
||||
const withFiat = _.filter(({ triggerType }) =>
|
||||
_.includes(triggerType, ['txVolume', 'txAmount']),
|
||||
)
|
||||
const blocking = _.filter(({ requirement }) =>
|
||||
_.includes(requirement, ['block', 'suspend']),
|
||||
)
|
||||
return _.compose(_.minBy('threshold'), blocking, withFiat)(triggers)
|
||||
}
|
||||
|
||||
const hasRequirement = requirement => _.compose(_.negate(_.isEmpty), _.find(_.matches({ requirement })))
|
||||
const hasRequirement = requirement =>
|
||||
_.compose(_.negate(_.isEmpty), _.find(_.matches({ requirement })))
|
||||
|
||||
const hasPhone = hasRequirement('sms')
|
||||
const hasFacephoto = hasRequirement('facephoto')
|
||||
|
|
@ -28,7 +37,16 @@ const hasIdScan = hasRequirement('idCardData')
|
|||
|
||||
const AUTH_METHODS = {
|
||||
SMS: 'SMS',
|
||||
EMAIL: 'EMAIL'
|
||||
EMAIL: 'EMAIL',
|
||||
}
|
||||
|
||||
module.exports = { getBackwardsCompatibleTriggers, hasSanctions, maxDaysThreshold, getCashLimit, hasPhone, hasFacephoto, hasIdScan, AUTH_METHODS }
|
||||
module.exports = {
|
||||
getBackwardsCompatibleTriggers,
|
||||
hasSanctions,
|
||||
maxDaysThreshold,
|
||||
getCashLimit,
|
||||
hasPhone,
|
||||
hasFacephoto,
|
||||
hasIdScan,
|
||||
AUTH_METHODS,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue