diff --git a/bin/lamassu-admin-server b/bin/lamassu-admin-server index 55e2d9b3..9e91e977 100755 --- a/bin/lamassu-admin-server +++ b/bin/lamassu-admin-server @@ -130,6 +130,7 @@ app.post('/api/machines', (req, res) => { }) app.get('/api/status', (req, res, next) => { + console.log('DEBUG100') return Promise.all([server.status(), config.validateCurrentConfig()]) .then(([serverStatus, invalidConfigGroups]) => res.send({ server: serverStatus, diff --git a/lib/cash-in-tx.js b/lib/cash-in-tx.js index 2a59ca7c..3cbad152 100644 --- a/lib/cash-in-tx.js +++ b/lib/cash-in-tx.js @@ -53,9 +53,7 @@ function post (machineTx, pi) { return postProcess(txVector, pi) .then(_.tap(pp('DEBUG99'))) .then(changes => update(updatedTx, changes)) - .then(_.tap(pp('DEBUG100'))) .then(tx => _.set('bills', machineTx.bills, tx)) - .then(_.tap(pp('DEBUG101'))) }) } @@ -86,9 +84,6 @@ function ensureRatchet (oldField, newField, fieldKey) { return true } - const tt = r => Object.prototype.toString.call(r) - console.log('DEBUG100: %j', [tt(oldField), tt(newField)]) - if (oldField.toString() === newField.toString()) return true logger.error('This field [%s] should never change', fieldKey) @@ -218,7 +213,7 @@ function registerTrades (pi, newBills) { function logAction (rec, tx) { const action = { tx_id: tx.id, - action: tx.sendCompleted ? 'sendCoins' : 'sendCoinsError', + action: rec.sendConfirmed ? 'sendCoins' : 'sendCoinsError', error: rec.error, error_code: rec.errorCode, tx_hash: rec.txHash diff --git a/lib/config-validate.js b/lib/config-validate.js index 31a92734..952e7e9e 100644 --- a/lib/config-validate.js +++ b/lib/config-validate.js @@ -44,10 +44,10 @@ function satisfiesRequire (config, cryptos, machineList, field, refFields) { return isScopeEnabled(config, cryptos, machineList, refField, scope) }) - const isBlank = () => _.isNil(configManager.scopedValue(scope[0], scope[1], fieldCode, config)) + const isBlank = _.isNil(configManager.scopedValue(scope[0], scope[1], fieldCode, config)) const isRequired = refFields.length === 0 || isEnabled() - return isRequired ? !isBlank() : true + return isRequired ? !isBlank : true }) } @@ -78,8 +78,12 @@ function getGroup (fieldCode) { return _.find(group => _.includes(fieldCode, group.fields), schema.groups) } -function getField (group, fieldCode) { - if (!group) group = getGroup(fieldCode) +function getField (fieldCode) { + const group = getGroup(fieldCode) + return getGroupField(group, fieldCode) +} + +function getGroupField (group, fieldCode) { const field = _.find(_.matchesProperty('code', fieldCode), schema.fields) return _.merge(_.pick(['cryptoScope', 'machineScope'], group), field) } @@ -126,10 +130,11 @@ function validateRequires (config) { return schema.groups.filter(group => { return group.fields.some(fieldCode => { - const field = getField(group, fieldCode) + const field = getGroupField(group, fieldCode) if (!field.fieldValidation.find(r => r.code === 'required')) return false - const refFields = _.map(_.partial(getField, null), field.enabledIf) + const refFields = _.map(_.partial(getField, group), field.enabledIf) + return !satisfiesRequire(config, cryptos, machineList, field, refFields) }) }) diff --git a/public/elm.js b/public/elm.js index a608ec6c..9b462e18 100644 --- a/public/elm.js +++ b/public/elm.js @@ -27207,10 +27207,22 @@ var _user$project$Account$view = function (webModel) { return ''; } }(); - var fieldSetView = A2( - _elm_lang$html$Html$map, - _user$project$Account$FieldSetMsg, - _user$project$FieldSet$view(_p3.account.fields)); + var fieldSetView = A3( + _elm_lang$html$Html_Keyed$node, + 'div', + {ctor: '[]'}, + { + ctor: '::', + _0: { + ctor: '_Tuple2', + _0: _p3.account.code, + _1: A2( + _elm_lang$html$Html$map, + _user$project$Account$FieldSetMsg, + _user$project$FieldSet$view(_p3.account.fields)) + }, + _1: {ctor: '[]'} + }); return A2( _elm_lang$html$Html$div, {ctor: '[]'},