Completed
Push — master ( 56a686...736967 )
by Oleksandr
15s queued 11s
created

DebitOnRegistrationTransaction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 9
dl 0
loc 33
c 1
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A executeTransaction() 0 12 1
1
<?php
2
3
/**
4
 * MIT License
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace SprykerEco\Zed\Heidelpay\Business\Payment\Transaction;
9
10
use Generated\Shared\Transfer\HeidelpayRequestTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfer\HeidelpayRequestTransfer 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\HeidelpayResponseTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...idelpayResponseTransfer 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\Heidelpay\HeidelpayConfig;
13
use SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\Logger\TransactionLoggerInterface;
14
use SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithDebitOnRegistrationInterface;
15
16
class DebitOnRegistrationTransaction implements DebitOnRegistrationTransactionInterface
17
{
18
    /**
19
     * @var \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\Logger\TransactionLoggerInterface
20
     */
21
    protected $transactionLogger;
22
23
    /**
24
     * @param \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\Logger\TransactionLoggerInterface $transactionLogger
25
     */
26
    public function __construct(TransactionLoggerInterface $transactionLogger)
27
    {
28
        $this->transactionLogger = $transactionLogger;
29
    }
30
31
    /**
32
     * @param \Generated\Shared\Transfer\HeidelpayRequestTransfer $debitOnRegistrationRequestTransfer
33
     * @param \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithDebitOnRegistrationInterface $paymentAdapter
34
     *
35
     * @return \Generated\Shared\Transfer\HeidelpayResponseTransfer
36
     */
37
    public function executeTransaction(
38
        HeidelpayRequestTransfer $debitOnRegistrationRequestTransfer,
39
        PaymentWithDebitOnRegistrationInterface $paymentAdapter
40
    ): HeidelpayResponseTransfer {
41
        $debitOnRegistrationResponseTransfer = $paymentAdapter->debitOnRegistration($debitOnRegistrationRequestTransfer);
42
        $this->transactionLogger->logTransaction(
43
            HeidelpayConfig::TRANSACTION_TYPE_DEBIT_ON_REGISTRATION,
44
            $debitOnRegistrationRequestTransfer,
45
            $debitOnRegistrationResponseTransfer
46
        );
47
48
        return $debitOnRegistrationResponseTransfer;
49
    }
50
}
51