Passed
Pull Request — master (#25)
by Dmitri
05:00
created

PaymentTransactionHandler   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A createPayment() 0 15 1
1
<?php
2
3
namespace SprykerEco\Zed\Braintree\Business\Payment\Transaction\Handler;
4
5
use Generated\Shared\Transfer\CheckoutResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\CheckoutResponseTransfer 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...
6
use Generated\Shared\Transfer\QuoteTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\QuoteTransfer 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...
7
use Generated\Shared\Transfer\TransactionMetaTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\TransactionMetaTransfer 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...
8
9
class PaymentTransactionHandler extends AbstractTransactionHandler implements PaymentTransactionHandlerInterface
10
{
11
    /**
12
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
13
     * @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponseTransfer
14
     *
15
     * @return \Generated\Shared\Transfer\QuoteTransfer
16
     */
17
    public function createPayment(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponseTransfer)
18
    {
19
        $transactionMetaTransfer = new TransactionMetaTransfer();
20
        $transactionMetaTransfer->setQuote($quoteTransfer);
21
        $transactionMetaTransfer->setTransactionIdentifier('');
22
        $transactionMetaTransfer->setIdPayment('');
23
24
        $response = $this->transaction->executeTransaction($transactionMetaTransfer);
25
        $quoteTransfer->getPayment()->setBraintreeTransactionResponse($response);
26
        $quoteTransfer->getPayment()->getBraintree()
27
            ->setTransactionId($response->getTransactionId());
28
29
        $checkoutResponseTransfer->setIsSuccess($response->getIsSuccess());
30
31
        return $quoteTransfer;
32
    }
33
}
34