diff options
| author | Adam Soltys <[email protected]> | 2021-08-30 14:48:26 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-08-30 14:54:23 -0700 |
| commit | 29a31a25c9c7bba63a4a19698f7f4678cff03d05 (patch) | |
| tree | 5b16c2ca770753e9eeafcc123bd238c2cb3046c7 /routes/send.js | |
| parent | 0fd7ad7ca44c455bc392f0cbaead27f477c77bd4 (diff) | |
| download | coinos-server-29a31a25c9c7bba63a4a19698f7f4678cff03d05.tar.gz coinos-server-29a31a25c9c7bba63a4a19698f7f4678cff03d05.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 }); |
