aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-04-11 17:53:30 +0000
committerAdam Soltys <[email protected]>2023-04-11 17:53:30 +0000
commit166d97420056f6478ea9d291d709bbb3d3028195 (patch)
treeed2788537fad0556fcd550a9ab983b0e30b6bd89
parent5d5a551dc6eab03a42657af0d35118e6c939c6df (diff)
downloadcoinos-server-166d97420056f6478ea9d291d709bbb3d3028195.tar.gz
coinos-server-166d97420056f6478ea9d291d709bbb3d3028195.zip
lookup payment by redeemcode
-rw-r--r--routes/payments.js13
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 });