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\AdyenApi\Business\Request; |
9
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\AdyenApiRequestTransfer; |
|
|
|
|
11
|
|
|
use Generated\Shared\Transfer\AdyenApiResponseTransfer; |
|
|
|
|
12
|
|
|
use GuzzleHttp\Exception\RequestException; |
13
|
|
|
use SprykerEco\Zed\AdyenApi\AdyenApiConfig; |
14
|
|
|
use SprykerEco\Zed\AdyenApi\Business\Adapter\AdyenApiAdapterInterface; |
15
|
|
|
use SprykerEco\Zed\AdyenApi\Business\Converter\AdyenApiConverterInterface; |
16
|
|
|
use SprykerEco\Zed\AdyenApi\Business\Mapper\AdyenApiMapperInterface; |
17
|
|
|
|
18
|
|
|
class AdyenApiRequest implements AdyenApiRequestInterface |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* @var \SprykerEco\Zed\AdyenApi\Business\Adapter\AdyenApiAdapterInterface |
22
|
|
|
*/ |
23
|
|
|
protected $adapter; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var \SprykerEco\Zed\AdyenApi\Business\Converter\AdyenApiConverterInterface |
27
|
|
|
*/ |
28
|
|
|
protected $converter; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var \SprykerEco\Zed\AdyenApi\Business\Mapper\AdyenApiMapperInterface |
32
|
|
|
*/ |
33
|
|
|
protected $mapper; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var \SprykerEco\Zed\AdyenApi\AdyenApiConfig |
37
|
|
|
*/ |
38
|
|
|
protected $config; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var string |
42
|
|
|
*/ |
43
|
|
|
protected $method; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @param \SprykerEco\Zed\AdyenApi\Business\Adapter\AdyenApiAdapterInterface $adapter |
47
|
|
|
* @param \SprykerEco\Zed\AdyenApi\Business\Converter\AdyenApiConverterInterface $converter |
48
|
|
|
* @param \SprykerEco\Zed\AdyenApi\Business\Mapper\AdyenApiMapperInterface $mapper |
49
|
|
|
* @param \SprykerEco\Zed\AdyenApi\AdyenApiConfig $config |
50
|
|
|
*/ |
51
|
|
|
public function __construct( |
52
|
|
|
AdyenApiAdapterInterface $adapter, |
53
|
|
|
AdyenApiConverterInterface $converter, |
54
|
|
|
AdyenApiMapperInterface $mapper, |
55
|
|
|
AdyenApiConfig $config |
56
|
|
|
) { |
57
|
|
|
$this->adapter = $adapter; |
58
|
|
|
$this->converter = $converter; |
59
|
|
|
$this->mapper = $mapper; |
60
|
|
|
$this->config = $config; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @param \Generated\Shared\Transfer\AdyenApiRequestTransfer $requestTransfer |
65
|
|
|
* |
66
|
|
|
* @return \Generated\Shared\Transfer\AdyenApiResponseTransfer |
67
|
|
|
*/ |
68
|
|
|
public function request(AdyenApiRequestTransfer $requestTransfer): AdyenApiResponseTransfer |
69
|
|
|
{ |
70
|
|
|
$requestData = $this->mapper->buildRequestArray($requestTransfer); |
71
|
|
|
$isSuccess = true; |
72
|
|
|
|
73
|
|
|
try { |
74
|
|
|
$response = $this->adapter->sendRequest($requestData); |
75
|
|
|
} catch (RequestException $requestException) { |
76
|
|
|
$response = $requestException->getResponse(); |
77
|
|
|
$isSuccess = false; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
return $this->converter->convertToResponseTransfer($response, $isSuccess); |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|
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