Passed
Push — feature/eco-2295/eco-2344-crea... ( 982ddf...5354d6 )
by Aleksey
01:04
created

CrefoPayApiBusinessFactory   A

Complexity

Total Complexity 28

Size/Duplication

Total Lines 290
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 77
dl 0
loc 290
rs 10
c 0
b 0
f 0
wmc 28

28 Methods

Rating   Name   Duplication   Size   Complexity  
A createReserveConverter() 0 3 1
A createReserveRequestBuilder() 0 5 1
A createFinishRequestBuilder() 0 5 1
A createRefundConverter() 0 3 1
A createCancelConverter() 0 3 1
A createCreateTransactionRequestBuilder() 0 5 1
A createCaptureConverter() 0 3 1
A createCancelRequestBuilder() 0 5 1
A createCreateTransactionConverter() 0 3 1
A createReserveRequest() 0 5 1
A createCaptureRequestBuilder() 0 5 1
A createRefundRequestBuilder() 0 5 1
A createFinishRequest() 0 5 1
A createCancelRequest() 0 5 1
A createFinishConverter() 0 3 1
A createCaptureRequest() 0 5 1
A createCreateTransactionRequest() 0 5 1
A createRefundRequest() 0 5 1
A createRefundClient() 0 7 1
A createReserveClient() 0 7 1
A createCaptureClient() 0 7 1
A createCreateTransactionClient() 0 7 1
A getCrefoPayApiHttpClient() 0 3 1
A getUtilEncodingService() 0 3 1
A createLogger() 0 3 1
A getCrefoPayApiService() 0 3 1
A createCancelClient() 0 7 1
A createFinishClient() 0 7 1
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\Builder\Request\CancelRequestBuilder;
13
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CaptureRequestBuilder;
14
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CreateTransactionRequestBuilder;
15
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface;
16
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\FinishRequestBuilder;
17
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\RefundRequestBuilder;
18
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\ReserveRequestBuilder;
19
use SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClient;
20
use SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface;
21
use SprykerEco\Zed\CrefoPayApi\Business\Converter\CancelConverter;
22
use SprykerEco\Zed\CrefoPayApi\Business\Converter\CaptureConverter;
23
use SprykerEco\Zed\CrefoPayApi\Business\Converter\CreateTransactionConverter;
24
use SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface;
25
use SprykerEco\Zed\CrefoPayApi\Business\Converter\FinishConverter;
26
use SprykerEco\Zed\CrefoPayApi\Business\Converter\RefundConverter;
27
use SprykerEco\Zed\CrefoPayApi\Business\Converter\ReserveConverter;
28
use SprykerEco\Zed\CrefoPayApi\Business\Logger\CrefoPayApiLogger;
29
use SprykerEco\Zed\CrefoPayApi\Business\Logger\CrefoPayApiLoggerInterface;
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\CrefoPayApiDependencyProvider;
38
use SprykerEco\Zed\CrefoPayApi\Dependency\External\Guzzle\CrefoPayApiGuzzleHttpClientAdapterInterface;
39
use SprykerEco\Zed\CrefoPayApi\Dependency\Service\CrefoPayApiToUtilEncodingServiceInterface;
40
41
/**
42
 * @method \SprykerEco\Zed\CrefoPayApi\CrefoPayApiConfig getConfig()
43
 * @method \SprykerEco\Zed\CrefoPayApi\Persistence\CrefoPayApiEntityManagerInterface getEntityManager()
44
 */
