PriceToPayProvider::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * MIT License
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace SprykerEco\Zed\AfterPay\Business\Payment\Transaction;
9
10
use Generated\Shared\Transfer\AfterPayCallTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\AfterPayCallTransfer 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 Generated\Shared\Transfer\SalesPaymentTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\SalesPaymentTransfer 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\AfterPay\AfterPayConfig;
13
use SprykerEco\Zed\AfterPay\Dependency\Facade\AfterPayToPaymentFacadeInterface;
14
15
class PriceToPayProvider implements PriceToPayProviderInterface
16
{
17
    /**
18
     * @var \SprykerEco\Zed\AfterPay\Dependency\Facade\AfterPayToPaymentFacadeInterface
19
     */
20
    protected $paymentFacade;
21
22
    /**
23
     * @param \SprykerEco\Zed\AfterPay\Dependency\Facade\AfterPayToPaymentFacadeInterface $paymentFacade
24
     */
25
    public function __construct(AfterPayToPaymentFacadeInterface $paymentFacade)
26
    {
27
        $this->paymentFacade = $paymentFacade;
28
    }
29
30
    /**
31
     * @param \Generated\Shared\Transfer\AfterPayCallTransfer $afterPayCallTransfer
32
     *
33
     * @return int
34
     */
35
    public function getPriceToPayForOrder(AfterPayCallTransfer $afterPayCallTransfer): int
36
    {
37
        $salesPaymentTransfer = $this->createSalesPaymentTransfer($afterPayCallTransfer);
38
39
        return $this->paymentFacade->getPaymentMethodPriceToPay($salesPaymentTransfer);
40
    }
41
42
    /**
43
     * @param \Generated\Shared\Transfer\AfterPayCallTransfer $afterPayCallTransfer
44
     *
45
     * @return \Generated\Shared\Transfer\SalesPaymentTransfer
46
     */
47
    protected function createSalesPaymentTransfer(AfterPayCallTransfer $afterPayCallTransfer): SalesPaymentTransfer
48
    {
49
        return (new SalesPaymentTransfer())
50
            ->setPaymentProvider(AfterPayConfig::PROVIDER_NAME)
51
            ->setPaymentMethod($afterPayCallTransfer->getPaymentMethod())
52
            ->setFkSalesOrder($afterPayCallTransfer->getIdSalesOrder());
53
    }
54
}
55