Block organizer features when Stripe Connect account is not validated

- Hide organizer tabs (events, subaccounts, payouts) if Stripe not ready
- Redirect organizer tab content and all organizer routes to /mon-compte
- Add requireStripeReady() guard on all ROLE_ORGANIZER routes
- Force default tab to 'tickets' when Stripe is not validated
- Update test fixtures: approved organizers get Stripe enabled by default
- Add tests for blocked tabs and blocked event creation without Stripe

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-03-24 11:06:39 +01:00
parent 7d81fa3604
commit f9788adab3
3 changed files with 146 additions and 7 deletions

View File

@@ -77,9 +77,11 @@
{% endif %}
{% endif %}
{% set stripeReady = app.user.stripeChargesEnabled and app.user.stripePayoutsEnabled %}
<div class="flex flex-wrap overflow-x-auto mb-8">
{% set isSubAccount = app.user.parentOrganizer is not null %}
{% if isOrganizer %}
{% if isOrganizer and stripeReady %}
{% if not isSubAccount or app.user.hasPermission('events') %}
<a href="{{ path('app_account', {tab: 'events'}) }}" class="flex-1 min-w-[100px] text-center py-3 border-3 border-gray-900 border-r-0 {{ tab == 'events' ? 'bg-yellow-400' : 'bg-white' }} font-black uppercase text-xs tracking-widest transition-all">Evenements / Brocantes</a>
{% endif %}
@@ -245,7 +247,7 @@
{% endif %}
</div>
{% elseif tab == 'events' %}
{% elseif tab == 'events' and stripeReady %}
<div class="flex flex-wrap items-center justify-between gap-4 mb-6">
<a href="{{ path('app_account_create_event') }}" class="btn-brutal font-black uppercase text-xs tracking-widest hover:bg-indigo-600 hover:text-white transition-all">
+ Creer un evenement
@@ -339,7 +341,7 @@
</div>
{% endif %}
{% elseif tab == 'subaccounts' %}
{% elseif tab == 'subaccounts' and stripeReady %}
<div class="card-brutal p-6 mb-8">
<h2 class="text-sm font-black uppercase tracking-widest mb-4">Creer un sous-compte</h2>
@@ -427,7 +429,7 @@
{% endif %}
</div>
{% elseif tab == 'payouts' %}
{% elseif tab == 'payouts' and stripeReady %}
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-6">
<div class="card-brutal p-4 text-center">
<div class="text-[10px] font-black uppercase tracking-widest text-gray-500 mb-1">Encaisse</div>