Merge pull request #1312 from siiky/fix/lam-548/gql-bugs-8.1
Server-machine GraphQL bugs
This commit is contained in:
commit
3d96e8321c
2 changed files with 25 additions and 10 deletions
|
|
@ -23,16 +23,18 @@ const speedtestFiles = [
|
||||||
]
|
]
|
||||||
|
|
||||||
const addSmthInfo = (dstField, srcFields) => smth =>
|
const addSmthInfo = (dstField, srcFields) => smth =>
|
||||||
smth && smth.active ? _.set(dstField, _.pick(srcFields, smth)) : _.identity
|
(smth && smth.active) ? _.set(dstField, _.pick(srcFields, smth)) : _.identity
|
||||||
|
|
||||||
const addOperatorInfo = addSmthInfo(
|
const addOperatorInfo = addSmthInfo(
|
||||||
'operatorInfo',
|
'operatorInfo',
|
||||||
['name', 'phone', 'email', 'website', 'companyNumber']
|
['name', 'phone', 'email', 'website', 'companyNumber']
|
||||||
)
|
)
|
||||||
|
|
||||||
const addReceiptInfo = addSmthInfo(
|
const addReceiptInfo = receiptInfo => ret => {
|
||||||
'receiptInfo',
|
if (!receiptInfo) return ret
|
||||||
[
|
|
||||||
|
const fields = [
|
||||||
|
'paper',
|
||||||
'sms',
|
'sms',
|
||||||
'operatorWebsite',
|
'operatorWebsite',
|
||||||
'operatorEmail',
|
'operatorEmail',
|
||||||
|
|
@ -43,10 +45,22 @@ const addReceiptInfo = addSmthInfo(
|
||||||
'exchangeRate',
|
'exchangeRate',
|
||||||
'addressQRCode',
|
'addressQRCode',
|
||||||
]
|
]
|
||||||
)
|
const defaults = _.fromPairs(_.map(field => [field, false], fields))
|
||||||
|
|
||||||
|
receiptInfo = _.flow(
|
||||||
|
o => _.set('paper', o.active, o),
|
||||||
|
_.assign(defaults),
|
||||||
|
_.pick(fields),
|
||||||
|
)(receiptInfo)
|
||||||
|
|
||||||
|
return (receiptInfo.paper || receiptInfo.sms) ?
|
||||||
|
_.set('receiptInfo', receiptInfo, ret) :
|
||||||
|
ret
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* TODO: Simplify this. */
|
/* TODO: Simplify this. */
|
||||||
const buildTriggers = (allTriggers) => {
|
const buildTriggers = allTriggers => {
|
||||||
const normalTriggers = []
|
const normalTriggers = []
|
||||||
const customTriggers = _.filter(o => {
|
const customTriggers = _.filter(o => {
|
||||||
if (_.isEmpty(o.customInfoRequestId) || _.isNil(o.customInfoRequestId)) normalTriggers.push(o)
|
if (_.isEmpty(o.customInfoRequestId) || _.isNil(o.customInfoRequestId)) normalTriggers.push(o)
|
||||||
|
|
@ -82,7 +96,6 @@ const staticConfig = ({ currentConfigVersion, deviceId, deviceName, pq, settings
|
||||||
|
|
||||||
const staticConf = _.flow(
|
const staticConf = _.flow(
|
||||||
_.pick([
|
_.pick([
|
||||||
'areThereAvailablePromoCodes',
|
|
||||||
'coins',
|
'coins',
|
||||||
'configVersion',
|
'configVersion',
|
||||||
'timezone'
|
'timezone'
|
||||||
|
|
@ -157,7 +170,7 @@ const dynamicConfig = ({ deviceId, operatorId, pid, pq, settings, }) => {
|
||||||
state.pids = _.update(operatorId, _.set(deviceId, { pid, ts: Date.now() }), state.pids)
|
state.pids = _.update(operatorId, _.set(deviceId, { pid, ts: Date.now() }), state.pids)
|
||||||
|
|
||||||
return _.flow(
|
return _.flow(
|
||||||
_.pick(['balances', 'cassettes', 'coins', 'rates']),
|
_.pick(['areThereAvailablePromoCodes', 'balances', 'cassettes', 'coins', 'rates']),
|
||||||
|
|
||||||
_.update('cassettes', massageCassettes),
|
_.update('cassettes', massageCassettes),
|
||||||
|
|
||||||
|
|
@ -172,7 +185,8 @@ const dynamicConfig = ({ deviceId, operatorId, pid, pq, settings, }) => {
|
||||||
|
|
||||||
/* Group the separate objects by cryptoCode */
|
/* Group the separate objects by cryptoCode */
|
||||||
/* { balances, coins, rates } => { cryptoCode: { balance, ask, bid, cashIn, cashOut }, ... } */
|
/* { balances, coins, rates } => { cryptoCode: { balance, ask, bid, cashIn, cashOut }, ... } */
|
||||||
({ balances, cassettes, coins, rates }) => ({
|
({ areThereAvailablePromoCodes, balances, cassettes, coins, rates }) => ({
|
||||||
|
areThereAvailablePromoCodes,
|
||||||
cassettes,
|
cassettes,
|
||||||
coins: _.flow(
|
coins: _.flow(
|
||||||
_.reduce(
|
_.reduce(
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ type MachineInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReceiptInfo {
|
type ReceiptInfo {
|
||||||
|
paper: Boolean!
|
||||||
sms: Boolean!
|
sms: Boolean!
|
||||||
operatorWebsite: Boolean!
|
operatorWebsite: Boolean!
|
||||||
operatorEmail: Boolean!
|
operatorEmail: Boolean!
|
||||||
|
|
@ -85,7 +86,6 @@ type Terms {
|
||||||
type StaticConfig {
|
type StaticConfig {
|
||||||
configVersion: Int!
|
configVersion: Int!
|
||||||
|
|
||||||
areThereAvailablePromoCodes: Boolean!
|
|
||||||
coins: [Coin!]!
|
coins: [Coin!]!
|
||||||
enablePaperWalletOnly: Boolean!
|
enablePaperWalletOnly: Boolean!
|
||||||
hasLightning: Boolean!
|
hasLightning: Boolean!
|
||||||
|
|
@ -136,6 +136,7 @@ type Cassettes {
|
||||||
}
|
}
|
||||||
|
|
||||||
type DynamicConfig {
|
type DynamicConfig {
|
||||||
|
areThereAvailablePromoCodes: Boolean!
|
||||||
cassettes: Cassettes
|
cassettes: Cassettes
|
||||||
coins: [DynamicCoinValues!]!
|
coins: [DynamicCoinValues!]!
|
||||||
reboot: Boolean!
|
reboot: Boolean!
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue