diff options
| author | Adam Soltys <[email protected]> | 2023-08-09 16:56:44 +0000 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-08-09 16:56:44 +0000 |
| commit | b72619d3096e9a9c891b854d29371679dde82ae8 (patch) | |
| tree | 7f17a936868fa3d6d1d9897873b41cffa0d13ee2 /lib | |
| parent | cf3e8c27e990f493b483400d5215411be253e5a0 (diff) | |
| download | coinos-server-b72619d3096e9a9c891b854d29371679dde82ae8.tar.gz coinos-server-b72619d3096e9a9c891b854d29371679dde82ae8.zip | |
check for printer flag
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/payments.js | 13 |
1 files changed, 7 insertions, 6 deletions
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; }; |
