Passed
Pull Request — master (#4)
by Aleksey
08:30
created

FinishOmsCommandRequestBuilder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 40
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A buildRequestTransfer() 0 7 1
A createFinishRequestTransfer() 0 6 1
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\CrefoPay\Business\Oms\Command\Builder;
9
10
use Generated\Shared\Transfer\CrefoPayApiFinishRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...piFinishRequestTransfer 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\CrefoPayApiRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...foPayApiRequestTransfer 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\CrefoPayOmsCommandTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...foPayOmsCommandTransfer 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\Zed\CrefoPay\CrefoPayConfig;
14
15
class FinishOmsCommandRequestBuilder implements CrefoPayOmsCommandRequestBuilderInterface
16
{
17
    /**
18
     * @var \SprykerEco\Zed\CrefoPay\CrefoPayConfig
19
     */
20
    protected $config;
21
22
    /**
23
     * @param \SprykerEco\Zed\CrefoPay\CrefoPayConfig $config
24
     */
25
    public function __construct(CrefoPayConfig $config)
26
    {
27
        $this->config = $config;
28
    }
29
30
    /**
31
     * @param \Generated\Shared\Transfer\CrefoPayOmsCommandTransfer $crefoPayOmsCommandTransfer
32
     *
33
     * @return \Generated\Shared\Transfer\CrefoPayOmsCommandTransfer
34
     */
35
    public function buildRequestTransfer(CrefoPayOmsCommandTransfer $crefoPayOmsCommandTransfer): CrefoPayOmsCommandTransfer
36
    {
37
        $requestTransfer = (new CrefoPayApiRequestTransfer())
38
            ->setFinishRequest($this->createFinishRequestTransfer($crefoPayOmsCommandTransfer));
39
40
        return $crefoPayOmsCommandTransfer
41
            ->setRequest($requestTransfer);
42
    }
43
44
    /**
45
     * @param \Generated\Shared\Transfer\CrefoPayOmsCommandTransfer $crefoPayOmsCommandTransfer
46
     *
47
     * @return \Generated\Shared\Transfer\CrefoPayApiFinishRequestTransfer
48
     */
49
    protected function createFinishRequestTransfer(CrefoPayOmsCommandTransfer $crefoPayOmsCommandTransfer): CrefoPayApiFinishRequestTransfer
50
    {
51
        return (new CrefoPayApiFinishRequestTransfer())
52
            ->setMerchantID($this->config->getMerchantId())
53
            ->setStoreID($this->config->getStoreId())
54
            ->setOrderID($crefoPayOmsCommandTransfer->getPaymentCrefoPay()->getCrefoPayOrderId());
55
    }
56
}
57