diff options
| author | Adam Soltys <[email protected]> | 2022-11-06 06:19:17 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-11-06 06:19:17 -0800 |
| commit | bee5e350576baf674594a101795b23318b654c9a (patch) | |
| tree | 404b404e0f0bdeb609df125ad89aca3f0dd5f116 | |
| parent | a40fe3364af0242fd6584b06528a00866918f437 (diff) | |
| download | coinos-server-bee5e350576baf674594a101795b23318b654c9a.tar.gz coinos-server-bee5e350576baf674594a101795b23318b654c9a.zip | |
send invoice to recipient
| -rw-r--r-- | routes/invoices.js | 6 |
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); |
