CancelPayment.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Paypal\Controller\Payflow;
  8. use Magento\Framework\App\CsrfAwareActionInterface;
  9. use Magento\Framework\App\Request\InvalidRequestException;
  10. use Magento\Framework\App\RequestInterface;
  11. class CancelPayment extends \Magento\Paypal\Controller\Payflow implements CsrfAwareActionInterface
  12. {
  13. /**
  14. * @inheritDoc
  15. */
  16. public function createCsrfValidationException(
  17. RequestInterface $request
  18. ): ?InvalidRequestException {
  19. return null;
  20. }
  21. /**
  22. * @inheritDoc
  23. */
  24. public function validateForCsrf(RequestInterface $request): ?bool
  25. {
  26. return true;
  27. }
  28. /**
  29. * When a customer cancel payment from payflow gateway.
  30. *
  31. * @return void
  32. */
  33. public function execute()
  34. {
  35. $this->_view->loadLayout(false);
  36. $gotoSection = $this->_cancelPayment();
  37. $redirectBlock = $this->_view->getLayout()->getBlock($this->_redirectBlockName);
  38. $redirectBlock->setGotoSection($gotoSection);
  39. $this->_view->renderLayout();
  40. }
  41. }