server v1.0.9 (full featured)
This commit is contained in:
@@ -9,6 +9,8 @@ import {
|
||||
changeLunchMenu,
|
||||
changeLunchMenuSet,
|
||||
fetchUser,
|
||||
initializePayment,
|
||||
renewSubscription,
|
||||
} from "../services/databaseServices.js";
|
||||
import {
|
||||
decodeAndSanitize,
|
||||
@@ -159,4 +161,23 @@ router.post("/delete", async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// ACTIVATE SUBSCRIPTION
|
||||
|
||||
router.post("/subscription", async (req, res) => {
|
||||
try {
|
||||
const token = req.headers["x-auth-token"];
|
||||
const user = validateUserToken(token);
|
||||
await validateRestaurant(req.body.restaurantId);
|
||||
/* const response = await initializePayment(
|
||||
req.body.restaurantId,
|
||||
req.body.userData,
|
||||
req.body.type
|
||||
); */
|
||||
await renewSubscription(req.body.restaurantId, req.body.type);
|
||||
res.send(200);
|
||||
} catch (error) {
|
||||
handleError(error, res);
|
||||
}
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
Reference in New Issue
Block a user