diff options
Diffstat (limited to 'lib/payments.js')
| -rw-r--r-- | lib/payments.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/payments.js b/lib/payments.js index 8d7a7ff0..2d0b3330 100644 --- a/lib/payments.js +++ b/lib/payments.js @@ -23,7 +23,7 @@ export const types = { bitcoin: "bitcoin", lightning: "lightning", fund: "fund", - classic: "classic", + classic: "classic" }; export let debit = async ( @@ -91,7 +91,7 @@ export let debit = async ( type, ref, tip, - created: Date.now(), + created: Date.now() }; await s(`payment:${id}`, p); @@ -99,9 +99,6 @@ export let debit = async ( l("sent", type, user.username, amount); emit(user.id, "payment", p); - // mail(user, "Payment sent", templates.paymentSent, { - // username: user.username - // }); return p; }; @@ -153,7 +150,7 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => { tip, type, confirmed: true, - created: Date.now(), + created: Date.now() }; if (type === types.bitcoin) invoice.pending += amount; @@ -185,6 +182,10 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => { notify(user, `Received ${amount} sats`); callWebhook(invoice, p); + if (user.verified) { + mail(user, "Payment received", templates.paymentReceived, p); + } + mqtt1.publish( username, `pay:${p.amount}:${p.tip}:${p.rate}:${p.created}:${p.id}` @@ -291,7 +292,7 @@ export let payLightning = async (user, payreq, amount, maxfee, memo) => { bolt11: payreq.replace(/\s/g, "").toLowerCase(), amount_msat: amount_msat ? undefined : amount * 1000, maxfee: maxfee * 1000, - retry_for: 5, + retry_for: 5 }); if (!(r.status === "complete" && r.payment_preimage)) |
