InstallmentCalculationResponseConverter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 25
c 1
b 0
f 0
dl 0
loc 58
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A convert() 0 25 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\Api\Converter;
9
10
use Generated\Shared\Transfer\RatepayInstallmentCalculationResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ulationResponseTransfer 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;
12
use SprykerEco\Zed\Ratepay\Business\Api\Model\Payment\Calculation;
13
use SprykerEco\Zed\Ratepay\Business\Api\Model\Response\CalculationResponse;
14
use SprykerEco\Zed\Ratepay\Dependency\Facade\RatepayToMoneyInterface;
15
16
class InstallmentCalculationResponseConverter extends BaseConverter
17
{
18
    /**
19
     * @var \SprykerEco\Zed\Ratepay\Business\Api\Model\Payment\Calculation
20
     */
21
    protected $request;
22
23
    /**
24
     * @var \SprykerEco\Zed\Ratepay\Business\Api\Converter\ConverterInterface
25
     */
26
    protected $responseTransferConverter;
27
28
    /**
29
     * @param \SprykerEco\Zed\Ratepay\Business\Api\Model\Response\CalculationResponse $response
30
     * @param \SprykerEco\Zed\Ratepay\Dependency\Facade\RatepayToMoneyInterface $moneyFacade
31
     * @param \SprykerEco\Zed\Ratepay\Business\Api\Converter\ConverterInterface $responseTransferConverter
32
     * @param \SprykerEco\Zed\Ratepay\Business\Api\Model\Payment\Calculation $request
33
     */
34
    public function __construct(
35
        CalculationResponse $response,
36
        RatepayToMoneyInterface $moneyFacade,
37
        ConverterInterface $responseTransferConverter,
38
        Calculation $request
39
    ) {
40
        parent::__construct($response, $moneyFacade);
41
42
        $this->responseTransferConverter = $responseTransferConverter;
43
        $this->request = $request;
44
    }
45
46
    /**
47
     * @return \Generated\Shared\Transfer\RatepayInstallmentCalculationResponseTransfer
48
     */
49
    public function convert()
50
    {
51
        $baseResponse = $this->responseTransferConverter->convert();
52
53
        $responseTransfer = new RatepayInstallmentCalculationResponseTransfer();
54
        $responseTransfer
55
            ->setBaseResponse($baseResponse);
56
57
        $successCode = Constants::REQUEST_CODE_SUCCESS_MATRIX[Constants::REQUEST_MODEL_CALCULATION_REQUEST];
58
        if ($successCode == $baseResponse->getResultCode()) {
0 ignored issues
show
Bug introduced by
The method getResultCode() does not exist on Spryker\Shared\Kernel\Transfer\AbstractTransfer. ( Ignorable by Annotation )

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

58
        if ($successCode == $baseResponse->/** @scrutinizer ignore-call */ getResultCode()) {

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...
59
            $responseTransfer
60
                ->setTotalAmount($this->decimalToCents($this->response->getTotalAmount()))
0 ignored issues
show
Bug introduced by
The method getTotalAmount() does not exist on SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface. It seems like you code against a sub-type of SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface such as SprykerEco\Zed\Ratepay\B...nse\CalculationResponse. ( Ignorable by Annotation )

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

60
                ->setTotalAmount($this->decimalToCents($this->response->/** @scrutinizer ignore-call */ getTotalAmount()))
Loading history...
61
                ->setAmount($this->decimalToCents($this->response->getAmount()))
0 ignored issues
show
Bug introduced by
The method getAmount() does not exist on SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface. It seems like you code against a sub-type of SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface such as SprykerEco\Zed\Ratepay\B...nse\CalculationResponse. ( Ignorable by Annotation )

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

61
                ->setAmount($this->decimalToCents($this->response->/** @scrutinizer ignore-call */ getAmount()))
Loading history...
62
                ->setInterestAmount($this->decimalToCents($this->response->getInterestAmount()))
0 ignored issues
show
Bug introduced by
The method getInterestAmount() does not exist on SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface. It seems like you code against a sub-type of SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface such as SprykerEco\Zed\Ratepay\B...nse\CalculationResponse. ( Ignorable by Annotation )

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

62
                ->setInterestAmount($this->decimalToCents($this->response->/** @scrutinizer ignore-call */ getInterestAmount()))
Loading history...
63
                ->setServiceCharge($this->decimalToCents($this->response->getServiceCharge()))
0 ignored issues
show
Bug introduced by
The method getServiceCharge() does not exist on SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface. It seems like you code against a sub-type of SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface such as SprykerEco\Zed\Ratepay\B...nse\CalculationResponse or SprykerEco\Zed\Ratepay\B...e\ConfigurationResponse. ( Ignorable by Annotation )

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

63
                ->setServiceCharge($this->decimalToCents($this->response->/** @scrutinizer ignore-call */ getServiceCharge()))
Loading history...
64
                ->setInterestRate($this->decimalToCents($this->response->getInterestRate()))
0 ignored issues
show
Bug introduced by
The method getInterestRate() does not exist on SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface. It seems like you code against a sub-type of SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface such as SprykerEco\Zed\Ratepay\B...nse\CalculationResponse. ( Ignorable by Annotation )

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

64
                ->setInterestRate($this->decimalToCents($this->response->/** @scrutinizer ignore-call */ getInterestRate()))
Loading history...
65
                ->setAnnualPercentageRate($this->response->getAnnualPercentageRate())
0 ignored issues
show
Bug introduced by
The method getAnnualPercentageRate() does not exist on SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface. It seems like you code against a sub-type of SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface such as SprykerEco\Zed\Ratepay\B...nse\CalculationResponse. ( Ignorable by Annotation )

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

65
                ->setAnnualPercentageRate($this->response->/** @scrutinizer ignore-call */ getAnnualPercentageRate())
Loading history...
66
                ->setMonthlyDebitInterest($this->decimalToCents($this->response->getMonthlyDebitInterest()))
0 ignored issues
show
Bug introduced by
The method getMonthlyDebitInterest() does not exist on SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface. It seems like you code against a sub-type of SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface such as SprykerEco\Zed\Ratepay\B...nse\CalculationResponse. ( Ignorable by Annotation )

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

66
                ->setMonthlyDebitInterest($this->decimalToCents($this->response->/** @scrutinizer ignore-call */ getMonthlyDebitInterest()))
Loading history...
67
                ->setRate($this->decimalToCents($this->response->getRate()))
0 ignored issues
show
Bug introduced by
The method getRate() does not exist on SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface. It seems like you code against a sub-type of SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface such as SprykerEco\Zed\Ratepay\B...nse\CalculationResponse. ( Ignorable by Annotation )

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

67
                ->setRate($this->decimalToCents($this->response->/** @scrutinizer ignore-call */ getRate()))
Loading history...
68
                ->setNumberOfRates($this->response->getNumberOfRates())
0 ignored issues
show
Bug introduced by
The method getNumberOfRates() does not exist on SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface. It seems like you code against a sub-type of SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface such as SprykerEco\Zed\Ratepay\B...nse\CalculationResponse. ( Ignorable by Annotation )

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

68
                ->setNumberOfRates($this->response->/** @scrutinizer ignore-call */ getNumberOfRates())
Loading history...
69
                ->setLastRate($this->decimalToCents($this->response->getLastRate()))
0 ignored issues
show
Bug introduced by
The method getLastRate() does not exist on SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface. It seems like you code against a sub-type of SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface such as SprykerEco\Zed\Ratepay\B...nse\CalculationResponse. ( Ignorable by Annotation )

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

69
                ->setLastRate($this->decimalToCents($this->response->/** @scrutinizer ignore-call */ getLastRate()))
Loading history...
70
                ->setPaymentFirstDay($this->response->getPaymentFirstday());
0 ignored issues
show
Bug introduced by
The method getPaymentFirstday() does not exist on SprykerEco\Zed\Ratepay\B...ponse\ResponseInterface. Did you maybe mean getPaymentMethod()? ( Ignorable by Annotation )

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

70
                ->setPaymentFirstDay($this->response->/** @scrutinizer ignore-call */ getPaymentFirstday());

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...
71
        }
72
73
        return $responseTransfer;
74
    }
75
}
76