Completed
Pull Request — master (#3)
by Aleksey
15:31 queued 12:58
created

createReserveResponseConverter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
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;
11
use SprykerEco\Service\CrefoPayApi\CrefoPayApiServiceInterface;
12
use SprykerEco\Zed\CrefoPayApi\Business\ApiClient\CrefoPayApiClient;
13
use SprykerEco\Zed\CrefoPayApi\Business\ApiClient\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\ApiClient\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\ApiClient\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\ApiClient\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\ApiClient\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\ApiClient\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\ApiClient\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
        );
207
    }
208
209
    /**
210
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Builder\CrefoPayApiRequestBuilderInterface
211
     */
212
    public function createReserveRequestBuilder(): CrefoPayApiRequestBuilderInterface
213
    {
214
        return new CrefoPayApiRequestBuilder(
215
            $this->createReserveRequestConverter(),
216
            $this->getUtilEncodingService(),
217
            $this->getCrefoPayApiService()
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
        );
231
    }
232
233
    /**
234
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Builder\CrefoPayApiRequestBuilderInterface
235
     */
236
    public function createCancelRequestBuilder(): CrefoPayApiRequestBuilderInterface
237
    {
238
        return new CrefoPayApiRequestBuilder(
239
            $this->createCancelRequestConverter(),
240
            $this->getUtilEncodingService(),
241
            $this->getCrefoPayApiService()
242
        );
243
    }
244
245
    /**
246
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Builder\CrefoPayApiRequestBuilderInterface
247
     */
248
    public function createRefundRequestBuilder(): CrefoPayApiRequestBuilderInterface
249
    {
250
        return new CrefoPayApiRequestBuilder(
251
            $this->createRefundRequestConverter(),
252
            $this->getUtilEncodingService(),
253
            $this->getCrefoPayApiService()
254
        );
255
    }
256
257
    /**
258
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Builder\CrefoPayApiRequestBuilderInterface
259
     */
260
    public function createFinishRequestBuilder(): CrefoPayApiRequestBuilderInterface
261
    {
262
        return new CrefoPayApiRequestBuilder(
263
            $this->createFinishRequestConverter(),
264
            $this->getUtilEncodingService(),
265
            $this->getCrefoPayApiService()
266
        );
267
    }
268
269
    /**
270
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Converter\CrefoPayApiRequestConverterInterface
271
     */
272
    public function createCreateTransactionRequestConverter(): CrefoPayApiRequestConverterInterface
273
    {
274
        return new CreateTransactionRequestConverter();
275
    }
276
277
    /**
278
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Converter\CrefoPayApiRequestConverterInterface
279
     */
280
    public function createReserveRequestConverter(): CrefoPayApiRequestConverterInterface
281
    {
282
        return new ReserveRequestConverter();
283
    }
284
285
    /**
286
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Converter\CrefoPayApiRequestConverterInterface
287
     */
288
    public function createCaptureRequestConverter(): CrefoPayApiRequestConverterInterface
289
    {
290
        return new CaptureRequestConverter();
291
    }
292
293
    /**
294
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Converter\CrefoPayApiRequestConverterInterface
295
     */
296
    public function createCancelRequestConverter(): CrefoPayApiRequestConverterInterface
297
    {
298
        return new CancelRequestConverter();
299
    }
300
301
    /**
302
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Converter\CrefoPayApiRequestConverterInterface
303
     */
304
    public function createRefundRequestConverter(): CrefoPayApiRequestConverterInterface
305
    {
306
        return new RefundRequestConverter();
307
    }
308
309
    /**
310
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\Converter\CrefoPayApiRequestConverterInterface
311
     */
312
    public function createFinishRequestConverter(): CrefoPayApiRequestConverterInterface
313
    {
314
        return new FinishRequestConverter();
315
    }
316
317
    /**
318
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Converter\CrefoPayApiResponseConverterInterface
319
     */
320
    public function createCreateTransactionResponseConverter(): CrefoPayApiResponseConverterInterface
321
    {
322
        return new CrefoPayApiResponseConverter(
323
            $this->getUtilEncodingService(),
324
            $this->createCreateTransactionResponseMapper(),
325
            $this->createCrefoPayApiResponseValidator()
326
        );
327
    }
328
329
    /**
330
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Converter\CrefoPayApiResponseConverterInterface
331
     */
332
    public function createReserveResponseConverter(): CrefoPayApiResponseConverterInterface
333
    {
334
        return new CrefoPayApiResponseConverter(
335
            $this->getUtilEncodingService(),
336
            $this->createReserveResponseMapper(),
337
            $this->createCrefoPayApiResponseValidator()
338
        );
339
    }
340
341
    /**
342
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Converter\CrefoPayApiResponseConverterInterface
343
     */
344
    public function createCaptureResponseConverter(): CrefoPayApiResponseConverterInterface
