|
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\Request; |
|
9
|
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\CrefoPayApiRequestTransfer; |
|
|
|
|
|
|
11
|
|
|
use GuzzleHttp\RequestOptions; |
|
|
|
|
|
|
12
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface; |
|
13
|
|
|
use SprykerEco\Zed\CrefoPayApi\CrefoPayApiConfig; |
|
14
|
|
|
|
|
15
|
|
|
abstract class AbstractRequest implements CrefoPayApiRequestInterface |
|
16
|
|
|
{ |
|
17
|
|
|
protected const DEFAULT_TIMEOUT = 45; |
|
18
|
|
|
protected const HEADER_CONTENT_TYPE_KEY = 'Content-Type'; |
|
19
|
|
|
protected const HEADER_CONTENT_TYPE_VALUE = 'application/x-www-form-urlencoded'; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @var \SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface |
|
23
|
|
|
*/ |
|
24
|
|
|
protected $requestBuilder; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @var \SprykerEco\Zed\CrefoPayApi\CrefoPayApiConfig |
|
28
|
|
|
*/ |
|
29
|
|
|
protected $config; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @param \SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface $requestBuilder |
|
33
|
|
|
* @param \SprykerEco\Zed\CrefoPayApi\CrefoPayApiConfig $config |
|
34
|
|
|
*/ |
|
35
|
|
|
public function __construct( |
|
36
|
|
|
CrefoPayApiRequestBuilderInterface $requestBuilder, |
|
37
|
|
|
CrefoPayApiConfig $config |
|
38
|
|
|
) { |
|
39
|
|
|
$this->requestBuilder = $requestBuilder; |
|
40
|
|
|
$this->config = $config; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @param \Generated\Shared\Transfer\CrefoPayApiRequestTransfer $requestTransfer |
|
45
|
|
|
* |
|
46
|
|
|
* @return array |
|
47
|
|
|
*/ |
|
48
|
|
|
public function getRequestOptions(CrefoPayApiRequestTransfer $requestTransfer): array |
|
49
|
|
|
{ |
|
50
|
|
|
return [ |
|
51
|
|
|
RequestOptions::TIMEOUT => static::DEFAULT_TIMEOUT, |
|
52
|
|
|
RequestOptions::HEADERS => $this->getHeaders(), |
|
53
|
|
|
RequestOptions::FORM_PARAMS => $this->getFormParams($requestTransfer), |
|
54
|
|
|
]; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @return string[] |
|
59
|
|
|
*/ |
|
60
|
|
|
protected function getHeaders(): array |
|
61
|
|
|
{ |
|
62
|
|
|
return [ |
|
63
|
|
|
static::HEADER_CONTENT_TYPE_KEY => static::HEADER_CONTENT_TYPE_VALUE, |
|
64
|
|
|
]; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @param \Generated\Shared\Transfer\CrefoPayApiRequestTransfer $requestTransfer |
|
69
|
|
|
* |
|
70
|
|
|
* @return array |
|
71
|
|
|
*/ |
|
72
|
|
|
protected function getFormParams(CrefoPayApiRequestTransfer $requestTransfer): array |
|
73
|
|
|
{ |
|
74
|
|
|
return $this->requestBuilder->buildRequestPayload($requestTransfer); |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
|
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