GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Setup Failed
Branch master (472873)
by bSecure
14:19
created
src/Models/ClientApp.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@
 block discarded – undo
15 15
                 return ['client_id' => '', 'error' => true, 'message' => trans('bSecure::messages.client.secret.invalid')];
16 16
             } else {
17 17
                 return [
18
-                  'client_id' => $merchantClientId,
19
-                  'client_secret' => $merchantClientSecret,
20
-                  'error' => false,
18
+                    'client_id' => $merchantClientId,
19
+                    'client_secret' => $merchantClientSecret,
20
+                    'error' => false,
21 21
                 ];
22 22
             }
23 23
         } catch (\Exception $e) {
Please login to merge, or discard this patch.
src/CheckoutServiceProvider.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@
 block discarded – undo
32 32
         if ($this->app->runningInConsole()) {
33 33
 
34 34
             $this->publishes([
35
-              __DIR__.'/config/config.php' => config_path('bSecure.php'),
35
+                __DIR__.'/config/config.php' => config_path('bSecure.php'),
36 36
             ], 'config');
37 37
 
38 38
             $this->publishes([
39
-              __DIR__.'/lang/en/messages.php' => resource_path('lang/vendor/bSecure/en/messages.php'),
39
+                __DIR__.'/lang/en/messages.php' => resource_path('lang/vendor/bSecure/en/messages.php'),
40 40
             ]);
41 41
         }
42 42
     }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      */
14 14
     public function register()
15 15
     {
16
-        $this->app->bind("bSecure_facade", function(){
16
+        $this->app->bind("bSecure_facade", function() {
17 17
             return new BsecureCheckout();
18 18
         });
19 19
 
@@ -26,17 +26,17 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public function boot()
28 28
     {
29
-        $this->loadTranslationsFrom( resource_path('lang/vendor/bSecure'),'bSecure');
29
+        $this->loadTranslationsFrom(resource_path('lang/vendor/bSecure'), 'bSecure');
30 30
 
31 31
 
32 32
         if ($this->app->runningInConsole()) {
33 33
 
34 34
             $this->publishes([
35
-              __DIR__.'/config/config.php' => config_path('bSecure.php'),
35
+              __DIR__ . '/config/config.php' => config_path('bSecure.php'),
36 36
             ], 'config');
37 37
 
38 38
             $this->publishes([
39
-              __DIR__.'/lang/en/messages.php' => resource_path('lang/vendor/bSecure/en/messages.php'),
39
+              __DIR__ . '/lang/en/messages.php' => resource_path('lang/vendor/bSecure/en/messages.php'),
40 40
             ]);
41 41
         }
42 42
     }
Please login to merge, or discard this patch.
src/Helpers/Language.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 class Language
6 6
 {
7
-    static function getMessage($key){
7
+    static function getMessage($key) {
8 8
         return __($key);
9 9
     }
10 10
 }
Please login to merge, or discard this patch.
src/Helpers/Helper.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
             }
21 21
 
22 22
             $payload = [
23
-              $contentType => $body,
24
-              'headers' => $headers,
25
-              'http_errors' => false,
26
-              'timeout' => 30,
27
-              'connect_timeout' => 30
23
+                $contentType => $body,
24
+                'headers' => $headers,
25
+                'http_errors' => false,
26
+                'timeout' => 30,
27
+                'connect_timeout' => 30
28 28
             ];
29 29
 
30 30
             $client = new Client();
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
         $authUrl = Constant::AUTH_SERVER_URL . Constant::API_ENDPOINTS['oauth'];
58 58
 
59 59
         $response = $http->post($authUrl, [
60
-          'form_params' => [
60
+            'form_params' => [
61 61
             'grant_type' => 'client_credentials',
62 62
             'client_id' => $data['client_id'],
63 63
             'client_secret' => $data['client_secret'],
64 64
             'scope' => "",
65
-          ],
65
+            ],
66 66
         ]);
67 67
 
68 68
         $result = json_decode((string)$response->getBody("access_token"), true);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             $authUrl = Constant::AUTH_SERVER_URL . Constant::API_ENDPOINTS['verify_client'];
164 164
 
165 165
             $response = $http->post($authUrl, [
166
-              'form_params' => $ssoPayload
166
+                'form_params' => $ssoPayload
167 167
             ]);
168 168
 
169 169
             $result = json_decode((string)$response->getBody("access_token"), true);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
           ],
66 66
         ]);
