ConfirmPaymentTransaction   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A request() 0 19 2
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\Ratepay\Business\Request\Payment\Handler\Transaction;
9
10
use Generated\Shared\Transfer\OrderTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\OrderTransfer 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 SprykerEco\Zed\Ratepay\Business\Api\Constants as ApiConstants;
12
13
class ConfirmPaymentTransaction extends BaseTransaction implements OrderTransactionInterface
14
{
15
    public const TRANSACTION_TYPE = ApiConstants::REQUEST_MODEL_PAYMENT_CONFIRM;
16
17
    /**
18
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
19
     * @param \Generated\Shared\Transfer\OrderTransfer|null $partialOrderTransfer
20
     * @param \Generated\Shared\Transfer\ItemTransfer[] $orderItems
21
     *
22
     * @return \Spryker\Shared\Kernel\Transfer\AbstractTransfer
23
     */
24
    public function request(
25
        OrderTransfer $orderTransfer,
26
        ?OrderTransfer $partialOrderTransfer = null,
27
        array $orderItems = []
28
    ) {
29
        $paymentMethod = $this->getPaymentMethod($orderTransfer);
30
        $request = $this
31
            ->getMethodMapper($paymentMethod->getPaymentType())
32
            ->paymentConfirm($orderTransfer);
0 ignored issues
show
Bug introduced by
The method paymentConfirm() does not exist on SprykerEco\Zed\Ratepay\B...\Method\MethodInterface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

32
            ->/** @scrutinizer ignore-call */ paymentConfirm($orderTransfer);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
33
34
        $response = $this->sendRequest((string)$request);
35
        $this->logInfo($request, $response, $paymentMethod->getPaymentType(), $paymentMethod->getFkSalesOrder());
36
37
        if ($response->isSuccessful()) {
38
            $paymentMethod->setResultCode($response->getResultCode())->save();
39
        }
40
        return $this->converterFactory
41
            ->createTransferObjectConverter($response)
42
            ->convert();
43
    }
44
}
45