Passed
Push — feature/eco-2295/eco-2344-crea... ( cd4fd8...13938b )
by Aleksey
01:14
created

getCrefoPayApiService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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;
0 ignored issues
show
Bug introduced by
The type GuzzleHttp\Client was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use GuzzleHttp\ClientInterface;
0 ignored issues
show
Bug introduced by
The type GuzzleHttp\ClientInterface was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Spryker\Zed\Kernel\Business\AbstractBusinessFactory;
0 ignored issues
show
Bug introduced by
The type Spryker\Zed\Kernel\Busin...AbstractBusinessFactory was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use SprykerEco\Service\CrefoPayApi\CrefoPayApiServiceInterface;
14
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CancelRequestBuilder;
15
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CaptureRequestBuilder;
16
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CreateTransactionRequestBuilder;
17
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface;
18
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\FinishRequestBuilder;
19
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\RefundRequestBuilder;
20
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\ReserveRequestBuilder;
21
use SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClient;
22
use SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface;
23
use SprykerEco\Zed\CrefoPayApi\Business\Converter\CancelConverter;
24
use SprykerEco\Zed\CrefoPayApi\Business\Converter\CaptureConverter;
25
use SprykerEco\Zed\CrefoPayApi\Business\Converter\CreateTransactionConverter;
26
use SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface;
27
use SprykerEco\Zed\CrefoPayApi\Business\Converter\FinishConverter;
28
use SprykerEco\Zed\CrefoPayApi\Business\Converter\RefundConverter;
29
use SprykerEco\Zed\CrefoPayApi\Business\Converter\ReserveConverter;
30
use SprykerEco\Zed\CrefoPayApi\Business\Request\CancelRequest;
31
use SprykerEco\Zed\CrefoPayApi\Business\Request\CaptureRequest;
32
use SprykerEco\Zed\CrefoPayApi\Business\Request\CreateTransactionRequest;
33
use SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface;
34
use SprykerEco\Zed\CrefoPayApi\Business\Request\FinishRequest;
35
use SprykerEco\Zed\CrefoPayApi\Business\Request\RefundRequest;
36
use SprykerEco\Zed\CrefoPayApi\Business\Request\ReserveRequest;
37
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CancelRequestValidator;
38
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CaptureRequestValidator;
39
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CreateTransactionRequestValidator;
40
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CrefoPayApiRequestValidatorInterface;
41
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\FinishRequestValidator;
42
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\RefundRequestValidator;
43
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\ReserveRequestValidator;
44
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CancelResponseValidator;
45
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CaptureResponseValidator;
46
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CreateTransactionResponseValidator;
47
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CrefoPayApiResponseValidatorInterface;
48
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\FinishResponseValidator;
49
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\RefundResponseValidator;
50
use SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\ReserveResponseValidator;
51
use SprykerEco\Zed\CrefoPayApi\CrefoPayApiDependencyProvider;
52
use SprykerEco\Zed\CrefoPayApi\Dependency\Service\CrefoPayApiToUtilEncodingServiceInterface;
53
54
/**
55
 * @method \SprykerEco\Zed\CrefoPayApi\CrefoPayApiConfig getConfig()
56
 */