345
    {
346
        return new CrefoPayApiResponseConverter(
347
            $this->getUtilEncodingService(),
348
            $this->createCaptureResponseMapper(),
349
            $this->createCrefoPayApiResponseValidator()
350
        );
351
    }
352
353
    /**
354
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Converter\CrefoPayApiResponseConverterInterface
355
     */
356
    public function createCancelResponseConverter(): CrefoPayApiResponseConverterInterface
357
    {
358
        return new CrefoPayApiResponseConverter(
359
            $this->getUtilEncodingService(),
360
            $this->createCancelResponseMapper(),
361
            $this->createCrefoPayApiResponseValidator()
362
        );
363
    }
364
365
    /**
366
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Converter\CrefoPayApiResponseConverterInterface
367
     */
368
    public function createRefundResponseConverter(): CrefoPayApiResponseConverterInterface
369
    {
370
        return new CrefoPayApiResponseConverter(
371
            $this->getUtilEncodingService(),
372
            $this->createRefundResponseMapper(),
373
            $this->createCrefoPayApiResponseValidator()
374
        );
375
    }
376
377
    /**
378
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Converter\CrefoPayApiResponseConverterInterface
379
     */
380
    public function createFinishResponseConverter(): CrefoPayApiResponseConverterInterface
381
    {
382
        return new CrefoPayApiResponseConverter(
383
            $this->getUtilEncodingService(),
384
            $this->createFinishResponseMapper(),
385
            $this->createCrefoPayApiResponseValidator()
386
        );
387
    }
388
389
    /**
390
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Mapper\CrefoPayApiResponseMapperInterface
391
     */
392
    public function createCreateTransactionResponseMapper(): CrefoPayApiResponseMapperInterface
393
    {
394
        return new CreateTransactionResponseMapper();
395
    }
396
397
    /**
398
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Mapper\CrefoPayApiResponseMapperInterface
399
     */
400
    public function createReserveResponseMapper(): CrefoPayApiResponseMapperInterface
401
    {
402
        return new ReserveResponseMapper();
403
    }
404
405
    /**
406
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Mapper\CrefoPayApiResponseMapperInterface
407
     */
408
    public function createCaptureResponseMapper(): CrefoPayApiResponseMapperInterface
409
    {
410
        return new CaptureResponseMapper();
411
    }
412
413
    /**
414
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Mapper\CrefoPayApiResponseMapperInterface
415
     */
416
    public function createCancelResponseMapper(): CrefoPayApiResponseMapperInterface
417
    {
418
        return new CancelResponseMapper();
419
    }
420
421
    /**
422
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Mapper\CrefoPayApiResponseMapperInterface
423
     */
424
    public function createRefundResponseMapper(): CrefoPayApiResponseMapperInterface
425
    {
426
        return new RefundResponseMapper();
427
    }
428
429
    /**
430
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Mapper\CrefoPayApiResponseMapperInterface
431
     */
432
    public function createFinishResponseMapper(): CrefoPayApiResponseMapperInterface
433
    {
434
        return new FinishResponseMapper();
435
    }
436
437
    /**
438
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Response\Validator\CrefoPayApiResponseValidatorInterface
439
     */
440
    public function createCrefoPayApiResponseValidator(): CrefoPayApiResponseValidatorInterface
441
    {
442
        return new CrefoPayApiResponseValidator(
443
            $this->getCrefoPayApiService()
444
        );
445
    }
446
447
    /**
448
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Logger\CrefoPayApiLoggerInterface
449
     */
450
    public function createCrefoPayApiLogger(): CrefoPayApiLoggerInterface
451
    {
452
        return new CrefoPayApiLogger($this->getEntityManager());
453
    }
454
455
    /**
456
     * @return \SprykerEco\Zed\CrefoPayApi\Dependency\Service\CrefoPayApiToUtilEncodingServiceInterface
457
     */
458
    public function getUtilEncodingService(): CrefoPayApiToUtilEncodingServiceInterface
459
    {
460
        return $this->getProvidedDependency(CrefoPayApiDependencyProvider::SERVICE_UTIL_ENCODING);
461
    }
462
463
    /**
464
     * @return \SprykerEco\Service\CrefoPayApi\CrefoPayApiServiceInterface
465
     */
466
    public function getCrefoPayApiService(): CrefoPayApiServiceInterface
467
    {
468
        return $this->getProvidedDependency(CrefoPayApiDependencyProvider::SERVICE_CREFO_PAY_API);
469
    }
470
471
    /**
472
     * @return \SprykerEco\Zed\CrefoPayApi\Dependency\External\Guzzle\CrefoPayApiGuzzleHttpClientAdapterInterface
473
     */
474
    public function getCrefoPayApiHttpClient(): CrefoPayApiGuzzleHttpClientAdapterInterface
475
    {
476
        return $this->getProvidedDependency(CrefoPayApiDependencyProvider::CREFO_PAY_API_HTTP_CLIENT);
477
    }
478
}
479