feat: only refetch t&c on config change
This commit is contained in:
parent
a7823736e6
commit
8f28b7aa0a
2 changed files with 19 additions and 4 deletions
|
|
@ -793,7 +793,8 @@ function plugins (settings, deviceId) {
|
|||
buy,
|
||||
sell,
|
||||
notificationsEnabled,
|
||||
notifyOperator
|
||||
notifyOperator,
|
||||
fetchCurrentConfigVersion
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,8 +72,6 @@ function poll (req, res, next) {
|
|||
}
|
||||
}
|
||||
|
||||
const terms = config.termsScreenActive && config.termsScreenText ? createTerms(config) : null
|
||||
|
||||
const response = {
|
||||
error: null,
|
||||
locale,
|
||||
|
|
@ -94,7 +92,6 @@ function poll (req, res, next) {
|
|||
frontCameraVerificationActive: config.frontCameraVerificationActive,
|
||||
frontCameraVerificationThreshold: config.frontCameraVerificationThreshold,
|
||||
receiptPrintingActive: config.receiptPrintingActive,
|
||||
terms,
|
||||
cassettes,
|
||||
twoWayMode: config.cashOutEnabled,
|
||||
zeroConfLimit: config.zeroConfLimit,
|
||||
|
|
@ -120,6 +117,21 @@ function poll (req, res, next) {
|
|||
.catch(next)
|
||||
}
|
||||
|
||||
function getTermsConditions (req, res, next) {
|
||||
const deviceId = req.deviceId
|
||||
const settings = req.settings
|
||||
|
||||
const config = configManager.unscoped(req.settings.config)
|
||||
const pi = plugins(settings, deviceId)
|
||||
|
||||
const terms = config.termsScreenActive && config.termsScreenText ? createTerms(config) : null
|
||||
|
||||
return pi.fetchCurrentConfigVersion().then(version => {
|
||||
return res.json({ terms, version })
|
||||
})
|
||||
.catch(next)
|
||||
}
|
||||
|
||||
function getTx (req, res, next) {
|
||||
if (req.query.status) {
|
||||
return helpers.fetchStatusTx(req.params.id, req.query.status)
|
||||
|
|
@ -356,6 +368,7 @@ const skip = (req, res) => _.includes(req.path, ['/poll', '/state', '/logs']) &&
|
|||
|
||||
const configRequiredRoutes = [
|
||||
'/poll',
|
||||
'/terms_conditions',
|
||||
'/event',
|
||||
'/phone_code',
|
||||
'/customer',
|
||||
|
|
@ -379,6 +392,7 @@ app.use(configRequiredRoutes, populateSettings)
|
|||
app.use(filterOldRequests)
|
||||
|
||||
app.get('/poll', poll)
|
||||
app.get('/terms_conditions', getTermsConditions)
|
||||
app.post('/state', stateChange)
|
||||
|
||||
app.post('/verify_user', verifyUser)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue