Skip to content

Commit 768e5de

Browse files
MC-32546: Website Payments Pro Hosted Solution redirect to home page
1 parent ac3eb00 commit 768e5de

File tree

2 files changed

+55
-4
lines changed

2 files changed

+55
-4
lines changed

app/code/Magento/Paypal/Controller/Hostedpro/Cancel.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
6+
declare(strict_types=1);
7+
78
namespace Magento\Paypal\Controller\Hostedpro;
89

10+
use Magento\Framework\App\Action\Action;
911
use Magento\Framework\App\Action\Context;
12+
use Magento\Framework\App\Action\HttpGetActionInterface;
13+
use Magento\Framework\App\CsrfAwareActionInterface;
14+
use Magento\Framework\App\Request\InvalidRequestException;
15+
use Magento\Framework\App\RequestInterface;
1016
use Magento\Paypal\Helper\Checkout;
1117

12-
class Cancel extends \Magento\Framework\App\Action\Action
18+
/**
19+
* PayPal Hostedpro cancel controller.
20+
*/
21+
class Cancel extends Action implements CsrfAwareActionInterface, HttpGetActionInterface
1322
{
1423
/**
1524
* @var Checkout
@@ -40,4 +49,20 @@ public function execute()
4049

4150
$this->_redirect('checkout', ['_fragment' => 'payment']);
4251
}
52+
53+
/**
54+
* @inheritDoc
55+
*/
56+
public function createCsrfValidationException(RequestInterface $request): ?InvalidRequestException
57+
{
58+
return null;
59+
}
60+
61+
/**
62+
* @inheritDoc
63+
*/
64+
public function validateForCsrf(RequestInterface $request): ?bool
65+
{
66+
return true;
67+
}
4368
}

app/code/Magento/Paypal/Controller/Hostedpro/ReturnAction.php

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
6+
declare(strict_types=1);
7+
78
namespace Magento\Paypal\Controller\Hostedpro;
89

9-
class ReturnAction extends \Magento\Framework\App\Action\Action
10+
use Magento\Framework\App\Action\Action;
11+
use Magento\Framework\App\Action\HttpPostActionInterface;
12+
use Magento\Framework\App\CsrfAwareActionInterface;
13+
use Magento\Framework\App\Request\InvalidRequestException;
14+
use Magento\Framework\App\RequestInterface;
15+
16+
/**
17+
* PayPal Hostedpro return controller.
18+
*/
19+
class ReturnAction extends Action implements CsrfAwareActionInterface, HttpPostActionInterface
1020
{
1121
/**
1222
* When a customer return to website from gateway.
@@ -21,4 +31,20 @@ public function execute()
2131
$this->_redirect('checkout/onepage/success');
2232
}
2333
}
34+
35+
/**
36+
* @inheritDoc
37+
*/
38+
public function createCsrfValidationException(RequestInterface $request): ?InvalidRequestException
39+
{
40+
return null;
41+
}
42+
43+
/**
44+
* @inheritDoc
45+
*/
46+
public function validateForCsrf(RequestInterface $request): ?bool
47+
{
48+
return true;
49+
}
2450
}

0 commit comments

Comments
 (0)