Failure.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Checkout\Block\Onepage;
  7. /**
  8. * @api
  9. * @since 100.0.2
  10. */
  11. class Failure extends \Magento\Framework\View\Element\Template
  12. {
  13. /**
  14. * @var \Magento\Checkout\Model\Session
  15. */
  16. protected $_checkoutSession;
  17. /**
  18. * @param \Magento\Framework\View\Element\Template\Context $context
  19. * @param \Magento\Checkout\Model\Session $checkoutSession
  20. * @param array $data
  21. */
  22. public function __construct(
  23. \Magento\Framework\View\Element\Template\Context $context,
  24. \Magento\Checkout\Model\Session $checkoutSession,
  25. array $data = []
  26. ) {
  27. $this->_checkoutSession = $checkoutSession;
  28. parent::__construct($context, $data);
  29. $this->_isScopePrivate = true;
  30. }
  31. /**
  32. * @return mixed
  33. */
  34. public function getRealOrderId()
  35. {
  36. return $this->_checkoutSession->getLastRealOrderId();
  37. }
  38. /**
  39. * Payment custom error message
  40. *
  41. * @return string
  42. */
  43. public function getErrorMessage()
  44. {
  45. $error = $this->_checkoutSession->getErrorMessage();
  46. return $error;
  47. }
  48. /**
  49. * Continue shopping URL
  50. *
  51. * @return string
  52. */
  53. public function getContinueShoppingUrl()
  54. {
  55. return $this->getUrl('checkout/cart');
  56. }
  57. }