Completed
Push — feature/eco-3656/eco-3658-enab... ( ab05e4...16d9cc )
by
unknown
06:10
created

addPayPalExpressSuccessRoute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
c 0
b 0
f 0
dl 0
loc 11
rs 10
cc 1
nc 1
nop 1
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\Yves\Computop\Plugin\Router;
9
10
use Spryker\Yves\Router\Plugin\RouteProvider\AbstractRouteProviderPlugin;
11
use Spryker\Yves\Router\Route\RouteCollection;
12
13
class ComputopRouteProviderPlugin extends AbstractRouteProviderPlugin
14
{
15
    public const CREDIT_CARD_SUCCESS = 'computop-credit-card-success';
16
    public const DIRECT_DEBIT_SUCCESS = 'computop-direct-debit-success';
17
    public const EASY_CREDIT_SUCCESS = 'computop-easy-credit-success';
18
    public const IDEAL_SUCCESS = 'computop-ideal-success';
19
    public const PAYDIREKT_SUCCESS = 'computop-paydirekt-success';
20
    public const PAY_NOW_SUCCESS = 'computop-paynow-success';
21
    public const PAY_PAL_SUCCESS = 'computop-pay-pal-success';
22
    public const SOFORT_SUCCESS = 'computop-sofort-success';
23
24
    public const ROUTE_NAME_CHECKOUT_COMPUTOP_PAY_PAL_EXPRESS_PREPARE = 'computop-pay-pal-express-prepare';
25
    public const ROUTE_NAME_PAY_PAL_EXPRESS_PLACE_ORDER = 'computop-pay-pal-express-place-order';
26
    public const ROUTE_NAME_PAY_PAL_EXPRESS_COMPLETE = 'computop-pay-pal-express-complete';
27
28
    public const FAILURE_PATH_NAME = 'computop-failure';
29
    public const NOTIFY_PATH_NAME = 'computop-notify';
30
31
    /**
32
     * Specification:
33
     * - Adds Routes to the RouteCollection.
34
     *
35
     * @api
36
     *
37
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
38
     *
39
     * @return \Spryker\Yves\Router\Route\RouteCollection
40
     */
41
    public function addRoutes(RouteCollection $routeCollection): RouteCollection
42
    {
43
        $routeCollection = $this->addCreditCardSuccessRoute($routeCollection);
44
        $routeCollection = $this->addDirectDebitSuccessRoute($routeCollection);
45
        $routeCollection = $this->addEasyCreditSuccessRoute($routeCollection);
46
        $routeCollection = $this->addIdealSuccessRoute($routeCollection);
47
        $routeCollection = $this->addPaydirectSuccessRoute($routeCollection);
48
        $routeCollection = $this->addPayNowSuccessRoute($routeCollection);
49
        $routeCollection = $this->addPayPalSuccessRoute($routeCollection);
50
        $routeCollection = $this->addSofortSuccessRoute($routeCollection);
51
        $routeCollection = $this->addFailureRoute($routeCollection);
52
        $routeCollection = $this->addNotifyRoute($routeCollection);
53
        $routeCollection = $this->addPayPalExpressPrepareRoute($routeCollection);
54
        $routeCollection = $this->addPayPalExpressPlaceOrderRoute($routeCollection);
55
        $routeCollection = $this->addPayPalExpressCompleteRoute($routeCollection);
56
57
        return $routeCollection;
58
    }
59
60
    /**
61
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
62
     *
63
     * @return \Spryker\Yves\Router\Route\RouteCollection
64
     */
65
    protected function addCreditCardSuccessRoute(RouteCollection $routeCollection): RouteCollection
66
    {
67
        $route = $this->buildRoute(
68
            '/computop/credit-card-success',
69
            'Computop',
70
            'Callback',
71
            'successCreditCardAction'
72
        );
73
        $routeCollection->add(static::CREDIT_CARD_SUCCESS, $route);
74
75
        return $routeCollection;
76
    }
77
78
    /**
79
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
80
     *
81
     * @return \Spryker\Yves\Router\Route\RouteCollection
82
     */
83
    protected function addDirectDebitSuccessRoute(RouteCollection $routeCollection): RouteCollection
84
    {
85
        $route = $this->buildRoute(
86
            '/computop/direct-debit-success',
87
            'Computop',
88
            'Callback',
89
            'successDirectDebitAction'
90
        );
91
        $routeCollection->add(static::DIRECT_DEBIT_SUCCESS, $route);
92
93
        return $routeCollection;
94
    }
95
96
    /**
97
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
98
     *
99
     * @return \Spryker\Yves\Router\Route\RouteCollection
100
     */
101
    protected function addEasyCreditSuccessRoute(RouteCollection $routeCollection): RouteCollection
102
    {
103
        $route = $this->buildRoute(
104
            '/computop/easy-credit-success',
105
            'Computop',
106
            'Callback',
107
            'successEasyCreditAction'
108
        );
109
        $routeCollection->add(static::EASY_CREDIT_SUCCESS, $route);
110
111
        return $routeCollection;
112
    }
113
114
    /**
115
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
116
     *
117
     * @return \Spryker\Yves\Router\Route\RouteCollection
118
     */
119
    protected function addIdealSuccessRoute(RouteCollection $routeCollection): RouteCollection
120
    {
121
        $route = $this->buildRoute(
122
            '/computop/ideal-success',
123
            'Computop',
124
            'Callback',
125
            'successIdealAction'
126
        );
127
        $routeCollection->add(static::IDEAL_SUCCESS, $route);
128
129
        return $routeCollection;
130
    }
131
132
    /**
133
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
134
     *
135
     * @return \Spryker\Yves\Router\Route\RouteCollection
136
     */
137
    protected function addPaydirectSuccessRoute(RouteCollection $routeCollection): RouteCollection
138
    {
139
        $route = $this->buildRoute(
140
            '/computop/paydirekt-success',
141
            'Computop',
142
            'Callback',
143
            'successPaydirektAction'
144
        );
145
        $routeCollection->add(static::PAYDIREKT_SUCCESS, $route);
146
147
        return $routeCollection;
148
    }
149
150
    /**
151
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
152
     *
153
     * @return \Spryker\Yves\Router\Route\RouteCollection
154
     */
155
    protected function addPayNowSuccessRoute(RouteCollection $routeCollection): RouteCollection
156
    {
157
        $route = $this->buildRoute(
158
            '/computop/paynow-success',
159
            'Computop',
160
            'Callback',
161
            'successPayNowAction'
162
        );
163
        $routeCollection->add(static::PAY_NOW_SUCCESS, $route);
164
165
        return $routeCollection;
166
    }
167
168
    /**
169
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
170
     *
171
     * @return \Spryker\Yves\Router\Route\RouteCollection
172
     */
173
    protected function addPayPalSuccessRoute(RouteCollection $routeCollection): RouteCollection
174
    {
175
        $route = $this->buildRoute(
176
            '/computop/pay-pal-success',
177
            'Computop',
178
            'Callback',
179
            'successPayPalAction'
180
        );
181
        $routeCollection->add(static::PAY_PAL_SUCCESS, $route);
182
183
        return $routeCollection;
184
    }
185
186
    /**
187
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
188
     *
189
     * @return \Spryker\Yves\Router\Route\RouteCollection
190
     */
191
    protected function addSofortSuccessRoute(RouteCollection $routeCollection): RouteCollection
192
    {
193
        $route = $this->buildRoute(
194
            '/computop/sofort-success',
195
            'Computop',
196
            'Callback',
197
            'successSofortAction'
198
        );
199
        $routeCollection->add(static::SOFORT_SUCCESS, $route);
200
201
        return $routeCollection;
202
    }
203
204
    /**
205
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
206
     *
207
     * @return \Spryker\Yves\Router\Route\RouteCollection
208
     */
209
    protected function addPayPalExpressPrepareRoute(RouteCollection $routeCollection): RouteCollection
210
    {
211
        $route = $this->buildRoute(
212
            '/computop/pay-pal-express-prepare',
213
            'Computop',
214
            'ExpressCheckout',
215
            'preparePayPalExpressAction'
216
        );
217
        $routeCollection->add(static::ROUTE_NAME_CHECKOUT_COMPUTOP_PAY_PAL_EXPRESS_PREPARE, $route);
218
219
        return $routeCollection;
220
    }
221
222
    /**
223
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
224
     *
225
     * @return \Spryker\Yves\Router\Route\RouteCollection
226
     */
227
    protected function addPayPalExpressPlaceOrderRoute(RouteCollection $routeCollection): RouteCollection
228
    {
229
        $route = $this->buildRoute(
230
            '/computop/pay-pal-express-place-order',
231
            'Computop',
232
            'ExpressCheckout',
233
            'placeOrderPayPalExpressAction'
234
        );
235
        $routeCollection->add(static::ROUTE_NAME_PAY_PAL_EXPRESS_PLACE_ORDER, $route);
236
237
        return $routeCollection;
238
    }
239
240
    /**
241
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
242
     *
243
     * @return \Spryker\Yves\Router\Route\RouteCollection
244
     */
245
    protected function addPayPalExpressCompleteRoute(RouteCollection $routeCollection): RouteCollection
246
    {
247
        $route = $this->buildRoute(
248
            '/computop/pay-pal-express-complete',
249
            'Computop',
250
            'ExpressCheckout',
251
            'completeOrderPayPalExpressAction'
252
        );
253
        $routeCollection->add(static::ROUTE_NAME_PAY_PAL_EXPRESS_COMPLETE, $route);
254
255
        return $routeCollection;
256
    }
257
258
    /**
259
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
260
     *
261
     * @return \Spryker\Yves\Router\Route\RouteCollection
262
     */
263
    protected function addFailureRoute(RouteCollection $routeCollection): RouteCollection
264
    {
265
        $route = $this->buildRoute(
266
            '/computop/failure',
267
            'Computop',
268
            'Callback',
269
            'failureAction'
270
        );
271
        $routeCollection->add(static::FAILURE_PATH_NAME, $route);
272
273
        return $routeCollection;
274
    }
275
276
    /**
277
     * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection
278
     *
279
     * @return \Spryker\Yves\Router\Route\RouteCollection
280
     */
281
    protected function addNotifyRoute(RouteCollection $routeCollection): RouteCollection
282
    {
283
        $route = $this->buildRoute(
284
            '/computop/notify',
285
            'Computop',
286
            'Callback',
287
            'notifyAction'
288
        );
289
        $routeCollection->add(static::NOTIFY_PATH_NAME, $route);
290
291
        return $routeCollection;
292
    }
293
}
294