Completed
Pull Request — master (#4)
by Andrey
10:46 queued 03:14
created

CaptureOrderAdapter::call()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 15
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 11
nc 1
nop 1
dl 15
loc 15
rs 9.4285
c 0
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\Api\Adapter;
9
10
use Generated\Shared\Transfer\AmazonpayCallTransfer;
11
12 View Code Duplication
class CaptureOrderAdapter extends AbstractAdapter
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
15
    const CAPTURE_REFERENCE_ID = 'capture_reference_id';
16
    const CAPTURE_AMOUNT = 'capture_amount';
17
18
    /**
19
     * @param \Generated\Shared\Transfer\AmazonpayCallTransfer $amazonpayCallTransfer
20
     *
21
     * @return \Generated\Shared\Transfer\AmazonpayResponseTransfer
22
     */
23
    public function call(AmazonpayCallTransfer $amazonpayCallTransfer)
24
    {
25
        $result = $this->client->capture([
26
            static::AMAZON_AUTHORIZATION_ID =>
27
                $amazonpayCallTransfer->getAmazonpayPayment()
28
                    ->getAuthorizationDetails()
29
                    ->getAmazonAuthorizationId(),
30
            static::CAPTURE_REFERENCE_ID =>
31
                $amazonpayCallTransfer->getAmazonpayPayment()
32
                    ->getCaptureDetails()
33
                    ->getCaptureReferenceId(),
34
            static::CAPTURE_AMOUNT => $this->getAmount($amazonpayCallTransfer),
35
        ]);
36
37
        return $this->converter->convert($result);
38
    }
39
40
}
41