Skip to content

Commit

Permalink
fix: add paper/SMS receipt arguments to static config queries
Browse files Browse the repository at this point in the history
  • Loading branch information
siiky committed Sep 26, 2024
1 parent 8d58fb2 commit fa6c436
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
14 changes: 10 additions & 4 deletions lib/lssettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ module.exports = (readwrite=false) => {
device_name,
number_of_cassettes,
number_of_recyclers
number_of_recyclers,
paper_receipt,
sms_receipt
)
VALUES (1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
ON CONFLICT (rowid) DO UPDATE SET
Expand All @@ -108,17 +110,21 @@ module.exports = (readwrite=false) => {
device_name = excluded.device_name,
number_of_cassettes = excluded.number_of_cassettes,
number_of_recyclers = excluded.number_of_recyclers
`,
number_of_recyclers = excluded.number_of_recyclers,
paper_receipt = excluded.paper_receipt,
sms_receipt = excluded.sms_receipt`,
version, enable_paper_wallet_only, has_lightening, server_version, timezone, two_way_mode, customer_authentication,
country, fiat_code, primary_locale,
deviceName, numberOfCassettes, numberOfRecyclers,
paper_receipt, sms_receipt
)

const loadStaticConfig = db => db.get(
`SELECT version, enable_paper_wallet_only, has_lightening, server_version, timezone, two_way_mode, customer_authentication,
country, fiat_code, primary_locale,
device_name, number_of_cassettes, number_of_recyclers
device_name, number_of_cassettes, number_of_recyclers,
paper_receipt, sms_receipt
FROM static_config
WHERE rowid = 1`,
)
Expand Down
13 changes: 12 additions & 1 deletion lib/trader.js
Original file line number Diff line number Diff line change
Expand Up @@ -936,12 +936,23 @@ Trader.prototype.failedQRScans = function failedQRScans (frames) {
}

Trader.prototype.loadConfigsFromDB = function loadConfigsFromDB () {
const loadStaticConfig = ({ version, enable_paper_wallet_only, has_lightening, server_version, two_way_mode }) => {
const loadStaticConfig = ({
version,
enable_paper_wallet_only,
has_lightening,
server_version,
two_way_mode,
paper_receipt,
sms_receipt,
}) => {
this.latestConfigVersion = version
this.enablePaperWalletOnly = enable_paper_wallet_only
this.hasLightning = has_lightening
this.serverVersion = server_version
this.twoWayMode = two_way_mode

this.receiptPrintingActive = paper_receipt
this.smsReceiptActive = sms_receipt
}

const loadLocales = ({ country, fiat_code, primary_locale }, primaryLocales) => {
Expand Down

0 comments on commit fa6c436

Please sign in to comment.