diff options
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; }; |
