Session 14: Africa checkout, Tank01 NBA/MLB wiring, WNBA+MLB odds proxies, OAuth icons, loading skeletons (1330 tests)
This commit is contained in:
+16
-2
@@ -14,8 +14,12 @@ const router = express.Router();
|
||||
router.post('/checkout', requireAuth, async (req, res) => {
|
||||
const { tier, founder_code } = req.body;
|
||||
|
||||
if (!tier || !['analyst', 'desk'].includes(tier)) {
|
||||
return res.status(400).json({ error: 'tier must be "analyst" or "desk"' });
|
||||
// Session 14 — 'africa' joins the validation whitelist. Whether
|
||||
// the checkout succeeds for 'africa' depends on STRIPE_PRICE_AFRICA
|
||||
// being set (see stripeService.PRICE_UNCONFIGURED handling); when
|
||||
// it isn't, the service throws a 503 the catch block surfaces.
|
||||
if (!tier || !['africa', 'analyst', 'desk'].includes(tier)) {
|
||||
return res.status(400).json({ error: 'tier must be "africa", "analyst" or "desk"' });
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -23,6 +27,16 @@ router.post('/checkout', requireAuth, async (req, res) => {
|
||||
return res.json(result);
|
||||
} catch (err) {
|
||||
console.error('[VYNDR] Checkout error:', err.message);
|
||||
// Session 14 — surface the "tier valid but Stripe price not
|
||||
// provisioned yet" case with the explicit message + 503. This
|
||||
// path is what the Africa-tier user hits until
|
||||
// STRIPE_PRICE_AFRICA is configured in Coolify.
|
||||
if (err && err.code === 'tier_unconfigured') {
|
||||
return res.status(503).json({
|
||||
error: err.message || 'Tier pricing not configured yet.',
|
||||
code: 'tier_unconfigured',
|
||||
});
|
||||
}
|
||||
return res.status(503).json({ error: 'Checkout creation failed' });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user