Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Checkout.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Paypal\Helper;
7 
9 
13 class Checkout
14 {
18  protected $session;
19 
23  public function __construct(
24  \Magento\Checkout\Model\Session $session
25  ) {
26  $this->session = $session;
27  }
28 
35  public function cancelCurrentOrder($comment)
36  {
37  $order = $this->session->getLastRealOrder();
38  if ($order->getId() && $order->getState() != Order::STATE_CANCELED) {
39  $order->registerCancellation($comment)->save();
40  return true;
41  }
42  return false;
43  }
44 
50  public function restoreQuote()
51  {
52  return $this->session->restoreQuote();
53  }
54 }
$order
Definition: order.php:55
__construct(\Magento\Checkout\Model\Session $session)
Definition: Checkout.php:23