Passed
Push — master ( a2100c...af4f13 )
by Andrey
06:37
created

CaptureDetailsConverter   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 43
rs 10
c 0
b 0
f 0
wmc 7

1 Method

Rating   Name   Duplication   Size   Complexity  
C convert() 0 31 7
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\Converter\Details;
9
10
use Generated\Shared\Transfer\AmazonpayCaptureDetailsTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...yCaptureDetailsTransfer 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 SprykerEco\Zed\Amazonpay\Business\Api\Converter\AbstractArrayConverter;
12
13
class CaptureDetailsConverter extends AbstractArrayConverter
14
{
15
16
    const CAPTURE_STATUS_DECLINED = 'Declined';
17
    const CAPTURE_STATUS_PENDING = 'Pending';
18
    const CAPTURE_STATUS_COMPLETED = 'Completed';
19
20
    /**
21
     * @param array $captureDetailsData
22
     *
23
     * @return \Generated\Shared\Transfer\AmazonpayCaptureDetailsTransfer
24
     */
25
    public function convert(array $captureDetailsData)
26
    {
27
        $captureDetails = new AmazonpayCaptureDetailsTransfer();
28
        $captureDetails->setAmazonCaptureId($captureDetailsData['AmazonCaptureId']);
29
        $captureDetails->setCaptureReferenceId($captureDetailsData['CaptureReferenceId']);
30
31
        if (!empty($captureDetailsData['CaptureAmount'])) {
32
            $captureDetails->setCaptureAmount($this->convertPriceToTransfer($captureDetailsData['CaptureAmount']));
33
        }
34
35
        if (!empty($captureDetailsData['CaptureFee'])) {
36
            $captureDetails->setCaptureFee($this->convertPriceToTransfer($captureDetailsData['CaptureFee']));
37
        }
38
39
        if (!empty($captureDetailsData['CaptureStatus'])) {
40
            $captureDetails->setCaptureStatus($this->convertStatusToTransfer($captureDetailsData['CaptureStatus']));
41
        }
42
43
        if (!empty($captureDetailsData['IdList'])) {
44
            $captureDetails->setIdList(array_values($captureDetailsData['IdList'])[0]);
45
        }
46
47
        if (!empty($captureDetailsData['SellerCaptureNote'])) {
48
            $captureDetails->setSellerCaptureNote($captureDetailsData['SellerCaptureNote']);
49
        }
50
51
        if (!empty($captureDetailsData['CreationTimestamp'])) {
52
            $captureDetails->setCreationTimestamp($captureDetailsData['CreationTimestamp']);
53
        }
54
55
        return $captureDetails;
56
    }
57
58
}
59