fix: remove machine selector

This commit is contained in:
Sérgio Salgado 2021-08-25 16:56:07 +01:00
parent 30bc9c96da
commit ee8c46b51e
8 changed files with 32 additions and 132 deletions

View file

@ -5,22 +5,11 @@ const _ = require('lodash/fp')
const customSms = require('./custom-sms')
function getPhoneCodeSms (deviceId, phone, code) {
return Promise.all([
customSms.getCommonCustomMessages('sms_code'),
customSms.getMachineCustomMessages('sms_code', deviceId)
])
.then(([commonMsg, machineMsg]) => {
if (!_.isNil(machineMsg)) {
const messageContent = _.replace('#code', code, machineMsg.message)
return {
toNumber: phone,
body: messageContent
}
}
if (!_.isNil(commonMsg)) {
const messageContent = _.replace('#code', code, commonMsg.message)
function getPhoneCodeSms (phone, code) {
return customSms.getCustomMessage('sms_code')
.then(msg => {
if (!_.isNil(msg)) {
const messageContent = _.replace('#code', code, msg.message)
return {
toNumber: phone,
body: messageContent
@ -34,22 +23,11 @@ function getPhoneCodeSms (deviceId, phone, code) {
})
}
function getCashOutReadySms (deviceId, phone, timestamp) {
return Promise.all([
customSms.getCommonCustomMessages('cash_out_dispense_ready'),
customSms.getMachineCustomMessages('cash_out_dispense_ready', deviceId)
])
.then(([commonMsg, machineMsg]) => {
if (!_.isNil(machineMsg)) {
const messageContent = _.replace('#timestamp', timestamp, machineMsg.message)
return {
toNumber: phone,
body: messageContent
}
}
if (!_.isNil(commonMsg)) {
const messageContent = _.replace('#timestamp', timestamp, commonMsg.message)
function getCashOutReadySms (phone, timestamp) {
return customSms.getCustomMessage('cash_out_dispense_ready')
.then(msg => {
if (!_.isNil(msg)) {
const messageContent = _.replace('#timestamp', timestamp, msg.message)
return {
toNumber: phone,
body: messageContent