aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/mail.js2
-rw-r--r--lib/payments.js15
2 files changed, 9 insertions, 8 deletions
diff --git a/lib/mail.js b/lib/mail.js
index 12580544..d5586aa5 100644
--- a/lib/mail.js
+++ b/lib/mail.js
@@ -10,7 +10,7 @@ let Charset = "UTF-8";
export let templates = {
verifyEmail: "templates/payments/verify.html",
- paymentSent: "templates/payments/sent.html"
+ paymentReceived: "templates/payments/received.html"
};
export let mail = async (user, subject, template, params) => {
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))