Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| WebhookSignatureException | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| getStatusCode | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getTitle | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace App\Domain\Stripe\Exception; |
| 6 | |
| 7 | use App\Domain\Exception\HttpStatusException; |
| 8 | use Fig\Http\Message\StatusCodeInterface; |
| 9 | use RuntimeException; |
| 10 | |
| 11 | /** |
| 12 | * Thrown when an inbound Stripe webhook payload fails signature |
| 13 | * verification — either the body was tampered with or the configured |
| 14 | * `webhook_secret` does not match the one Stripe is signing with. |
| 15 | * |
| 16 | * The action layer translates this into a 400, signaling Stripe to retry |
| 17 | * but flagging the request as malformed. |
| 18 | */ |
| 19 | final class WebhookSignatureException extends RuntimeException implements HttpStatusException |
| 20 | { |
| 21 | public function getStatusCode(): int |
| 22 | { |
| 23 | return StatusCodeInterface::STATUS_BAD_REQUEST; |
| 24 | } |
| 25 | |
| 26 | public function getTitle(): string |
| 27 | { |
| 28 | return 'Bad Request'; |
| 29 | } |
| 30 | } |