diff options
Diffstat (limited to 'routes/payments.js')
| -rw-r--r-- | routes/payments.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/routes/payments.js b/routes/payments.js index da55f1ec..093ad6b5 100644 --- a/routes/payments.js +++ b/routes/payments.js @@ -143,7 +143,7 @@ app.get("/payments", auth, async (req, res) => { } }); -app.get("/payment/:redeemcode", async (req, res) => { +app.get("/voucher/:redeemcode", async (req, res) => { try { const { redeemcode } = req.params; let payment = await db.Payment.findOne({ @@ -265,3 +265,16 @@ app.post("/checkRedeemCode", auth, async function(req, res) { const payment = await db.Payment.findOne({ where: { redeemcode } }); res.send(payment); }); + +app.get("/payments/:hash", auth, async function(req, res) { + console.log(req.params.hash) + try { + let payment = await db.Payment.findOne({ + where: { user_id: req.user.id, hash: req.params.hash } + }); + + return payment.get({ plain: true }); + } catch (e) { + console.log(e); + } +}); |
