Test Setup Failed
Pull Request — master (#11)
by
unknown
32:32
created

SoapApiAdapter::getRequestOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
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\ArvatoRss\Business\Api\Adapter;
9
10
use Generated\Shared\Transfer\ArvatoRssRiskCheckRequestTransfer;
11
use Generated\Shared\Transfer\ArvatoRssRiskCheckResponseTransfer;
12
use Generated\Shared\Transfer\ArvatoRssStoreOrderRequestTransfer;
13
use Generated\Shared\Transfer\ArvatoRssStoreOrderResponseTransfer;
14
use SprykerEco\Zed\ArvatoRss\Business\Api\Exception\ArvatoRssRiskCheckApiException;
15
use SprykerEco\Zed\ArvatoRss\Business\Api\Exception\ArvatoRssStoreOrderApiException;
16
17
class SoapApiAdapter implements ApiAdapterInterface
18
{
19
    const WSDL_PATH = __DIR__ . "/../Etc/risk-solution-services.v2.1.wsdl";
20
21
    /**
22
     * @var \SprykerEco\Zed\ArvatoRss\Business\Api\Adapter\AdapterFactoryInterface
23
     */
24
    protected $adapterFactory;
25
26
    /**
27
     * @param \SprykerEco\Zed\ArvatoRss\Business\Api\Adapter\AdapterFactoryInterface $adapterFactory
28
     */
29
    public function __construct(
30
        AdapterFactoryInterface $adapterFactory
31
    ) {
32
        $this->adapterFactory = $adapterFactory;
33
    }
34
35
    /**
36
     * @param \Generated\Shared\Transfer\ArvatoRssRiskCheckRequestTransfer $requestTransfer
37
     *
38
     * @return \Generated\Shared\Transfer\ArvatoRssRiskCheckResponseTransfer
39
     */
40 View Code Duplication
    public function performRiskCheck(ArvatoRssRiskCheckRequestTransfer $requestTransfer)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
41
    {
42
        $params = $this->adapterFactory
43
            ->createRiskCheckRequestConverter()
44
            ->convert($requestTransfer);
45
        try {
46
            $result = $this->adapterFactory
47
                ->createRiskCheckCall()
48
                ->execute(
49
                    $requestTransfer->getIdentification(),
50
                    $params
51
                );
52
        } catch (ArvatoRssRiskCheckApiException $exception) {
53
            $responseTransfer = new ArvatoRssRiskCheckResponseTransfer();
54
            $responseTransfer->setIsError(true);
55
            $responseTransfer->setErrorMessage($exception->getMessage());
56
            return $responseTransfer;
57
        }
58
59
        return $this->adapterFactory->createRiskCheckResponseConverter()->convert($result);
60
    }
61
62
    /**
63
     * @param \Generated\Shared\Transfer\ArvatoRssStoreOrderRequestTransfer $requestTransfer
64
     *
65
     * @return \Generated\Shared\Transfer\ArvatoRssStoreOrderResponseTransfer
66
     */
67 View Code Duplication
    public function storeOrder(ArvatoRssStoreOrderRequestTransfer $requestTransfer)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
68
    {
69
        $params = $this->adapterFactory
70
            ->createStoreOrderRequestConverter()
71
            ->convert($requestTransfer);
72
        try {
73
            $result = $this->adapterFactory
74
                ->createStoreOrderCall()
75
                ->execute(
76
                    $requestTransfer->getIdentification(),
77
                    $params
78
                );
79
        } catch (ArvatoRssStoreOrderApiException $exception) {
80
            $responseTransfer = new ArvatoRssStoreOrderResponseTransfer();
81
            $responseTransfer->setIsError(true);
82
            $responseTransfer->setErrorMessage($exception->getMessage());
83
84
            return $responseTransfer;
85
        }
86
87
        return $this->adapterFactory->createStoreOrderResponseConverter()->convert($result);
88
    }
89
}
90