Completed
Push — feature/eco-3656/eco-3658-enab... ( 16d9cc...e5c4c7 )
by
unknown
03:57
created

ComputopPayPalExpressPrepareHandler::fillQuoteWithDummyData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 12
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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\Service\ComputopApi\ComputopApiServiceInterface;
14
use SprykerEco\Yves\Computop\ComputopConfigInterface;
15
use SprykerEco\Yves\Computop\Dependency\Client\ComputopToComputopApiClientInterface;
16
use SprykerEco\Yves\Computop\Dependency\Client\ComputopToQuoteClientInterface;
17
18
class ComputopPayPalExpressPrepareHandler implements ComputopPayPalExpressPrepareHandlerInterface
19
{
20
    /**
21
     * @var \Spryker\Client\Quote\QuoteClientInterface
22
     */
23
    protected $quoteClient;
24
25
    /**
26
     * @var \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface
27
     */
28
    protected $stepEngineFormDataProvider;
29
30
    /**
31
     * @var \SprykerEco\Yves\Computop\Dependency\Client\ComputopToComputopApiClientInterface
32
     */
33
    protected $computopApiClient;
34
35
    /**
36
     * @var \SprykerEco\Service\ComputopApi\ComputopApiServiceInterface
37
     */
38
    protected $computopApiService;
39
40
    /**
41
     * @var \SprykerEco\Yves\Computop\ComputopConfigInterface
42
     */
43
    protected $computopConfig;
44
45
    public function __construct(
46
        ComputopToQuoteClientInterface $quoteClient,
47
        StepEngineFormDataProviderInterface $stepEngineFormDataProvider,
48
        ComputopToComputopApiClientInterface $computopApiClient,
49
        ComputopApiServiceInterface $computopApiService,
50
        ComputopConfigInterface $computopConfig
51
    ) {
52
        $this->quoteClient = $quoteClient;
0 ignored issues
show
Documentation Bug introduced by
It seems like $quoteClient of type SprykerEco\Yves\Computop...pToQuoteClientInterface is incompatible with the declared type Spryker\Client\Quote\QuoteClientInterface of property $quoteClient.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
53
        $this->stepEngineFormDataProvider = $stepEngineFormDataProvider;
54
        $this->computopApiClient = $computopApiClient;
55
        $this->computopApiService = $computopApiService;
56
        $this->computopConfig = $computopConfig;
57
    }
58
59
60
    /**
61
     * @param QuoteTransfer $quoteTransfer
62
     *
63
     * @return \Generated\Shared\Transfer\ComputopApiPayPalExpressPrepareResponseTransfer
64
     */
65
    public function handle(QuoteTransfer $quoteTransfer): ComputopApiPayPalExpressPrepareResponseTransfer
66
    {
67
        $quoteTransfer = $this->stepEngineFormDataProvider->getData($quoteTransfer);
68
        $quoteTransfer = $this->computopApiClient->sendPayPalExpressPrepareRequest($quoteTransfer);
69
70
        $this->quoteClient->setQuote($quoteTransfer);
71
72
        return $quoteTransfer->getPayment()->getComputopPayPalExpress()->getPayPalExpressPrepareResponse();
73
    }
74
}
75