aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--routes/invoices.js4
-rw-r--r--routes/payments.js15
2 files changed, 16 insertions, 3 deletions
diff --git a/routes/invoices.js b/routes/invoices.js
index d689775f..338c66e7 100644
--- a/routes/invoices.js
+++ b/routes/invoices.js
@@ -20,7 +20,7 @@ app.get("/invoice", async (req, res, next) => {
{
model: db.User,
as: "user",
- attributes: ["username", "currency", "profile"]
+ attributes: ["username", "currency", "profile", "uuid"]
},
{
model: db.Request,
@@ -53,7 +53,7 @@ app.get("/invoice/:text", async (req, res, next) => {
include: {
model: db.User,
as: "user",
- attributes: ["username", "currency", "profile"]
+ attributes: ["username", "currency", "profile", "uuid"]
}
});
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);
+ }
+});