aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--routes/invoices.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/routes/invoices.js b/routes/invoices.js
index 6e0fe358..c492b475 100644
--- a/routes/invoices.js
+++ b/routes/invoices.js
@@ -60,7 +60,7 @@ app.get("/invoice/:text", async (req, res, next) => {
app.post("/invoice", optionalAuth, async (req, res, next) => {
try {
let { type = "bech32", liquidAddress, id, invoice, user, tx } = req.body;
- let { blindkey, currency, tip, amount, rate, network } = invoice;
+ let { blindkey, currency, tip, amount, rate, network, recipient } = invoice;
let address, unconfidential, text;
if (amount < 0) throw new Error("amount out of range");
@@ -151,6 +151,10 @@ app.post("/invoice", optionalAuth, async (req, res, next) => {
if (blindkey) await lq.importBlindingKey(invoice.address, blindkey);
}
+ if (recipient) {
+ emit(recipient, "invoice", invoice.get({ plain: true {));
+ }
+
res.send(invoice);
} catch (e) {
err(e.message, e.stack);