Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ReturnAction.php
Go to the documentation of this file.
1 <?php
8 
10 
12 {
18  public function execute()
19  {
21  $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
22 
23  if ($this->getRequest()->getParam('retry_authorization') == 'true'
24  && is_array($this->_getCheckoutSession()->getPaypalTransactionData())
25  ) {
26  $this->_forward('placeOrder');
27  return;
28  }
29  try {
30  $this->_getCheckoutSession()->unsPaypalTransactionData();
31  $this->_initCheckout();
32  $this->_checkout->returnFromPaypal($this->_initToken());
33  if ($this->_checkout->canSkipOrderReviewStep()) {
34  $this->_forward('placeOrder');
35  } else {
36  $this->_redirect('*/*/review');
37  }
38  return;
39  } catch (\Magento\Framework\Exception\LocalizedException $e) {
40  $this->messageManager->addExceptionMessage(
41  $e,
42  $e->getMessage()
43  );
44  } catch (\Exception $e) {
45  $this->messageManager->addExceptionMessage(
46  $e,
47  __('We can\'t process Express Checkout approval.')
48  );
49  }
50 
51  return $resultRedirect->setPath('checkout/cart');
52  }
53 }
_redirect($path, $arguments=[])
Definition: Action.php:167
__()
Definition: __.php:13
_forward($action, $controller=null, $module=null, array $params=null)
Definition: Action.php:137