Passed
Push — feature/eco-2295/eco-2344-crea... ( b58615...425ba1 )
by Aleksey
01:12
created

createFinishResponseConverter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 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 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...
11
use SprykerEco\Service\CrefoPayApi\CrefoPayApiServiceInterface;
12
use SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClient;
13
use SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface;
14
use SprykerEco\Zed\CrefoPayApi\Business\Logger\CrefoPayApiLogger;
15
use SprykerEco\Zed\CrefoPayApi\Business\Logger\CrefoPayApiLoggerInterface;
16
use SprykerEco\Zed\CrefoPayApi\Business\Request\Builder\CrefoPayApiRequestBuilder;
17
use SprykerEco\Zed\CrefoPayApi\Business\Request\Builder\CrefoPayApiRequestBuilderInterface;
18
use SprykerEco\Zed\CrefoPayApi\Business\Request\CancelRequest;
19
use SprykerEco\Zed\CrefoPayApi\Business\Request\CaptureRequest;
20
use SprykerEco\Zed\CrefoPayApi\Business\Request\Converter\CancelRequestConverter;
21
use SprykerEco\Zed\CrefoPayApi\Business\Request\Converter\CaptureRequestConverter;
22
use SprykerEco\Zed\CrefoPayApi\Business\Request\Converter\CreateTransactionRequestConverter;
23
use SprykerEco\Zed\CrefoPayApi\Business\Request\Converter\CrefoPayApiRequestConverterInterface;
24
use SprykerEco\Zed\CrefoPayApi\Business\Request\Converter\FinishRequestConverter;
25
use SprykerEco\Zed\CrefoPayApi\Business\Request\Converter\RefundRequestConverter;
26
use SprykerEco\Zed\CrefoPayApi\Business\Request\Converter\ReserveRequestConverter;
27
use SprykerEco\Zed\CrefoPayApi\Business\Request\CreateTransactionRequest;
28
use SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface;
29
use SprykerEco\Zed\CrefoPayApi\Business\Request\FinishRequest;
30
use SprykerEco\Zed\CrefoPayApi\Business\Request\RefundRequest;
31
use SprykerEco\Zed\CrefoPayApi\Business\Request\ReserveRequest;
32
use SprykerEco\Zed\CrefoPayApi\Business\Response\Converter\CrefoPayApiResponseConverter;
33
use SprykerEco\Zed\CrefoPayApi\Business\Response\Converter\CrefoPayApiResponseConverterInterface;
34
use SprykerEco\Zed\CrefoPayApi\Business\Response\Mapper\CancelResponseMapper;
35
use SprykerEco\Zed\CrefoPayApi\Business\Response\Mapper\CaptureResponseMapper;
36
use SprykerEco\Zed\CrefoPayApi\Business\Response\Mapper\CreateTransactionResponseMapper;
37
use SprykerEco\Zed\CrefoPayApi\Business\Response\Mapper\CrefoPayApiResponseMapperInterface;
38
use SprykerEco\Zed\CrefoPayApi\Business\Response\Mapper\FinishResponseMapper;
39
use SprykerEco\Zed\CrefoPayApi\Business\Response\Mapper\RefundResponseMapper;
40
use SprykerEco\Zed\CrefoPayApi\Business\Response\Mapper\ReserveResponseMapper;
41
use SprykerEco\Zed\CrefoPayApi\Business\Response\Validator\CrefoPayApiResponseValidator;
42
use SprykerEco\Zed\CrefoPayApi\Business\Response\Validator\CrefoPayApiResponseValidatorInterface;
43
use SprykerEco\Zed\CrefoPayApi\CrefoPayApiDependencyProvider;
44
use SprykerEco\Zed\CrefoPayApi\Dependency\External\Guzzle\CrefoPayApiGuzzleHttpClientAdapterInterface;
45
use SprykerEco\Zed\CrefoPayApi\Dependency\Service\CrefoPayApiToUtilEncodingServiceInterface;
46
47
/**
48
 * @method \SprykerEco\Zed\CrefoPayApi\CrefoPayApiConfig getConfig()
49
 * @method \SprykerEco\Zed\CrefoPayApi\Persistence\CrefoPayApiEntityManagerInterface getEntityManager()
50
 */
