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/send.js | |
| parent | 3161dd7ee95b6c7d70f8341298dd4fab84cda8b0 (diff) | |
| download | coinos-server-d1cc66d1a02b75f90fbf0c05910777c76228259a.tar.gz coinos-server-d1cc66d1a02b75f90fbf0c05910777c76228259a.zip | |
es6 migration
Diffstat (limited to 'routes/send.js')
| -rw-r--r-- | routes/send.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/routes/send.js b/routes/send.js index 7cc403e1..b0f8accb 100644 --- a/routes/send.js +++ b/routes/send.js @@ -1,3 +1,4 @@ +import { rates } from "../lib/store.js"; import { callWebhook } from "../lib/webhooks.js"; import axios from "axios"; import { v4 as uuidv4 } from "uuid"; @@ -60,7 +61,7 @@ export default async (req, res, next) => { account_id: account.id, memo, user_id: user.id, - rate: app.get("rates")[user.currency], + rate: rates[user.currency], currency: user.currency, confirmed: true, hash: `#${uuidv4().substr(0, 6)} ${ @@ -70,7 +71,7 @@ export default async (req, res, next) => { }; if (!username) { - l.info("creating redeemable payment"); + l("creating redeemable payment"); params.redeemcode = uuidv4(); params.hash = `${req.get("origin")}/redeem/${params.redeemcode}`; } @@ -80,7 +81,7 @@ export default async (req, res, next) => { payment = payment.get({ plain: true }); payment.account = account.get({ plain: true }); - l.info("sent internal", user.username, -payment.amount); + l("sent internal", user.username, -payment.amount); emit(user.username, "payment", payment); emit(user.username, "account", account); @@ -165,7 +166,7 @@ export default async (req, res, next) => { amount, account_id: a2.id, user_id: recipient.id, - rate: app.get("rates")[recipient.currency] * spread, + rate: rates[recipient.currency] * spread, currency: recipient.currency, confirmed: true, hash: `#${uuidv4().substr(0, 6)} Payment from ${user.username}`, @@ -179,7 +180,7 @@ export default async (req, res, next) => { let c = convert[invoice.text]; if (c) { - l.info( + l( "internal payment detected for conversion", invoice.text, c.address, @@ -204,7 +205,7 @@ export default async (req, res, next) => { emit(recipient.username, "payment", p2); emit(recipient.username, "account", p2.account); - l.info("received internal", recipient.username, amount); + l("received internal", recipient.username, amount); notify(recipient, `Received ${amount} ${a2.ticker} sats`); callWebhook(invoice, p2); } @@ -212,7 +213,7 @@ export default async (req, res, next) => { }); } catch (e) { console.log(e); - l.error("problem sending internal payment", user.username, e.message); + err("problem sending internal payment", user.username, e.message); return res.status(500).send(e.message); } }; |
