CaptureOrderAdapter   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A call() 0 15 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;
11
12
class CaptureOrderAdapter extends AbstractAdapter
13
{
14
    public const CAPTURE_REFERENCE_ID = 'capture_reference_id';
15
    public const CAPTURE_AMOUNT = 'capture_amount';
16
17
    /**
18
     * @param \Generated\Shared\Transfer\AmazonpayCallTransfer $amazonpayCallTransfer
19
     *
20
     * @return \Generated\Shared\Transfer\AmazonpayResponseTransfer
21
     */
22
    public function call(AmazonpayCallTransfer $amazonpayCallTransfer)
23
    {
24
        $result = $this->client->capture([
25
            static::AMAZON_AUTHORIZATION_ID =>
26
                $amazonpayCallTransfer->getAmazonpayPayment()
27
                    ->getAuthorizationDetails()
28
                    ->getAmazonAuthorizationId(),
29
            static::CAPTURE_REFERENCE_ID =>
30
                $amazonpayCallTransfer->getAmazonpayPayment()
31
                    ->getCaptureDetails()
32
                    ->getCaptureReferenceId(),
33
            static::CAPTURE_AMOUNT => $this->getAmount($amazonpayCallTransfer),
34
        ]);
35
36
        return $this->converter->convert($result);
37
    }
38
}
39