Skip to content

Commit

Permalink
added missed authorize controller.
Browse files Browse the repository at this point in the history
  • Loading branch information
makasim committed Sep 15, 2014
1 parent 284deee commit b2aa509
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
25 changes: 25 additions & 0 deletions src/Payum/LaravelPackage/Controller/AuthorizeController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
namespace Payum\LaravelPackage\Controller;

use Payum\Core\Request\SecuredAuthorize;
use Symfony\Component\HttpFoundation\Request;

class AuthorizeController extends PayumController
{
public function doAction($payum_token)
{
/** @var Request $request */
$request = \App::make('request');
$request->attributes->set('payum_token', $payum_token);

$token = $this->getHttpRequestVerifier()->verify($request);

$payment = $this->getPayum()->getPayment($token->getPaymentName());

$payment->execute(new SecuredAuthorize($token));

$this->getHttpRequestVerifier()->invalidate($token);

return \Redirect::to($token->getAfterUrl());
}
}
8 changes: 7 additions & 1 deletion src/Payum/LaravelPackage/PayumServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public function boot()
);
});

\Route::any('/payment/authorize/{payum_token}', array(
'as' => 'payum_authorize_do',
'uses' => 'Payum\LaravelPackage\Controller\AuthorizeController@doAction'
));

\Route::any('/payment/capture/{payum_token}', array(
'as' => 'payum_capture_do',
'uses' => 'Payum\LaravelPackage\Controller\CaptureController@doAction'
Expand Down Expand Up @@ -88,7 +93,8 @@ public function boot()
$app['payum.security.token_storage'],
$app['payum'],
'payum_capture_do',
'payum_notify_do'
'payum_notify_do',
'payum_authorize_do'
);
});

Expand Down

0 comments on commit b2aa509

Please sign in to comment.