Passed
Pull Request — master (#29)
by Volodymyr
09:56 queued 04:02
created

ConfirmQuoteReferenceAdapter::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 4
dl 0
loc 9
rs 10
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 AmazonPay\ClientInterface;
11
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...
12
use SprykerEco\Shared\AmazonPay\AmazonPayConfig;
13
use SprykerEco\Zed\AmazonPay\Business\Api\Converter\ResponseParserConverterInterface;
14
use SprykerEco\Zed\AmazonPay\Dependency\Facade\AmazonPayToMoneyInterface;
15
16
class ConfirmQuoteReferenceAdapter extends AbstractAdapter
17
{
18
    /**
19
     * @var \SprykerEco\Shared\AmazonPay\AmazonPayConfig
20
     */
21
    protected $sharedConfig;
22
23
    /**
24
     * @param \AmazonPay\ClientInterface $client
25
     * @param \SprykerEco\Zed\AmazonPay\Business\Api\Converter\ResponseParserConverterInterface $converter
26
     * @param \SprykerEco\Zed\AmazonPay\Dependency\Facade\AmazonPayToMoneyInterface $moneyFacade
27
     * @param \SprykerEco\Shared\AmazonPay\AmazonPayConfig $sharedConfig
28
     */
29
    public function __construct(
30
        ClientInterface $client,
31
        ResponseParserConverterInterface $converter,
32
        AmazonPayToMoneyInterface $moneyFacade,
33
        AmazonPayConfig $sharedConfig
34
    ) {
35
        $this->sharedConfig = $sharedConfig;
36
37
        parent::__construct($client, $converter, $moneyFacade);
38
    }
39
40
    /**
41
     * @param \Generated\Shared\Transfer\AmazonpayCallTransfer $amazonpayCallTransfer
42
     *
43
     * @return \Generated\Shared\Transfer\AmazonpayResponseTransfer
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...azonpayResponseTransfer 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...
44
     */
45
    public function call(AmazonpayCallTransfer $amazonpayCallTransfer)
46
    {
47
        $result = $this->client->confirmOrderReference([
48
            AbstractAdapter::AMAZON_ORDER_REFERENCE_ID => $amazonpayCallTransfer->getAmazonpayPayment()->getOrderReferenceId(),
49
            AbstractAdapter::AMAZON_AMOUNT => $this->getAmount($amazonpayCallTransfer),
50
            AbstractAdapter::AMAZON_SUCCESS_URL => $this->sharedConfig->getSuccessPaymentUrl(),
51
            AbstractAdapter::AMAZON_FAILURE_URL => $this->sharedConfig->getFailurePaymentUrl(),
52
        ]);
53
54
        return $this->converter->convert($result);
55
    }
56
}
57