Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/Payum/PayumModule/Security/HttpRequestVerifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ public function __construct(StorageInterface $tokenStorage)
/**
* {@inheritDoc}
*/
public function verify($httpRequest)
public function verify($controller)
{

$httpRequest = $controller->getRequest();

if (false == $httpRequest instanceof Request) {
throw new InvalidArgumentException(sprintf(
'Invalid request given. Expected %s but it is %s',
Expand All @@ -36,8 +39,10 @@ public function verify($httpRequest)
));
}

$hash = $controller->params()->fromRoute('payum_token') ?: $httpRequest->getQuery('payum_token');

/** @var $httpRequest Request */
if (false === $hash = $httpRequest->getQuery('payum_token')) {
if (!$hash) {
//TODO we should set 404 to response but I do not know how. symfony just throws not found exception.
throw new InvalidArgumentException('Token parameter not set in request');
}
Expand Down Expand Up @@ -70,4 +75,4 @@ public function invalidate(TokenInterface $token)
{
$this->tokenStorage->delete($token);
}
}
}