Passed
Push — feature/eco-2295/eco-2344-crea... ( 946f77...8dc4d0 )
by Aleksey
01:38
created

CrefoPayApiBusinessFactory::createFinishResponseValidator()   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\Service\CrefoPayApi\CrefoPayApiServiceInterface;
14
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CancelRequestBuilder;
15
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CaptureRequestBuilder;
16
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CreateTransactionRequestBuilder;
17
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\CrefoPayApiRequestBuilderInterface;
18
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\FinishRequestBuilder;
19
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\RefundRequestBuilder;
20
use SprykerEco\Zed\CrefoPayApi\Business\Builder\Request\ReserveRequestBuilder;
21
use SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClient;
22
use SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface;
23
use SprykerEco\Zed\CrefoPayApi\Business\Converter\CancelConverter;
24
use SprykerEco\Zed\CrefoPayApi\Business\Converter\CaptureConverter;
25
use SprykerEco\Zed\CrefoPayApi\Business\Converter\CreateTransactionConverter;
26
use SprykerEco\Zed\CrefoPayApi\Business\Converter\CrefoPayApiConverterInterface;
27
use SprykerEco\Zed\CrefoPayApi\Business\Converter\FinishConverter;
28
use SprykerEco\Zed\CrefoPayApi\Business\Converter\RefundConverter;
29
use SprykerEco\Zed\CrefoPayApi\Business\Converter\ReserveConverter;
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\Service\CrefoPayApiToUtilEncodingServiceInterface;
39
40
/**
41
 * @method \SprykerEco\Zed\CrefoPayApi\CrefoPayApiConfig getConfig()
42
 */
43
class CrefoPayApiBusinessFactory extends AbstractBusinessFactory
44
{
45
    /**
46
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
47
     */
48
    public function createCreateTransactionClient(): CrefoPayApiClientInterface
49
    {
50
        return new CrefoPayApiClient(
51
            $this->createGuzzleClient(),
52
            $this->createCreateTransactionRequest(),
53
            $this->createCreateTransactionConverter()
54
        );
55
    }
56
57
    /**
58
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
59
     */
60
    public function createReserveClient(): CrefoPayApiClientInterface
61
    {
62
        return new CrefoPayApiClient(
63
            $this->createGuzzleClient(),
64
            $this->createReserveRequest(),
65
            $this->createReserveConverter()
66
        );
67
    }
68
69
    /**
70
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
71
     */
72
    public function createCaptureClient(): CrefoPayApiClientInterface
73
    {
74
        return new CrefoPayApiClient(
75
            $this->createGuzzleClient(),
76
            $this->createCaptureRequest(),
77
            $this->createCancelConverter()
78
        );
79
    }
80
81
    /**
82
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
83
     */
84
    public function createCancelClient(): CrefoPayApiClientInterface
85
    {
86
        return new CrefoPayApiClient(
87
            $this->createGuzzleClient(),
88
            $this->createCancelRequest(),
89
            $this->createCancelConverter()
90
        );
91
    }
92
93
    /**
94
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
95
     */
96
    public function createRefundClient(): CrefoPayApiClientInterface
97
    {
98
        return new CrefoPayApiClient(
99
            $this->createGuzzleClient(),
100
            $this->createRefundRequest(),
101
            $this->createRefundConverter()
102
        );
103
    }
104
105
    /**
106
     * @return \SprykerEco\Zed\CrefoPayApi\Business\Client\CrefoPayApiClientInterface
107
     */
108
    public function createFinishClient(): CrefoPayApiClientInterface
109
    {
110
        return new CrefoPayApiClient(
111
            $this->createGuzzleClient(),
112
            $this->createFinishRequest(),
113
            $this->createFinishConverter()
114
        );
115
    }
116
117
    /**
118
     * @return \GuzzleHttp\ClientInterface
119
     */
120
    public function createGuzzleClient(): ClientInterface
121
    {
122
        return new Client();
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\Dependency\Service\CrefoPayApiToUtilEncodingServiceInterface
307
     */
308
    public function getUtilEncodingService(): CrefoPayApiToUtilEncodingServiceInterface
309
    {
310
        return $this->getProvidedDependency(CrefoPayApiDependencyProvider::SERVICE_UTIL_ENCODING);
311
    }
312
313
    /**
314
     * @return \SprykerEco\Service\CrefoPayApi\CrefoPayApiServiceInterface
315
     */
316
    public function getCrefoPayApiService(): CrefoPayApiServiceInterface
317
    {
318
        return $this->getProvidedDependency(CrefoPayApiDependencyProvider::SERVICE_CREFO_PAY_API);
319
    }
320
}
321