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\Yves\CrefoPay\Plugin\Router; |
9
|
|
|
|
10
|
|
|
use Spryker\Yves\Router\Plugin\RouteProvider\AbstractRouteProviderPlugin; |
11
|
|
|
use Spryker\Yves\Router\Route\RouteCollection; |
12
|
|
|
|
13
|
|
|
class CrefoPayRouteProviderPlugin extends AbstractRouteProviderPlugin |
14
|
|
|
{ |
15
|
|
|
protected const BUNDLE_NAME = 'CrefoPay'; |
16
|
|
|
protected const CALLBACK_CONTROLLER_NAME = 'Callback'; |
17
|
|
|
protected const NOTIFICATION_CONTROLLER_NAME = 'Notification'; |
18
|
|
|
protected const CREFO_PAY_NOTIFICATION = 'crefo-pay-notification'; |
19
|
|
|
protected const CREFO_PAY_CONFIRMATION = 'crefo-pay-confirmation'; |
20
|
|
|
protected const CREFO_PAY_SUCCESS = 'crefo-pay-success'; |
21
|
|
|
protected const CREFO_PAY_FAILURE = 'crefo-pay-failure'; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection |
25
|
|
|
* |
26
|
|
|
* @return \Spryker\Yves\Router\Route\RouteCollection |
27
|
|
|
*/ |
28
|
|
|
public function addRoutes(RouteCollection $routeCollection): RouteCollection |
29
|
|
|
{ |
30
|
|
|
$routeCollection = $this->addCrefoPayNotificationRoute($routeCollection); |
31
|
|
|
$routeCollection = $this->addCrefoPayConfirmationRoute($routeCollection); |
32
|
|
|
$routeCollection = $this->addCrefoPaySuccessRoute($routeCollection); |
33
|
|
|
$routeCollection = $this->addCrefoPayFailureRoute($routeCollection); |
34
|
|
|
|
35
|
|
|
return $routeCollection; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection |
40
|
|
|
* |
41
|
|
|
* @return \Spryker\Yves\Router\Route\RouteCollection |
42
|
|
|
*/ |
43
|
|
|
protected function addCrefoPayNotificationRoute(RouteCollection $routeCollection): RouteCollection |
44
|
|
|
{ |
45
|
|
|
$routeCollection->add( |
46
|
|
|
static::CREFO_PAY_NOTIFICATION, |
47
|
|
|
$this->buildPostRoute('/crefo-pay/notification', static::BUNDLE_NAME, static::NOTIFICATION_CONTROLLER_NAME, 'index') |
48
|
|
|
); |
49
|
|
|
|
50
|
|
|
return $routeCollection; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection |
55
|
|
|
* |
56
|
|
|
* @return \Spryker\Yves\Router\Route\RouteCollection |
57
|
|
|
*/ |
58
|
|
|
protected function addCrefoPayConfirmationRoute(RouteCollection $routeCollection): RouteCollection |
59
|
|
|
{ |
60
|
|
|
$routeCollection->add( |
61
|
|
|
static::CREFO_PAY_CONFIRMATION, |
62
|
|
|
$this->buildPostRoute('/crefo-pay/callback/confirmation', static::BUNDLE_NAME, static::CALLBACK_CONTROLLER_NAME, 'confirmation') |
63
|
|
|
); |
64
|
|
|
|
65
|
|
|
return $routeCollection; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection |
70
|
|
|
* |
71
|
|
|
* @return \Spryker\Yves\Router\Route\RouteCollection |
72
|
|
|
*/ |
73
|
|
|
protected function addCrefoPaySuccessRoute(RouteCollection $routeCollection): RouteCollection |
74
|
|
|
{ |
75
|
|
|
$routeCollection->add( |
76
|
|
|
static::CREFO_PAY_SUCCESS, |
77
|
|
|
$this->buildPostRoute('/crefo-pay/callback/success', static::BUNDLE_NAME, static::CALLBACK_CONTROLLER_NAME, 'success') |
78
|
|
|
); |
79
|
|
|
|
80
|
|
|
return $routeCollection; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection |
85
|
|
|
* |
86
|
|
|
* @return \Spryker\Yves\Router\Route\RouteCollection |
87
|
|
|
*/ |
88
|
|
|
protected function addCrefoPayFailureRoute(RouteCollection $routeCollection): RouteCollection |
89
|
|
|
{ |
90
|
|
|
$routeCollection->add( |
91
|
|
|
static::CREFO_PAY_FAILURE, |
92
|
|
|
$this->buildPostRoute('/crefo-pay/callback/failure', static::BUNDLE_NAME, static::CALLBACK_CONTROLLER_NAME, 'failure') |
93
|
|
|
); |
94
|
|
|
|
95
|
|
|
return $routeCollection; |
96
|
|
|
} |
97
|
|
|
} |
98
|
|
|
|