1
1
<?php
2
2
/**
3
- * Copyright © Magento, Inc. All rights reserved.
4
- * See COPYING.txt for license details .
3
+ * Copyright 2020 Adobe
4
+ * All rights reserved .
5
5
*/
6
6
namespace Magento \Paypal \Controller \Transparent ;
7
7
8
8
use Magento \Framework \App \Action \Action ;
9
9
use Magento \Framework \App \Action \Context ;
10
+ use Magento \Framework \App \Action \HttpGetActionInterface ;
10
11
use Magento \Framework \App \Action \HttpPostActionInterface ;
11
12
use Magento \Framework \App \CsrfAwareActionInterface ;
12
13
use Magento \Framework \App \Request \InvalidRequestException ;
20
21
/**
21
22
* Class for redirecting the Paypal response result to Magento controller.
22
23
*/
23
- class Redirect extends Action implements CsrfAwareActionInterface, HttpPostActionInterface
24
+ class Redirect extends Action implements CsrfAwareActionInterface, HttpPostActionInterface, HttpGetActionInterface
24
25
{
25
26
/**
26
27
* @var LayoutFactory
@@ -81,6 +82,7 @@ public function validateForCsrf(RequestInterface $request): ?bool
81
82
*/
82
83
public function execute ()
83
84
{
85
+ $ this ->mapGatewayResponse ();
84
86
$ gatewayResponse = (array )$ this ->getRequest ()->getPostValue ();
85
87
$ this ->logger ->debug (
86
88
['PayPal PayflowPro redirect: ' => $ gatewayResponse ],
@@ -94,4 +96,20 @@ public function execute()
94
96
95
97
return $ resultLayout ;
96
98
}
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
+ }
97
115
}
0 commit comments