Passed
Push — bugfix/cc-14473-computop-notif... ( 520fd0...afeda9 )
by Roman
05:18 queued 13s
created

ComputopFacade::filterPaymentMethods()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\Computop\Business;
9
10
use Generated\Shared\Transfer\CheckoutResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\CheckoutResponseTransfer 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 Generated\Shared\Transfer\ComputopApiResponseHeaderTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...iResponseHeaderTransfer 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 Generated\Shared\Transfer\ComputopNotificationTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...topNotificationTransfer 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 Generated\Shared\Transfer\OrderTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\OrderTransfer 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...
14
use Generated\Shared\Transfer\PaymentMethodsTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PaymentMethodsTransfer 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...
15
use Generated\Shared\Transfer\QuoteTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\QuoteTransfer 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...
16
use Generated\Shared\Transfer\SaveOrderTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\SaveOrderTransfer 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...
17
use Spryker\Zed\Kernel\Business\AbstractFacade;
18
19
/**
20
 * @method \SprykerEco\Zed\Computop\Business\ComputopBusinessFactory getFactory()
21
 * @method \SprykerEco\Zed\Computop\Persistence\ComputopEntityManagerInterface getEntityManager()
22
 * @method \SprykerEco\Zed\Computop\Persistence\ComputopRepositoryInterface getRepository()
23
 */
24
class ComputopFacade extends AbstractFacade implements ComputopFacadeInterface
25
{
26
    /**
27
     * {@inheritDoc}
28
     *
29
     * @api
30
     *
31
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
32
     * @param \Generated\Shared\Transfer\SaveOrderTransfer $saveOrderTransfer
33
     *
34
     * @return void
35
     */
36
    public function saveOrderPayment(QuoteTransfer $quoteTransfer, SaveOrderTransfer $saveOrderTransfer)
37
    {
38
        $this->getFactory()
39
            ->createOrderSaver()
40
            ->saveOrderPayment($quoteTransfer, $saveOrderTransfer);
41
    }
42
43
    /**
44
     * {@inheritDoc}
45
     *
46
     * @api
47
     *
48
     * @param \Generated\Shared\Transfer\ComputopApiResponseHeaderTransfer $header
49
     * @param string $method
50
     *
51
     * @return \Generated\Shared\Transfer\ComputopApiResponseHeaderTransfer
52
     */
53
    public function logResponseHeader(ComputopApiResponseHeaderTransfer $header, $method)
54
    {
55
        $this->getFactory()
56
            ->createComputopResponseLogger()
57
            ->log($header, $method);
58
59
        return $header;
60
    }
61
62
    /**
63
     * {@inheritDoc}
64
     *
65
     * @api
66
     *
67
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
68
     * @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponseTransfer
69
     *
70
     * @return \Generated\Shared\Transfer\CheckoutResponseTransfer
71
     */
72
    public function postSaveHookExecute(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponseTransfer)
73
    {
74
        return $this->getFactory()
75
            ->createPostSaveHook()
76
            ->execute($quoteTransfer, $checkoutResponseTransfer);
77
    }
78
79
    /**
80
     * {@inheritDoc}
81
     *
82
     * @api
83
     *
84
     * @param \Orm\Zed\Sales\Persistence\SpySalesOrderItem[] $orderItems
85
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
86
     *
87
     * @return \Spryker\Shared\Kernel\Transfer\TransferInterface|array
88
     */
89
    public function authorizeCommandHandle(array $orderItems, OrderTransfer $orderTransfer)
90
    {
91
        return $this->getFactory()
92
            ->createAuthorizeCommandHandler()
93
            ->handle($orderItems, $orderTransfer);
94
    }
95
96
    /**
97
     * {@inheritDoc}
98
     *
99
     * @api
100
     *
101
     * @param \Orm\Zed\Sales\Persistence\SpySalesOrderItem[] $orderItems
102
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
103
     *
104
     * @return array|\Spryker\Shared\Kernel\Transfer\TransferInterface
105
     */
106
    public function cancelCommandHandle(array $orderItems, OrderTransfer $orderTransfer)
107
    {
108
        return $this->getFactory()
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFactory...rItems, $orderTransfer) returns the type Spryker\Shared\Kernel\Transfer\TransferInterface which is incompatible with the return type mandated by SprykerEco\Zed\Computop\...::cancelCommandHandle() of array.

In the issue above, the returned value is violating the contract defined by the mentioned interface.

Let's take a look at an example:

interface HasName {
    /** @return string */
    public function getName();
}

class Name {
    public $name;
}

class User implements HasName {
    /** @return string|Name */
    public function getName() {
        return new Name('foo'); // This is a violation of the ``HasName`` interface
                                // which only allows a string value to be returned.
    }
}
Loading history...
109
            ->createCancelCommandHandler()
110
            ->handle($orderItems, $orderTransfer);
111
    }
