Add billing system: subscription, webhooks, and access control

- Add billing fields to User (isBilling, billingAmount, billingState,
  billingStripeSubscriptionId) and OrganizerInvitation (billingAmount)
- Registration: organizer gets billingState="poor" (pending review)
- Admin approval: sets isBilling=true, billingAmount from form, state="good"
- Invitation: billingAmount from invitation, if 0 then isBilling=false
- ROLE_ROOT accounts: billing free (amount=0, state="good")
- Block Stripe Connect creation and all organizer features if state is
  "poor" or "suspendu"
- Hide Stripe configuration section if billing not settled
- Add billing checkout via Stripe subscription with success route
- Webhooks: checkout.session.completed activates billing,
  invoice.payment_failed and customer.subscription.deleted suspend
  account and disable online events
- Show billing alert on /mon-compte with amount and subscribe button
- Display billing info in invitation email and landing page
- Add email templates for billing activated/failed/cancelled

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-03-24 14:30:21 +01:00
parent b14a15f0a4
commit e4c701456b
17 changed files with 398 additions and 1 deletions

View File

@@ -76,6 +76,21 @@ class OrganizerInvitationTest extends TestCase
self::assertSame($inv, $result);
}
public function testSetAndGetBillingAmount(): void
{
$inv = new OrganizerInvitation();
self::assertNull($inv->getBillingAmount());
$result = $inv->setBillingAmount(1000);
self::assertSame(1000, $inv->getBillingAmount());
self::assertSame($inv, $result);
$inv->setBillingAmount(0);
self::assertSame(0, $inv->getBillingAmount());
}
public function testSetAndGetStatus(): void
{
$inv = new OrganizerInvitation();

View File

@@ -187,6 +187,30 @@ class UserTest extends TestCase
self::assertTrue($user->isStripePayoutsEnabled());
}
public function testBillingFields(): void
{
$user = new User();
self::assertNull($user->isBilling());
self::assertNull($user->getBillingAmount());
self::assertNull($user->getBillingState());
self::assertNull($user->getBillingStripeSubscriptionId());
$result = $user->setIsBilling(true)
->setBillingAmount(2990)
->setBillingState('good')
->setBillingStripeSubscriptionId('sub_123456');
self::assertSame($user, $result);
self::assertTrue($user->isBilling());
self::assertSame(2990, $user->getBillingAmount());
self::assertSame('good', $user->getBillingState());
self::assertSame('sub_123456', $user->getBillingStripeSubscriptionId());
$user->setBillingState('suspendu');
self::assertSame('suspendu', $user->getBillingState());
}
public function testEmailVerificationFields(): void
{
$user = new User();