refactor: move getCustomInfoRequests call out of config manager
This commit is contained in:
parent
2f1d60b7e5
commit
6c43f7536d
3 changed files with 14 additions and 10 deletions
|
|
@ -1,5 +1,4 @@
|
|||
const _ = require('lodash/fp')
|
||||
const { getCustomInfoRequests } = require('./new-admin/services/customInfoRequests')
|
||||
|
||||
const namespaces = {
|
||||
ADVANCED: 'advanced',
|
||||
|
|
@ -21,6 +20,7 @@ const filter = namespace => _.pickBy((value, key) => _.startsWith(`${namespace}_
|
|||
const strip = key => _.mapKeys(stripl(`${key}_`))
|
||||
|
||||
const fromNamespace = _.curry((key, config) => _.compose(strip(key), filter(key))(config))
|
||||
const toNamespace = _.curry((ns, config) => _.mapKeys(key => `${ns}_${key}`, config))
|
||||
|
||||
const getCommissions = (cryptoCode, deviceId, config) => {
|
||||
const commissions = fromNamespace(namespaces.COMMISSIONS)(config)
|
||||
|
|
@ -116,8 +116,9 @@ const getGlobalNotifications = config => getNotifications(null, null, config)
|
|||
|
||||
const getTriggers = _.get('triggers')
|
||||
|
||||
const getTriggersAutomation = config => {
|
||||
return getCustomInfoRequests(true)
|
||||
/* `customInfoRequests` is the result of a call to `getCustomInfoRequests` */
|
||||
const getTriggersAutomation = (customInfoRequests, config) => {
|
||||
return customInfoRequests
|
||||
.then(infoRequests => {
|
||||
const defaultAutomation = _.get('triggersConfig_automation')(config)
|
||||
const requirements = {
|
||||
|
|
@ -154,6 +155,8 @@ const getCryptoUnits = (crypto, config) => {
|
|||
return getWalletSettings(crypto, config).cryptoUnits
|
||||
}
|
||||
|
||||
const setTermsConditions = toNamespace(namespaces.TERMS_CONDITIONS)
|
||||
|
||||
module.exports = {
|
||||
getWalletSettings,
|
||||
getCashInSettings,
|
||||
|
|
@ -173,5 +176,6 @@ module.exports = {
|
|||
getGlobalCashOut,
|
||||
getCashOut,
|
||||
getCryptosFromWalletNamespace,
|
||||
getCryptoUnits
|
||||
getCryptoUnits,
|
||||
setTermsConditions,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue