getAuthorizationResponseTransfer()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 48
Code Lines 35

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 35
c 1
b 1
f 0
nc 1
nop 1
dl 0
loc 48
rs 9.36
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\Zed\Payone\Business\Api\Response\Mapper;
9
10
use Generated\Shared\Transfer\AuthorizationResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...izationResponseTransfer 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\BaseResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\BaseResponseTransfer 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 Generated\Shared\Transfer\ClearingTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\ClearingTransfer 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...
13
use Generated\Shared\Transfer\CreditorTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\CreditorTransfer 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...
14
use SprykerEco\Zed\Payone\Business\Api\Response\Container\AuthorizationResponseContainer;
15
16
class AuthorizationResponseMapper implements AuthorizationResponseMapperInterface
17
{
18
    /**
19
     * @param \SprykerEco\Zed\Payone\Business\Api\Response\Container\AuthorizationResponseContainer $responseContainer
20
     *
21
     * @return \Generated\Shared\Transfer\AuthorizationResponseTransfer
22
     */
23
    public function getAuthorizationResponseTransfer(AuthorizationResponseContainer $responseContainer): AuthorizationResponseTransfer
24
    {
25
        $result = new AuthorizationResponseTransfer();
26
        $clearing = new ClearingTransfer();
27
        $creditor = new CreditorTransfer();
28
        $baseResponse = new BaseResponseTransfer();
29
30
        // Fill clearing transfer
31
        $clearing->setBankAccountHolder($responseContainer->getClearingBankaccountholder());
32
        $clearing->setBankCountry($responseContainer->getClearingBankcountry());
33
        $clearing->setBankAccount($responseContainer->getClearingBankaccount());
34
        $clearing->setBankCode($responseContainer->getClearingBankcode());
35
        $clearing->setBankIban($responseContainer->getClearingBankiban());
36
        $clearing->setBankBic($responseContainer->getClearingBankbic());
37
        $clearing->setBankCity($responseContainer->getClearingBankcity());
38
        $clearing->setBankName($responseContainer->getClearingBankname());
39
        $clearing->setDate($responseContainer->getClearingDate());
40
        $clearing->setAmount($responseContainer->getClearingAmount());
41
42
        // Fill creditor transfer
43
        $creditor->setIdentifier($responseContainer->getCreditorIdentifier());
44
        $creditor->setName($responseContainer->getCreditorName());
45
        $creditor->setStreet($responseContainer->getCreditorStreet());
46
        $creditor->setZip($responseContainer->getCreditorZip());
47
        $creditor->setCity($responseContainer->getCreditorCity());
48
        $creditor->setCountry($responseContainer->getCreditorCountry());
49
        $creditor->setEmail($responseContainer->getCreditorEmail());
50
51
        // Fill base response transfer
52
        $baseResponse->setErrorCode($responseContainer->getErrorcode());
53
        $baseResponse->setErrorMessage($responseContainer->getErrormessage());
54
        $baseResponse->setCustomerMessage($responseContainer->getCustomermessage());
55
        $baseResponse->setStatus($responseContainer->getStatus());
56
        $baseResponse->setRawResponse($responseContainer->getRawResponse());
57
58
        // Set plain attributes
59
        $result->setTxid($responseContainer->getTxid());
60
        $result->setUserId($responseContainer->getUserid());
61
        $result->setProtectResultAvs($responseContainer->getProtectResultAvs());
62
        $result->setRedirectUrl($responseContainer->getMandateIdentification());
63
        $result->setMandateIdentification($responseContainer->getMandateIdentification());
64
65
        // Set aggregated transfers
66
        $result->setClearing($clearing);
67
        $result->setCreditor($creditor);
68
        $result->setBaseResponse($baseResponse);
69
70
        return $result;
71
    }
72
}
73