diff options
| author | Adam Soltys <[email protected]> | 2022-09-02 15:06:43 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-09-02 15:06:43 -0700 |
| commit | d1cc66d1a02b75f90fbf0c05910777c76228259a (patch) | |
| tree | 7b93dc6a2fc0ec9d03676d6b4093fedf9733f128 /routes/invoices.js | |
| parent | 3161dd7ee95b6c7d70f8341298dd4fab84cda8b0 (diff) | |
| download | coinos-server-d1cc66d1a02b75f90fbf0c05910777c76228259a.tar.gz coinos-server-d1cc66d1a02b75f90fbf0c05910777c76228259a.zip | |
es6 migration
Diffstat (limited to 'routes/invoices.js')
| -rw-r--r-- | routes/invoices.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/routes/invoices.js b/routes/invoices.js index a65ff7ba..d4a003be 100644 --- a/routes/invoices.js +++ b/routes/invoices.js @@ -1,3 +1,5 @@ +import { rates } from "../lib/store.js"; +import { addresses } from "../lib/store.js"; import app from "../app.js"; import { optionalAuth } from "../lib/passport.js"; import { Op } from "@sequelize/core"; @@ -18,7 +20,7 @@ app.get("/invoice", async (req, res, next) => { res.send(invoice); } catch (e) { - l.error("couldn't find invoice", e); + err("couldn't find invoice", e); } }); @@ -36,7 +38,7 @@ app.post("/invoice", optionalAuth, async (req, res, next) => { throw new Error("tip amount out of range"); if (liquidAddress) { - l.info("conversion request for", liquidAddress, invoice.text); + l("conversion request for", liquidAddress, invoice.text); convert[invoice.text] = { address: liquidAddress, tx }; } @@ -50,7 +52,7 @@ app.post("/invoice", optionalAuth, async (req, res, next) => { } if (!user) throw new Error("user not provided"); if (!invoice.currency) invoice.currency = user.currency; - if (!invoice.rate) invoice.rate = app.get("rates")[invoice.currency]; + if (!invoice.rate) invoice.rate = rates[invoice.currency]; if (invoice.tip > invoice.amount || invoice.tip > 1000000) throw new Error("tip is too large"); if (invoice.tip < 0 || invoice.amount < 0) @@ -58,7 +60,7 @@ app.post("/invoice", optionalAuth, async (req, res, next) => { invoice.user_id = user.id; invoice.account_id = user.account_id; - l.info( + l( "creating invoice", user.username, invoice.network, @@ -93,7 +95,7 @@ app.post("/invoice", optionalAuth, async (req, res, next) => { res.send(invoice); } catch (e) { - l.error(e.message, e.stack); + err(e.message, e.stack); res.status(500).send(`Problem during invoice creation: ${e.message}`); } }); |