57
class CrefoPayApiBusinessFactory extends AbstractBusinessFactory
58
{
59
    /**
60
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
61
     */
62
    public function createCreateTransactionClient(): CrefoPayApiClientInterface
63
    {
64
        return new CrefoPayApiClient(
65
            $this->createGuzzleClient(),
66
            $this->createCreateTransactionRequest(),
67
            $this->createCreateTransactionConverter()
68
        );
69
    }
70
71
    /**
72
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
73
     */
74
    public function createReserveClient(): CrefoPayApiClientInterface
75
    {
76
        return new CrefoPayApiClient(
77
            $this->createGuzzleClient(),
78
            $this->createReserveRequest(),
79
            $this->createReserveConverter()
80
        );
81
    }
82
83
    /**
84
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
85
     */
86
    public function createCaptureClient(): CrefoPayApiClientInterface
87
    {
88
        return new CrefoPayApiClient(
89
            $this->createGuzzleClient(),
90
            $this->createCaptureRequest(),
91
            $this->createCancelConverter()
92
        );
93
    }
94
95
    /**
96
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
97
     */
98
    public function createCancelClient(): CrefoPayApiClientInterface
99
    {
100
        return new CrefoPayApiClient(
101
            $this->createGuzzleClient(),
102
            $this->createCancelRequest(),
103
            $this->createCancelConverter()
104
        );
105
    }
106
107
    /**
108
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
109
     */
110
    public function createRefundClient(): CrefoPayApiClientInterface
111
    {
112
        return new CrefoPayApiClient(
113
            $this->createGuzzleClient(),
114
            $this->createRefundRequest(),
115
            $this->createRefundConverter()
116
        );
117
    }
118
119
    /**
120
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
121
     */
122
    public function createFinishClient(): CrefoPayApiClientInterface
123
    {
124
        return new CrefoPayApiClient(
125
            $this->createGuzzleClient(),
126
            $this->createFinishRequest(),
127
            $this->createFinishConverter()
128
        );
129
    }
130
131
    /**
132
     * @return \GuzzleHttp\ClientInterface
133
     */
134
    public function createGuzzleClient(): ClientInterface
135
    {
136
        return new Client();
137
    }
138
139
    /**
140
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface
141
     */
142
    public function createCreateTransactionRequest(): CrefoPayApiRequestInterface
143
    {
144
        return new CreateTransactionRequest(
145
            $this->createCreateTransactionRequestBuilder(),
146
            $this->getConfig()
147
        );
148
    }
149
150
    /**
151
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface
152
     */
153
    public function createReserveRequest(): CrefoPayApiRequestInterface
154
    {
155
        return new ReserveRequest(
156
            $this->createReserveRequestBuilder(),
157
            $this->getConfig()
158
        );
159
    }
160
161
    /**
162
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface
163
     */
164
    public function createCaptureRequest(): CrefoPayApiRequestInterface
165
    {
166
        return new CaptureRequest(
167
            $this->createCaptureRequestBuilder(),
168
            $this->getConfig()
169
        );
170
    }
171
172
    /**
173
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface
174
     */
175
    public function createCancelRequest(): CrefoPayApiRequestInterface
176
    {
177
        return new CancelRequest(
178
            $this->createCancelRequestBuilder(),
179
            $this->getConfig()
180
        );
181
    }
182
183
    /**
184
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface
185
     */
186
    public function createRefundRequest(): CrefoPayApiRequestInterface
187
    {
188
        return new RefundRequest(
189
            $this->createRefundRequestBuilder(),
190
            $this->getConfig()
191
        );
192
    }
193
194
    /**
195
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface
196
     */
197
    public function createFinishRequest(): CrefoPayApiRequestInterface
198
    {
199
        return new FinishRequest(
200
            $this->createFinishRequestBuilder(),
201
            $this->getConfig()
202
        );
203
    }
204
205
    /**
206
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface
207
     */
208
    public function createCreateTransactionRequestBuilder(): CrefoPayApiRequestBuilderInterface
209
    {
210
        return new CreateTransactionRequestBuilder(
211
            $this->createCreateTransactionRequestValidator(),
212
            $this->getUtilEncodingService(),
213
            $this->getCrefoPayApiService()
214
        );
215
    }
216
217
    /**
218
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface
219
     */
220
    public function createReserveRequestBuilder(): CrefoPayApiRequestBuilderInterface
221
    {
222
        return new ReserveRequestBuilder(
223
            $this->createReserveRequestValidator(),
224
            $this->getUtilEncodingService(),
225
            $this->getCrefoPayApiService()
226
        );
227
    }
228
229
    /**
230
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface
231
     */
232
    public function createCaptureRequestBuilder(): CrefoPayApiRequestBuilderInterface
233
    {
234
        return new CaptureRequestBuilder(
235
            $this->createCaptureRequestValidator(),
236
            $this->getUtilEncodingService(),
237
            $this->getCrefoPayApiService()
238
        );
239
    }
240
241
    /**
242
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface
243
     */
244
    public function createCancelRequestBuilder(): CrefoPayApiRequestBuilderInterface
245
    {
246
        return new CancelRequestBuilder(
247
            $this->createCancelRequestValidator(),
248
            $this->getUtilEncodingService(),
249
            $this->getCrefoPayApiService()
250
        );
251
    }
252
253
    /**
254
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface
255
     */
256
    public function createRefundRequestBuilder(): CrefoPayApiRequestBuilderInterface
257
    {
258
        return new RefundRequestBuilder(
259
            $this->createRefundRequestValidator(),
260
            $this->getUtilEncodingService(),
261
            $this->getCrefoPayApiService()
262
        );
263
    }
264
265
    /**
266
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface
267
     */
268
    public function createFinishRequestBuilder(): CrefoPayApiRequestBuilderInterface
269
    {
270
        return new FinishRequestBuilder(
271
            $this->createFinishRequestValidator(),
272
            $this->getUtilEncodingService(),
273
            $this->getCrefoPayApiService()
274
        );
275
    }
276
277
    /**
278
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CrefoPayApiRequestValidatorInterface
279
     */
280
    public function createCreateTransactionRequestValidator(): CrefoPayApiRequestValidatorInterface
281
    {
282
        return new CreateTransactionRequestValidator();
283
    }
284
285
    /**
286
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CrefoPayApiRequestValidatorInterface
287
     */
288
    public function createReserveRequestValidator(): CrefoPayApiRequestValidatorInterface
289
    {
290
        return new ReserveRequestValidator();
291
    }
292
293
    /**
294
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CrefoPayApiRequestValidatorInterface
295
     */
296
    public function createCaptureRequestValidator(): CrefoPayApiRequestValidatorInterface
297
    {
298
        return new CaptureRequestValidator();
299
    }
300
301
    /**
302
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CrefoPayApiRequestValidatorInterface
303
     */
304
    public function createCancelRequestValidator(): CrefoPayApiRequestValidatorInterface
305
    {
306
        return new CancelRequestValidator();
307
    }
308
309
    /**
310
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CrefoPayApiRequestValidatorInterface
311
     */
312
    public function createRefundRequestValidator(): CrefoPayApiRequestValidatorInterface
313
    {
314
        return new RefundRequestValidator();
315
    }
316
317
    /**
318
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Request\CrefoPayApiRequestValidatorInterface
319
     */
320
    public function createFinishRequestValidator(): CrefoPayApiRequestValidatorInterface
321
    {
322
        return new FinishRequestValidator();
323
    }
324
325
    /**
326
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface
327
     */
328
    public function createCreateTransactionConverter(): CrefoPayApiConverterInterface
329
    {
330
        return new CreateTransactionConverter(
331
            $this->createCreateTransactionResponseValidator(),
332
            $this->getUtilEncodingService()
333
        );
334
    }
335
336
    /**
337
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface
338
     */
339
    public function createReserveConverter(): CrefoPayApiConverterInterface
340
    {
341
        return new ReserveConverter(
342
            $this->createReserveResponseValidator(),
343
            $this->getUtilEncodingService()
344
        );
345
    }
346
347
    /**
348
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface
349
     */
350
    public function createCaptureConverter(): CrefoPayApiConverterInterface
351
    {
352
        return new CaptureConverter(
353
            $this->createCaptureResponseValidator(),
354
            $this->getUtilEncodingService()
355
        );
356
    }
357
358
    /**
359
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface
360
     */
361
    public function createCancelConverter(): CrefoPayApiConverterInterface
362
    {
363
        return new CancelConverter(
364
            $this->createCancelResponseValidator(),
365
            $this->getUtilEncodingService()
366
        );
367
    }
368
369
    /**
370
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface
371
     */
372
    public function createRefundConverter(): CrefoPayApiConverterInterface
373
    {
374
        return new RefundConverter(
375
            $this->createRefundResponseValidator(),
376
            $this->getUtilEncodingService()
377
        );
378
    }
379
380
    /**
381
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface
382
     */
383
    public function createFinishConverter(): CrefoPayApiConverterInterface
384
    {
385
        return new FinishConverter(
386
            $this->createFinishResponseValidator(),
387
            $this->getUtilEncodingService()
388
        );
389
    }
390
391
    /**
392
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CrefoPayApiResponseValidatorInterface
393
     */
394
    public function createCreateTransactionResponseValidator(): CrefoPayApiResponseValidatorInterface
395
    {
396
        return new CreateTransactionResponseValidator();
397
    }
398
399
    /**
400
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CrefoPayApiResponseValidatorInterface
401
     */
402
    public function createReserveResponseValidator(): CrefoPayApiResponseValidatorInterface
403
    {
404
        return new ReserveResponseValidator();
405
    }
406
407
    /**
408
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CrefoPayApiResponseValidatorInterface
409
     */
410
    public function createCaptureResponseValidator(): CrefoPayApiResponseValidatorInterface
411
    {
412
        return new CaptureResponseValidator();
413
    }
414
415
    /**
416
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CrefoPayApiResponseValidatorInterface
417
     */
418
    public function createCancelResponseValidator(): CrefoPayApiResponseValidatorInterface
419
    {
420
        return new CancelResponseValidator();
421
    }
422
423
    /**
424
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CrefoPayApiResponseValidatorInterface
425
     */
426
    public function createRefundResponseValidator(): CrefoPayApiResponseValidatorInterface
427
    {
428
        return new RefundResponseValidator();
429
    }
430
431
    /**
432
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Validator\Response\CrefoPayApiResponseValidatorInterface
433
     */
434
    public function createFinishResponseValidator(): CrefoPayApiResponseValidatorInterface
435
    {
436
        return new FinishResponseValidator();
437
    }
438
439
    /**
440
     * @return \SprykerEco\Zed\CrefoPayApi\Dependency\Service\CrefoPayApiToUtilEncodingServiceInterface
441
     */
442
    public function getUtilEncodingService(): CrefoPayApiToUtilEncodingServiceInterface
443
    {
444
        return $this->getProvidedDependency(CrefoPayApiDependencyProvider::SERVICE_UTIL_ENCODING);
445
    }
446
447
    /**
448
     * @return \SprykerEco\Service\CrefoPayApi\CrefoPayApiServiceInterface
449
     */
450
    public function getCrefoPayApiService(): CrefoPayApiServiceInterface
451
    {
452
        return $this->getProvidedDependency(CrefoPayApiDependencyProvider::SERVICE_CREFO_PAY_API);
453
    }
454
}
455