Passed
Push — feature/eco-2295/eco-2344-crea... ( 0c1e08...b58615 )
by Aleksey
01:17
created

createRefundRequestConverter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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