OrderHeadMapper::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 4
dl 0
loc 11
rs 10
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\Ratepay\Business\Api\Mapper;
9
10
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...
11
use Generated\Shared\Transfer\RatepayRequestHeadTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...epayRequestHeadTransfer 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\RatepayRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\RatepayRequestTransfer 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 Orm\Zed\Ratepay\Persistence\SpyPaymentRatepay;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Ratepay\Persistence\SpyPaymentRatepay 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 SprykerEco\Zed\Ratepay\RatepayConfig;
15
16
class OrderHeadMapper extends BaseMapper
17
{
18
    /**
19
     * @var \Generated\Shared\Transfer\OrderTransfer
20
     */
21
    protected $orderTransfer;
22
23
    /**
24
     * @var \Orm\Zed\Ratepay\Persistence\SpyPaymentRatepay
25
     */
26
    protected $paymentData;
27
28
    /**
29
     * @var \SprykerEco\Zed\Ratepay\RatepayConfig
30
     */
31
    protected $config;
32
33
    /**
34
     * @var \Generated\Shared\Transfer\RatepayRequestTransfer
35
     */
36
    protected $requestTransfer;
37
38
    /**
39
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
40
     * @param \Orm\Zed\Ratepay\Persistence\SpyPaymentRatepay $paymentData
41
     * @param \SprykerEco\Zed\Ratepay\RatepayConfig $config
42
     * @param \Generated\Shared\Transfer\RatepayRequestTransfer $requestTransfer
43
     */
44
    public function __construct(
45
        OrderTransfer $orderTransfer,
46
        SpyPaymentRatepay $paymentData,
47
        RatepayConfig $config,
48
        RatepayRequestTransfer $requestTransfer
49
    ) {
50
51
        $this->orderTransfer = $orderTransfer;
52
        $this->paymentData = $paymentData;
53
        $this->config = $config;
54
        $this->requestTransfer = $requestTransfer;
55
    }
56
57
    /**
58
     * @return void
59
     */
60
    public function map()
61
    {
62
        $this->requestTransfer->setHead(new RatepayRequestHeadTransfer())->getHead()
63
            ->setTransactionId($this->paymentData->getTransactionId())
64
            ->setTransactionShortId($this->paymentData->getTransactionShortId())
65
66
            ->setOrderId($this->orderTransfer->getIdSalesOrder())
67
            ->setExternalOrderId($this->orderTransfer->getOrderReference())
68
69
            ->setSystemId($this->config->getSystemId())
70
            ->setProfileId($this->config->getProfileId())
71
            ->setSecurityCode($this->config->getSecurityCode());
72
    }
73
}
74