Completed
Pull Request — master (#44)
by Aleksey
05:42
created

addPayoneExpressCheckoutLoadDetailsRoute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 4
c 1
b 1
f 0
nc 1
nop 1
dl 0
loc 7
rs 10
1
<?php
2
3
/**
4
 * Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Yves\Payone\Plugin\Router;
9
10
use Spryker\Yves\Router\Plugin\RouteProvider\AbstractRouteProviderPlugin;
0 ignored issues
show
Bug introduced by
The type Spryker\Yves\Router\Plug...ractRouteProviderPlugin was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Spryker\Yves\Router\Route\RouteCollection;
0 ignored issues
show
Bug introduced by
The type Spryker\Yves\Router\Route\RouteCollection was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
13
class PayoneRouteProviderPlugin extends AbstractRouteProviderPlugin
14
{
15
    protected const ROUTE_PAYONE_INDEX = 'payone-index';
16
    protected const ROUTE_PAYONE_GET_FILE = 'payone-getfile';
17
    protected const ROUTE_PAYONE_CANCEL_REDIRECT = 'payone-cancel-redirect';
18
    protected const ROUTE_PAYONE_GET_INVOICE = 'payone-getinvoice';
19
20
    protected const ROUTE_PAYONE_EXPRESS_CHECKOUT_BUTTON = 'payone-checkout-with-paypal-button';
21
    protected const ROUTE_PAYONE_EXPRESS_CHECKOUT_INIT = 'payone-paypal-express-checkout-init';
22
    protected const ROUTE_PAYONE_EXPRESS_CHECKOUT_FAILURE = 'payone-paypal-express-checkout-failure';
23
    protected const ROUTE_PAYONE_EXPRESS_CHECKOUT_BACK = 'payone-paypal-express-checkout-back';
24
    protected const ROUTE_PAYONE_EXPRESS_CHECKOUT_LOAD_DETAILS = 'payone-paypal-express-checkout-load-details';
25
26
    /**
27
     * {@inheritDoc}
28
     * - Adds Payone specific Routes to the RouteCollection.
29
     *
30
     * @api
31
     *
32
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
33
     *
34
     * @return \Spryker\Yves\Router\Route\RouteCollection
35
     */
36
    public function addRoutes(RouteCollection $routeCollection): RouteCollection
37
    {
38
        $routeCollection = $this->addPayoneIndexRoute($routeCollection);
39
        $routeCollection = $this->addPayoneGetFileRoute($routeCollection);
40
        $routeCollection = $this->addPayoneCancelRedirectRoute($routeCollection);
41
        $routeCollection = $this->addPayoneGetInvoiceRoute($routeCollection);
42
        $routeCollection = $this->addPayoneExpressCheckoutButtonRoute($routeCollection);
43
        $routeCollection = $this->addPayoneExpressCheckoutInitRoute($routeCollection);
44
        $routeCollection = $this->addPayoneExpressCheckoutFailureRoute($routeCollection);
45
        $routeCollection = $this->addPayoneExpressCheckoutBackRoute($routeCollection);
46
        $routeCollection = $this->addPayoneExpressCheckoutLoadDetailsRoute($routeCollection);
47
48
        return $routeCollection;
49
    }
50
51
    /**
52
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
53
     *
54
     * @return \Spryker\Yves\Router\Route\RouteCollection
55
     */
56
    protected function addPayoneIndexRoute(RouteCollection $routeCollection): RouteCollection
57
    {
58
        $route = $this->buildRoute('/payone', 'Payone', 'Index', 'indexAction');
59
        $route = $route->setMethods(['POST']);
60
        $routeCollection->add(static::ROUTE_PAYONE_INDEX, $route);
61
62
        return $routeCollection;
63
    }
64
65
    /**
66
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
67
     *
68
     * @return \Spryker\Yves\Router\Route\RouteCollection
69
     */
70
    protected function addPayoneGetFileRoute(RouteCollection $routeCollection): RouteCollection
71
    {
72
        $route = $this->buildRoute('/payone/getfile', 'Payone', 'Index', 'getFileAction');
73
        $route = $route->setMethods(['GET', 'POST']);
74
        $routeCollection->add(static::ROUTE_PAYONE_GET_FILE, $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 addPayoneCancelRedirectRoute(RouteCollection $routeCollection): RouteCollection
85
    {
86
        $route = $this->buildRoute('/payone/regular-redirect-payment-cancellation', 'Payone', 'Index', 'cancelRedirectAction');
87
        $route = $route->setMethods(['GET']);
88
        $routeCollection->add(static::ROUTE_PAYONE_CANCEL_REDIRECT, $route);
89
90
        return $routeCollection;
91
    }
92
93
    /**
94
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
95
     *
96
     * @return \Spryker\Yves\Router\Route\RouteCollection
97
     */
98
    protected function addPayoneGetInvoiceRoute(RouteCollection $routeCollection): RouteCollection
99
    {
100
        $route = $this->buildRoute('/payone/getinvoice', 'Payone', 'Index', 'getInvoiceAction');
101
        $route = $route->setMethods(['GET']);
102
        $routeCollection->add(static::ROUTE_PAYONE_GET_INVOICE, $route);
103
104
        return $routeCollection;
105
    }
106
107
    /**
108
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
109
     *
110
     * @return \Spryker\Yves\Router\Route\RouteCollection
111
     */
112
    protected function addPayoneExpressCheckoutButtonRoute(RouteCollection $routeCollection): RouteCollection
113
    {
114
        $route = $this->buildRoute('/payone/checkout-with-paypal-button', 'Payone', 'ExpressCheckout', 'checkoutWithPaypalButtonAction');
115
        $route = $route->setMethods(['GET']);
116
        $routeCollection->add(static::ROUTE_PAYONE_EXPRESS_CHECKOUT_BUTTON, $route);
117
118
        return $routeCollection;
119
    }
120
121
    /**
122
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
123
     *
124
     * @return \Spryker\Yves\Router\Route\RouteCollection
125
     */
126
    protected function addPayoneExpressCheckoutInitRoute(RouteCollection $routeCollection): RouteCollection
127
    {
128
        $route = $this->buildRoute('/payone/paypal-express-checkout-init', 'Payone', 'ExpressCheckout', 'initPaypalExpressCheckoutAction');
129
        $route = $route->setMethods(['GET']);
130
        $routeCollection->add(static::ROUTE_PAYONE_EXPRESS_CHECKOUT_INIT, $route);
131
132
        return $routeCollection;
133
    }
134
135
    /**
136
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
137
     *
138
     * @return \Spryker\Yves\Router\Route\RouteCollection
139
     */
140
    protected function addPayoneExpressCheckoutFailureRoute(RouteCollection $routeCollection): RouteCollection
141
    {
142
        $route = $this->buildRoute('/payone/expresscheckout/failure', 'Payone', 'ExpressCheckout', 'failureAction');
143
        $route = $route->setMethods(['GET']);
144
        $routeCollection->add(static::ROUTE_PAYONE_EXPRESS_CHECKOUT_FAILURE, $route);
145
146
        return $routeCollection;
147
    }
148
149
    /**
150
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
151
     *
152
     * @return \Spryker\Yves\Router\Route\RouteCollection
153
     */
154
    protected function addPayoneExpressCheckoutBackRoute(RouteCollection $routeCollection): RouteCollection
155
    {
156
        $route = $this->buildRoute('/payone/expresscheckout/back', 'Payone', 'ExpressCheckout', 'backAction');
157
        $route = $route->setMethods(['GET']);
158
        $routeCollection->add(static::ROUTE_PAYONE_EXPRESS_CHECKOUT_BACK, $route);
159
160
        return $routeCollection;
161
    }
162
163
    /**
164
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
165
     *
166
     * @return \Spryker\Yves\Router\Route\RouteCollection
167
     */
168
    protected function addPayoneExpressCheckoutLoadDetailsRoute(RouteCollection $routeCollection): RouteCollection
169
    {
170
        $route = $this->buildRoute('/payone/expresscheckout/load-details', 'Payone', 'ExpressCheckout', 'loadPaypalExpressCheckoutDetailsAction');
171
        $route = $route->setMethods(['GET']);
172
        $routeCollection->add(static::ROUTE_PAYONE_EXPRESS_CHECKOUT_LOAD_DETAILS, $route);
173
174
        return $routeCollection;
175
    }
176
}
177