CaptureResponseMapper   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 38
c 1
b 1
f 0
dl 0
loc 57
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCaptureResponseTransfer() 0 50 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\Zed\Payone\Business\Api\Response\Mapper;
9
10
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...
11
use Generated\Shared\Transfer\CaptureResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\CaptureResponseTransfer 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\CaptureResponseContainer;
15
16
class CaptureResponseMapper implements CaptureResponseMapperInterface
17
{
18
    /**
19
     * @param \SprykerEco\Zed\Payone\Business\Api\Response\Container\CaptureResponseContainer $responseContainer
20
     *
21
     * @return \Generated\Shared\Transfer\CaptureResponseTransfer
22
     */
23
    public function getCaptureResponseTransfer(CaptureResponseContainer $responseContainer): CaptureResponseTransfer
24
    {
25
        $result = new CaptureResponseTransfer();
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->setLegalNote($responseContainer->getClearingLegalnote());
40
        $clearing->setDate($responseContainer->getClearingDate());
41
        $clearing->setDueDate($responseContainer->getClearingDuedate());
42
        $clearing->setReference($responseContainer->getClearingReference());
43
        $clearing->setInstructionNote($responseContainer->getClearingInstructionnote());
44
        $clearing->setAmount($responseContainer->getClearingAmount());
45
46
        // Fill creditor transfer
47
        $creditor->setIdentifier($responseContainer->getCreditorIdentifier());
48
        $creditor->setName($responseContainer->getCreditorName());
49
        $creditor->setStreet($responseContainer->getCreditorStreet());
50
        $creditor->setZip($responseContainer->getCreditorZip());
51
        $creditor->setCity($responseContainer->getCreditorCity());
52
        $creditor->setCountry($responseContainer->getCreditorCountry());
53
        $creditor->setEmail($responseContainer->getCreditorEmail());
54
55
        // Fill base response transfer
56
        $baseResponse->setErrorCode($responseContainer->getErrorcode());
57
        $baseResponse->setErrorMessage($responseContainer->getErrormessage());
58
        $baseResponse->setCustomerMessage($responseContainer->getCustomermessage());
59
        $baseResponse->setStatus($responseContainer->getStatus());
60
        $baseResponse->setRawResponse($responseContainer->getRawResponse());
61
62
        // Set plain attributes
63
        $result->setTxid($responseContainer->getTxid());
64
        $result->setSettleAccount($responseContainer->getSettleaccount());
65
        $result->setMandateIdentification($responseContainer->getMandateIdentification());
66
67
        // Set aggregated transfers
68
        $result->setClearing($clearing);
69
        $result->setCreditor($creditor);
70
        $result->setBaseResponse($baseResponse);
71
72
        return $result;
73
    }
74
}
75