diff options
| author | Adam Soltys <[email protected]> | 2022-09-02 22:12:24 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-09-02 22:12:24 -0700 |
| commit | 13352f9b30eed52d2e7d0970d3cbd76f401d6de0 (patch) | |
| tree | e745685b2d7373ad391431323b0bdf5ff373b55a /routes/invoices.js | |
| parent | d1cc66d1a02b75f90fbf0c05910777c76228259a (diff) | |
| download | coinos-server-13352f9b30eed52d2e7d0970d3cbd76f401d6de0.tar.gz coinos-server-13352f9b30eed52d2e7d0970d3cbd76f401d6de0.zip | |
es6 migration
Diffstat (limited to 'routes/invoices.js')
| -rw-r--r-- | routes/invoices.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/routes/invoices.js b/routes/invoices.js index d4a003be..814363b0 100644 --- a/routes/invoices.js +++ b/routes/invoices.js @@ -1,5 +1,4 @@ -import { rates } from "../lib/store.js"; -import { addresses } from "../lib/store.js"; +import store from "../lib/store.js"; import app from "../app.js"; import { optionalAuth } from "../lib/passport.js"; import { Op } from "@sequelize/core"; @@ -52,7 +51,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 = rates[invoice.currency]; + if (!invoice.rate) invoice.rate = store.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) @@ -87,9 +86,9 @@ app.post("/invoice", optionalAuth, async (req, res, next) => { invoice = exists ? await exists.update(invoice) : await db.Invoice.create(invoice); - addresses[invoice.address] = user.username; + store.addresses[invoice.address] = user.username; if (invoice.unconfidential) { - addresses[invoice.unconfidential] = user.username; + store.addresses[invoice.unconfidential] = user.username; if (blindkey) await lq.importBlindingKey(invoice.address, blindkey); } |
