InitPayPalConverter   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 38
dl 0
loc 49
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createResponseTransfer() 0 41 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\ComputopPayPalInitResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...PalInitResponseTransfer 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 InitPayPalConverter 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 ComputopPayPalInitResponseTransfer();
25
        $responseTransfer->fromArray($decryptedArray, true);
26
        $responseTransfer->setHeader($header);
27
        $responseTransfer->setEmail($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::EMAIL));
28
        $responseTransfer->setFirstName($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::FIRST_NAME));
29
        $responseTransfer->setLastName($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::LAST_NAME));
30
        //optional fields
31
        $responseTransfer->setTransactionId($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::TRANSACTION_ID));
32
        $responseTransfer->setRefNr($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::REF_NR));
33
        $responseTransfer->setInfoText($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::INFO_TEXT));
34
        $responseTransfer->setBillingAgreementId($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::BILLING_AGREEMENT_ID));
35
        $responseTransfer->setPhone($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::PHONE));
36
        $responseTransfer->setAddressStreet($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::ADDRESS_STREET));
37
        $responseTransfer->setAddressStreet2($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::ADDRESS_STREET2));
38
        $responseTransfer->setAddressCity($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::ADDRESS_CITY));
39
        $responseTransfer->setAddressState($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::ADDRESS_STATE));
40
        $responseTransfer->setAddressZip($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::ADDRESS_ZIP));
41
        $responseTransfer->setBillingAddressCity($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::BILLING_AGREEMENT_ID));
42
        $responseTransfer->setBillingAddressCountryCode($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::BILLING_ADDRESS_COUNTRY_CODE));
43
        $responseTransfer->setBillingAddressState($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::BILLING_ADDRESS_STATE));
44
        $responseTransfer->setBillingAddressStreet($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::BILLING_ADDRESS_STREET));
45
        $responseTransfer->setBillingAddressStreet2($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::BILLING_ADDRESS_STREET2));
46
        $responseTransfer->setBillingAddressZip($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::BILLING_ADDRESS_ZIP));
47
        $responseTransfer->setBillingName($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::BILLING_NAME));
48
        $responseTransfer->setPayerId($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::PAYER_ID));
49
        $responseTransfer->setIsFinancing($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::IS_FINANCING));
50
        $responseTransfer->setFinancingFeeAmount($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::FINANCING_FEE_AMOUNT));
51
        $responseTransfer->setFinancingMonthlyPayment($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::FINANCING_MONTHLY_PAYMENT));
52
        $responseTransfer->setFinancingTerm($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::FINANCING_TERM));
53
        $responseTransfer->setFinancingTotalCost($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::FINANCING_TOTAL_COST));
54
        $responseTransfer->setGrossAmount($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::GROSS_AMOUNT));
55
        $responseTransfer->setFeeAmount($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::FEE_AMOUNT));
56
        $responseTransfer->setSettleAmount($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::SETTLE_AMOUNT));
57
        $responseTransfer->setTaxAmount($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::TAX_AMOUNT));
58
        $responseTransfer->setExchangeRate($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::EXCHANGE_RATE));
59
        $responseTransfer->setMcFee($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::MC_FEE));
60
        $responseTransfer->setMcGross($this->computopApiService->getResponseValue($decryptedArray, ComputopApiConfig::MC_GROSS));
61
62
        return $responseTransfer;
63
    }
64
}
65