Passed
Pull Request — dev (#9)
by Andrey
07:03 queued 03:30
created

AbstractAdapter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getAmount() 0 4 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\Api\Adapter;
9
10
use Generated\Shared\Transfer\AmazonpayCallTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfer\AmazonpayCallTransfer 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 PayWithAmazon\ClientInterface;
12
use SprykerEco\Zed\AmazonPay\Business\Api\Converter\ResponseParserConverterInterface;
13
use SprykerEco\Zed\AmazonPay\Dependency\Facade\AmazonPayToMoneyInterface;
14
15
abstract class AbstractAdapter implements CallAdapterInterface
16
{
17
    const AMAZON_AUTHORIZATION_ID = 'amazon_authorization_id';
18
    const AMAZON_ORDER_REFERENCE_ID = 'amazon_order_reference_id';
19
    const AMAZON_ADDRESS_CONSENT_TOKEN = 'address_consent_token';
20
    const AMAZON_AMOUNT = 'amount';
21
    const AMAZON_CAPTURE_ID = 'amazon_capture_id';
22
    const AMAZON_REFUND_ID = 'amazon_refund_id';
23
24
    /**
25
     * @var \PayWithAmazon\ClientInterface
26
     */
27
    protected $client;
28
29
    /**
30
     * @var \SprykerEco\Zed\AmazonPay\Dependency\Facade\AmazonPayToMoneyInterface
31
     */
32
    protected $moneyFacade;
33
34
    /**
35
     * @var \SprykerEco\Zed\AmazonPay\Business\Api\Converter\ResponseParserConverterInterface
36
     */
37
    protected $converter;
38
39
    /**
40
     * @param \PayWithAmazon\ClientInterface $client
41
     * @param \SprykerEco\Zed\AmazonPay\Business\Api\Converter\ResponseParserConverterInterface $converter
42
     * @param \SprykerEco\Zed\AmazonPay\Dependency\Facade\AmazonPayToMoneyInterface $moneyFacade
43
     */
44
    public function __construct(
45
        ClientInterface $client,
46
        ResponseParserConverterInterface $converter,
47
        AmazonPayToMoneyInterface $moneyFacade
48
    ) {
49
        $this->client = $client;
50
        $this->converter = $converter;
51
        $this->moneyFacade = $moneyFacade;
52
    }
53
54
    /**
55
     * @param \Generated\Shared\Transfer\AmazonpayCallTransfer $amazonpayCallTransfer
56
     *
57
     * @return float
58
     */
59
    protected function getAmount(AmazonpayCallTransfer $amazonpayCallTransfer)
60
    {
61
        return $this->moneyFacade->convertIntegerToDecimal(
62
            $amazonpayCallTransfer->getRequestedAmount()
63
        );
64
    }
65
}
66