diff options
| author | Adam Soltys <[email protected]> | 2023-04-11 17:53:30 +0000 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-04-11 17:53:30 +0000 |
| commit | 166d97420056f6478ea9d291d709bbb3d3028195 (patch) | |
| tree | ed2788537fad0556fcd550a9ab983b0e30b6bd89 | |
| parent | 5d5a551dc6eab03a42657af0d35118e6c939c6df (diff) | |
| download | coinos-server-166d97420056f6478ea9d291d709bbb3d3028195.tar.gz coinos-server-166d97420056f6478ea9d291d709bbb3d3028195.zip | |
lookup payment by redeemcode
| -rw-r--r-- | routes/payments.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/routes/payments.js b/routes/payments.js index 279588d1..ab3b547e 100644 --- a/routes/payments.js +++ b/routes/payments.js @@ -266,10 +266,19 @@ app.post("/checkRedeemCode", auth, async function(req, res) { res.send(payment); }); -app.get("/payments/:hash", auth, async function(req, res) { +app.get("/payment/:hash", auth, async function(req, res) { try { + let { hash } = req.params; let payment = await db.Payment.findOne({ - where: { user_id: req.user.id, hash: req.params.hash } + where: { + user_id: req.user.id, + [Op.or]: [{ hash }, { redeemcode: hash }] + }, + + include: { + model: db.Account, + as: "account" + } }); return payment.get({ plain: true }); |
