Passed
Pull Request — master (#29)
by Aleksey
08:31 queued 03:27
created

OrderAuthorizer::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
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\Order;
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\Handler\Transaction\AmazonpayTransactionInterface;
13
14
class OrderAuthorizer implements OrderAuthorizerInterface
15
{
16
    /**
17
     * @var \SprykerEco\Zed\AmazonPay\Business\Converter\AmazonPayConverterInterface
18
     */
19
    protected $converter;
20
21
    /**
22
     * @var \SprykerEco\Zed\AmazonPay\Business\Payment\Handler\Transaction\AmazonpayTransactionInterface
23
     */
24
    protected $transaction;
25
26
    /**
27
     * @param \SprykerEco\Zed\AmazonPay\Business\Converter\AmazonPayConverterInterface $converter
28
     * @param \SprykerEco\Zed\AmazonPay\Business\Payment\Handler\Transaction\AmazonpayTransactionInterface $transaction
29
     */
30
    public function __construct(AmazonPayConverterInterface $converter, AmazonpayTransactionInterface $transaction)
31
    {
32
        $this->converter = $converter;
33
        $this->transaction = $transaction;
34
    }
35
36
    /**
37
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
38
     *
39
     * @return \Generated\Shared\Transfer\QuoteTransfer
40
     */
41
    public function authorizeOrder(QuoteTransfer $quoteTransfer): QuoteTransfer
42
    {
43
        $amazonpayCallTransfer = $this->converter->mapToAmazonpayCallTransfer($quoteTransfer);
44
        $amazonpayCallTransfer = $this->transaction->execute($amazonpayCallTransfer);
45
46
        $quoteTransfer->fromArray($amazonpayCallTransfer->modifiedToArray(), true);
47
48
        return $quoteTransfer;
49
    }
50
}
51