diff options
Diffstat (limited to 'lib/payments.js')
| -rw-r--r-- | lib/payments.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/payments.js b/lib/payments.js index c76bea70..92cd0760 100644 --- a/lib/payments.js +++ b/lib/payments.js @@ -70,7 +70,7 @@ export let debit = async ({ amount || 0, tip || 0, fee || 0, - ourfee || 0, + ourfee || 0 ); if (r !== "ok") fail("Problem debiting account"); @@ -133,7 +133,7 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => { if (Math.abs(invoice.rate / store.rates[invoice.currency] - 1) < 0.01) { rate = equivalentRate; } else { - warn("rate slipped", hash, invoice.rate, equivalentRate); + // warn("rate slipped", hash, invoice.rate, equivalentRate); } let id = v4(); @@ -176,7 +176,9 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => { .incrBy(`${balance}:${uid}`, amount) .exec(); - l("received", type, username, amount, tip); + if (!username.startsWith("lightning")) + l(username, "received", type, amount, tip); + emit(uid, "payment", p); notify(user, `Received ${amount} sats`); callWebhook(invoice, p); @@ -187,7 +189,7 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => { sats: "⚡️" + new Intl.NumberFormat("en-US", { maximumFractionDigits: 0 }).format( - p.amount, + p.amount ), link: `${process.env.URL}/payment/${p.id}`, }); @@ -195,12 +197,12 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => { mqtt1.publish( username, - `pay:${p.amount}:${p.tip}:${p.rate}:${p.created}:${p.id}`, + `pay:${p.amount}:${p.tip}:${p.rate}:${p.created}:${p.id}` ); mqtt2.publish( username, - `pay:${p.amount}:${p.tip}:${p.rate}:${p.created}:${p.id}`, + `pay:${p.amount}:${p.tip}:${p.rate}:${p.created}:${p.id}` ); return p; |
