From 166d97420056f6478ea9d291d709bbb3d3028195 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 11 Apr 2023 17:53:30 +0000 Subject: lookup payment by redeemcode --- routes/payments.js | 13 +++++++++++-- 1 file 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 }); -- cgit v1.2.3