-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from Adyen/develop
Release 1.6.0
- Loading branch information
Showing
18 changed files
with
274 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
use Shopware\Components\CSRFWhitelistAware; | ||
use Shopware\Components\Logger; | ||
|
||
// phpcs:ignore PSR1.Classes.ClassDeclaration.MissingNamespace, Squiz.Classes.ValidClassName.NotCamelCaps, Generic.Files.LineLength.TooLong | ||
class Shopware_Controllers_Frontend_Transparent extends Shopware_Controllers_Frontend_Payment implements CSRFWhitelistAware | ||
{ | ||
|
||
const ALLOWED_PARAMS = ['MD', 'PaRes']; | ||
/** | ||
* @var Logger | ||
*/ | ||
private $logger; | ||
|
||
public function preDispatch() | ||
{ | ||
$this->logger = $this->get('adyen_payment.logger'); | ||
} | ||
|
||
public function getWhitelistedCSRFActions() | ||
{ | ||
return ['redirect']; | ||
} | ||
|
||
/** | ||
* Transparent redirect to solve 3DS1 issue same site cookie policy issue | ||
* Used to fetch POST return data and redirect locally to allow session usage | ||
* https://github.com/Adyen/adyen-shopware5/issues/72 | ||
*/ | ||
public function redirectAction() | ||
{ | ||
$redirectUrl = Shopware()->Router()->assemble([ | ||
'controller' => 'process', | ||
'action' => 'return', | ||
]); | ||
|
||
$redirectParams = $this->retrieveParams(); | ||
$this->View()->assign('redirectUrl', $redirectUrl); | ||
$this->View()->assign('redirectParams', $redirectParams); | ||
$this->logger->debug('Forward incoming POST response to process/return', [ | ||
'POST and GET parameter keys' => array_keys($redirectParams) | ||
]); | ||
} | ||
|
||
private function retrieveParams(): array | ||
{ | ||
$request = $this->Request(); | ||
|
||
//Getting all GET parameters except for Shopware's action, controller and module | ||
$getParams = $request->getQuery(); | ||
unset($getParams['action'], $getParams['controller'], $getParams['module']); | ||
|
||
//Filtering allowed POST parameters | ||
$fullPostParams = $request->getParams(); | ||
$postParams = []; | ||
foreach (self::ALLOWED_PARAMS as $allowedParam) { | ||
if (isset($fullPostParams[$allowedParam])) { | ||
$postParams[$allowedParam] = $fullPostParams[$allowedParam]; | ||
} | ||
} | ||
return array_merge($getParams, $postParams); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.