67 67
 
68
-        $result = json_decode((string)$response->getBody("access_token"), true);
68
+        $result = json_decode((string) $response->getBody("access_token"), true);
69 69
 
70 70
         if (isset($result['status']) && $result['status'] == Constant::HTTP_RESPONSE_STATUSES['success']) {
71 71
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
         $headers = ['Authorization' => 'Bearer ' . $merchantAccessToken];
119 119
 
120
-        $result = Helper::apiRequest($method, $url, [],$order_ref , $headers, 'form_params');
120
+        $result = Helper::apiRequest($method, $url, [], $order_ref, $headers, 'form_params');
121 121
 
122 122
         if (isset($result['status']) && $result['status'] == Constant::HTTP_RESPONSE_STATUSES['success']) {
123 123
             $response = ['error' => false, 'body' => $result['body']];
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
         $headers = ['Authorization' => 'Bearer ' . $merchantAccessToken];
142 142
 
143
-        $result = Helper::apiRequest($method, $url, [],$payload , $headers, 'form_params');
143
+        $result = Helper::apiRequest($method, $url, [], $payload, $headers, 'form_params');
144 144
 
145 145
         if (isset($result['status']) && $result['status'] == Constant::HTTP_RESPONSE_STATUSES['success']) {
146 146
             $response = ['error' => false, 'body' => $result['body']];
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
               'form_params' => $ssoPayload
167 167
             ]);
168 168
 
169
-            $result = json_decode((string)$response->getBody("access_token"), true);
169
+            $result = json_decode((string) $response->getBody("access_token"), true);
170 170
 
171 171
             if (isset($result['status']) && $result['status'] == Constant::HTTP_RESPONSE_STATUSES['success']) {
172 172
                 $response = ['error' => false, 'body' => $result['body']];
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         } else {
194 194
             $merchantAccessToken = $merchantToken['body'];
195 195
             // Call Create Order API
196
-            $response = Helper::getCustomerProfile($merchantAccessToken,$ssoCustomerProfile);
196
+            $response = Helper::getCustomerProfile($merchantAccessToken, $ssoCustomerProfile);
197 197
 
198 198
             if ($response['error']) {
199 199
                 return ['error' => true, 'message' => $response['body']['message']];
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
      * Author: Sara Hasan
210 210
      * Date: 26-November-2020
211 211
      */
212
-    public static function getCustomerProfile($merchantAccessToken,$ssoCustomerProfile)
212
+    public static function getCustomerProfile($merchantAccessToken, $ssoCustomerProfile)
213 213
     {
214 214
         $method = 'POST';
215 215
 
Please login to merge, or discard this patch.
src/Helpers/ApiResponseHandler.php 3 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
     public static function success( $body = [], $message ="messages.general.success" ){
14 14
 
15 15
         return  self::send(
16
-          Http::$Codes[ Http::SUCCESS ],
17
-          [Language::getMessage( $message )],
18
-          (object) $body,
19
-          null
16
+            Http::$Codes[ Http::SUCCESS ],
17
+            [Language::getMessage( $message )],
18
+            (object) $body,
19
+            null
20 20
         );
21 21
     }
22 22
 
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
         }
42 42
 
43 43
         return self::send(
44
-          Http::$Codes[ Http::INPROCESSABLE ],
45
-          $errorMessages,
46
-          (object) [],
47
-          null
44
+            Http::$Codes[ Http::INPROCESSABLE ],
45
+            $errorMessages,
46
+            (object) [],
47
+            null
48 48
         );
49 49
     }
50 50
 
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
     public static function authenticationError(){
55 55
 
56 56
         return self::send(
57
-          Http::$Codes[ Http::UNAUTHORISED ],
58
-          [Language::getMessage( "general.unauthenticated" )],
59
-          (object) [],
60
-          null
57
+            Http::$Codes[ Http::UNAUTHORISED ],
58
+            [Language::getMessage( "general.unauthenticated" )],
59
+            (object) [],
60
+            null
61 61
         );
62 62
     }
63 63
 
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
      */
70 70
     public static function failure( $message = 'general.error', $exception=null, $body = [] ){
71 71
         return self::send(
72
-          Http::$Codes[ Http::BAD_REQUEST ],
73
-          (gettype($message) == "array") ? $message : [ Language::getMessage( $message ) ],
74
-          (object) $body,
75
-          $exception
72
+            Http::$Codes[ Http::BAD_REQUEST ],
73
+            (gettype($message) == "array") ? $message : [ Language::getMessage( $message ) ],
74
+            (object) $body,
75
+            $exception
76 76
         );
77 77
     }
78 78
 
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
 
86 86
     public static function exception( $code, $message, $exception=null ){
87 87
         return self::send(
88
-          $code,
89
-          [$message],
90
-          [],
91
-          $exception
88
+            $code,
89
+            [$message],
90
+            [],
91
+            $exception
92 92
         );
93 93
     }
94 94
 
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
     private static function send( $status, $message, $body, $exception ){
103 103
 
104 104
         return response()->json([
105
-          'status'    =>  $status,
106
-          'message'   =>  $message,
107
-          'body'      =>  $body,
108
-          'exception' =>  $exception
105
+            'status'    =>  $status,
106
+            'message'   =>  $message,
107
+            'body'      =>  $body,
108
+            'exception' =>  $exception
109 109
         ], $status, [], JSON_UNESCAPED_UNICODE );
110 110
     }
111 111
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
      * @param string $message
11 11
      * @return \Illuminate\Http\JsonResponse
12 12
      */
13
-    public static function success( $body = [], $message ="messages.general.success" ){
13
+    public static function success($body = [], $message = "messages.general.success") {
14 14
 
15 15
         return  self::send(
16
-          Http::$Codes[ Http::SUCCESS ],
17
-          [Language::getMessage( $message )],
16
+          Http::$Codes[Http::SUCCESS],
17
+          [Language::getMessage($message)],
18 18
           (object) $body,
19 19
           null
20 20
         );
@@ -25,23 +25,23 @@  discard block
 block discarded – undo
25 25
      * @param string $message
26 26
      * @return \Illuminate\Http\JsonResponse
27 27
      */
28
-    public static function validationError( $validationErrors, $message = "general.validation" ){
28
+    public static function validationError($validationErrors, $message = "general.validation") {
29 29
 
30 30
         $errorMessages = [];
31 31
 
32
-        if( is_array( $validationErrors ) ){
33
-            $errorMessages = array_values( $validationErrors );
32
+        if (is_array($validationErrors)) {
33
+            $errorMessages = array_values($validationErrors);
34 34
         }
35 35
         else
36 36
         {
37
-            foreach( $validationErrors->getMessages() as $key => $errors )
37
+            foreach ($validationErrors->getMessages() as $key => $errors)
38 38
             {
39
-                $errorMessages = array_merge( $errorMessages, $errors );
39
+                $errorMessages = array_merge($errorMessages, $errors);
40 40
             }
41 41
         }
42 42
 
43 43
         return self::send(
44
-          Http::$Codes[ Http::INPROCESSABLE ],
44
+          Http::$Codes[Http::INPROCESSABLE],
45 45
           $errorMessages,
46 46
           (object) [],
47 47
           null
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
     /**
52 52
      * @return \Illuminate\Http\JsonResponse
53 53
      */
54
-    public static function authenticationError(){
54
+    public static function authenticationError() {
55 55
 
56 56
         return self::send(
57
-          Http::$Codes[ Http::UNAUTHORISED ],
58
-          [Language::getMessage( "general.unauthenticated" )],
57
+          Http::$Codes[Http::UNAUTHORISED],
58
+          [Language::getMessage("general.unauthenticated")],
59 59
           (object) [],
60 60
           null
61 61
         );
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
      * @param array $body
68 68
      * @return \Illuminate\Http\JsonResponse
69 69
      */
70
-    public static function failure( $message = 'general.error', $exception=null, $body = [] ){
70
+    public static function failure($message = 'general.error', $exception = null, $body = []) {
71 71
         return self::send(
72
-          Http::$Codes[ Http::BAD_REQUEST ],
73
-          (gettype($message) == "array") ? $message : [ Language::getMessage( $message ) ],
72
+          Http::$Codes[Http::BAD_REQUEST],
73
+          (gettype($message) == "array") ? $message : [Language::getMessage($message)],
74 74
           (object) $body,
75 75
           $exception
76 76
         );
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      * @return \Illuminate\Http\JsonResponse
84 84
      */
85 85
 
86
-    public static function exception( $code, $message, $exception=null ){
86
+    public static function exception($code, $message, $exception = null) {
87 87
         return self::send(
88 88
           $code,
89 89
           [$message],
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
      * @param $exception
100 100
      * @return \Illuminate\Http\JsonResponse
101 101
      */
102
-    private static function send( $status, $message, $body, $exception ){
102
+    private static function send($status, $message, $body, $exception) {
103 103
 
104 104
         return response()->json([
105 105
           'status'    =>  $status,
106 106
           'message'   =>  $message,
107 107
           'body'      =>  $body,
108 108
           'exception' =>  $exception
109
-        ], $status, [], JSON_UNESCAPED_UNICODE );
109
+        ], $status, [], JSON_UNESCAPED_UNICODE);
110 110
     }
111 111
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@
 block discarded – undo
31 31
 
32 32
         if( is_array( $validationErrors ) ){
33 33
             $errorMessages = array_values( $validationErrors );
34
-        }
35
-        else
34
+        } else
36 35
         {
37 36
             foreach( $validationErrors->getMessages() as $key => $errors )
38 37
             {
Please login to merge, or discard this patch.
src/Helpers/Constant.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@  discard block
 block discarded – undo
5 5
 class Constant
6 6
 {
7 7
     const HTTP_RESPONSE_STATUSES = [
8
-      'success'             => 200,
9
-      'failed'              => 400,
10
-      'validationError'     => 422,
11
-      'authenticationError' => 401,
12
-      'authorizationError'  => 403,
13
-      'serverError'         => 500,
8
+        'success'             => 200,
9
+        'failed'              => 400,
10
+        'validationError'     => 422,
11
+        'authenticationError' => 401,
12
+        'authorizationError'  => 403,
13
+        'serverError'         => 500,
14 14
     ];
15 15
 
16 16
     const AUTH_SERVER_URL = 'https://api-dev.bsecure.app/';
@@ -20,26 +20,26 @@  discard block
 block discarded – undo
20 20
     const API_VERSION = 'v1';
21 21
 
22 22
     const API_ENDPOINTS = [
23
-      'oauth'               => Constant::API_VERSION . '/oauth/token',
24
-      'create_order' => Constant::API_VERSION . '/order/create',
25
-      'order_status' => Constant::API_VERSION . '/order/status',
26
-      'manual_order_status_update' => Constant::API_VERSION . '/order/update-status',
27
-      'verify_client' => Constant::API_VERSION . '/sso/verify-client',
28
-      'customer_profile' => Constant::API_VERSION . '/sso/customer/profile',
23
+        'oauth'               => Constant::API_VERSION . '/oauth/token',
24
+        'create_order' => Constant::API_VERSION . '/order/create',
25
+        'order_status' => Constant::API_VERSION . '/order/status',
26
+        'manual_order_status_update' => Constant::API_VERSION . '/order/update-status',
27
+        'verify_client' => Constant::API_VERSION . '/sso/verify-client',
28
+        'customer_profile' => Constant::API_VERSION . '/sso/customer/profile',
29 29
     ];
30 30
 
31 31
     const APP_TYPE = [
32
-      'checkout' => 1,
33
-      'sdk' => 2,
32
+        'checkout' => 1,
33
+        'sdk' => 2,
34 34
     ];
35 35
 
36 36
     const OrderStatus = [
37
-      'created'       => 1,
38
-      'initiated'     => 2,
39
-      'placed'        => 3,
40
-      'awaiting-confirmation' => 4,
41
-      'canceled' => 5,
42
-      'expired' => 6,
43
-      'failed' => 7
37
+        'created'       => 1,
38
+        'initiated'     => 2,
39
+        'placed'        => 3,
40
+        'awaiting-confirmation' => 4,
41
+        'canceled' => 5,
42
+        'expired' => 6,
43
+        'failed' => 7
44 44
     ];
45 45
 }
Please login to merge, or discard this patch.
src/Helpers/Http.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
         self::INPROCESSABLE => 422
38 38
     ];
39 39
 
40
-    public static function getApiPossibleCodes(){
41
-        return array_values( self::$Codes );
40
+    public static function getApiPossibleCodes() {
41
+        return array_values(self::$Codes);
42 42
     }
43 43
 
44 44
     public static function getIpDetails($ip)
@@ -49,6 +49,6 @@  discard block
 block discarded – undo
49 49
 
50 50
         $accessKey = env('IPSTACK_API_KEY');
51 51
         $url = env('IPSTACK_URL') . $ip . '?access_key=' . $accessKey;
52
-        return Helper::apiRequest( 'GET',$url);
52
+        return Helper::apiRequest('GET', $url);
53 53
     }
54 54
 }
Please login to merge, or discard this patch.
src/config/config.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@
 block discarded – undo
2 2
 
3 3
 return [
4 4
 
5
-  'client_id' => env('BSECURE_CLIENT_ID', ''),
6
-  'client_secret' => env('BSECURE_CLIENT_SECRET',''),
5
+    'client_id' => env('BSECURE_CLIENT_ID', ''),
6
+    'client_secret' => env('BSECURE_CLIENT_SECRET',''),
7 7
 
8
-  //use 'production' for live orders and 'sandbox' for testing orders. When left empty or `null` the sandbox environment will be used
9
-  'environment' => env('BSECURE_ENVIRONMENT'),
8
+    //use 'production' for live orders and 'sandbox' for testing orders. When left empty or `null` the sandbox environment will be used
9
+    'environment' => env('BSECURE_ENVIRONMENT'),
10 10
 ];
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 return [
4 4
 
5 5
   'client_id' => env('BSECURE_CLIENT_ID', ''),
6
-  'client_secret' => env('BSECURE_CLIENT_SECRET',''),
6
+  'client_secret' => env('BSECURE_CLIENT_SECRET', ''),
7 7
 
8 8
   //use 'production' for live orders and 'sandbox' for testing orders. When left empty or `null` the sandbox environment will be used
9 9
   'environment' => env('BSECURE_ENVIRONMENT'),
Please login to merge, or discard this patch.
src/BsecureSSO.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
     {
18 18
         try {
19 19
             $client = new VerifyClientController();
20
-            $result = $client->verifyClient($state,Constant::APP_TYPE['checkout']);
21
-            return json_decode($result->getContent(),true);
20
+            $result = $client->verifyClient($state, Constant::APP_TYPE['checkout']);
21
+            return json_decode($result->getContent(), true);
22 22
             //code...
23 23
         } catch (\Throwable $th) {
24 24
             throw $th;
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
     {
34 34
         try {
35 35
             $client = new VerifyClientController();
36
-            $result = $client->verifyClient($state,Constant::APP_TYPE['sdk']);
37
-            return json_decode($result->getContent(),true);
36
+            $result = $client->verifyClient($state, Constant::APP_TYPE['sdk']);
37
+            return json_decode($result->getContent(), true);
38 38
             //code...
39 39
         } catch (\Throwable $th) {
40 40
             throw $th;
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         try {
51 51
             $customer = new CustomerVerification();
52 52
             $result = $customer->verifyCustomer($auth_code);
53
-            return json_decode($result->getContent(),true);
53
+            return json_decode($result->getContent(), true);
54 54
             //code...
55 55
         } catch (\Throwable $th) {
56 56
             throw $th;
Please login to merge, or discard this patch.