Passed
Pull Request — dev (#9)
by Andrey
07:45 queued 04:11
created

RefundOrderAdapter   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A call() 0 22 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
12
class RefundOrderAdapter extends AbstractAdapter
13
{
14
    const REFUND_REFERENCE_ID = 'refund_reference_id';
15
    const REFUND_AMOUNT = 'refund_amount';
16
17
    /**
18
     * @param \Generated\Shared\Transfer\AmazonpayCallTransfer $amazonpayCallTransfer
19
     *
20
     * @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...
21
     */
22
    public function call(AmazonpayCallTransfer $amazonpayCallTransfer)
23
    {
24
        $refundAmount = $this->moneyFacade->convertIntegerToDecimal(
25
            $amazonpayCallTransfer->getRequestedAmount()
26
        );
27
28
        $result = $this->client->refund([
29
            static::AMAZON_ORDER_REFERENCE_ID => $amazonpayCallTransfer->getAmazonpayPayment()->getOrderReferenceId(),
30
            static::AMAZON_CAPTURE_ID =>
31
                $amazonpayCallTransfer
32
                    ->getAmazonpayPayment()
33
                    ->getCaptureDetails()
34
                    ->getAmazonCaptureId(),
35
            static::REFUND_REFERENCE_ID =>
36
                $amazonpayCallTransfer
37
                    ->getAmazonpayPayment()
38
                    ->getRefundDetails()
39
                    ->getRefundReferenceId(),
40
            static::REFUND_AMOUNT => $refundAmount,
41
        ]);
42
43
        return $this->converter->convert($result);
44
    }
45
}
46