From d99d67375bf046680a0c4149c6cbc6034b2413c9 Mon Sep 17 00:00:00 2001 From: delta-lynx-89e8 Date: Sun, 22 Feb 2026 15:36:35 -0800 Subject: [PATCH] Fix payout account-status route ordering Move /account-status route before /:id to prevent Express from matching "account-status" as a payout ID parameter. Co-Authored-By: Claude Opus 4.6 --- server/src/routes/payout.ts | 46 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/server/src/routes/payout.ts b/server/src/routes/payout.ts index e779d33..dbfad92 100644 --- a/server/src/routes/payout.ts +++ b/server/src/routes/payout.ts @@ -32,6 +32,29 @@ router.get('/', authenticate, async (req, res, next) => { } }); +// --- Check Stripe Connect account status --- +router.get('/account-status', authenticate, async (req, res, next) => { + try { + if (!stripe) throw new AppError(500, 'Stripe not configured'); + + const user = await prisma.user.findUnique({ where: { id: req.userId } }); + if (!user?.stripeAccountId) { + return res.json({ connected: false, detailsSubmitted: false, chargesEnabled: false, payoutsEnabled: false }); + } + + const account = await stripe.accounts.retrieve(user.stripeAccountId); + + res.json({ + connected: true, + detailsSubmitted: account.details_submitted, + chargesEnabled: account.charges_enabled, + payoutsEnabled: account.payouts_enabled, + }); + } catch (error) { + next(error); + } +}); + // --- Get payout details --- router.get('/:id', authenticate, async (req, res, next) => { try { @@ -90,27 +113,4 @@ router.post('/setup-account', authenticate, async (req, res, next) => { } }); -// --- Check Stripe Connect account status --- -router.get('/account-status', authenticate, async (req, res, next) => { - try { - if (!stripe) throw new AppError(500, 'Stripe not configured'); - - const user = await prisma.user.findUnique({ where: { id: req.userId } }); - if (!user?.stripeAccountId) { - return res.json({ connected: false, detailsSubmitted: false, chargesEnabled: false, payoutsEnabled: false }); - } - - const account = await stripe.accounts.retrieve(user.stripeAccountId); - - res.json({ - connected: true, - detailsSubmitted: account.details_submitted, - chargesEnabled: account.charges_enabled, - payoutsEnabled: account.payouts_enabled, - }); - } catch (error) { - next(error); - } -}); - export default router;