Skip to content

Commit 8211eb7

Browse files
committed
MC-31573: PayflowPro Checkout Broken with SameSite Cookie Changes from Chrome 80
1 parent 8ed20d1 commit 8211eb7

File tree

2 files changed

+69
-16
lines changed

2 files changed

+69
-16
lines changed

app/code/Magento/Paypal/Controller/Adminhtml/Transparent/Redirect.php

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,67 @@
55
*/
66
namespace Magento\Paypal\Controller\Adminhtml\Transparent;
77

8+
use Magento\Backend\App\AbstractAction;
9+
use Magento\Backend\App\Action\Context;
10+
use Magento\Framework\View\Result\LayoutFactory;
11+
use Magento\Payment\Model\Method\Logger;
12+
use Magento\Paypal\Model\Payflow\Transparent;
13+
814
/**
915
* Class for redirecting the Paypal response result to Magento controller.
1016
*/
11-
class Redirect extends \Magento\Paypal\Controller\Transparent\Redirect
17+
class Redirect extends AbstractAction
1218
{
19+
/**
20+
* @var LayoutFactory
21+
*/
22+
private $resultLayoutFactory;
23+
24+
/**
25+
* @var Transparent
26+
*/
27+
private $transparent;
28+
29+
/**
30+
* @var Logger
31+
*/
32+
private $logger;
33+
34+
/**
35+
* @param Context $context
36+
* @param LayoutFactory $resultLayoutFactory
37+
* @param Transparent $transparent
38+
* @param Logger $logger
39+
*/
40+
public function __construct(
41+
Context $context,
42+
LayoutFactory $resultLayoutFactory,
43+
Transparent $transparent,
44+
Logger $logger
45+
)
46+
{
47+
parent::__construct($context);
48+
$this->transparent = $transparent;
49+
$this->logger = $logger;
50+
$this->resultLayoutFactory = $resultLayoutFactory;
51+
}
52+
53+
/**
54+
* @inheritdoc
55+
*/
56+
public function execute()
57+
{
58+
$gatewayResponse = (array)$this->getRequest()->getPostValue();
59+
$this->logger->debug(
60+
['PayPal PayflowPro redirect:' => $gatewayResponse],
61+
$this->transparent->getDebugReplacePrivateDataKeys(),
62+
$this->transparent->getDebugFlag()
63+
);
64+
65+
$resultLayout = $this->resultLayoutFactory->create();
66+
$resultLayout->addDefaultHandle();
67+
$resultLayout->getLayout()->getUpdate()->load(['transparent_payment_redirect']);
68+
69+
return $resultLayout;
70+
}
1371
}

app/code/Magento/Paypal/Controller/Transparent/Redirect.php

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
*/
66
namespace Magento\Paypal\Controller\Transparent;
77

8+
use Magento\Framework\App\Action\Action;
9+
use Magento\Framework\App\Action\Context;
810
use Magento\Framework\App\Action\HttpPostActionInterface;
9-
use Magento\Framework\App\ActionInterface;
1011
use Magento\Framework\App\CsrfAwareActionInterface;
1112
use Magento\Framework\App\Request\InvalidRequestException;
1213
use Magento\Framework\App\RequestInterface;
@@ -19,13 +20,8 @@
1920
/**
2021
* Class for redirecting the Paypal response result to Magento controller.
2122
*/
22-
class Redirect implements ActionInterface, CsrfAwareActionInterface, HttpPostActionInterface
23+
class Redirect extends Action implements CsrfAwareActionInterface, HttpPostActionInterface
2324
{
24-
/**
25-
* @var RequestInterface
26-
*/
27-
private $request;
28-
2925
/**
3026
* @var LayoutFactory
3127
*/
@@ -42,27 +38,26 @@ class Redirect implements ActionInterface, CsrfAwareActionInterface, HttpPostAct
4238
private $logger;
4339

4440
/**
45-
* Constructor
46-
*
47-
* @param RequestInterface $request
41+
* @param Context $context
4842
* @param LayoutFactory $resultLayoutFactory
4943
* @param Transparent $transparent
5044
* @param Logger $logger
5145
*/
5246
public function __construct(
53-
RequestInterface $request,
47+
Context $context,
5448
LayoutFactory $resultLayoutFactory,
5549
Transparent $transparent,
5650
Logger $logger
5751
) {
58-
$this->request = $request;
5952
$this->resultLayoutFactory = $resultLayoutFactory;
6053
$this->transparent = $transparent;
6154
$this->logger = $logger;
55+
56+
parent::__construct($context);
6257
}
6358

6459
/**
65-
* @inheritDoc
60+
* @inheritdoc
6661
*/
6762
public function createCsrfValidationException(
6863
RequestInterface $request
@@ -71,7 +66,7 @@ public function createCsrfValidationException(
7166
}
7267

7368
/**
74-
* @inheritDoc
69+
* @inheritdoc
7570
*/
7671
public function validateForCsrf(RequestInterface $request): ?bool
7772
{
@@ -86,7 +81,7 @@ public function validateForCsrf(RequestInterface $request): ?bool
8681
*/
8782
public function execute()
8883
{
89-
$gatewayResponse = (array)$this->request->getPostValue();
84+
$gatewayResponse = (array)$this->getRequest()->getPostValue();
9085
$this->logger->debug(
9186
['PayPal PayflowPro redirect:' => $gatewayResponse],
9287
$this->transparent->getDebugReplacePrivateDataKeys(),

0 commit comments

Comments
 (0)