InitPaydirektConverter::createResponseTransfer()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 22
rs 9.6666
c 0
b 0
f 0
cc 1
nc 1
nop 2
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\ComputopPaydirektInitResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ektInitResponseTransfer 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 InitPaydirektConverter 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 ComputopPaydirektInitResponseTransfer();
25
        $responseTransfer->fromArray($decryptedArray, true);
26
        $responseTransfer->setHeader($header);
27
        //optional fields
28
        $responseTransfer->setRefNr($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::REF_NR));
29
        $responseTransfer->setShoppingBasketCategory($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::SHOPPING_BASKET_CATEGORY));
30
        $responseTransfer->setShippingFirstName($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::SHIPPING_FIRST_NAME));
31
        $responseTransfer->setShippingLastName($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::SHIPPING_LAST_NAME));
32
        $responseTransfer->setShippingCompany($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::SHIPPING_COMPANY));
33
        $responseTransfer->setShippingAddressAddition($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::SHIPPING_ADDRESS_ADDITION));
34
        $responseTransfer->setShippingStreet($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::SHIPPING_STREET));
35
        $responseTransfer->setShippingStreetNumber($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::SHIPPING_STREET_NUMBER));
36
        $responseTransfer->setShippingZip($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::SHIPPING_ZIP));
37
        $responseTransfer->setShippingCity($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::SHIPPING_CITY));
38
        $responseTransfer->setShippingCountryCode($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::SHIPPING_COUNTRY_CODE));
39
        $responseTransfer->setShippingEmail($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::SHIPPING_EMAIL));
40
        $responseTransfer->setAgeAccepted($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::AGE_ACCEPTED));
41
        $responseTransfer->setCustomerTransactionId($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::CUSTOMER_TRANSACTION_ID));
42
43
        return $responseTransfer;
44
    }
45
}
46