1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* MIT License |
5
|
|
|
* For full license information, please view the LICENSE file that was distributed with this source code. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\CrefoPayApi\Business\Client; |
9
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\CrefoPayApiRequestTransfer; |
|
|
|
|
11
|
|
|
use Generated\Shared\Transfer\CrefoPayApiResponseTransfer; |
|
|
|
|
12
|
|
|
use GuzzleHttp\ClientInterface; |
|
|
|
|
13
|
|
|
use GuzzleHttp\Exception\RequestException; |
|
|
|
|
14
|
|
|
use Spryker\Shared\Kernel\Transfer\Exception\RequiredTransferPropertyException; |
|
|
|
|
15
|
|
|
|
16
|
|
|
class CrefoPayApiClient implements CrefoPayApiClientInterface |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* @var \GuzzleHttp\ClientInterface |
20
|
|
|
*/ |
21
|
|
|
protected $client; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var \SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface |
25
|
|
|
*/ |
26
|
|
|
protected $request; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface |
30
|
|
|
*/ |
31
|
|
|
protected $converter; |
32
|
|
|
|
33
|
|
|
public function __construct( |
34
|
|
|
ClientInterface $client |
35
|
|
|
) { |
36
|
|
|
$this->client = $client; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @param \Generated\Shared\Transfer\CrefoPayApiRequestTransfer $requestTransfer |
41
|
|
|
* |
42
|
|
|
* @return \Generated\Shared\Transfer\CrefoPayApiResponseTransfer |
43
|
|
|
*/ |
44
|
|
|
public function performRequest(CrefoPayApiRequestTransfer $requestTransfer): CrefoPayApiResponseTransfer |
45
|
|
|
{ |
46
|
|
|
$method = $this->getMethod(); |
47
|
|
|
|
48
|
|
|
try { |
49
|
|
|
/** @var \Psr\Http\Message\ResponseInterface $response */ |
50
|
|
|
$response = $this->client->$method( |
51
|
|
|
$this->request->getUrl(), |
52
|
|
|
$this->request->getRequestOptions($requestTransfer) |
53
|
|
|
); |
54
|
|
|
|
55
|
|
|
return $this->converter->convertToResponseTransfer($response); |
56
|
|
|
|
57
|
|
|
} catch (RequestException $requestException) { |
58
|
|
|
$response = $requestException->getResponse(); |
|
|
|
|
59
|
|
|
return; |
|
|
|
|
60
|
|
|
} catch (RequiredTransferPropertyException $requiredTransferPropertyException) { |
61
|
|
|
return; |
|
|
|
|
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @return string |
67
|
|
|
*/ |
68
|
|
|
protected function getMethod(): string |
69
|
|
|
{ |
70
|
|
|
return strtolower($this->request->getHttpMethod()); |
71
|
|
|
} |
72
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths