Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| WebhookEventData | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace App\Domain\Stripe\Data; |
| 6 | |
| 7 | /** |
| 8 | * Verified Stripe webhook event. |
| 9 | * |
| 10 | * The wrapped {@see $payload} is the parsed event body — kept as a |
| 11 | * generic associative array because the shape varies per event type and |
| 12 | * we don't want every domain field on this DTO. Handlers cast into more |
| 13 | * specific types as they consume them. |
| 14 | * |
| 15 | * Construction of this DTO implies the signature has already been |
| 16 | * verified — either {@see StripeClientInterface::parseWebhookEvent} |
| 17 | * succeeded, or a fake produced one in tests. |
| 18 | */ |
| 19 | final readonly class WebhookEventData |
| 20 | { |
| 21 | /** |
| 22 | * @param array<mixed> $payload |
| 23 | * @param string $id |
| 24 | * @param string $type |
| 25 | */ |
| 26 | public function __construct( |
| 27 | public string $id, |
| 28 | public string $type, |
| 29 | public array $payload, |
| 30 | ) {} |
| 31 | } |