Archived
- src/payments: provider registry and PaymentProvider interface (createCheckout, verifyWebhook/parseWebhook, getTransaction, refund, listTransactions as capabilities), Yoco as the first provider. All four direct Yoco checkout calls go through payments.createCheckout. - Webhook split into the provider part (signature, parsing) and shared processing; same URL (/api/webhooks/yoco), same behaviour. - YocoTransaction renamed in place to ProviderTransaction (+ provider, unique per provider + externalId); Payment.provider added and backfilled to "yoco". Payment.method stays the wallet type so cashups are unchanged. - Site settings → Payments: Enabled toggle and order per provider; Yoco's settings shown while it's enabled. R15 minimum for all online payments. - New endpoint names (/api/payments/checkout, /api/provider-transactions); the old /yoco-checkout and /yoco-transactions paths still work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
938 B
JavaScript
21 lines
938 B
JavaScript
const express = require('express');
|
|
const router = express.Router();
|
|
const { getAllProviderTransactions, getUnreconciledProviderTransactions, reconcileProviderTransaction, ignoreProviderTransaction } = require('../controllers/providerTransactionsController');
|
|
const { protect, supervisor} = require('../middleware/authMiddleware');
|
|
|
|
// Mounted at /api/provider-transactions (and /api/yoco-transactions, the older name).
|
|
|
|
// GET all payment provider transactions (admin/supervisor)
|
|
router.get('/', protect, supervisor, getAllProviderTransactions);
|
|
|
|
// GET all unreconciled transactions (admin/supervisor)
|
|
router.get('/unreconciled', protect, supervisor, getUnreconciledProviderTransactions);
|
|
|
|
// POST reconcile a transaction
|
|
router.post('/:id/reconcile', protect, supervisor, reconcileProviderTransaction);
|
|
|
|
// POST ignore a transaction
|
|
router.post('/:id/ignore', protect, supervisor, ignoreProviderTransaction);
|
|
|
|
module.exports = router;
|