Passed
Pull Request — feature/eco-2295/dev (#1)
by Aleksey
02:52 queued 01:06
created

CrefoPayApiBusinessFactory::createRefundClient()   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\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
            $this->getConfig()
200
        );
201
    }
202
203
    /**
204
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface
205
     */
206
    public function createReserveRequestBuilder(): CrefoPayApiRequestBuilderInterface
207
    {
208
        return new ReserveRequestBuilder(
209
            $this->getUtilEncodingService(),
210
            $this->getCrefoPayApiService(),
211
            $this->getConfig()
212
        );
213
    }
214
215
    /**
216
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface
217
     */
218
    public function createCaptureRequestBuilder(): CrefoPayApiRequestBuilderInterface
219
    {
220
        return new CaptureRequestBuilder(
221
            $this->getUtilEncodingService(),
222
            $this->getCrefoPayApiService(),
223
            $this->getConfig()
224
        );
225
    }
226
227
    /**
228
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface
229
     */
230
    public function createCancelRequestBuilder(): CrefoPayApiRequestBuilderInterface
231
    {
232
        return new CancelRequestBuilder(
233
            $this->getUtilEncodingService(),
234
            $this->getCrefoPayApiService(),
235
            $this->getConfig()
236
        );
237
    }
238
239
    /**
240
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface
241
     */
242
    public function createRefundRequestBuilder(): CrefoPayApiRequestBuilderInterface
243
    {
244
        return new RefundRequestBuilder(
245
            $this->getUtilEncodingService(),
246
            $this->getCrefoPayApiService(),
247
            $this->getConfig()
248
        );
249
    }
250
251
    /**
252
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface
253
     */
254
    public function createFinishRequestBuilder(): CrefoPayApiRequestBuilderInterface
255
    {
256
        return new FinishRequestBuilder(
257
            $this->getUtilEncodingService(),
258
            $this->getCrefoPayApiService(),
259
            $this->getConfig()
260
        );
261
    }
262
263
    /**
264
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface
265
     */
266
    public function createCreateTransactionConverter(): CrefoPayApiConverterInterface
267
    {
268
        return new CreateTransactionConverter(
269
            $this->getUtilEncodingService(),
270
            $this->getConfig()
271
        );
272
    }
273
274
    /**
275
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface
276
     */
277
    public function createReserveConverter(): CrefoPayApiConverterInterface
278
    {
279
        return new ReserveConverter(
280
            $this->getUtilEncodingService(),
281
            $this->getConfig()
282
        );
283
    }
284
285
    /**
286
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface
287
     */
288
    public function createCaptureConverter(): CrefoPayApiConverterInterface
289
    {
290
        return new CaptureConverter(
291
            $this->getUtilEncodingService(),
292
            $this->getConfig()
293
        );
294
    }
295
296
    /**
297
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface
298
     */
299
    public function createCancelConverter(): CrefoPayApiConverterInterface
300
    {
301
        return new CancelConverter(
302
            $this->getUtilEncodingService(),
303
            $this->getConfig()
304
        );
305
    }
306
307
    /**
308
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface
309
     */
310
    public function createRefundConverter(): CrefoPayApiConverterInterface
311
    {
312
        return new RefundConverter(
313
            $this->getUtilEncodingService(),
314
            $this->getConfig()
315
        );
316
    }
317
318
    /**
319
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface
320
     */
321
    public function createFinishConverter(): CrefoPayApiConverterInterface
322
    {
323
        return new FinishConverter(
324
            $this->getUtilEncodingService(),
325
            $this->getConfig()
326
        );
327
    }
328
329
    /**
330
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Logger\CrefoPayApiLoggerInterface
331
     */
332
    public function createLogger(): CrefoPayApiLoggerInterface
333
    {
334
        return new CrefoPayApiLogger($this->getEntityManager());
335
    }
336
337
    /**
338
     * @return \SprykerEco\Zed\CrefoPayApi\Dependency\Service\CrefoPayApiToUtilEncodingServiceInterface
339
     */
340
    public function getUtilEncodingService(): CrefoPayApiToUtilEncodingServiceInterface
341
    {
342
        return $this->getProvidedDependency(CrefoPayApiDependencyProvider::SERVICE_UTIL_ENCODING);
343
    }
344
345
    /**
346
     * @return \SprykerEco\Service\CrefoPayApi\CrefoPayApiServiceInterface
347
     */
348
    public function getCrefoPayApiService(): CrefoPayApiServiceInterface
349
    {
350
        return $this->getProvidedDependency(CrefoPayApiDependencyProvider::SERVICE_CREFO_PAY_API);
351
    }
352
353
    /**
354
     * @return \SprykerEco\Zed\CrefoPayApi\Dependency\External\Guzzle\CrefoPayApiGuzzleHttpClientAdapterInterface
355
     */
356
    public function getCrefoPayApiHttpClient(): CrefoPayApiGuzzleHttpClientAdapterInterface
357
    {
358
        return $this->getProvidedDependency(CrefoPayApiDependencyProvider::CREFO_PAY_API_HTTP_CLIENT);
359
    }
360
}
361