51
class CrefoPayApiBusinessFactory extends AbstractBusinessFactory
52
{
53
    /**
54
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
55
     */
56
    public function createCreateTransactionClient(): CrefoPayApiClientInterface
57
    {
58
        return new CrefoPayApiClient(
59
            $this->getCrefoPayApiHttpClient(),
60
            $this->createCreateTransactionRequest(),
61
            $this->createCreateTransactionResponseConverter(),
62
            $this->createCrefoPayApiLogger()
63
        );
64
    }
65
66
    /**
67
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
68
     */
69
    public function createReserveClient(): CrefoPayApiClientInterface
70
    {
71
        return new CrefoPayApiClient(
72
            $this->getCrefoPayApiHttpClient(),
73
            $this->createReserveRequest(),
74
            $this->createReserveResponseConverter(),
75
            $this->createCrefoPayApiLogger()
76
        );
77
    }
78
79
    /**
80
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
81
     */
82
    public function createCaptureClient(): CrefoPayApiClientInterface
83
    {
84
        return new CrefoPayApiClient(
85
            $this->getCrefoPayApiHttpClient(),
86
            $this->createCaptureRequest(),
87
            $this->createCaptureResponseConverter(),
88
            $this->createCrefoPayApiLogger()
89
        );
90
    }
91
92
    /**
93
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
94
     */
95
    public function createCancelClient(): CrefoPayApiClientInterface
96
    {
97
        return new CrefoPayApiClient(
98
            $this->getCrefoPayApiHttpClient(),
99
            $this->createCancelRequest(),
100
            $this->createCancelResponseConverter(),
101
            $this->createCrefoPayApiLogger()
102
        );
103
    }
104
105
    /**
106
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
107
     */
108
    public function createRefundClient(): CrefoPayApiClientInterface
109
    {
110
        return new CrefoPayApiClient(
111
            $this->getCrefoPayApiHttpClient(),
112
            $this->createRefundRequest(),
113
            $this->createRefundResponseConverter(),
114
            $this->createCrefoPayApiLogger()
115
        );
116
    }
117
118
    /**
119
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
120
     */
121
    public function createFinishClient(): CrefoPayApiClientInterface
122
    {
123
        return new CrefoPayApiClient(
124
            $this->getCrefoPayApiHttpClient(),
125
            $this->createFinishRequest(),
126
            $this->createFinishResponseConverter(),
127
            $this->createCrefoPayApiLogger()
128
        );
129
    }
130
131
    /**
132
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface
133
     */
134
    public function createCreateTransactionRequest(): CrefoPayApiRequestInterface
135
    {
136
        return new CreateTransactionRequest(
137
            $this->createCreateTransactionRequestBuilder(),
138
            $this->getConfig()
139
        );
140
    }
141
142
    /**
143
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface
144
     */
145
    public function createReserveRequest(): CrefoPayApiRequestInterface
146
    {
147
        return new ReserveRequest(
148
            $this->createReserveRequestBuilder(),
149
            $this->getConfig()
150
        );
151
    }
152
153
    /**
154
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface
155
     */
156
    public function createCaptureRequest(): CrefoPayApiRequestInterface
157
    {
158
        return new CaptureRequest(
159
            $this->createCaptureRequestBuilder(),
160
            $this->getConfig()
161
        );
162
    }
163
164
    /**
165
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface
166
     */
167
    public function createCancelRequest(): CrefoPayApiRequestInterface
168
    {
169
        return new CancelRequest(
170
            $this->createCancelRequestBuilder(),
171
            $this->getConfig()
172
        );
173
    }
174
175
    /**
176
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface
177
     */
178
    public function createRefundRequest(): CrefoPayApiRequestInterface
179
    {
180
        return new RefundRequest(
181
            $this->createRefundRequestBuilder(),
182
            $this->getConfig()
183
        );
184
    }
185
186
    /**
187
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface
188
     */
189
    public function createFinishRequest(): CrefoPayApiRequestInterface
190
    {
191
        return new FinishRequest(
192
            $this->createFinishRequestBuilder(),
193
            $this->getConfig()
194
        );
195
    }
196
197
    /**
198
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Builder\CrefoPayApiRequestBuilderInterface
199
     */
200
    public function createCreateTransactionRequestBuilder(): CrefoPayApiRequestBuilderInterface
201
    {
202
        return new CrefoPayApiRequestBuilder(
203
            $this->createCreateTransactionRequestConverter(),
204
            $this->getUtilEncodingService(),
205
            $this->getCrefoPayApiService(),
206
            $this->getConfig()
207
        );
208
    }
209
210
    /**
211
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Builder\CrefoPayApiRequestBuilderInterface
212
     */
213
    public function createReserveRequestBuilder(): CrefoPayApiRequestBuilderInterface
214
    {
215
        return new CrefoPayApiRequestBuilder(
216
            $this->createReserveRequestConverter(),
217
            $this->getUtilEncodingService(),
218
            $this->getCrefoPayApiService(),
219
            $this->getConfig()
220
        );
221
    }
222
223
    /**
224
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Builder\CrefoPayApiRequestBuilderInterface
225
     */
226
    public function createCaptureRequestBuilder(): CrefoPayApiRequestBuilderInterface
227
    {
228
        return new CrefoPayApiRequestBuilder(
229
            $this->createCaptureRequestConverter(),
230
            $this->getUtilEncodingService(),
231
            $this->getCrefoPayApiService(),
232
            $this->getConfig()
233
        );
234
    }
235
236
    /**
237
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Builder\CrefoPayApiRequestBuilderInterface
238
     */
239
    public function createCancelRequestBuilder(): CrefoPayApiRequestBuilderInterface
240
    {
241
        return new CrefoPayApiRequestBuilder(
242
            $this->createCancelRequestConverter(),
243
            $this->getUtilEncodingService(),
244
            $this->getCrefoPayApiService(),
245
            $this->getConfig()
246
        );
247
    }
248
249
    /**
250
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Builder\CrefoPayApiRequestBuilderInterface
251
     */
252
    public function createRefundRequestBuilder(): CrefoPayApiRequestBuilderInterface
253
    {
254
        return new CrefoPayApiRequestBuilder(
255
            $this->createRefundRequestConverter(),
256
            $this->getUtilEncodingService(),
257
            $this->getCrefoPayApiService(),
258
            $this->getConfig()
259
        );
260
    }
261
262
    /**
263
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Builder\CrefoPayApiRequestBuilderInterface
264
     */
265
    public function createFinishRequestBuilder(): CrefoPayApiRequestBuilderInterface
266
    {
267
        return new CrefoPayApiRequestBuilder(
268
            $this->createFinishRequestConverter(),
269
            $this->getUtilEncodingService(),
270
            $this->getCrefoPayApiService(),
271
            $this->getConfig()
272
        );
273
    }
274
275
    /**
276
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Converter\CrefoPayApiRequestConverterInterface
277
     */
278
    public function createCreateTransactionRequestConverter(): CrefoPayApiRequestConverterInterface
279
    {
280
        return new CreateTransactionRequestConverter();
281
    }
282
283
    /**
284
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Converter\CrefoPayApiRequestConverterInterface
285
     */
286
    public function createReserveRequestConverter(): CrefoPayApiRequestConverterInterface
287
    {
288
        return new ReserveRequestConverter();
289
    }
290
291
    /**
292
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Converter\CrefoPayApiRequestConverterInterface
293
     */
294
    public function createCaptureRequestConverter(): CrefoPayApiRequestConverterInterface
295
    {
296
        return new CaptureRequestConverter();
297
    }
298
299
    /**
300
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Converter\CrefoPayApiRequestConverterInterface
301
     */
302
    public function createCancelRequestConverter(): CrefoPayApiRequestConverterInterface
303
    {
304
        return new CancelRequestConverter();
305
    }
306
307
    /**
308
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Converter\CrefoPayApiRequestConverterInterface
309
     */
310
    public function createRefundRequestConverter(): CrefoPayApiRequestConverterInterface
311
    {
312
        return new RefundRequestConverter();
313
    }
314
315
    /**
316
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Converter\CrefoPayApiRequestConverterInterface
317
     */
318
    public function createFinishRequestConverter(): CrefoPayApiRequestConverterInterface
319
    {
320
        return new FinishRequestConverter();
321
    }
322
323
    /**
324
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Converter\CrefoPayApiResponseConverterInterface
325
     */
326
    public function createCreateTransactionResponseConverter(): CrefoPayApiResponseConverterInterface
327
    {
328
        return new CrefoPayApiResponseConverter(
329
            $this->getUtilEncodingService(),
330
            $this->createCreateTransactionResponseMapper(),
331
            $this->createCrefoPayApiResponseValidator(),
332
            $this->getConfig()
333
        );
334
    }
335
336
    /**
337
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Converter\CrefoPayApiResponseConverterInterface
338
     */
339
    public function createReserveResponseConverter(): CrefoPayApiResponseConverterInterface
340
    {
341
        return new CrefoPayApiResponseConverter(
342
            $this->getUtilEncodingService(),
343
            $this->createReserveResponseMapper(),
344
            $this->createCrefoPayApiResponseValidator(),
345
            $this->getConfig()
346
        );
347
    }
348
349
    /**
350
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Converter\CrefoPayApiResponseConverterInterface
351
     */
352
    public function createCaptureResponseConverter(): CrefoPayApiResponseConverterInterface
353
    {
354
        return new CrefoPayApiResponseConverter(
355
            $this->getUtilEncodingService(),
356
            $this->createCaptureResponseMapper(),
357
            $this->createCrefoPayApiResponseValidator(),
358
            $this->getConfig()
359
        );
360
    }
361
362
    /**
363
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Converter\CrefoPayApiResponseConverterInterface
364
     */
365
    public function createCancelResponseConverter(): CrefoPayApiResponseConverterInterface
366
    {
367
        return new CrefoPayApiResponseConverter(
368
            $this->getUtilEncodingService(),
369
            $this->createCancelResponseMapper(),
370
            $this->createCrefoPayApiResponseValidator(),
371
            $this->getConfig()
372
        );
373
    }
374
375
    /**
376
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Converter\CrefoPayApiResponseConverterInterface
377
     */
378
    public function createRefundResponseConverter(): CrefoPayApiResponseConverterInterface
379
    {
380
        return new CrefoPayApiResponseConverter(
381
            $this->getUtilEncodingService(),
382
            $this->createRefundResponseMapper(),
383
            $this->createCrefoPayApiResponseValidator(),
384
            $this->getConfig()
385
        );
386
    }
387
388
    /**
389
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Converter\CrefoPayApiResponseConverterInterface
390
     */
391
    public function createFinishResponseConverter(): CrefoPayApiResponseConverterInterface
392
    {
393
        return new CrefoPayApiResponseConverter(
394
            $this->getUtilEncodingService(),
395
            $this->createFinishResponseMapper(),
396
            $this->createCrefoPayApiResponseValidator(),
397
            $this->getConfig()
398
        );
399
    }
400
401
    /**
402
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Mapper\CrefoPayApiResponseMapperInterface
403
     */
404
    public function createCreateTransactionResponseMapper(): CrefoPayApiResponseMapperInterface
405
    {
406
        return new CreateTransactionResponseMapper();
407
    }
408
409
    /**
410
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Mapper\CrefoPayApiResponseMapperInterface
411
     */
412
    public function createReserveResponseMapper(): CrefoPayApiResponseMapperInterface
413
    {
414
        return new ReserveResponseMapper();
415
    }
416
417
    /**
418
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Mapper\CrefoPayApiResponseMapperInterface
419
     */
420
    public function createCaptureResponseMapper(): CrefoPayApiResponseMapperInterface
421
    {
422
        return new CaptureResponseMapper();
423
    }
424
425
    /**
426
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Mapper\CrefoPayApiResponseMapperInterface
427
     */
428
    public function createCancelResponseMapper(): CrefoPayApiResponseMapperInterface
429
    {
430
        return new CancelResponseMapper();
431
    }
432
433
    /**
434
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Mapper\CrefoPayApiResponseMapperInterface
435
     */
436
    public function createRefundResponseMapper(): CrefoPayApiResponseMapperInterface
437
    {
438
        return new RefundResponseMapper();
439
    }
440
441
    /**
442
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Mapper\CrefoPayApiResponseMapperInterface
443
     */
444
    public function createFinishResponseMapper(): CrefoPayApiResponseMapperInterface
445
    {
446
        return new FinishResponseMapper();
447
    }
448
449
    /**
450
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Validator\CrefoPayApiResponseValidatorInterface
451
     */
452
    public function createCrefoPayApiResponseValidator(): CrefoPayApiResponseValidatorInterface
453
    {
454
        return new CrefoPayApiResponseValidator(
455
            $this->getCrefoPayApiService(),
456
            $this->getConfig()
457
        );
458
    }
459
460
    /**
461
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Logger\CrefoPayApiLoggerInterface
462
     */
463
    public function createCrefoPayApiLogger(): CrefoPayApiLoggerInterface
464
    {
465
        return new CrefoPayApiLogger($this->getEntityManager());
466
    }
467
468
    /**
469
     * @return \SprykerEco\Zed\CrefoPayApi\Dependency\Service\CrefoPayApiToUtilEncodingServiceInterface
470
     */
471
    public function getUtilEncodingService(): CrefoPayApiToUtilEncodingServiceInterface
472
    {
473
        return $this->getProvidedDependency(CrefoPayApiDependencyProvider::SERVICE_UTIL_ENCODING);
474
    }
475
476
    /**
477
     * @return \SprykerEco\Service\CrefoPayApi\CrefoPayApiServiceInterface
478
     */
479
    public function getCrefoPayApiService(): CrefoPayApiServiceInterface
480
    {
481
        return $this->getProvidedDependency(CrefoPayApiDependencyProvider::SERVICE_CREFO_PAY_API);
482
    }
483
484
    /**
485
     * @return \SprykerEco\Zed\CrefoPayApi\Dependency\External\Guzzle\CrefoPayApiGuzzleHttpClientAdapterInterface
486
     */
487
    public function getCrefoPayApiHttpClient(): CrefoPayApiGuzzleHttpClientAdapterInterface
488
    {
489
        return $this->getProvidedDependency(CrefoPayApiDependencyProvider::CREFO_PAY_API_HTTP_CLIENT);
490
    }
491
}
492