Passed
Pull Request — master (#44)
by Michael
12:11 queued 07:57
created

ComputopPayPalExpressCompleteAggregator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A aggregate() 0 7 1
A __construct() 0 6 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\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...
11
use SprykerEco\Client\Computop\ComputopClientInterface;
12
use SprykerEco\Yves\Computop\Dependency\Client\ComputopToComputopApiClientInterface;
13
14
class ComputopPayPalExpressCompleteAggregator implements ComputopPayPalExpressCompleteAggregatorInterface
15
{
16
    /**
17
     * @var \SprykerEco\Yves\Computop\Dependency\Client\ComputopToComputopApiClientInterface
18
     */
19
    protected $computopApiClient;
20
21
    /**
22
     * @var \SprykerEco\Client\Computop\ComputopClientInterface
23
     */
24
    protected $computopClient;
25
26
    /**
27
     * @param \SprykerEco\Yves\Computop\Dependency\Client\ComputopToComputopApiClientInterface $computopApiClient
28
     * @param \SprykerEco\Client\Computop\ComputopClientInterface $computopClient
29
     */
30
    public function __construct(
31
        ComputopToComputopApiClientInterface $computopApiClient,
32
        ComputopClientInterface $computopClient
33
    ) {
34
        $this->computopApiClient = $computopApiClient;
35
        $this->computopClient = $computopClient;
36
    }
37
38
    /**
39
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
40
     *
41
     * @return \Generated\Shared\Transfer\QuoteTransfer
42
     */
43
    public function aggregate(QuoteTransfer $quoteTransfer): QuoteTransfer
44
    {
45
        $quoteTransfer = $this->computopApiClient->sendPayPalExpressCompleteRequest($quoteTransfer);
46
        $quoteTransfer = $this->computopClient->savePayPalExpressInitResponse($quoteTransfer);
47
        $quoteTransfer = $this->computopClient->savePayPalExpressCompleteResponse($quoteTransfer);
48
49
        return $quoteTransfer;
50
    }
51
}
52