forked from Deen-Bridge/dnb-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpaymentRoutes.js
More file actions
58 lines (51 loc) · 1.62 KB
/
Copy pathpaymentRoutes.js
File metadata and controls
58 lines (51 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// routes/stellar/paymentRoutes.js
import express from "express";
import { protect, authorizeRoles } from "../../middlewares/authMiddleware.js";
import {
initializePayment,
submitPayment,
getQuote,
getPaymentPreflight,
getTransactionHistory,
getTransaction,
cancelTransaction,
} from "../../controllers/stellar/paymentController.js";
import {
requestRefund,
buildRefundXdr,
submitRefund,
rejectRefund,
escalateDispute,
arbitrateDispute,
} from "../../controllers/stellar/refundController.js";
import { reconciliationStatus } from "../../controllers/stellar/reconciliationController.js";
const router = express.Router();
// All routes require authentication
router.use(protect);
// Payment flow
router.post("/quote", getQuote);
router.post("/preflight", getPaymentPreflight);
router.post("/initialize", initializePayment);
router.post("/submit", submitPayment);
// Transaction management
router.get("/transactions", getTransactionHistory);
router.get("/transactions/:transactionId", getTransaction);
router.delete("/transactions/:transactionId", cancelTransaction);
// Refund & Dispute flow
router.post("/transactions/:id/refund-request", requestRefund);
router.post("/refunds/:refundId/build", buildRefundXdr);
router.post("/refunds/:refundId/submit", submitRefund);
router.post("/refunds/:refundId/reject", rejectRefund);
router.post("/refunds/:refundId/dispute", escalateDispute);
router.patch(
"/refunds/:refundId/arbitrate",
authorizeRoles("admin"),
arbitrateDispute
);
// Admin reconciliation status
router.get(
"/reconciliation/status",
authorizeRoles("admin"),
reconciliationStatus
);
export default router;