45
class CrefoPayApiBusinessFactory extends AbstractBusinessFactory
46
{
47
    /**
48
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
49
     */
50
    public function createCreateTransactionClient(): CrefoPayApiClientInterface
51
    {
52
        return new CrefoPayApiClient(
53
            $this->getCrefoPayApiHttpClient(),
54
            $this->createCreateTransactionRequest(),
55
            $this->createCreateTransactionConverter(),
56
            $this->createLogger()
57
        );
58
    }
59
60
    /**
61
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
62
     */
63
    public function createReserveClient(): CrefoPayApiClientInterface
64
    {
65
        return new CrefoPayApiClient(
66
            $this->getCrefoPayApiHttpClient(),
67
            $this->createReserveRequest(),
68
            $this->createReserveConverter(),
69
            $this->createLogger()
70
        );
71
    }
72
73
    /**
74
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
75
     */
76
    public function createCaptureClient(): CrefoPayApiClientInterface
77
    {
78
        return new CrefoPayApiClient(
79
            $this->getCrefoPayApiHttpClient(),
80
            $this->createCaptureRequest(),
81
            $this->createCaptureConverter(),
82
            $this->createLogger()
83
        );
84
    }
85
86
    /**
87
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
88
     */
89
    public function createCancelClient(): CrefoPayApiClientInterface
90
    {
91
        return new CrefoPayApiClient(
92
            $this->getCrefoPayApiHttpClient(),
93
            $this->createCancelRequest(),
94
            $this->createCancelConverter(),
95
            $this->createLogger()
96
        );
97
    }
98
99
    /**
100
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
101
     */
102
    public function createRefundClient(): CrefoPayApiClientInterface
103
    {
104
        return new CrefoPayApiClient(
105
            $this->getCrefoPayApiHttpClient(),
106
            $this->createRefundRequest(),
107
            $this->createRefundConverter(),
108
            $this->createLogger()
109
        );
110
    }
111
112
    /**
113
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
114
     */
115
    public function createFinishClient(): CrefoPayApiClientInterface
116
    {
117
        return new CrefoPayApiClient(
118
            $this->getCrefoPayApiHttpClient(),
119
            $this->createFinishRequest(),
120
            $this->createFinishConverter(),
121
            $this->createLogger()
122
        );
123
    }
124
125
    /**
126
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface
127
     */
128
    public function createCreateTransactionRequest(): CrefoPayApiRequestInterface
129
    {
130
        return new CreateTransactionRequest(
131
            $this->createCreateTransactionRequestBuilder(),
132
            $this->getConfig()
133
        );
134
    }
135
136
    /**
137
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface
138
     */
139
    public function createReserveRequest(): CrefoPayApiRequestInterface
140
    {
141
        return new ReserveRequest(
142
            $this->createReserveRequestBuilder(),
143
            $this->getConfig()
144
        );
145
    }
146
147
    /**
148
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface
149
     */
150
    public function createCaptureRequest(): CrefoPayApiRequestInterface
151
    {
152
        return new CaptureRequest(
153
            $this->createCaptureRequestBuilder(),
154
            $this->getConfig()
155
        );
156
    }
157
158
    /**
159
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface
160
     */
161
    public function createCancelRequest(): CrefoPayApiRequestInterface
162
    {
163
        return new CancelRequest(
164
            $this->createCancelRequestBuilder(),
165
            $this->getConfig()
166
        );
167
    }
168
169
    /**
170
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface
171
     */
172
    public function createRefundRequest(): CrefoPayApiRequestInterface
173
    {
174
        return new RefundRequest(
175
            $this->createRefundRequestBuilder(),
176
            $this->getConfig()
177
        );
178
    }
179
180
    /**
181
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Request\CrefoPayApiRequestInterface
182
     */
183
    public function createFinishRequest(): CrefoPayApiRequestInterface
184
    {
185
        return new FinishRequest(
186
            $this->createFinishRequestBuilder(),
187
            $this->getConfig()
188
        );
189
    }
190
191
    /**
192
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface
193
     */
194
    public function createCreateTransactionRequestBuilder(): CrefoPayApiRequestBuilderInterface
195
    {
196
        return new CreateTransactionRequestBuilder(
197
            $this->getUtilEncodingService(),
198
            $this->getCrefoPayApiService()
199
        );
200
    }
201
202
    /**
203
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface
204
     */
205
    public function createReserveRequestBuilder(): CrefoPayApiRequestBuilderInterface
206
    {
207
        return new ReserveRequestBuilder(
208
            $this->getUtilEncodingService(),
209
            $this->getCrefoPayApiService()
210
        );
211
    }
212
213
    /**
214
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface
215
     */
216
    public function createCaptureRequestBuilder(): CrefoPayApiRequestBuilderInterface
217
    {
218
        return new CaptureRequestBuilder(
219
            $this->getUtilEncodingService(),
220
            $this->getCrefoPayApiService()
221
        );
222
    }
223
224
    /**
225
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface
226
     */
227
    public function createCancelRequestBuilder(): CrefoPayApiRequestBuilderInterface
228
    {
229
        return new CancelRequestBuilder(
230
            $this->getUtilEncodingService(),
231
            $this->getCrefoPayApiService()
232
        );
233
    }
234
235
    /**
236
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface
237
     */
238
    public function createRefundRequestBuilder(): CrefoPayApiRequestBuilderInterface
239
    {
240
        return new RefundRequestBuilder(
241
            $this->getUtilEncodingService(),
242
            $this->getCrefoPayApiService()
243
        );
244
    }
245
246
    /**
247
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface
248
     */
249
    public function createFinishRequestBuilder(): CrefoPayApiRequestBuilderInterface
250
    {
251
        return new FinishRequestBuilder(
252
            $this->getUtilEncodingService(),
253
            $this->getCrefoPayApiService()
254
        );
255
    }
256
257
    /**
258
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface
259
     */
260
    public function createCreateTransactionConverter(): CrefoPayApiConverterInterface
261
    {
262
        return new CreateTransactionConverter($this->getUtilEncodingService());
263
    }
264
265
    /**
266
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface
267
     */
268
    public function createReserveConverter(): CrefoPayApiConverterInterface
269
    {
270
        return new ReserveConverter($this->getUtilEncodingService());
271
    }
272
273
    /**
274
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface
275
     */
276
    public function createCaptureConverter(): CrefoPayApiConverterInterface
277
    {
278
        return new CaptureConverter($this->getUtilEncodingService());
279
    }
280
281
    /**
282
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface
283
     */
284
    public function createCancelConverter(): CrefoPayApiConverterInterface
285
    {
286
        return new CancelConverter($this->getUtilEncodingService());
287
    }
288
289
    /**
290
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface
291
     */
292
    public function createRefundConverter(): CrefoPayApiConverterInterface
293
    {
294
        return new RefundConverter($this->getUtilEncodingService());
295
    }
296
297
    /**
298
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface
299
     */
300
    public function createFinishConverter(): CrefoPayApiConverterInterface
301
    {
302
        return new FinishConverter($this->getUtilEncodingService());
303
    }
304
305
    /**
306
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Logger\CrefoPayApiLoggerInterface
307
     */
308
    public function createLogger(): CrefoPayApiLoggerInterface
309
    {
310
        return new CrefoPayApiLogger($this->getEntityManager());
311
    }
312
313
    /**
314
     * @return \SprykerEco\Zed\CrefoPayApi\Dependency\Service\CrefoPayApiToUtilEncodingServiceInterface
315
     */
316
    public function getUtilEncodingService(): CrefoPayApiToUtilEncodingServiceInterface
317
    {
318
        return $this->getProvidedDependency(CrefoPayApiDependencyProvider::SERVICE_UTIL_ENCODING);
319
    }
320
321
    /**
322
     * @return \SprykerEco\Service\CrefoPayApi\CrefoPayApiServiceInterface
323
     */
324
    public function getCrefoPayApiService(): CrefoPayApiServiceInterface
325
    {
326
        return $this->getProvidedDependency(CrefoPayApiDependencyProvider::SERVICE_CREFO_PAY_API);
327
    }
328
329
    /**
330
     * @return \SprykerEco\Zed\CrefoPayApi\Dependency\External\Guzzle\CrefoPayApiGuzzleHttpClientAdapterInterface
331
     */
332
    public function getCrefoPayApiHttpClient(): CrefoPayApiGuzzleHttpClientAdapterInterface
333
    {
334
        return $this->getProvidedDependency(CrefoPayApiDependencyProvider::CREFO_PAY_API_HTTP_CLIENT);
335
    }
336
}
337