Passed
Pull Request — master (#45)
by
unknown
03:36
created

ComputopPayPalExpressPrepareAggregator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A aggregate() 0 8 1
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\Handler\ExpressCheckout;
9
10
use Generated\Shared\Transfer\ComputopApiPayPalExpressPrepareResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...PrepareResponseTransfer 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\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface;
13
use SprykerEco\Yves\Computop\Dependency\Client\ComputopToComputopApiClientInterface;
14
use SprykerEco\Yves\Computop\Dependency\Client\ComputopToQuoteClientInterface;
15
16
class ComputopPayPalExpressPrepareAggregator implements ComputopPayPalExpressPrepareAggregatorInterface
17
{
18
    /**
19
     * @var \SprykerEco\Yves\Computop\Dependency\Client\ComputopToQuoteClientInterface
20
     */
21
    protected $quoteClient;
22
23
    /**
24
     * @var \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface
25
     */
26
    protected $stepEngineFormDataProvider;
27
28
    /**
29
     * @var \SprykerEco\Yves\Computop\Dependency\Client\ComputopToComputopApiClientInterface
30
     */
31
    protected $computopApiClient;
32
33
    /**
34
     * @param \SprykerEco\Yves\Computop\Dependency\Client\ComputopToQuoteClientInterface $quoteClient
35
     * @param \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface $stepEngineFormDataProvider
36
     * @param \SprykerEco\Yves\Computop\Dependency\Client\ComputopToComputopApiClientInterface $computopApiClient
37
     */
38
    public function __construct(
39
        ComputopToQuoteClientInterface $quoteClient,
40
        StepEngineFormDataProviderInterface $stepEngineFormDataProvider,
41
        ComputopToComputopApiClientInterface $computopApiClient
42
    ) {
43
        $this->quoteClient = $quoteClient;
44
        $this->stepEngineFormDataProvider = $stepEngineFormDataProvider;
45
        $this->computopApiClient = $computopApiClient;
46
    }
47
48
    /**
49
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
50
     *
51
     * @return \Generated\Shared\Transfer\ComputopApiPayPalExpressPrepareResponseTransfer
52
     */
53
    public function aggregate(QuoteTransfer $quoteTransfer): ComputopApiPayPalExpressPrepareResponseTransfer
54
    {
55
        $quoteTransfer = $this->stepEngineFormDataProvider->getData($quoteTransfer);
56
        $quoteTransfer = $this->computopApiClient->sendPayPalExpressPrepareRequest($quoteTransfer);
57
58
        $this->quoteClient->setQuote($quoteTransfer);
59
60
        return $quoteTransfer->getPayment()->getComputopPayPalExpress()->getPayPalExpressPrepareResponse();
61
    }
62
}
63