|
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
|
|
|
|