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

@ -46,15 +46,14 @@ function mapCoin (rates, deviceId, settings, cryptoCode) {
}
}
function mapIdentification (config, deviceId) {
const triggers = configManager.getTriggers(deviceId, config)
const compatTriggers = complianceTriggers.getBackwardsCompatibleTriggers(triggers)
function mapIdentification (config) {
const triggers = configManager.getTriggers(config)
return {
isPhone: !!compatTriggers.sms,
isPhone: complianceTriggers.hasPhone(triggers),
isPalmVein: false,
isPhoto: !!compatTriggers.facephoto,
isIdDocScan: !!compatTriggers.idData,
isPhoto: complianceTriggers.hasFacephoto(triggers),
isIdDocScan: complianceTriggers.hasIdScan(triggers),
isFingerprint: false
}
}
@ -64,8 +63,8 @@ function mapMachine (rates, settings, machineRow) {
const config = settings.config
const coinAtmRadar = configManager.getCoinAtmRadar(config)
const triggers = configManager.getTriggers(deviceId, config)
const compatTriggers = complianceTriggers.getBackwardsCompatibleTriggers(triggers)
const triggers = configManager.getTriggers(config)
const triggerCashLimit = complianceTriggers.getCashLimit(triggers)
const locale = configManager.getLocale(deviceId, config)
const cashOutConfig = configManager.getCashOut(deviceId, config)
@ -76,19 +75,13 @@ function mapMachine (rates, settings, machineRow) {
const showSupportedBuySellDirection = coinAtmRadar.supportedBuySellDirection
const showLimitsAndVerification = coinAtmRadar.limitsAndVerification
// TODO new-admin: this is relaying info with backwards compatible triggers
// need to get in touch with coinatmradar before updating this
// TODO all directions and max between them instead of min
const cashLimit = showLimitsAndVerification ? (
!!compatTriggers.block
? compatTriggers.block
: Infinity ) : null
const cashLimit = showLimitsAndVerification ? ( triggerCashLimit || Infinity ) : null
const cryptoCurrencies = locale.cryptoCurrencies
const cashInEnabled = showSupportedBuySellDirection ? true : null
const cashOutEnabled = showSupportedBuySellDirection ? cashOutConfig.active : null
const fiat = showSupportedFiat ? locale.fiatCurrency : null
const identification = mapIdentification(config, deviceId)
const identification = mapIdentification(config)
const coins = showSupportedCryptocurrencies ?
_.map(_.partial(mapCoin, [rates, deviceId, settings]), cryptoCurrencies)
: null