ExpressCheckoutController   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 14
c 3
b 0
f 0
dl 0
loc 51
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A initPaypalExpressCheckoutAction() 0 5 1
A loadPaypalExpressCheckoutDetailsAction() 0 6 1
A backAction() 0 5 1
A checkoutWithPaypalButtonAction() 0 3 1
A failureAction() 0 7 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\Payone\Controller;
9
10
use Spryker\Yves\Kernel\Controller\AbstractController;
11
12
/**
13
 * @method \SprykerEco\Client\Payone\PayoneClientInterface getClient()
14
 * @method \SprykerEco\Yves\Payone\PayoneFactory getFactory()
15
 */
16
class ExpressCheckoutController extends AbstractController
17
{
18
    /**
19
     * @return array
20
     */
21
    public function checkoutWithPaypalButtonAction()
22
    {
23
        return $this->viewResponse();
24
    }
25
26
    /**
27
     * @return \Symfony\Component\HttpFoundation\RedirectResponse
28
     */
29
    public function initPaypalExpressCheckoutAction()
30
    {
31
        $expressCheckoutHandler = $this->getFactory()->createExpressCheckoutHandler();
32
33
        return $expressCheckoutHandler->initPaypalExpressCheckout();
34
    }
35
36
    /**
37
     * @return \Symfony\Component\HttpFoundation\RedirectResponse
38
     */
39
    public function loadPaypalExpressCheckoutDetailsAction()
40
    {
41
        $expressCheckoutHandler = $this->getFactory()->createExpressCheckoutHandler();
42
        $expressCheckoutHandler->loadExpressCheckoutDetails();
43
44
        return $expressCheckoutHandler->redirectToCheckoutEntryPoint();
45
    }
46
47
    /**
48
     * @return \Symfony\Component\HttpFoundation\RedirectResponse
49
     */
50
    public function failureAction()
51
    {
52
        $this->addErrorMessage('Paypal transaction failed.');
53
54
        return $this->getFactory()
55
            ->createExpressCheckoutHandler()
56
            ->redirectToFailureUrl();
57
    }
58
59
    /**
60
     * @return \Symfony\Component\HttpFoundation\RedirectResponse
61
     */
62
    public function backAction()
63
    {
64
        return $this->getFactory()
65
            ->createExpressCheckoutHandler()
66
            ->redirectToBackUrl();
67
    }
68
}
69