Passed
Push — feature/eco-2635-amazon-psd2-a... ( e3557f...8790e7 )
by Volodymyr
04:26
created

__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 8
rs 10
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * Apache OSL-2
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\AmazonPay\Business\Payment\Handler\Transaction;
9
10
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...
11
use SprykerEco\Zed\AmazonPay\Business\Converter\AmazonPayConverterInterface;
12
use SprykerEco\Zed\AmazonPay\Business\Payment\Writer\AmazonpayPaymentWriterInterface;
13
14
class ConfirmPurchaseTransactionCollection extends AbstractTransactionCollection implements TransactionCollectionInterface
15
{
16
    /**
17
     * @var \SprykerEco\Zed\AmazonPay\Business\Converter\AmazonPayConverterInterface
18
     */
19
    protected $converter;
20
21
    /**
22
     * @var AmazonpayPaymentWriterInterface
23
     */
24
    protected $amazonpayPaymentSaver;
25
26
    /**
27
     * @param \SprykerEco\Zed\AmazonPay\Business\Payment\Handler\Transaction\AmazonpayTransactionInterface[] $transactionHandlers
28
     * @param \SprykerEco\Zed\AmazonPay\Business\Converter\AmazonPayConverterInterface $converter
29
     * @param AmazonpayPaymentWriterInterface $amazonpayPaymentSaver
30
     */
31
    public function __construct(
32
        array $transactionHandlers,
33
        AmazonPayConverterInterface $converter,
34
        AmazonpayPaymentWriterInterface $amazonpayPaymentSaver
35
    ) {
36
        parent::__construct($transactionHandlers);
37
        $this->converter = $converter;
38
        $this->amazonpayPaymentSaver = $amazonpayPaymentSaver;
39
    }
40
41
    /**
42
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
43
     *
44
     * @return \Generated\Shared\Transfer\QuoteTransfer
45
     */
46
    public function execute(QuoteTransfer $quoteTransfer): QuoteTransfer
47
    {
48
        $amazonpayCallTransfer = $this->converter->mapToAmazonpayCallTransfer($quoteTransfer);
49
        $amazonpayCallTransfer = $this->executeHandlers($amazonpayCallTransfer);
50
        $quoteTransfer->fromArray($amazonpayCallTransfer->modifiedToArray(), true);
51
52
        $this->amazonpayPaymentSaver->writerConfirmedAmazonPayPayment($quoteTransfer->getAmazonpayPayment());
53
54
        return $quoteTransfer;
55
    }
56
}
57