|
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; |
|
9
|
|
|
|
|
10
|
|
|
use GuzzleHttp\Client; |
|
|
|
|
|
|
11
|
|
|
use GuzzleHttp\ClientInterface; |
|
|
|
|
|
|
12
|
|
|
use Spryker\Zed\Kernel\Business\AbstractBusinessFactory; |
|
|
|
|
|
|
13
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClient; |
|
14
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface; |
|
15
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Converter\CancelConverter; |
|
16
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Converter\CaptureConverter; |
|
17
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Converter\CreateTransactionConverter; |
|
18
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface; |
|
19
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Converter\FinishConverter; |
|
20
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Converter\RefundConverter; |
|
21
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Converter\ReserveConverter; |
|
22
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CancelRequestValidator; |
|
23
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CaptureRequestValidator; |
|
24
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CreateTransactionRequestValidator; |
|
25
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CrefoPayApiRequestValidatorInterface; |
|
26
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\FinishRequestValidator; |
|
27
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\RefundRequestValidator; |
|
28
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\ReserveRequestValidator; |
|
29
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CancelResponseValidator; |
|
30
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CaptureResponseValidator; |
|
31
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CreateTransactionResponseValidator; |
|
32
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CrefoPayApiResponseValidatorInterface; |
|
33
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\FinishResponseValidator; |
|
34
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\RefundResponseValidator; |
|
35
|
|
|
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\ReserveResponseValidator; |
|
36
|
|
|
use SprykerEco\Zed\CrefoPayApi\CrefoPayApiDependencyProvider; |
|
37
|
|
|
use SprykerEco\Zed\CrefoPayApi\Dependency\Service\CrefoPayApiToUtilEncodingServiceInterface; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @method \SprykerEco\Zed\CrefoPayApi\CrefoPayApiConfig getConfig() |
|
41
|
|
|
*/ |
|
42
|
|
|
class CrefoPayApiBusinessFactory extends AbstractBusinessFactory |
|
43
|
|
|
{ |
|
44
|
|
|
/** |
|
45
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface |
|
46
|
|
|
*/ |
|
47
|
|
|
public function createCreateTransactionClient(): CrefoPayApiClientInterface |
|
48
|
|
|
{ |
|
49
|
|
|
return new CrefoPayApiClient( |
|
50
|
|
|
$this->createGuzzleClient() |
|
51
|
|
|
); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface |
|
56
|
|
|
*/ |
|
57
|
|
|
public function createReserveClient(): CrefoPayApiClientInterface |
|
58
|
|
|
{ |
|
59
|
|
|
return new CrefoPayApiClient( |
|
60
|
|
|
$this->createGuzzleClient() |
|
61
|
|
|
); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface |
|
66
|
|
|
*/ |
|
67
|
|
|
public function createCaptureClient(): CrefoPayApiClientInterface |
|
68
|
|
|
{ |
|
69
|
|
|
return new CrefoPayApiClient( |
|
70
|
|
|
$this->createGuzzleClient() |
|
71
|
|
|
); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface |
|
76
|
|
|
*/ |
|
77
|
|
|
public function createCancelClient(): CrefoPayApiClientInterface |
|
78
|
|
|
{ |
|
79
|
|
|
return new CrefoPayApiClient( |
|
80
|
|
|
$this->createGuzzleClient() |
|
81
|
|
|
); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface |
|
86
|
|
|
*/ |
|
87
|
|
|
public function createRefundClient(): CrefoPayApiClientInterface |
|
88
|
|
|
{ |
|
89
|
|
|
return new CrefoPayApiClient( |
|
90
|
|
|
$this->createGuzzleClient() |
|
91
|
|
|
); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface |
|
96
|
|
|
*/ |
|
97
|
|
|
public function createFinishClient(): CrefoPayApiClientInterface |
|
98
|
|
|
{ |
|
99
|
|
|
return new CrefoPayApiClient( |
|
100
|
|
|
$this->createGuzzleClient() |
|
101
|
|
|
); |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @return \GuzzleHttp\ClientInterface |
|
106
|
|
|
*/ |
|
107
|
|
|
public function createGuzzleClient(): ClientInterface |
|
108
|
|
|
{ |
|
109
|
|
|
return new Client(); |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CrefoPayApiRequestValidatorInterface |
|
114
|
|
|
*/ |
|
115
|
|
|
public function createCreateTransactionRequestValidator(): CrefoPayApiRequestValidatorInterface |
|
116
|
|
|
{ |
|
117
|
|
|
return new CreateTransactionRequestValidator(); |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CrefoPayApiRequestValidatorInterface |
|
122
|
|
|
*/ |
|
123
|
|
|
public function createReserveRequestValidator(): CrefoPayApiRequestValidatorInterface |
|
124
|
|
|
{ |
|
125
|
|
|
return new ReserveRequestValidator(); |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CrefoPayApiRequestValidatorInterface |
|
130
|
|
|
*/ |
|
131
|
|
|
public function createCaptureRequestValidator(): CrefoPayApiRequestValidatorInterface |
|
132
|
|
|
{ |
|
133
|
|
|
return new CaptureRequestValidator(); |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
/** |
|
137
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CrefoPayApiRequestValidatorInterface |
|
138
|
|
|
*/ |
|
139
|
|
|
public function createCancelRequestValidator(): CrefoPayApiRequestValidatorInterface |
|
140
|
|
|
{ |
|
141
|
|
|
return new CancelRequestValidator(); |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CrefoPayApiRequestValidatorInterface |
|
146
|
|
|
*/ |
|
147
|
|
|
public function createRefundRequestValidator(): CrefoPayApiRequestValidatorInterface |
|
148
|
|
|
{ |
|
149
|
|
|
return new RefundRequestValidator(); |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CrefoPayApiRequestValidatorInterface |
|
154
|
|
|
*/ |
|
155
|
|
|
public function createFinishRequestValidator(): CrefoPayApiRequestValidatorInterface |
|
156
|
|
|
{ |
|
157
|
|
|
return new FinishRequestValidator(); |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface |
|
162
|
|
|
*/ |
|
163
|
|
|
public function createCreateTransactionConverter(): CrefoPayApiConverterInterface |
|
164
|
|
|
{ |
|
165
|
|
|
return new CreateTransactionConverter( |
|
166
|
|
|
$this->createCreateTransactionResponseValidator(), |
|
167
|
|
|
$this->getUtilEncodingService() |
|
168
|
|
|
); |
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
/** |
|
172
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface |
|
173
|
|
|
*/ |
|
174
|
|
|
public function createReserveConverter(): CrefoPayApiConverterInterface |
|
175
|
|
|
{ |
|
176
|
|
|
return new ReserveConverter( |
|
177
|
|
|
$this->createReserveResponseValidator(), |
|
178
|
|
|
$this->getUtilEncodingService() |
|
179
|
|
|
); |
|
180
|
|
|
} |
|
181
|
|
|
|
|
182
|
|
|
/** |
|
183
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface |
|
184
|
|
|
*/ |
|
185
|
|
|
public function createCaptureConverter(): CrefoPayApiConverterInterface |
|
186
|
|
|
{ |
|
187
|
|
|
return new CaptureConverter( |
|
188
|
|
|
$this->createCaptureResponseValidator(), |
|
189
|
|
|
$this->getUtilEncodingService() |
|
190
|
|
|
); |
|
191
|
|
|
} |
|
192
|
|
|
|
|
193
|
|
|
/** |
|
194
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface |
|
195
|
|
|
*/ |
|
196
|
|
|
public function createCancelConverter(): CrefoPayApiConverterInterface |
|
197
|
|
|
{ |
|
198
|
|
|
return new CancelConverter( |
|
199
|
|
|
$this->createCancelResponseValidator(), |
|
200
|
|
|
$this->getUtilEncodingService() |
|
201
|
|
|
); |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
|
|
/** |
|
205
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface |
|
206
|
|
|
*/ |
|
207
|
|
|
public function createRefundConverter(): CrefoPayApiConverterInterface |
|
208
|
|
|
{ |
|
209
|
|
|
return new RefundConverter( |
|
210
|
|
|
$this->createRefundResponseValidator(), |
|
211
|
|
|
$this->getUtilEncodingService() |
|
212
|
|
|
); |
|
213
|
|
|
} |
|
214
|
|
|
|
|
215
|
|
|
/** |
|
216
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface |
|
217
|
|
|
*/ |
|
218
|
|
|
public function createFinishConverter(): CrefoPayApiConverterInterface |
|
219
|
|
|
{ |
|
220
|
|
|
return new FinishConverter( |
|
221
|
|
|
$this->createFinishResponseValidator(), |
|
222
|
|
|
$this->getUtilEncodingService() |
|
223
|
|
|
); |
|
224
|
|
|
} |
|
225
|
|
|
|
|
226
|
|
|
/** |
|
227
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CrefoPayApiResponseValidatorInterface |
|
228
|
|
|
*/ |
|
229
|
|
|
public function createCreateTransactionResponseValidator(): CrefoPayApiResponseValidatorInterface |
|
230
|
|
|
{ |
|
231
|
|
|
return new CreateTransactionResponseValidator(); |
|
232
|
|
|
} |
|
233
|
|
|
|
|
234
|
|
|
/** |
|
235
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CrefoPayApiResponseValidatorInterface |
|
236
|
|
|
*/ |
|
237
|
|
|
public function createReserveResponseValidator(): CrefoPayApiResponseValidatorInterface |
|
238
|
|
|
{ |
|
239
|
|
|
return new ReserveResponseValidator(); |
|
240
|
|
|
} |
|
241
|
|
|
|
|
242
|
|
|
/** |
|
243
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CrefoPayApiResponseValidatorInterface |
|
244
|
|
|
*/ |
|
245
|
|
|
public function createCaptureResponseValidator(): CrefoPayApiResponseValidatorInterface |
|
246
|
|
|
{ |
|
247
|
|
|
return new CaptureResponseValidator(); |
|
248
|
|
|
} |
|
249
|
|
|
|
|
250
|
|
|
/** |
|
251
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CrefoPayApiResponseValidatorInterface |
|
252
|
|
|
*/ |
|
253
|
|
|
public function createCancelResponseValidator(): CrefoPayApiResponseValidatorInterface |
|
254
|
|
|
{ |
|
255
|
|
|
return new CancelResponseValidator(); |
|
256
|
|
|
} |
|
257
|
|
|
|
|
258
|
|
|
/** |
|
259
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CrefoPayApiResponseValidatorInterface |
|
260
|
|
|
*/ |
|
261
|
|
|
public function createRefundResponseValidator(): CrefoPayApiResponseValidatorInterface |
|
262
|
|
|
{ |
|
263
|
|
|
return new RefundResponseValidator(); |
|
264
|
|
|
} |
|
265
|
|
|
|
|
266
|
|
|
/** |
|
267
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CrefoPayApiResponseValidatorInterface |
|
268
|
|
|
*/ |
|
269
|
|
|
public function createFinishResponseValidator(): CrefoPayApiResponseValidatorInterface |
|
270
|
|
|
{ |
|
271
|
|
|
return new FinishResponseValidator(); |
|
272
|
|
|
} |
|
273
|
|
|
|
|
274
|
|
|
/** |
|
275
|
|
|
* @return \SprykerEco\Zed\CrefoPayApi\Dependency\Service\CrefoPayApiToUtilEncodingServiceInterface |
|
276
|
|
|
*/ |
|
277
|
|
|
public function getUtilEncodingService(): CrefoPayApiToUtilEncodingServiceInterface |
|
278
|
|
|
{ |
|
279
|
|
|
return $this->getProvidedDependency(CrefoPayApiDependencyProvider::SERVICE_UTIL_ENCODING); |
|
280
|
|
|
} |
|
281
|
|
|
} |
|
282
|
|
|
|
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