Skip to content

Commit

Permalink
more routes for transaction processing
Browse files Browse the repository at this point in the history
  • Loading branch information
Baalmart committed Dec 8, 2024
1 parent ff9925c commit 1b0a76f
Showing 1 changed file with 74 additions and 7 deletions.
81 changes: 74 additions & 7 deletions src/auth-service/routes/v2/transactions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const express = require("express");
const PaymentController = require("@controllers/create-transaction");
const TransactionController = require("@controllers/create-transaction");
const validateTransaction = require("@middleware/validateTransaction");
const validateTenant = require("@middleware/validateTenant");
const router = express.Router();
Expand All @@ -21,22 +21,89 @@ router.post(
"/checkout",
validateTenant(),
validateTransaction,
PaymentController.createCheckoutSession
TransactionController.createCheckoutSession
);

router.post(
"/webhook",
validateTenant(),
express.raw({ type: "application/json" }),
PaymentController.handleWebhook
TransactionController.handleWebhook
);

router.get("/list", validateTenant(), PaymentController.listTransactions);
router.get("/list", validateTenant(), TransactionController.listTransactions);

router.patch("/update", validateTenant(), PaymentController.updateTransaction);
router.patch(
"/update",
validateTenant(),
TransactionController.updateTransaction
);

router.get(
"/stats",
validateTenant(),
TransactionController.getTransactionStats
);

router.delete(
"/delete",
validateTenant(),
TransactionController.deleteTransaction
);

router.post(
"/enable-auto-renewal",
validateTenant(),
TransactionController.optInForAutomaticRenewal
);

router.get("/stats", validateTenant(), PaymentController.getTransactionStats);
// Route for creating a subscription transaction
router.post(
"/subscribe",
validateTenant(),
TransactionController.createSubscriptionTransaction
);

router.delete("/delete", validateTenant(), PaymentController.deleteTransaction);
// Route for cancelling a user's subscription
router.post(
"/cancel-subscription",
validateTenant(),
TransactionController.cancelSubscription
);

// Route for generating a dynamic price for flexible donations
router.post(
"/generate-price",
validateTenant(),
TransactionController.generateDynamicPrice
);

// Route for retrieving user's subscription status
router.get(
"/subscription-status",
validateTenant(),
TransactionController.getSubscriptionStatus
);

// Route for handling subscription renewals manually
router.post(
"/renew-subscription",
validateTenant(),
TransactionController.manualSubscriptionRenewal
);

// Route for retrieving transaction history with advanced filtering
router.get(
"/transaction-history",
validateTenant(),
TransactionController.getExtendedTransactionHistory
);

// Route for generating financial reports
router.get(
"/financial-report",
validateTenant(),
TransactionController.generateFinancialReport
);

module.exports = router;

0 comments on commit 1b0a76f

Please sign in to comment.