Invoice   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 17
c 2
b 0
f 0
dl 0
loc 45
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getMethodName() 0 3 1
A getPaymentTransfer() 0 3 1
A mapMethodDataToPayment() 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\Order\MethodMapper;
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 Orm\Zed\Ratepay\Persistence\SpyPaymentRatepay;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Ratepay\Persistence\SpyPaymentRatepay 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\Ratepay\RatepayConfig;
13
14
class Invoice extends AbstractMapper
15
{
16
    /**
17
     * @return string
18
     */
19
    public function getMethodName()
20
    {
21
        return RatepayConfig::INVOICE;
22
    }
23
24
    /**
25
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
26
     *
27
     * @return \Generated\Shared\Transfer\RatepayPaymentInvoiceTransfer
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...yPaymentInvoiceTransfer 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...
28
     */
29
    protected function getPaymentTransfer(QuoteTransfer $quoteTransfer)
30
    {
31
        return $quoteTransfer->getPayment()->getRatepayInvoice();
32
    }
33
34
    /**
35
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
36
     * @param \Orm\Zed\Ratepay\Persistence\SpyPaymentRatepay $payment
37
     *
38
     * @return void
39
     */
40
    public function mapMethodDataToPayment(QuoteTransfer $quoteTransfer, SpyPaymentRatepay $payment)
41
    {
42
        $paymentTransfer = $this->getPaymentTransfer($quoteTransfer);
43
        $payment
44
            ->setPaymentType($quoteTransfer->requirePayment()->getPayment()->requirePaymentMethod()->getPaymentMethod())
45
            ->setTransactionId($paymentTransfer->getTransactionId())
46
            ->setTransactionShortId($paymentTransfer->getTransactionShortId())
47
            ->setResultCode($paymentTransfer->getResultCode())
48
            ->setDeviceFingerprint($paymentTransfer->getDeviceFingerprint())
49
50
            ->setDescriptor($paymentTransfer->getDescriptor())
51
52
            ->setGender($paymentTransfer->requireGender()->getGender())
53
            ->setPhone($paymentTransfer->requirePhone()->getPhone())
54
            ->setDateOfBirth($paymentTransfer->requireDateOfBirth()->getDateOfBirth())
55
            ->setCustomerAllowCreditInquiry(($paymentTransfer->getCustomerAllowCreditInquiry() === false) ? false : true)
56
57
            ->setIpAddress($paymentTransfer->requireIpAddress()->getIpAddress())
58
            ->setCurrencyIso3($paymentTransfer->requireCurrencyIso3()->getCurrencyIso3());
59
    }
60
}
61