112
113
    /**
114
     * {@inheritDoc}
115
     *
116
     * @api
117
     *
118
     * @param \Orm\Zed\Sales\Persistence\SpySalesOrderItem[] $orderItems
119
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
120
     *
121
     * @return \Spryker\Shared\Kernel\Transfer\TransferInterface
122
     */
123
    public function captureCommandHandle(array $orderItems, OrderTransfer $orderTransfer)
124
    {
125
        return $this->getFactory()
126
            ->createCaptureCommandHandler()
127
            ->handle($orderItems, $orderTransfer);
128
    }
129
130
    /**
131
     * {@inheritDoc}
132
     *
133
     * @api
134
     *
135
     * @param \Orm\Zed\Sales\Persistence\SpySalesOrderItem[] $orderItems
136
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
137
     *
138
     * @return \Spryker\Shared\Kernel\Transfer\TransferInterface
139
     */
140
    public function refundCommandHandle(array $orderItems, OrderTransfer $orderTransfer)
141
    {
142
        return $this->getFactory()
143
            ->createRefundCommandHandler()
144
            ->handle($orderItems, $orderTransfer);
145
    }
146
147
    /**
148
     * {@inheritDoc}
149
     *
150
     * @api
151
     *
152
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
153
     *
154
     * @return \Generated\Shared\Transfer\QuoteTransfer
155
     */
156
    public function saveSofortInitResponse(QuoteTransfer $quoteTransfer)
157
    {
158
        return $this->getFactory()
159
            ->createSofortResponseSaver()
160
            ->save($quoteTransfer);
161
    }
162
163
    /**
164
     * {@inheritDoc}
165
     *
166
     * @api
167
     *
168
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
169
     *
170
     * @return \Generated\Shared\Transfer\QuoteTransfer
171
     */
172
    public function saveIdealInitResponse(QuoteTransfer $quoteTransfer)
173
    {
174
        return $this->getFactory()
175
            ->createIdealResponseSaver()
176
            ->save($quoteTransfer);
177
    }
178
179
    /**
180
     * {@inheritDoc}
181
     *
182
     * @api
183
     *
184
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
185
     *
186
     * @return \Generated\Shared\Transfer\QuoteTransfer
187
     */
188
    public function saveCreditCardInitResponse(QuoteTransfer $quoteTransfer)
189
    {
190
        return $this->getFactory()
191
            ->createCreditCardResponseSaver()
192
            ->save($quoteTransfer);
193
    }
194
195
    /**
196
     * {@inheritDoc}
197
     *
198
     * @api
199
     *
200
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
201
     *
202
     * @return \Generated\Shared\Transfer\QuoteTransfer
203
     */
204
    public function savePayNowInitResponse(QuoteTransfer $quoteTransfer)
205
    {
206
        return $this->getFactory()
207
            ->createPayNowResponseSaver()
208
            ->save($quoteTransfer);
209
    }
210
211
    /**
212
     * {@inheritDoc}
213
     *
214
     * @api
215
     *
216
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
217
     *
218
     * @return \Generated\Shared\Transfer\QuoteTransfer
219
     */
220
    public function savePayPalInitResponse(QuoteTransfer $quoteTransfer)
221
    {
222
        return $this->getFactory()
223
            ->createPayPalResponseSaver()
224
            ->save($quoteTransfer);
225
    }
226
227
    /**
228
     * {@inheritDoc}
229
     *
230
     * @api
231
     *
232
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
233
     *
234
     * @return \Generated\Shared\Transfer\QuoteTransfer
235
     */
236
    public function savePayPalExpressInitResponse(QuoteTransfer $quoteTransfer): QuoteTransfer
237
    {
238
        return $this->getFactory()
239
            ->createPayPalExpressResponseSaver()
240
            ->save($quoteTransfer);
241
    }
242
243
    /**
244
     * {@inheritDoc}
245
     *
246
     * @api
247
     *
248
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
249
     *
250
     * @return \Generated\Shared\Transfer\QuoteTransfer
251
     */
252
    public function savePayPalExpressCompleteResponse(QuoteTransfer $quoteTransfer): QuoteTransfer
253
    {
254
        return $this->getFactory()
255
            ->createPayPalExpressCompleteResponseSaver()
256
            ->save($quoteTransfer);
257
    }
258
259
    /**
260
     * {@inheritDoc}
261
     *
262
     * @api
263
     *
264
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
265
     *
266
     * @return \Generated\Shared\Transfer\QuoteTransfer
267
     */
268
    public function saveDirectDebitInitResponse(QuoteTransfer $quoteTransfer)
269
    {
270
        return $this->getFactory()
271
            ->createDirectDebitResponseSaver()
272
            ->save($quoteTransfer);
273
    }
274
275
    /**
276
     * {@inheritDoc}
277
     *
278
     * @api
279
     *
280
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
281
     *
282
     * @return \Generated\Shared\Transfer\QuoteTransfer
283
     */
284
    public function saveEasyCreditInitResponse(QuoteTransfer $quoteTransfer)
285
    {
286
        return $this->getFactory()
287
            ->createEasyCreditResponseSaver()
288
            ->save($quoteTransfer);
289
    }
