Passed
Push — feature/eco-2295/eco-2356-main... ( 3dab14...a279a0 )
by Aleksey
03:10
created

CrefoPayCommunicationFactory::getRefundFacade()   A

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 0
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\CrefoPay\Communication;
9
10
use Spryker\Zed\Kernel\Communication\AbstractCommunicationFactory;
11
use SprykerEco\Zed\CrefoPay\Communication\Oms\Command\CancelOmsCommand;
12
use SprykerEco\Zed\CrefoPay\Communication\Oms\Command\CaptureOmsCommand;
13
use SprykerEco\Zed\CrefoPay\Communication\Oms\Command\CrefoPayOmsCommandByItemInterface;
14
use SprykerEco\Zed\CrefoPay\Communication\Oms\Command\CrefoPayOmsCommandByOrderInterface;
15
use SprykerEco\Zed\CrefoPay\Communication\Oms\Command\FinishOmsCommand;
16
use SprykerEco\Zed\CrefoPay\Communication\Oms\Command\RefundOmsCommand;
17
use SprykerEco\Zed\CrefoPay\Communication\Oms\CrefoPayOmsMapper;
18
use SprykerEco\Zed\CrefoPay\Communication\Oms\CrefoPayOmsMapperInterface;
19
use SprykerEco\Zed\CrefoPay\CrefoPayDependencyProvider;
20
use SprykerEco\Zed\CrefoPay\Dependency\Facade\CrefoPayToCalculationFacadeInterface;
21
use SprykerEco\Zed\CrefoPay\Dependency\Facade\CrefoPayToRefundFacadeInterface;
22
use SprykerEco\Zed\CrefoPay\Dependency\Facade\CrefoPayToSalesFacadeInterface;
23
24
/**
25
 * @method \SprykerEco\Zed\CrefoPay\Business\CrefoPayFacadeInterface getFacade()
26
 * @method \SprykerEco\Zed\CrefoPay\CrefoPayConfig getConfig()
27
 * @method \SprykerEco\Zed\CrefoPay\Persistence\CrefoPayEntityManagerInterface getEntityManager()
28
 * @method \SprykerEco\Zed\CrefoPay\Persistence\CrefoPayRepositoryInterface getRepository()
29
 */
30
class CrefoPayCommunicationFactory extends AbstractCommunicationFactory
31
{
32
    /**
33
     * @return \SprykerEco\Zed\CrefoPay\Communication\Oms\Command\CrefoPayOmsCommandByOrderInterface
34
     */
35
    public function createCancelOmsCommand(): CrefoPayOmsCommandByOrderInterface
36
    {
37
        return new CancelOmsCommand(
38
            $this->createCrefoPayOmsMapper(),
39
            $this->getFacade(),
40
            $this->getConfig()
41
        );
42
    }
43
44
    /**
45
     * @return \SprykerEco\Zed\CrefoPay\Communication\Oms\Command\CrefoPayOmsCommandByItemInterface
46
     */
47
    public function createCaptureOmsCommand(): CrefoPayOmsCommandByItemInterface
48
    {
49
        return new CaptureOmsCommand(
50
            $this->createCrefoPayOmsMapper(),
51
            $this->getFacade()
52
        );
53
    }
54
55
    /**
56
     * @return \SprykerEco\Zed\CrefoPay\Communication\Oms\Command\CrefoPayOmsCommandByItemInterface
57
     */
58
    public function createRefundOmsCommand(): CrefoPayOmsCommandByItemInterface
59
    {
60
        return new RefundOmsCommand(
61
            $this->createCrefoPayOmsMapper(),
62
            $this->getFacade(),
63
            $this->getRefundFacade()
64
        );
65
    }
66
67
    /**
68
     * @return \SprykerEco\Zed\CrefoPay\Communication\Oms\Command\CrefoPayOmsCommandByOrderInterface
69
     */
70
    public function createFinishOmsCommand(): CrefoPayOmsCommandByOrderInterface
71
    {
72
        return new FinishOmsCommand(
73
            $this->createCrefoPayOmsMapper(),
74
            $this->getFacade(),
75
            $this->getConfig()
76
        );
77
    }
78
79
    /**
80
     * @return \SprykerEco\Zed\CrefoPay\Communication\Oms\CrefoPayOmsMapperInterface
81
     */
82
    public function createCrefoPayOmsMapper(): CrefoPayOmsMapperInterface
83
    {
84
        return new CrefoPayOmsMapper(
85
            $this->getSalesFacade(),
86
            $this->getCalculationFacade()
87
        );
88
    }
89
90
    /**
91
     * @return \SprykerEco\Zed\CrefoPay\Dependency\Facade\CrefoPayToSalesFacadeInterface
92
     */
93
    public function getSalesFacade(): CrefoPayToSalesFacadeInterface
94
    {
95
        return $this->getProvidedDependency(CrefoPayDependencyProvider::FACADE_SALES);
96
    }
97
98
    /**
99
     * @return \SprykerEco\Zed\CrefoPay\Dependency\Facade\CrefoPayToCalculationFacadeInterface
100
     */
101
    public function getCalculationFacade(): CrefoPayToCalculationFacadeInterface
102
    {
103
        return $this->getProvidedDependency(CrefoPayDependencyProvider::FACADE_CALCULATION);
104
    }
105
106
    /**
107
     * @return \SprykerEco\Zed\CrefoPay\Dependency\Facade\CrefoPayToRefundFacadeInterface
108
     */
109
    public function getRefundFacade(): CrefoPayToRefundFacadeInterface
110
    {
111
        return $this->getProvidedDependency(CrefoPayDependencyProvider::FACADE_REFUND);
112
    }
113
}
114