Passed
Push — feature/eco-2295/eco-2344-crea... ( 226db0...8515c8 )
by Aleksey
01:11
created

createRefundRequestBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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