From b72619d3096e9a9c891b854d29371679dde82ae8 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 9 Aug 2023 16:56:44 +0000 Subject: check for printer flag --- lib/payments.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/payments.js b/lib/payments.js index ee143a82..61c0b196 100644 --- a/lib/payments.js +++ b/lib/payments.js @@ -173,7 +173,8 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => { emit(uid, "payment", p); notify(user, `Received ${amount} sats`); callWebhook(invoice, p); - if (user.username === "bob") { + + if (user.hasprinter) { let words = dollarsToWords( parseFloat(((amount * p.rate) / 100000000).toFixed(2)) ); @@ -185,12 +186,12 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => { } catch (e) { console.log(e); } - } - const client = mqtt.connect('mqtt://ln.coinos.io', config.mqtt); - client.on('connect', function () { - client.publish('payments', `${p.amount}:${p.tip}:${p.rate}:${p.created}:${p.id}`); - }); + const client = mqtt.connect('mqtt://ln.coinos.io', config.mqtt); + client.on('connect', function () { + client.publish(username, `${p.amount}:${p.tip}:${p.rate}:${p.created}:${p.id}`); + }); + } return p; }; -- cgit v1.2.3