InitCreditCardConverter   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A createResponseTransfer() 0 17 1
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Yves\Computop\Converter;
9
10
use Generated\Shared\Transfer\ComputopApiResponseHeaderTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...iResponseHeaderTransfer 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 Generated\Shared\Transfer\ComputopCreditCardInitResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ardInitResponseTransfer 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\Computop\Config\ComputopApiConfig;
13
14
class InitCreditCardConverter extends AbstractInitConverter
15
{
16
    /**
17
     * @param array $decryptedArray
18
     * @param \Generated\Shared\Transfer\ComputopApiResponseHeaderTransfer $header
19
     *
20
     * @return \Spryker\Shared\Kernel\Transfer\TransferInterface
21
     */
22
    protected function createResponseTransfer(array $decryptedArray, ComputopApiResponseHeaderTransfer $header)
23
    {
24
        $responseTransfer = new ComputopCreditCardInitResponseTransfer();
25
        $responseTransfer->fromArray($decryptedArray, true);
26
        $responseTransfer->setHeader($header);
27
        //optional fields
28
        $responseTransfer->setPcNr($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::PC_NR));
29
        $responseTransfer->setCreditCardBrand($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::CREDIT_CARD_BRAND));
30
        $responseTransfer->setCreditCardExpiry($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::CREDIT_CARD_EXPIRY));
31
        $responseTransfer->setMaskedPan($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::MASKED_PAN));
32
        $responseTransfer->setCavv($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::CAVV));
33
        $responseTransfer->setEci($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::ECI));
34
        $responseTransfer->setType($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::TYPE));
35
        $responseTransfer->setPlain($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::PLAIN));
36
        $responseTransfer->setCustom($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::CUSTOM));
37
38
        return $responseTransfer;
39
    }
40
}
41