|
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\Heidelpay\Dependency\Injector; |
|
9
|
|
|
|
|
10
|
|
|
use Spryker\Zed\Kernel\Container; |
|
11
|
|
|
use Spryker\Zed\Kernel\Dependency\Injector\AbstractDependencyInjector; |
|
12
|
|
|
use Spryker\Zed\Oms\Communication\Plugin\Oms\Command\CommandCollectionInterface; |
|
13
|
|
|
use Spryker\Zed\Oms\Communication\Plugin\Oms\Condition\ConditionCollectionInterface; |
|
14
|
|
|
use Spryker\Zed\Oms\OmsDependencyProvider; |
|
15
|
|
|
use SprykerEco\Zed\Heidelpay\Communication\Plugin\Checkout\Oms\Command\AuthorizePlugin; |
|
16
|
|
|
use SprykerEco\Zed\Heidelpay\Communication\Plugin\Checkout\Oms\Command\CapturePlugin; |
|
17
|
|
|
use SprykerEco\Zed\Heidelpay\Communication\Plugin\Checkout\Oms\Command\DebitPlugin; |
|
18
|
|
|
use SprykerEco\Zed\Heidelpay\Communication\Plugin\Checkout\Oms\Condition\IsAuthorizationCompletedPlugin; |
|
19
|
|
|
use SprykerEco\Zed\Heidelpay\Communication\Plugin\Checkout\Oms\Condition\IsCaptureApprovedPlugin; |
|
20
|
|
|
use SprykerEco\Zed\Heidelpay\Communication\Plugin\Checkout\Oms\Condition\IsDebitCompletedPlugin; |
|
21
|
|
|
|
|
22
|
|
|
class OmsDependencyInjector extends AbstractDependencyInjector |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* @param \Spryker\Zed\Kernel\Container $container |
|
26
|
|
|
* |
|
27
|
|
|
* @return \Spryker\Zed\Kernel\Container |
|
28
|
|
|
*/ |
|
29
|
|
|
public function injectBusinessLayerDependencies(Container $container) |
|
30
|
|
|
{ |
|
31
|
|
|
$container = $this->injectCommands($container); |
|
32
|
|
|
$container = $this->injectConditions($container); |
|
33
|
|
|
|
|
34
|
|
|
return $container; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @param \Spryker\Zed\Kernel\Container $container |
|
39
|
|
|
* |
|
40
|
|
|
* @return \Spryker\Zed\Kernel\Container |
|
41
|
|
|
*/ |
|
42
|
|
|
protected function injectCommands(Container $container) |
|
43
|
|
|
{ |
|
44
|
|
|
$container->extend(OmsDependencyProvider::COMMAND_PLUGINS, function (CommandCollectionInterface $commandCollection) { |
|
45
|
|
|
$commandCollection |
|
46
|
|
|
->add(new AuthorizePlugin(), 'Heidelpay/Authorize') |
|
47
|
|
|
->add(new DebitPlugin(), 'Heidelpay/Debit') |
|
48
|
|
|
->add(new CapturePlugin(), 'Heidelpay/Capture'); |
|
49
|
|
|
|
|
50
|
|
|
return $commandCollection; |
|
51
|
|
|
}); |
|
52
|
|
|
|
|
53
|
|
|
return $container; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @param \Spryker\Zed\Kernel\Container $container |
|
58
|
|
|
* |
|
59
|
|
|
* @return \Spryker\Zed\Kernel\Container |
|
60
|
|
|
*/ |
|
61
|
|
|
protected function injectConditions(Container $container) |
|
62
|
|
|
{ |
|
63
|
|
|
$container->extend(OmsDependencyProvider::CONDITION_PLUGINS, function (ConditionCollectionInterface $conditionCollection) { |
|
64
|
|
|
$conditionCollection |
|
65
|
|
|
->add(new IsAuthorizationCompletedPlugin(), 'Heidelpay/IsAuthorizationCompleted') |
|
66
|
|
|
->add(new IsDebitCompletedPlugin(), 'Heidelpay/IsDebitCompleted') |
|
67
|
|
|
->add(new IsCaptureApprovedPlugin(), 'Heidelpay/IsCaptureApproved'); |
|
68
|
|
|
|
|
69
|
|
|
return $conditionCollection; |
|
70
|
|
|
}); |
|
71
|
|
|
|
|
72
|
|
|
return $container; |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|