SilentPost.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 SilentPost 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. * Get response from PayPal by silent post method
  30. *
  31. * @return void
  32. */
  33. public function execute()
  34. {
  35. $data = $this->getRequest()->getPostValue();
  36. if (isset($data['INVNUM'])) {
  37. /** @var $paymentModel \Magento\Paypal\Model\Payflowlink */
  38. $paymentModel = $this->_payflowModelFactory->create();
  39. try {
  40. $paymentModel->process($data);
  41. } catch (\Exception $e) {
  42. $this->_logger->critical($e);
  43. }
  44. }
  45. }
  46. }