feat: support new advanced wallet settings

This commit is contained in:
José Oliveira 2022-02-17 21:50:31 +00:00
parent 4120d58a1b
commit ba72786dcb
7 changed files with 32 additions and 27 deletions

View file

@ -2,6 +2,7 @@ const _ = require('lodash/fp')
const { getCustomInfoRequests } = require('./new-admin/services/customInfoRequests')
const namespaces = {
ADVANCED: 'advanced',
WALLETS: 'wallets',
OPERATOR_INFO: 'operatorInfo',
NOTIFICATIONS: 'notifications',
@ -55,8 +56,14 @@ const getLocale = (deviceId, it) => {
const getGlobalLocale = it => getLocale(null, it)
const getWalletSettings = (key, it) => {
const result = _.compose(fromNamespace(key), fromNamespace(namespaces.WALLETS))(it)
return result
const filter = _.matches({ cryptoCurrency: key })
const getAdvancedSettings = it => {
const advancedSettings = fromNamespace(namespaces.ADVANCED)(it)
return _.omit(['overrides', 'cryptoCurrency', 'id'], _.assignAll([advancedSettings, ..._.filter(filter)(advancedSettings.overrides)]))
}
const walletsSettings = fromNamespace(namespaces.WALLETS)(it)
return _.assign(fromNamespace(key)(walletsSettings), getAdvancedSettings(walletsSettings))
}
const getCashOut = (key, it) => _.compose(fromNamespace(key), fromNamespace(namespaces.CASH_OUT))(it)
const getGlobalCashOut = fromNamespace(namespaces.CASH_OUT)
@ -133,7 +140,7 @@ const getTriggersAutomation = config => {
}, {}, overrides)
return _.assign(requirements, requirementsOverrides)
})
})
}
const splitGetFirst = _.compose(_.head, _.split('_'))