1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* MIT License |
5
|
|
|
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace SprykerEco\Client\Payone; |
9
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\PayoneStandardParameterTransfer; |
|
|
|
|
11
|
|
|
use Spryker\Client\Kernel\AbstractFactory; |
12
|
|
|
use Spryker\Shared\Config\Config; |
13
|
|
|
use SprykerEco\Client\Payone\ClientApi\Call\CreditCardCheck; |
14
|
|
|
use SprykerEco\Client\Payone\ClientApi\Call\CreditCardCheckInterface; |
15
|
|
|
use SprykerEco\Client\Payone\ClientApi\HashGenerator; |
16
|
|
|
use SprykerEco\Client\Payone\ClientApi\HashGeneratorInterface; |
17
|
|
|
use SprykerEco\Client\Payone\ClientApi\HashProvider; |
18
|
|
|
use SprykerEco\Client\Payone\Dependency\Client\PayoneToUtilEncodingServiceInterface; |
19
|
|
|
use SprykerEco\Client\Payone\Zed\PayoneStub; |
20
|
|
|
use SprykerEco\Client\Payone\Zed\PayoneStubInterface; |
21
|
|
|
use SprykerEco\Shared\Payone\Dependency\HashInterface; |
22
|
|
|
use SprykerEco\Shared\Payone\Dependency\ModeDetectorInterface; |
23
|
|
|
use SprykerEco\Shared\Payone\PayoneApiConstants; |
24
|
|
|
use SprykerEco\Shared\Payone\PayoneConstants; |
25
|
|
|
use SprykerEco\Zed\Payone\Business\Mode\ModeDetector; |
26
|
|
|
use SprykerEco\Zed\Payone\PayoneConfig; |
27
|
|
|
|
28
|
|
|
class PayoneFactory extends AbstractFactory |
29
|
|
|
{ |
30
|
|
|
/** |
31
|
|
|
* @param array $defaults |
32
|
|
|
* |
33
|
|
|
* @return \SprykerEco\Client\Payone\ClientApi\Call\CreditCardCheckInterface |
34
|
|
|
*/ |
35
|
|
|
public function createCreditCardCheckCall(array $defaults): CreditCardCheckInterface |
36
|
|
|
{ |
37
|
|
|
return new CreditCardCheck( |
38
|
|
|
$this->createStandardParameter($defaults), |
39
|
|
|
$this->createHashGenerator(), |
40
|
|
|
$this->createModeDetector(), |
41
|
|
|
$this->getUtilEncodingService(), |
42
|
|
|
); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @return \SprykerEco\Shared\Payone\Dependency\HashInterface |
47
|
|
|
*/ |
48
|
|
|
protected function createHashProvider(): HashInterface |
49
|
|
|
{ |
50
|
|
|
return new HashProvider(); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @return \SprykerEco\Shared\Payone\Dependency\ModeDetectorInterface |
55
|
|
|
*/ |
56
|
|
|
protected function createModeDetector(): ModeDetectorInterface |
57
|
|
|
{ |
58
|
|
|
return new ModeDetector($this->createBundleConfig()); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @return \SprykerEco\Zed\Payone\PayoneConfig |
63
|
|
|
*/ |
64
|
|
|
protected function createBundleConfig(): PayoneConfig |
65
|
|
|
{ |
66
|
|
|
return new PayoneConfig(); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @return \SprykerEco\Client\Payone\ClientApi\HashGeneratorInterface |
71
|
|
|
*/ |
72
|
|
|
protected function createHashGenerator(): HashGeneratorInterface |
73
|
|
|
{ |
74
|
|
|
return new HashGenerator( |
75
|
|
|
$this->createHashProvider(), |
76
|
|
|
); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @param array $defaults |
81
|
|
|
* |
82
|
|
|
* @return \Generated\Shared\Transfer\PayoneStandardParameterTransfer |
83
|
|
|
*/ |
84
|
|
|
protected function createStandardParameter(array $defaults): PayoneStandardParameterTransfer |
85
|
|
|
{ |
86
|
|
|
$standardParameterTransfer = new PayoneStandardParameterTransfer(); |
87
|
|
|
$standardParameterTransfer->fromArray($defaults); |
88
|
|
|
|
89
|
|
|
$payoneConfig = Config::get(PayoneConstants::PAYONE); |
90
|
|
|
$standardParameterTransfer->setAid($payoneConfig[PayoneConstants::PAYONE_CREDENTIALS_AID]); |
91
|
|
|
$standardParameterTransfer->setMid($payoneConfig[PayoneConstants::PAYONE_CREDENTIALS_MID]); |
92
|
|
|
$standardParameterTransfer->setPortalId($payoneConfig[PayoneConstants::PAYONE_CREDENTIALS_PORTAL_ID]); |
93
|
|
|
$standardParameterTransfer->setKey($payoneConfig[PayoneConstants::PAYONE_CREDENTIALS_KEY]); |
94
|
|
|
$standardParameterTransfer->setEncoding($payoneConfig[PayoneConstants::PAYONE_CREDENTIALS_ENCODING]); |
95
|
|
|
$standardParameterTransfer->setResponseType(PayoneApiConstants::RESPONSE_TYPE_JSON); |
96
|
|
|
|
97
|
|
|
return $standardParameterTransfer; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @return \SprykerEco\Client\Payone\Zed\PayoneStubInterface |
102
|
|
|
*/ |
103
|
|
|
public function createZedStub(): PayoneStubInterface |
104
|
|
|
{ |
105
|
|
|
$zedStub = $this->getProvidedDependency(PayoneDependencyProvider::CLIENT_ZED_REQUEST); |
106
|
|
|
|
107
|
|
|
return new PayoneStub($zedStub); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @return \SprykerEco\Client\Payone\Dependency\Client\PayoneToUtilEncodingServiceInterface |
112
|
|
|
*/ |
113
|
|
|
public function getUtilEncodingService(): PayoneToUtilEncodingServiceInterface |
114
|
|
|
{ |
115
|
|
|
return $this->getProvidedDependency(PayoneDependencyProvider::SERVICE_UTIL_ENCODING); |
116
|
|
|
} |
117
|
|
|
} |
118
|
|
|
|
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