Completed
Push — master ( 673226...2f9fa2 )
by Freek
01:35
created

src/Exceptions/WebhookFailed.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Spatie\StripeWebhooks\Exceptions;
4
5
use Exception;
6
use Spatie\StripeWebhooks\StripeWebhookCall;
7
8
class WebhookFailed extends Exception
9
{
10
    public static function signatureMissing()
11
    {
12
        return new static('The request did not contain a header named `Stripe-Signature`');
13
    }
14
15
    public static function invalidSignature($signature)
16
    {
17
        return new static("The signature `{$signature}` found in the header named `Stripe-Signature` is invalid. Make sure that the `services.stripe.webhook_signing_secret` config key is set to the value you found on the Stripe dashboard. If you are caching your config try running `php artisan clear:cache` to resolve the problem.");
18
    }
19
20
    public static function signingSecretNotSet()
21
    {
22
        return new static('The Stripe webhook signing secret is not set. Make sure that the `services.stripe.webhook_signing_secret` config key is set to the value you found on the Stripe dashboard.');
23
    }
24
25
    public static function jobClassDoesNotExist(string $jobClass, StripeWebhookCall $webhookCall)
26
    {
27
        return new static("Could not process webhook id `{$webhookCall->id}` of type `{$webhookCall->type} because the configured jobclass `$jobClass` does not exist");
28
    }
29
30
    public function render($request)
0 ignored issues
show
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
31
    {
32
        return response(['error' => $this->getMessage()], 400);
33
    }
34
}
35