InstallmentConfigurationTransaction::request()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 17
rs 9.8666
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\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...
11
use SprykerEco\Zed\Ratepay\Business\Api\Constants as ApiConstants;
12
use SprykerEco\Zed\Ratepay\Business\Api\Model\Response\ConfigurationResponse;
13
14
class InstallmentConfigurationTransaction extends BaseTransaction implements QuoteTransactionInterface
15
{
16
    public const TRANSACTION_TYPE = ApiConstants::REQUEST_MODEL_CONFIGURATION_REQUEST;
17
18
    /**
19
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
20
     *
21
     * @return \Generated\Shared\Transfer\RatepayInstallmentConfigurationResponseTransfer
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...urationResponseTransfer 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...
22
     */
23
    public function request(QuoteTransfer $quoteTransfer)
24
    {
25
        $paymentMethodName = $quoteTransfer
26
            ->requirePayment()
27
            ->getPayment()
28
            ->requirePaymentMethod()
29
            ->getPaymentMethod();
30
31
        $request = $this->getMethodMapper($paymentMethodName)
32
            ->configurationRequest($quoteTransfer);
0 ignored issues
show
Bug introduced by
The method configurationRequest() does not exist on SprykerEco\Zed\Ratepay\B...\Method\MethodInterface. It seems like you code against a sub-type of SprykerEco\Zed\Ratepay\B...\Method\MethodInterface such as SprykerEco\Zed\Ratepay\B...ment\Method\Installment. ( 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 */ configurationRequest($quoteTransfer);
Loading history...
Bug introduced by
The method configurationRequest() 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 */ configurationRequest($quoteTransfer);

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, $paymentMethodName);
36
37
        return $this->converterFactory
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->converterF...e, $request)->convert() returns the type Spryker\Shared\Kernel\Transfer\AbstractTransfer which is incompatible with the documented return type Generated\Shared\Transfe...urationResponseTransfer.
Loading history...
38
            ->createInstallmentConfigurationResponseConverter($response, $request)
39
            ->convert();
40
    }
41
42
    /**
43
     * @param string $request
44
     *
45
     * @return \SprykerEco\Zed\Ratepay\Business\Api\Model\Response\ConfigurationResponse
46
     */
47
    protected function sendRequest($request)
48
    {
49
        return new ConfigurationResponse($this->executionAdapter->sendRequest($request));
50
    }
51
}
52