aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/mail.js2
-rw-r--r--lib/payments.js15
-rw-r--r--routes/users.js1
-rw-r--r--templates/payments/received.html (renamed from templates/payments/sent.html)6
4 files changed, 12 insertions, 12 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))
diff --git a/routes/users.js b/routes/users.js
index 909cf186..b009573f 100644
--- a/routes/users.js
+++ b/routes/users.js
@@ -225,7 +225,6 @@ export default {
"currencies",
"currency",
"display",
- "email",
"language",
"fiat",
"locktime",
diff --git a/templates/payments/sent.html b/templates/payments/received.html
index 087577e1..9facb849 100644
--- a/templates/payments/sent.html
+++ b/templates/payments/received.html
@@ -10,17 +10,17 @@
<body>
<div style="display: flex; width: 100%;">
<a href="https://coinos.io" style="margin: auto">
- <img src="https://coinos.io/images/logo.svg">
+ <img src="https://coinos.io/images/logo.jpg" style="max-width: 800px">
</a>
</div>
<div style="margin-bottom: 10px">Hello {{username}},</div>
<div style="margin-bottom: 10px">
- Please visit <a href="{{link}}">{{link}}</a> to verify your email.
+ You received {{amount}} sats!
</div>
- <div style="margin-bottom: 10px">Thanks!</div>
+ <div style="margin-bottom: 10px">Cheers,</div>
<div>The Coinos Team</div>
</body>