Populate payment method filter from real data instead of a guessed list

The previous fix hardcoded apple_pay/google_pay as extra filter options,
but Payment.method is free-text set by whatever the gateway reports, so
guessing at literal values was fragile and still didn't surface them for
this user. Add GET /api/payments/mypayments/methods returning the
distinct method values actually present in the user's payments, and have
the dashboard filter build its options from that instead. Also switch
the method filter from a startsWith match to an exact match, since the
values now come straight from the same column being filtered.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-24 08:55:58 +02:00
co-authored by Claude Sonnet 5
parent 90bea25338
commit 59194349d2
7 changed files with 53 additions and 11 deletions
+2
View File
@@ -4,6 +4,7 @@ const {
createPayment,
getPayments,
getUserPayments,
getUserPaymentMethods,
getPaymentById,
getPaymentsByRegistration,
getPaymentsByEvent,
@@ -20,6 +21,7 @@ router.post('/', protect, supervisor, createPayment);
router.post('/yoco-checkout', protect, createYocoCheckout);
router.post('/yoco-checkout/send', protect, supervisor, sendPaymentLink);
router.get('/mypayments', protect, getUserPayments);
router.get('/mypayments/methods', protect, getUserPaymentMethods);
router.get('/:id', protect, getPaymentById);
router.get('/registration/:registrationId', protect, getPaymentsByRegistration);