Passed
Pull Request — feature/eco-3623-payone-pay-u-... (#39)
by
unknown
08:17
created

AbstractMapper::getActionUrl()   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
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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\Hook\Mapper\Init;
9
10
use Generated\Shared\Transfer\ComputopApiRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...putopApiRequestTransfer 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\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...
12
use Spryker\Shared\Kernel\Transfer\TransferInterface;
13
use SprykerEco\Service\ComputopApi\ComputopApiServiceInterface;
14
use SprykerEco\Shared\Computop\Config\ComputopApiConfig;
15
use SprykerEco\Zed\Computop\ComputopConfig;
16
17
abstract class AbstractMapper implements InitMapperInterface
18
{
19
    /**
20
     * @var \SprykerEco\Zed\Computop\ComputopConfig
21
     */
22
    protected $config;
23
24
    /**
25
     * @var \SprykerEco\Service\ComputopApi\ComputopApiServiceInterface
26
     */
27
    protected $computopApiService;
28
29
    /**
30
     * @param \SprykerEco\Zed\Computop\ComputopConfig $config
31
     * @param \SprykerEco\Service\ComputopApi\ComputopApiServiceInterface $computopApiService
32
     */
33
    public function __construct(
34
        ComputopConfig $config,
35
        ComputopApiServiceInterface $computopApiService
36
    ) {
37
        $this->config = $config;
38
        $this->computopApiService = $computopApiService;
39
    }
40
41
    /**
42
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
43
     * @param \Spryker\Shared\Kernel\Transfer\TransferInterface $computopPaymentTransfer
44
     *
45
     * @return \Spryker\Shared\Kernel\Transfer\TransferInterface
46
     */
47
    public function updateComputopPaymentTransfer(QuoteTransfer $quoteTransfer, TransferInterface $computopPaymentTransfer)
48
    {
49
        $computopPaymentTransfer->setRefNr($quoteTransfer->getOrderReference());
0 ignored issues
show
Bug introduced by
The method setRefNr() does not exist on Spryker\Shared\Kernel\Transfer\TransferInterface. ( Ignorable by Annotation )

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

49
        $computopPaymentTransfer->/** @scrutinizer ignore-call */ 
50
                                  setRefNr($quoteTransfer->getOrderReference());

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...
50
51
        return $computopPaymentTransfer;
52
    }
53
54
    /**
55
     * @param string $actionUrl
56
     * @param string $merchantId
57
     * @param string $data
58
     * @param int $length
59
     *
60
     * @return string
61
     */
62
    protected function getUrlToComputop(string $actionUrl, string $merchantId, string $data, int $length)
63
    {
64
        return $actionUrl . '?' . http_build_query([
65
                ComputopApiConfig::MERCHANT_ID => $merchantId,
66
                ComputopApiConfig::DATA => $data,
67
                ComputopApiConfig::LENGTH => $length,
68
            ]);
69
    }
70
71
    /**
72
     * @param \Spryker\Shared\Kernel\Transfer\TransferInterface $computopPaymentTransfer
73
     *
74
     * @return \Generated\Shared\Transfer\ComputopApiRequestTransfer
75
     */
76
    protected function createRequestTransfer(TransferInterface $computopPaymentTransfer)
77
    {
78
        return (new ComputopApiRequestTransfer())
79
            ->fromArray($computopPaymentTransfer->toArray(), true);
80
    }
81
}
82