feat: send individual discounts to machine
This commit is contained in:
parent
29257c42ec
commit
eda6decae0
2 changed files with 9 additions and 6 deletions
|
|
@ -33,8 +33,7 @@ function getAvailableIndividualDiscounts () {
|
||||||
id: it.id,
|
id: it.id,
|
||||||
idType: _.camelCase(it.identification),
|
idType: _.camelCase(it.identification),
|
||||||
value: it.value,
|
value: it.value,
|
||||||
discount: it.discount,
|
discount: it.discount
|
||||||
softDeleted: it.soft_deleted
|
|
||||||
}), res))
|
}), res))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -230,6 +230,7 @@ function plugins (settings, deviceId) {
|
||||||
const pingPromise = recordPing(deviceTime, machineVersion, machineModel)
|
const pingPromise = recordPing(deviceTime, machineVersion, machineModel)
|
||||||
const currentConfigVersionPromise = fetchCurrentConfigVersion()
|
const currentConfigVersionPromise = fetchCurrentConfigVersion()
|
||||||
const currentAvailablePromoCodes = loyalty.getNumberOfAvailablePromoCodes()
|
const currentAvailablePromoCodes = loyalty.getNumberOfAvailablePromoCodes()
|
||||||
|
const currentAvailableIndividualDiscounts = loyalty.getAvailableIndividualDiscounts()
|
||||||
const timezoneObj = { utcOffset: timezone[0], dstOffset: timezone[1] }
|
const timezoneObj = { utcOffset: timezone[0], dstOffset: timezone[1] }
|
||||||
|
|
||||||
const promises = [
|
const promises = [
|
||||||
|
|
@ -241,7 +242,8 @@ function plugins (settings, deviceId) {
|
||||||
tickerPromises,
|
tickerPromises,
|
||||||
balancePromises,
|
balancePromises,
|
||||||
testnetPromises,
|
testnetPromises,
|
||||||
currentAvailablePromoCodes
|
currentAvailablePromoCodes,
|
||||||
|
currentAvailableIndividualDiscounts
|
||||||
)
|
)
|
||||||
|
|
||||||
return Promise.all(promises)
|
return Promise.all(promises)
|
||||||
|
|
@ -252,10 +254,11 @@ function plugins (settings, deviceId) {
|
||||||
const cryptoCodesCount = cryptoCodes.length
|
const cryptoCodesCount = cryptoCodes.length
|
||||||
const tickers = arr.slice(4, cryptoCodesCount + 4)
|
const tickers = arr.slice(4, cryptoCodesCount + 4)
|
||||||
const balances = arr.slice(cryptoCodesCount + 4, 2 * cryptoCodesCount + 4)
|
const balances = arr.slice(cryptoCodesCount + 4, 2 * cryptoCodesCount + 4)
|
||||||
const testNets = arr.slice(2 * cryptoCodesCount + 4, arr.length - 1)
|
const testNets = arr.slice(2 * cryptoCodesCount + 4, arr.length - 2)
|
||||||
const coinParams = _.zip(cryptoCodes, testNets)
|
const coinParams = _.zip(cryptoCodes, testNets)
|
||||||
const coinsWithoutRate = _.map(mapCoinSettings, coinParams)
|
const coinsWithoutRate = _.map(mapCoinSettings, coinParams)
|
||||||
const areThereAvailablePromoCodes = arr[arr.length - 1] > 0
|
const areThereAvailablePromoCodes = arr[arr.length - 2] > 0
|
||||||
|
const individualDiscounts = arr[arr.length - 1]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
cassettes,
|
cassettes,
|
||||||
|
|
@ -264,7 +267,8 @@ function plugins (settings, deviceId) {
|
||||||
coins: _.zipWith(_.assign, coinsWithoutRate, tickers),
|
coins: _.zipWith(_.assign, coinsWithoutRate, tickers),
|
||||||
configVersion,
|
configVersion,
|
||||||
areThereAvailablePromoCodes,
|
areThereAvailablePromoCodes,
|
||||||
timezone: tz
|
timezone: tz,
|
||||||
|
individualDiscounts
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue