We will be off on April 7th (Monday) for public holiday in our country

Commit da1929ac authored by alexandros's avatar alexandros

Modify the transparent controller to be compatible with magento 2.2 version

parent 18a51807
......@@ -23,14 +23,11 @@
namespace Adyen\Payment\Controller\Transparent;
use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Framework\App\CsrfAwareActionInterface;
use Magento\Framework\App\Request\InvalidRequestException;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\App\Request\Http as Http;
use Magento\Framework\View\Result\LayoutFactory;
use Magento\Framework\App\Action\Context;
class Redirect extends Action implements CsrfAwareActionInterface, HttpPostActionInterface
class Redirect extends Action
{
/**
* @var \Adyen\Payment\Logger\AdyenLogger
......@@ -50,27 +47,18 @@ class Redirect extends Action implements CsrfAwareActionInterface, HttpPostActio
public function __construct(
Context $context,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger,
LayoutFactory $resultLayoutFactory)
{
LayoutFactory $resultLayoutFactory
) {
$this->adyenLogger = $adyenLogger;
$this->resultLayoutFactory = $resultLayoutFactory;
parent::__construct($context);
}
/**
* @inheritdoc
*/
public function validateForCsrf(RequestInterface $request): ?bool
{
return true;
}
/**
* @inheritdoc
*/
public function createCsrfValidationException(RequestInterface $request): ?InvalidRequestException
{
return null;
if (interface_exists(\Magento\Framework\App\CsrfAwareActionInterface::class)) {
$request = $this->getRequest();
if ($request instanceof Http && $request->isPost()) {
$request->setParam('isAjax', true);
$request->getHeaders()->addHeaderLine('X_REQUESTED_WITH', 'XMLHttpRequest');
}
}
}
/**
......@@ -88,4 +76,4 @@ class Redirect extends Action implements CsrfAwareActionInterface, HttpPostActio
return $resultLayout;
}
}
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment