diff options
| author | Adam Soltys <[email protected]> | 2020-03-11 15:10:40 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-03-11 15:10:40 -0700 |
| commit | c0888fab024cc9f7c99812bfabf9d7774312dbf7 (patch) | |
| tree | cad95683af97432f6092a2c2bae10fbb7a588db5 /addInvoice.js | |
| parent | bf2b51f0c2ae9b8f0f330dde6411e45fc0da8a25 (diff) | |
| download | coinos-server-c0888fab024cc9f7c99812bfabf9d7774312dbf7.tar.gz coinos-server-c0888fab024cc9f7c99812bfabf9d7774312dbf7.zip | |
refactor
Diffstat (limited to 'addInvoice.js')
| -rw-r--r-- | addInvoice.js | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/addInvoice.js b/addInvoice.js deleted file mode 100644 index fa183321..00000000 --- a/addInvoice.js +++ /dev/null @@ -1,27 +0,0 @@ -module.exports = (app, db, lnb) => async (req, res) => { - let err = m => res.status(500).send(m); - let { amount, address, tip } = req.body; - - let invoice; - try { - invoice = await lnb.addInvoice({ value: amount }); - } catch (e) { - return err(e.message); - } - - let hash = invoice.payment_request; - if (address) hash = address; - - await db.Payment.create({ - user_id: req.user.id, - hash, - amount, - currency: "CAD", - rate: app.get("rates")[req.user.currency], - tip, - confirmed: 1, - asset: 'LNBTC', - }); - - res.send(invoice); -}; |
