diff options
| author | Adam Soltys <[email protected]> | 2021-08-30 14:48:26 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-08-30 16:03:09 -0700 |
| commit | c6dc858ee5491e6c584d94d702438e9b24adbfc7 (patch) | |
| tree | 412344ab540dc81f209a965eaf82e5621a85b4d3 /routes/send.js | |
| parent | 7d3cc287e862e590c7cc85a8ce99eb2782ff84af (diff) | |
| download | coinos-server-c6dc858ee5491e6c584d94d702438e9b24adbfc7.tar.gz coinos-server-c6dc858ee5491e6c584d94d702438e9b24adbfc7.zip | |
handle conversions for internal payments
Diffstat (limited to 'routes/send.js')
| -rw-r--r-- | routes/send.js | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/routes/send.js b/routes/send.js index e8fdb79c..cdaa8a9b 100644 --- a/routes/send.js +++ b/routes/send.js @@ -158,7 +158,28 @@ module.exports = ah(async (req, res, next) => { received: true, }; - if (invoice) params.invoice_id = invoice.id; + if (invoice) { + params.invoice_id = invoice.id; + + let c = convert[invoice.text]; + if (c) { + l.info( + "internal payment detected for conversion", + invoice.text, + c.address, + recipient.username + ); + + recipient.account = a2; + + sendLiquid({ + address: c.address, + amount: amount - 100, + user: recipient, + limit: amount, + }).catch(console.log); + } + } let p2 = await db.Payment.create(params, { transaction }); |
