cashEnabled bug fixes
This commit is contained in:
parent
54611f6c17
commit
b6568baa5c
3 changed files with 9 additions and 4 deletions
|
|
@ -36,7 +36,7 @@ function generalScoped (crypto, machine, config) {
|
|||
const keys = R.uniq(R.map(r => r.fieldLocator.code, config))
|
||||
const keyedValues = keys.map(key => scopedValue(key, allScopes(key)))
|
||||
|
||||
return R.fromPairs(keys, keyedValues)
|
||||
return R.zipObj(keys, keyedValues)
|
||||
}
|
||||
|
||||
function machineScoped (machine, config) {
|
||||
|
|
|
|||
|
|
@ -50,9 +50,10 @@ function buildRates (deviceId, tickers) {
|
|||
const settings = settingsLoader.settings()
|
||||
const config = configManager.machineScoped(deviceId, settings.config)
|
||||
const cryptoCodes = config.cryptoCurrencies
|
||||
const cashOut = config.cashOutEnabled
|
||||
|
||||
const cashInCommission = new BigNumber(config.cashInCommission).div(100).plus(1)
|
||||
const cashOutCommission = new BigNumber(config.cashOutCommission).div(100).plus(1)
|
||||
const cashOutCommission = cashOut && new BigNumber(config.cashOutCommission).div(100).plus(1)
|
||||
|
||||
const rates = {}
|
||||
|
||||
|
|
@ -62,7 +63,7 @@ function buildRates (deviceId, tickers) {
|
|||
const rate = rateRec.rates
|
||||
rates[cryptoCode] = {
|
||||
cashIn: rate.ask.times(cashInCommission),
|
||||
cashOut: rate.bid.div(cashOutCommission)
|
||||
cashOut: cashOut ? rate.bid.div(cashOutCommission) : undefined
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -395,6 +396,7 @@ function executeTrades () {
|
|||
const config = configManager.machineScoped(deviceId, settings.config)
|
||||
const fiatCode = config.fiatCurrency
|
||||
const cryptoCodes = config.cryptoCurrencies
|
||||
|
||||
return cryptoCodes.map(cryptoCode => ({fiatCode, cryptoCode}))
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ const pids = {}
|
|||
const reboots = {}
|
||||
|
||||
function poll (req, res, next) {
|
||||
console.log('DEBUG77')
|
||||
const deviceId = req.deviceId
|
||||
const deviceTime = req.deviceTime
|
||||
const pid = req.query.pid
|
||||
|
|
@ -54,7 +55,7 @@ function poll (req, res, next) {
|
|||
idVerificationEnabled: config.idVerificationEnabled,
|
||||
smsVerificationEnabled: config.smsVerificationEnabled,
|
||||
cartridges,
|
||||
twoWayMode: !!cartridges,
|
||||
twoWayMode: config.cashOutEnabled,
|
||||
zeroConfLimit: config.zeroConfLimit,
|
||||
fiatTxLimit: config.cashOutTransactionLimit,
|
||||
reboot,
|
||||
|
|
@ -142,11 +143,13 @@ function ca (req, res) {
|
|||
}
|
||||
|
||||
function pair (req, res, next) {
|
||||
console.log('DEBUG100')
|
||||
const token = req.query.token
|
||||
const deviceId = req.deviceId
|
||||
|
||||
return pairing.pair(token, deviceId)
|
||||
.then(valid => {
|
||||
console.log('DEBUG102')
|
||||
if (valid) return res.end()
|
||||
throw httpError('Pairing failed')
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue