Passed
Pull Request — master (#33)
by Aleksey
09:12 queued 01:09
created

ComputopCreditCardInitStep   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 13
c 1
b 0
f 0
dl 0
loc 42
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getTemplateVariables() 0 8 1
A postCondition() 0 3 1
A requireInput() 0 10 3
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\Yves\Computop\CheckoutPage\Process\Steps;
9
10
use Spryker\Shared\Kernel\Transfer\AbstractTransfer;
11
use SprykerEco\Shared\Computop\ComputopConfig;
12
use SprykerShop\Yves\CheckoutPage\Process\Steps\AbstractBaseStep;
13
14
class ComputopCreditCardInitStep extends AbstractBaseStep
15
{
16
    /**
17
     * @param \Generated\Shared\Transfer\QuoteTransfer $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...
18
     *
19
     * @return bool
20
     */
21
    public function requireInput(AbstractTransfer $quoteTransfer): bool
22
    {
23
        if (
24
            !$quoteTransfer->getPayment()
0 ignored issues
show
Bug introduced by
The method getPayment() does not exist on Spryker\Shared\Kernel\Transfer\AbstractTransfer. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
            !$quoteTransfer->/** @scrutinizer ignore-call */ getPayment()

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
25
            || $quoteTransfer->getPayment()->getPaymentSelection() !== ComputopConfig::PAYMENT_METHOD_CREDIT_CARD
26
        ) {
27
            return false;
28
        }
29
30
        return true;
31
    }
32
33
    /**
34
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
35
     *
36
     * @return bool
37
     */
38
    public function postCondition(AbstractTransfer $quoteTransfer): bool
39
    {
40
        return true;
41
    }
42
43
    /**
44
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
45
     *
46
     * @return array
47
     */
48
    public function getTemplateVariables(AbstractTransfer $quoteTransfer): array
49
    {
50
        return [
51
            'formAction' => $quoteTransfer->getPayment()->getComputopCreditCard()->getUrl(),
52
            'encryptedData' => $quoteTransfer->getPayment()->getComputopCreditCard()->getData(),
53
            'encryptedDataLength' => $quoteTransfer->getPayment()->getComputopCreditCard()->getLen(),
54
            'merchantId' => $quoteTransfer->getPayment()->getComputopCreditCard()->getMerchantId(),
55
            'urlBack' => $quoteTransfer->getPayment()->getComputopCreditCard()->getUrlBack(),
56
        ];
57
    }
58
}
59