From 2a8fb1b0401781f436c7cf57ee54ff9d8e3f4ae9 Mon Sep 17 00:00:00 2001 From: Alin Jurj Date: Thu, 12 Mar 2015 16:19:59 +0200 Subject: [PATCH] Update HttpRequestVerifier.php it should get the params from route --- .../PayumModule/Security/HttpRequestVerifier.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Payum/PayumModule/Security/HttpRequestVerifier.php b/src/Payum/PayumModule/Security/HttpRequestVerifier.php index 8908ad4..5d82bde 100644 --- a/src/Payum/PayumModule/Security/HttpRequestVerifier.php +++ b/src/Payum/PayumModule/Security/HttpRequestVerifier.php @@ -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', @@ -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'); } @@ -70,4 +75,4 @@ public function invalidate(TokenInterface $token) { $this->tokenStorage->delete($token); } -} \ No newline at end of file +}