290
291
    /**
292
     * {@inheritDoc}
293
     *
294
     * @api
295
     *
296
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
297
     *
298
     * @return \Generated\Shared\Transfer\QuoteTransfer
299
     */
300
    public function savePaydirektInitResponse(QuoteTransfer $quoteTransfer)
301
    {
302
        return $this->getFactory()
303
            ->createPaydirektResponseSaver()
304
            ->save($quoteTransfer);
305
    }
306
307
    /**
308
     * {@inheritDoc}
309
     *
310
     * @api
311
     *
312
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
313
     *
314
     * @return \Generated\Shared\Transfer\QuoteTransfer
315
     */
316
    public function savePayuCeeSingleInitResponse(QuoteTransfer $quoteTransfer): QuoteTransfer
317
    {
318
        return $this->getFactory()
319
            ->createPayuCeeSingleResponseSaver()
320
            ->save($quoteTransfer);
321
    }
322
323
    /**
324
     * {@inheritDoc}
325
     *
326
     * @api
327
     *
328
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
329
     *
330
     * @return \Generated\Shared\Transfer\QuoteTransfer|\Spryker\Shared\Kernel\Transfer\TransferInterface
331
     */
332
    public function easyCreditStatusApiCall(QuoteTransfer $quoteTransfer)
333
    {
334
        return $this->getFactory()
335
            ->createEasyCreditStatusHandler()
336
            ->handle($quoteTransfer);
337
    }
338
339
    /**
340
     * {@inheritDoc}
341
     *
342
     * @api
343
     *
344
     * @param \Orm\Zed\Sales\Persistence\SpySalesOrderItem[] $orderItems
345
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
346
     *
347
     * @return \Spryker\Shared\Kernel\Transfer\TransferInterface
348
     */
349
    public function easyCreditAuthorizeCommandHandle(array $orderItems, OrderTransfer $orderTransfer)
350
    {
351
        return $this->getFactory()
352
            ->createEasyCreditAuthorizeCommandHandler()
353
            ->handle($orderItems, $orderTransfer);
354
    }
355
356
    /**
357
     * {@inheritDoc}
358
     *
359
     * @api
360
     *
361
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
362
     *
363
     * @return \Generated\Shared\Transfer\QuoteTransfer
364
     */
365
    public function isComputopPaymentExist(QuoteTransfer $quoteTransfer)
366
    {
367
        return $this->getFactory()
368
            ->createPaymentReader()
369
            ->isComputopPaymentExist($quoteTransfer);
370
    }
371
372
    /**
373
     * {@inheritDoc}
374
     *
375
     * @api
376
     *
377
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
378
     *
379
     * @return \Generated\Shared\Transfer\QuoteTransfer
380
     */
381
    public function performCrifApiCall(QuoteTransfer $quoteTransfer)
382
    {
383
        return $this->getFactory()
384
            ->createCrifHandler()
385
            ->handle($quoteTransfer);
386
    }
387
388
    /**
389
     * {@inheritDoc}
390
     *
391
     * @api
392
     *
393
     * @param \Generated\Shared\Transfer\PaymentMethodsTransfer $paymentMethodsTransfer
394
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
395
     *
396
     * @return \Generated\Shared\Transfer\PaymentMethodsTransfer
397
     */
398
    public function filterPaymentMethods(PaymentMethodsTransfer $paymentMethodsTransfer, QuoteTransfer $quoteTransfer)
399
    {
400
        return $this->getFactory()
401
            ->createPaymentMethodFilter()
402
            ->filterPaymentMethods($paymentMethodsTransfer, $quoteTransfer);
403
    }
404
405
    /**
406
     * {@inheritDoc}
407
     *
408
     * @api
409
     *
410
     * @param \Generated\Shared\Transfer\PaymentMethodsTransfer $paymentMethodsTransfer
411
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
412
     *
413
     * @return \Generated\Shared\Transfer\PaymentMethodsTransfer
414
     */
415
    public function filterPaymentMethodsByCurrency(PaymentMethodsTransfer $paymentMethodsTransfer, QuoteTransfer $quoteTransfer): PaymentMethodsTransfer
416
    {
417
        return $this->getFactory()
418
            ->createPaymentMethodByCurrencyFilter()
419
            ->filterPaymentMethods($paymentMethodsTransfer, $quoteTransfer);
420
    }
421
422
    /**
423
     * {@inheritDoc}
424
     *
425
     * @api
426
     *
427
     * @param \Generated\Shared\Transfer\ComputopNotificationTransfer $computopNotificationTransfer
428
     *
429
     * @return \Generated\Shared\Transfer\ComputopNotificationTransfer
430
     */
431
    public function processNotification(
432
        ComputopNotificationTransfer $computopNotificationTransfer
433
    ): ComputopNotificationTransfer {
434
        return $this->getFactory()
435
            ->createNotificationProcessor()
436
            ->processNotification($computopNotificationTransfer);
437
    }
438
}
439