Test Setup Failed
Push — master ( 496caf...c61b50 )
by payever
01:44
created
lib/Payever/ExternalIntegration/Core/CommonApiClient.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     const SUB_URL_LIST_CHANNEL_SETS = 'api/shop/oauth/%s/channel-sets';
48 48
     const SUB_URL_CURRENCY          = 'api/rest/v1/currency';
49 49
 
50
-	const FORBIDDEN_ERROR_CODE = 403;
50
+    const FORBIDDEN_ERROR_CODE = 403;
51 51
 
52 52
     /**
53 53
      * Stores oAuth Authentication Tokens
@@ -370,31 +370,31 @@  discard block
 block discarded – undo
370 370
         return $this->getHttpClient()->execute($request);
371 371
     }
372 372
 
373
-	/**
374
-	 * @param Request $request
375
-	 * @param string $scope
376
-	 *
377
-	 * @return \Payever\ExternalIntegration\Core\Http\Response
378
-	 * @throws \Exception
379
-	 */
380
-	protected function executeRequest($request, $scope = OauthToken::SCOPE_PAYMENT_ACTIONS)
381
-	{
382
-		try {
383
-			return $this->getHttpClient()->execute($request);
384
-		} catch (\Exception $exception) {
385
-			if ($exception->getCode() === self::FORBIDDEN_ERROR_CODE) {
386
-				$this->getTokens()->clear()->save();
387
-
388
-				$newToken = $this->getToken($scope)->getAuthorizationString();
389
-				$pieces = explode(':', $newToken, 2);
390
-				$request->addHeader($pieces[0], $pieces[1]);
391
-
392
-				return $this->getHttpClient()->execute($request);
393
-			}
394
-
395
-			throw $exception;
396
-		}
397
-	}
373
+    /**
374
+     * @param Request $request
375
+     * @param string $scope
376
+     *
377
+     * @return \Payever\ExternalIntegration\Core\Http\Response
378
+     * @throws \Exception
379
+     */
380
+    protected function executeRequest($request, $scope = OauthToken::SCOPE_PAYMENT_ACTIONS)
381
+    {
382
+        try {
383
+            return $this->getHttpClient()->execute($request);
384
+        } catch (\Exception $exception) {
385
+            if ($exception->getCode() === self::FORBIDDEN_ERROR_CODE) {
386
+                $this->getTokens()->clear()->save();
387
+
388
+                $newToken = $this->getToken($scope)->getAuthorizationString();
389
+                $pieces = explode(':', $newToken, 2);
390
+                $request->addHeader($pieces[0], $pieces[1]);
391
+
392
+                return $this->getHttpClient()->execute($request);
393
+            }
394
+
395
+            throw $exception;
396
+        }
397
+    }
398 398
 
399 399
     /**
400 400
      * Returns URL for Authentication path
Please login to merge, or discard this patch.
lib/Payever/ExternalIntegration/Payments/PaymentsApiClient.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             ->setResponseEntity(new RetrievePaymentResponse())
114 114
             ->build();
115 115
 
116
-	    return $this->executeRequest($request, OauthToken::SCOPE_CREATE_PAYMENT);
116
+        return $this->executeRequest($request, OauthToken::SCOPE_CREATE_PAYMENT);
117 117
     }
118 118
 
119 119
     /**
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             ->setResponseEntity(new RetrievePaymentResponse())
133 133
             ->build();
134 134
 
135
-	    return $this->executeRequest($request, OauthToken::SCOPE_PAYMENT_INFO);
135
+        return $this->executeRequest($request, OauthToken::SCOPE_PAYMENT_INFO);
136 136
     }
137 137
 
138 138
     /**
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             ->setResponseEntity(new ListPaymentsResponse())
153 153
             ->build();
154 154
 
155
-	    return $this->executeRequest($request);
155
+        return $this->executeRequest($request);
156 156
     }
157 157
 
158 158
     /**
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
             ->setResponseEntity(new RefundPaymentResponse())
176 176
             ->build();
177 177
 
178
-	    return $this->executeRequest($request);
178
+        return $this->executeRequest($request);
179 179
     }
180 180
 
181 181
     /**
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
             ->setResponseEntity(new RefundPaymentResponse())
200 200
             ->build();
201 201
 
202
-	    return $this->executeRequest($request);
202
+        return $this->executeRequest($request);
203 203
     }
204 204
 
205 205
     /**
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
             ->setResponseEntity(new AuthorizePaymentResponse())
220 220
             ->build();
221 221
 
222
-	    return $this->executeRequest($request);
222
+        return $this->executeRequest($request);
223 223
     }
224 224
 
225 225
     /**
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
             ->setResponseEntity(new RemindPaymentResponse())
241 241
             ->build();
242 242
 
243
-	    return $this->executeRequest($request);
243
+        return $this->executeRequest($request);
244 244
     }
245 245
 
246 246
     /**
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
             ->setResponseEntity(new CollectPaymentsResponse())
262 262
             ->build();
263 263
 
264
-	    return $this->executeRequest($request);
264
+        return $this->executeRequest($request);
265 265
     }
266 266
 
267 267
     /**
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
             ->setResponseEntity(new LatePaymentsResponse())
283 283
             ->build();
284 284
 
285
-	    return $this->executeRequest($request);
285
+        return $this->executeRequest($request);
286 286
     }
287 287
 
288 288
     /**
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
             ->setResponseEntity(new ShippingGoodsPaymentResponse())
305 305
             ->build();
306 306
 
307
-	    return $this->executeRequest($request);
307
+        return $this->executeRequest($request);
308 308
     }
309 309
 
310 310
     /**
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
             ->setResponseEntity(new CancelPaymentResponse())
324 324
             ->build();
325 325
 
326
-	    return $this->executeRequest($request);
326
+        return $this->executeRequest($request);
327 327
     }
328 328
 
329 329
     /**
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
             ->setResponseEntity(new RetrieveApiCallResponse())
343 343
             ->build();
344 344
 
345
-	    return $this->executeRequest($request);
345
+        return $this->executeRequest($request);
346 346
     }
347 347
 
348 348
     /**
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
             ->setResponseEntity(new ListPaymentOptionsResponse())
363 363
             ->build();
364 364
 
365
-	    return $this->executeRequest($request, OauthToken::SCOPE_PAYMENT_INFO);
365
+        return $this->executeRequest($request, OauthToken::SCOPE_PAYMENT_INFO);
366 366
     }
367 367
 
368 368
     /**
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
             ->setResponseEntity(new ListPaymentOptionsWithVariantsResponse())
383 383
             ->build();
384 384
 
385
-	    return $this->executeRequest($request, OauthToken::SCOPE_PAYMENT_INFO);
385
+        return $this->executeRequest($request, OauthToken::SCOPE_PAYMENT_INFO);
386 386
     }
387 387
 
388 388
     /**
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
             ->setResponseEntity(new GetTransactionResponse())
402 402
             ->build();
403 403
 
404
-	    return $this->executeRequest($request);
404
+        return $this->executeRequest($request);
405 405
     }
406 406
 
407 407
     /**
Please login to merge, or discard this patch.