Passed
Push — dev ( 42c835...626c44 )
by Aleksey
05:26
created

RegistrationToQuoteHydrator::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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\Yves\Heidelpay\Hydrator;
9
10
use Generated\Shared\Transfer\HeidelpayCreditCardRegistrationTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...ardRegistrationTransfer 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;
1 ignored issue
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 SprykerEco\Shared\Heidelpay\HeidelpayConfig;
13
use SprykerEco\Yves\Heidelpay\Handler\HeidelpayHandlerInterface;
14
15
class RegistrationToQuoteHydrator implements RegistrationToQuoteHydratorInterface
16
{
17
    /**
18
     * @var \SprykerEco\Yves\Heidelpay\Handler\HeidelpayHandlerInterface
19
     */
20
    private $heidelpayPaymentHandler;
21
22
    /**
23
     * @param \SprykerEco\Yves\Heidelpay\Handler\HeidelpayHandlerInterface $heidelpayPaymentHandler
24
     */
25
    public function __construct(HeidelpayHandlerInterface $heidelpayPaymentHandler)
26
    {
27
        $this->heidelpayPaymentHandler = $heidelpayPaymentHandler;
28
    }
29
30
    /**
31
     * @param \Generated\Shared\Transfer\HeidelpayCreditCardRegistrationTransfer $registrationTransfer
32
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
33
     *
34
     * @return void
35
     */
36
    public function hydrateCreditCardRegistrationToQuote(
37
        HeidelpayCreditCardRegistrationTransfer $registrationTransfer,
38
        QuoteTransfer $quoteTransfer
39
    ): void {
40
41
        $paymentTransfer = $quoteTransfer->requirePayment()->getPayment();
42
        $paymentTransfer->setPaymentSelection(HeidelpayConfig::PAYMENT_METHOD_CREDIT_CARD_SECURE);
43
44
        $paymentTransfer
45
            ->requireHeidelpayCreditCardSecure()
46
            ->getHeidelpayCreditCardSecure()
47
            ->setSelectedRegistration($registrationTransfer)
48
            ->setSelectedPaymentOption(HeidelpayConfig::PAYMENT_OPTION_NEW_REGISTRATION);
49
50
        $quoteTransfer->setPayment($paymentTransfer);
51
52
        $this->heidelpayPaymentHandler->addPaymentToQuote($quoteTransfer);
53
    }
54
}
55