Skip to content

Commit 45f4521

Browse files
committed
Merge remote-tracking branch 'origin/AC-13699' into spartans_pr_11022025
2 parents 1d48ea2 + 536e104 commit 45f4521

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

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

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2020 Adobe
4+
* All rights reserved.
55
*/
66
namespace Magento\Paypal\Controller\Transparent;
77

88
use Magento\Framework\App\Action\Action;
99
use Magento\Framework\App\Action\Context;
10+
use Magento\Framework\App\Action\HttpGetActionInterface;
1011
use Magento\Framework\App\Action\HttpPostActionInterface;
1112
use Magento\Framework\App\CsrfAwareActionInterface;
1213
use Magento\Framework\App\Request\InvalidRequestException;
@@ -20,7 +21,7 @@
2021
/**
2122
* Class for redirecting the Paypal response result to Magento controller.
2223
*/
23-
class Redirect extends Action implements CsrfAwareActionInterface, HttpPostActionInterface
24+
class Redirect extends Action implements CsrfAwareActionInterface, HttpPostActionInterface, HttpGetActionInterface
2425
{
2526
/**
2627
* @var LayoutFactory
@@ -81,6 +82,7 @@ public function validateForCsrf(RequestInterface $request): ?bool
8182
*/
8283
public function execute()
8384
{
85+
$this->mapGatewayResponse();
8486
$gatewayResponse = (array)$this->getRequest()->getPostValue();
8587
$this->logger->debug(
8688
['PayPal PayflowPro redirect:' => $gatewayResponse],
@@ -94,4 +96,20 @@ public function execute()
9496

9597
return $resultLayout;
9698
}
99+
100+
/**
101+
* Fill post data with gateway response params
102+
*
103+
* @return void
104+
*/
105+
private function mapGatewayResponse(): void
106+
{
107+
if (!empty($this->getRequest()->getPostValue())) {
108+
return;
109+
}
110+
$gatewayResponse = $this->getRequest()->getParams();
111+
if (!empty($gatewayResponse)) {
112+
$this->getRequest()->setPostValue($gatewayResponse);
113+
}
114+
}
97115
}

0 commit comments

Comments
 (0)