Payout system:
- Create Payout entity (stripePayoutId, status, amount, currency, destination, arrivalDate)
- Webhook handles payout.created/updated/paid/failed/canceled with email notification
- Payout list in /mon-compte virements tab with status badges
- PDF attestation on paid payouts with email attachment
PDF attestation:
- dompdf with DejaVu Sans font, yellow-orange gradient background
- Orange centered title bar, E-Cosplay logo, emitter/beneficiary info blocks
- QR code linking to /attestation/check/{payoutId} for authenticity verification
- Public verification page: shows payout details if valid, error if altered
- Legal disclaimer and CGV reference
- Button visible only when status is paid, opens in new tab
Sub-accounts:
- Add parentOrganizer (self-referencing ManyToOne) and subAccountPermissions (JSON) to User
- Permissions: scanner (validate tickets), events (CRUD), tickets (free invitations)
- Create sub-account with random password, send email with credentials
- Edit page with name/email/permissions checkboxes
- Delete with confirmation
- hasPermission() helper method
Account improvements:
- Block entire page for unapproved organizers with validation pending message
- Display stripeStatus in Stripe Connect banners
- Remove test payout button
Webhook v2 Connect events:
- v2.core.account.created/updated/closed → update stripeStatus
- capability_status_updated → sync charges/payouts enabled from capabilities
- PayoutPdfService for reusable PDF generation
Migrations: stripeStatus, Payout table, sub-account fields, drop pdfPath
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
46 lines
1.4 KiB
PHP
46 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Tests\Entity;
|
|
|
|
use App\Entity\Payout;
|
|
use App\Entity\User;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class PayoutTest extends TestCase
|
|
{
|
|
public function testNewPayoutHasCreatedAt(): void
|
|
{
|
|
$payout = new Payout();
|
|
|
|
self::assertInstanceOf(\DateTimeImmutable::class, $payout->getCreatedAt());
|
|
}
|
|
|
|
public function testPayoutFields(): void
|
|
{
|
|
$user = new User();
|
|
$arrival = new \DateTimeImmutable('2026-03-20');
|
|
|
|
$payout = new Payout();
|
|
$result = $payout->setOrganizer($user)
|
|
->setStripePayoutId('po_test123')
|
|
->setStatus('paid')
|
|
->setAmount(15000)
|
|
->setCurrency('eur')
|
|
->setDestination('ba_xxx')
|
|
->setStripeAccountId('acct_xxx')
|
|
->setArrivalDate($arrival);
|
|
|
|
self::assertSame($payout, $result);
|
|
self::assertNull($payout->getId());
|
|
self::assertSame($user, $payout->getOrganizer());
|
|
self::assertSame('po_test123', $payout->getStripePayoutId());
|
|
self::assertSame('paid', $payout->getStatus());
|
|
self::assertSame(15000, $payout->getAmount());
|
|
self::assertSame(150.0, $payout->getAmountDecimal());
|
|
self::assertSame('eur', $payout->getCurrency());
|
|
self::assertSame('ba_xxx', $payout->getDestination());
|
|
self::assertSame('acct_xxx', $payout->getStripeAccountId());
|
|
self::assertSame($arrival, $payout->getArrivalDate());
|
|
}
|
|
}
|