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