Completed
Pull Request — master (#4)
by Andrey
10:46 queued 03:14
created

TransactionCollection   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A execute() 0 7 1
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;
11
use SprykerEco\Zed\Amazonpay\Business\Converter\AmazonpayConverterInterface;
12
13
class TransactionCollection extends AbstractTransactionCollection implements TransactionCollectionInterface
14
{
15
16
    /**
17
     * @var \SprykerEco\Zed\Amazonpay\Business\Converter\AmazonpayConverterInterface
18
     */
19
    protected $converter;
20
21
    /**
22
     * @param \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\AmazonpayTransactionInterface[] $transactionHandlers
23
     * @param \SprykerEco\Zed\Amazonpay\Business\Converter\AmazonpayConverterInterface $converter
24
     */
25
    public function __construct(
26
        array $transactionHandlers,
27
        AmazonpayConverterInterface $converter
28
    ) {
29
        parent::__construct($transactionHandlers);
30
31
        $this->converter = $converter;
32
    }
33
34
    /**
35
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
36
     *
37
     * @return \Generated\Shared\Transfer\QuoteTransfer
38
     */
39
    public function execute(QuoteTransfer $quoteTransfer)
40
    {
41
        $amazonpayCallTransfer = $this->converter->mapToAmazonpayCallTransfer($quoteTransfer);
42
        $amazonpayCallTransfer = $this->executeHandlers($amazonpayCallTransfer);
43
        $quoteTransfer->fromArray($amazonpayCallTransfer->modifiedToArray(), true);
44
45
        return $quoteTransfer;
46
    }
47
48
}
49