refactor: pull up variable to constants file

This commit is contained in:
Sérgio Salgado 2021-10-11 01:58:00 +01:00
parent ed7c515993
commit d759704db3
2 changed files with 9 additions and 4 deletions

View file

@ -16,6 +16,9 @@ const USER_SESSIONS_CLEAR_INTERVAL = 1 * T.hour
const AUTOMATIC = 'automatic' const AUTOMATIC = 'automatic'
const MANUAL = 'manual' const MANUAL = 'manual'
const CASH_OUT_DISPENSE_READY = 'cash_out_dispense_ready'
const CONFIRMATION_CODE = 'sms_code'
module.exports = { module.exports = {
anonymousCustomer, anonymousCustomer,
cassetteMaxCapacity, cassetteMaxCapacity,
@ -25,5 +28,7 @@ module.exports = {
AUTOMATIC, AUTOMATIC,
MANUAL, MANUAL,
USER_SESSIONS_TABLE_NAME, USER_SESSIONS_TABLE_NAME,
USER_SESSIONS_CLEAR_INTERVAL USER_SESSIONS_CLEAR_INTERVAL,
CASH_OUT_DISPENSE_READY,
CONFIRMATION_CODE
} }

View file

@ -23,7 +23,7 @@ const customers = require('./customers')
const commissionMath = require('./commission-math') const commissionMath = require('./commission-math')
const loyalty = require('./loyalty') const loyalty = require('./loyalty')
const { cassetteMaxCapacity } = require('./constants') const { cassetteMaxCapacity, CASH_OUT_DISPENSE_READY, CONFIRMATION_CODE } = require('./constants')
const notifier = require('./notifier') const notifier = require('./notifier')
@ -361,7 +361,7 @@ function plugins (settings, deviceId) {
const phone = tx.phone const phone = tx.phone
const timestamp = dateFormat(new Date(), 'UTC:HH:MM Z') const timestamp = dateFormat(new Date(), 'UTC:HH:MM Z')
return sms.getSms('cash_out_dispense_ready', phone, { timestamp }) return sms.getSms(CASH_OUT_DISPENSE_READY, phone, { timestamp })
.then(smsObj => { .then(smsObj => {
const rec = { const rec = {
sms: smsObj sms: smsObj
@ -723,7 +723,7 @@ function plugins (settings, deviceId) {
? '123' ? '123'
: randomCode() : randomCode()
return sms.getSms('sms_code', phone, { code }) return sms.getSms(CONFIRMATION_CODE, phone, { code })
.then(smsObj => { .then(smsObj => {
const rec = { const rec = {
sms: smsObj sms: smsObj