Passed
Branch feature/add-webhook-services (535460)
by Eudald
02:00
created
src/GocardlessWebhookCall.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
             return;
41 41
         }
42 42
 
43
-        if (! class_exists($jobClass)) {
43
+        if (!class_exists($jobClass)) {
44 44
             throw WebhookFailed::jobClassDoesNotExist($jobClass, $this);
45 45
         }
46 46
 
Please login to merge, or discard this patch.
src/GocardlessServiceProvider.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,18 +31,18 @@  discard block
 block discarded – undo
31 31
     public function boot()
32 32
     {
33 33
         $this->publishes([
34
-            __DIR__.'/config/gocardless.php' => config_path('gocardless.php'),
34
+            __DIR__ . '/config/gocardless.php' => config_path('gocardless.php'),
35 35
         ], 'config');
36 36
 
37
-        if (! class_exists('CreateGocardlessWebhookClassTable')) {
37
+        if (!class_exists('CreateGocardlessWebhookClassTable')) {
38 38
             $timestamp = date('Y_m_d_His', time());
39 39
 
40 40
             $this->publishes([
41
-                __DIR__.'/../database/migrations/create_gocardless_webhook_calls_table.php.stub' => database_path('migrations/'.$timestamp.'_create_gocardless_webhook_calls_table.php'),
41
+                __DIR__ . '/../database/migrations/create_gocardless_webhook_calls_table.php.stub' => database_path('migrations/' . $timestamp . '_create_gocardless_webhook_calls_table.php'),
42 42
             ], 'migrations');
43 43
         }
44 44
 
45
-        Route::macro('gocardlessWebhooks', function ($url) {
45
+        Route::macro('gocardlessWebhooks', function($url) {
46 46
             return Route::post($url, '\Nestednet\Gocardless\Controllers\GocardlessWebhookController');
47 47
         });
48 48
     }
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
      */
75 75
     protected function registerGocardless()
76 76
     {
77
-        $this->app->singleton('gocardless', function ($app) {
77
+        $this->app->singleton('gocardless', function($app) {
78 78
             $config = $app['config']->get('gocardless');
79 79
             $token = isset($config['token']) ? $config['token'] : null;
80 80
             $environment = isset($config['environment']) ? $config['environment'] : null;
81
-            return new Client( array (
81
+            return new Client(array(
82 82
                 'access_token' => $token,
83 83
                 'environment' => $environment
84 84
             ));
Please login to merge, or discard this patch.
src/config/gocardless.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
          * The key is: {event_resource}_{event_action}
47 47
          */
48 48
         'jobs' => [
49
-          // 'payments_confirmed' => \App\Jobs\GocardlessWebhooks\HandleConfirmedPayment::class
49
+            // 'payments_confirmed' => \App\Jobs\GocardlessWebhooks\HandleConfirmedPayment::class
50 50
         ],
51 51
     ],
52 52
 ];
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
src/Controllers/GocardlessWebhookController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
         $payload = $request->input();
26 26
         $modelClass = config('gocardless.webhooks.model');
27 27
 
28
-        foreach($payload['events'] as $event) {
28
+        foreach ($payload['events'] as $event) {
29 29
             $gocardlessWebhookCall = $modelClass::create([
30 30
                 'resource_type' => $event['resource_type'] ?? '',
31 31
                 'action' => $event['action'] ?? '',
Please login to merge, or discard this patch.
src/Middlewares/VerifySignature.php 1 patch
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
     {
20 20
         $signature = $request->header('Webhook-Signature');
21 21
 
22
-        if (! $signature) {
22
+        if (!$signature) {
23 23
             throw WebhookFailed::missingSignature();
24 24
         }
25 25
 
26
-        if (! $this->isValid($signature, $request->getContent(), $request->route('configKey'))) {
26
+        if (!$this->isValid($signature, $request->getContent(), $request->route('configKey'))) {
27 27
             throw WebhookFailed::invalidSignature($signature);
28 28
         }
29 29
 
@@ -33,8 +33,7 @@  discard block
 block discarded – undo
33 33
     protected function isValid(string $signature, string $payload, string $configKey = null) : bool
34 34
     {
35 35
         $secret = ($configKey) ?
36
-            config('gocardless.webhooks.webhook_endpoint_secret_'.$configKey) :
37
-            config('gocardless.webhooks.webhook_endpoint_secret');
36
+            config('gocardless.webhooks.webhook_endpoint_secret_' . $configKey) : config('gocardless.webhooks.webhook_endpoint_secret');
38 37
 
39 38
         if (empty($secret)) {
40 39
             throw WebhookFailed::noSecretKeyProvided();
Please login to merge, or discard this patch.