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

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