diff options
| author | Adam Soltys <[email protected]> | 2021-08-14 01:37:50 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-08-14 01:38:15 -0700 |
| commit | 4c73bfdd4890bb8868a4c7cb5110cc98015a8318 (patch) | |
| tree | 2d10b22e668c6df692a48b0ef2582edff66934f8 | |
| parent | 1ea5f84aebaf916cae4ad97747ceb66e47c32cc7 (diff) | |
| download | coinos-server-4c73bfdd4890bb8868a4c7cb5110cc98015a8318.tar.gz coinos-server-4c73bfdd4890bb8868a4c7cb5110cc98015a8318.zip | |
lookup invoice by text
| -rw-r--r-- | routes/send.js | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/routes/send.js b/routes/send.js index 3f240e85..9b4396ef 100644 --- a/routes/send.js +++ b/routes/send.js @@ -2,7 +2,15 @@ const axios = require("axios"); const uuidv4 = require("uuid/v4"); module.exports = ah(async (req, res, next) => { - let { amount, asset, memo, username } = req.body; + let { + amount, + address, + payreq, + unconfidential, + asset, + memo, + username, + } = req.body; let { user } = req; amount = parseInt(amount); @@ -74,9 +82,12 @@ module.exports = ah(async (req, res, next) => { { transaction } ); - let invoice = await db.Invoice.findOne({ - where: { amount, user_id: recipient.id }, - }); + let text = address || payreq; + params = { + where: { user_id: recipient.id }, + }; + if (text) params.where.text = text; + let invoice = await db.Invoice.findOne(params); let a2; let acc = { |
