Fix issue with payment processing

This commit is contained in:
Christopher Cookman 2025-01-16 21:50:56 -07:00
parent a17de17aeb
commit 005f28bd5a

View file

@ -25,7 +25,7 @@ router.post("/external/hub/order/complete", async (req, res) => {
// Insert purchase into database
await pool.query('INSERT INTO purchases (robloxId, productId, hubId) VALUES (?, ?, ?)', [robloxID, product.id, hub.id]);
if (product.stock !== -1 && product.stock !== 0) {
if (product.stock != -1 && product.stock != 0) {
await pool.query('UPDATE products SET stock = stock - 1 WHERE id = ?', [product.id]);
}
res.status(200).json({ status: "200", message: 'Purchased product' });
@ -104,7 +104,7 @@ router.post("/external/hub/gift/complete", async (req, res) => {
// Insert purchase into database
await pool.query('INSERT INTO purchases (robloxId, productId, hubId) VALUES (?, ?, ?)', [recipientID, product.id, hub.id]);
if (product.stock !== -1 && product.stock !== 0) {
if (product.stock != -1 && product.stock != 0) {
await pool.query('UPDATE products SET stock = stock - 1 WHERE id = ?', [product.id]);
}
res.status(200).json({ status: "200", message: 'Gifted product to user' });