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 CONTROLLER_NAME_CALLBACK = 'Callback'; |
17
|
|
|
protected const CONTROLLER_NAME_NOTIFICATION = 'Notification'; |
18
|
|
|
protected const ROUTE_NAME_CREFO_PAY_NOTIFICATION = 'crefo-pay-notification'; |
19
|
|
|
protected const ROUTE_NAME_CREFO_PAY_CONFIRMATION = 'crefo-pay-confirmation'; |
20
|
|
|
protected const ROUTE_NAME_CREFO_PAY_SUCCESS = 'crefo-pay-success'; |
21
|
|
|
protected const ROUTE_NAME_CREFO_PAY_FAILURE = 'crefo-pay-failure'; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* {@inheritDoc} |
25
|
|
|
* |
26
|
|
|
* @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection |
27
|
|
|
* |
28
|
|
|
* @return \Spryker\Yves\Router\Route\RouteCollection |
29
|
|
|
*/ |
30
|
|
|
public function addRoutes(RouteCollection $routeCollection): RouteCollection |
31
|
|
|
{ |
32
|
|
|
$routeCollection = $this->addCrefoPayNotificationRoute($routeCollection); |
33
|
|
|
$routeCollection = $this->addCrefoPayConfirmationRoute($routeCollection); |
34
|
|
|
$routeCollection = $this->addCrefoPaySuccessRoute($routeCollection); |
35
|
|
|
$routeCollection = $this->addCrefoPayFailureRoute($routeCollection); |
36
|
|
|
|
37
|
|
|
return $routeCollection; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection |
42
|
|
|
* |
43
|
|
|
* @return \Spryker\Yves\Router\Route\RouteCollection |
44
|
|
|
*/ |
45
|
|
|
protected function addCrefoPayNotificationRoute(RouteCollection $routeCollection): RouteCollection |
46
|
|
|
{ |
47
|
|
|
$route = $this->buildPostRoute('/crefo-pay/notification', static::BUNDLE_NAME, static::CONTROLLER_NAME_NOTIFICATION, 'index'); |
48
|
|
|
$routeCollection->add(static::ROUTE_NAME_CREFO_PAY_NOTIFICATION, $route); |
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
|
|
|
$route = $this->buildPostRoute('/crefo-pay/callback/confirmation', static::BUNDLE_NAME, static::CONTROLLER_NAME_CALLBACK, 'confirmation'); |
61
|
|
|
$routeCollection->add(static::ROUTE_NAME_CREFO_PAY_CONFIRMATION, $route); |
62
|
|
|
|
63
|
|
|
return $routeCollection; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection |
68
|
|
|
* |
69
|
|
|
* @return \Spryker\Yves\Router\Route\RouteCollection |
70
|
|
|
*/ |
71
|
|
|
protected function addCrefoPaySuccessRoute(RouteCollection $routeCollection): RouteCollection |
72
|
|
|
{ |
73
|
|
|
$route = $this->buildPostRoute('/crefo-pay/callback/success', static::BUNDLE_NAME, static::CONTROLLER_NAME_CALLBACK, 'success'); |
74
|
|
|
$routeCollection->add(static::ROUTE_NAME_CREFO_PAY_SUCCESS, $route); |
75
|
|
|
|
76
|
|
|
return $routeCollection; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection |
81
|
|
|
* |
82
|
|
|
* @return \Spryker\Yves\Router\Route\RouteCollection |
83
|
|
|
*/ |
84
|
|
|
protected function addCrefoPayFailureRoute(RouteCollection $routeCollection): RouteCollection |
85
|
|
|
{ |
86
|
|
|
$route = $this->buildPostRoute('/crefo-pay/callback/failure', static::BUNDLE_NAME, static::CONTROLLER_NAME_CALLBACK, 'failure'); |
87
|
|
|
$routeCollection->add(static::ROUTE_NAME_CREFO_PAY_FAILURE, $route); |
88
|
|
|
|
89
|
|
|
return $routeCollection; |
90
|
|
|
} |
91
|
|
|
} |
92
|
|
|
|