laravel - L5 Paypal Integration - Finding Controller method -


i trying integrate paypal laravel 5 site using package: http://packalyst.com/packages/package/netshell/paypal

when go to: /paypal/checkout though, error:

invalidargumentexception in urlgenerator.php line 561: action app\http\controllers\paypalcontroller@getdone not defined.

this route:

route::get('/paypal/checkout', [     'as' => 'get-paypal-checkout', 'uses' => 'paypalcontroller@getcheckout' ]); 

and paypalcontroller:

<?php namespace app\http\controllers;  use app\http\requests; use app\http\controllers\controller; use paypal; use redirect; use illuminate\http\request;  class paypalcontroller extends controller {      private $_apicontext;     public function __construct() {         $this->_apicontext = paypal::apicontext(             config('services.paypal.client_id'),             config('services.paypal.secret'));          $this->_apicontext->setconfig(array(             'mode' => 'sandbox',             'service.endpoint' => 'https://api.sandbox.paypal.com',             'http.connectiontimeout' => 30,             'log.logenabled' => true,             'log.filename' => storage_path('logs/paypal.log'),             'log.loglevel' => 'fine'         ));     }      public function getcheckout() {         $payer = paypal::payer();         $payer->setpaymentmethod('paypal');          $amount = paypal:: amount();         $amount->setcurrency('eur');         $amount->settotal(42); // simple way,         // can alternatively describe in order separately;         // reference paypal php rest sdk details.          $transaction = paypal::transaction();         $transaction->setamount($amount);         $transaction->setdescription('what selling?');          $redirecturls = paypal:: redirecturls();         $redirecturls->setreturnurl(action('paypalcontroller@getdone'));         $redirecturls->setcancelurl(action('paypalcontroller@getcancel'));          $payment = paypal::payment();         $payment->setintent('sale');         $payment->setpayer($payer);         $payment->setredirecturls($redirecturls);         $payment->settransactions(array($transaction));          $response = $payment->create($this->_apicontext);         $redirecturl = $response->links[1]->href;          return redirect::to( $redirecturl );     }      public function getdone(request $request) {         $id = $request->get('paymentid');         $token = $request->get('token');         $payer_id = $request->get('payerid');          $payment = paypal::getbyid($id, $this->_apicontext);          $paymentexecution = paypal::paymentexecution();          $paymentexecution->setpayerid($payer_id);         $executepayment = $payment->execute($paymentexecution, $this->_apicontext);          // clear shopping cart, write database, send notifications, etc.          // thank user purchase         return view('checkout.done');     }      public function getcancel() {         // curse , humiliate user cancelling sacred payment (yours)         return view('checkout.cancel');     }  } 

any appreciated.

thanks

although laravel allows generate url's actions. researched happened in code.

in urlgenerator class:

/**  * url controller action.  *  * @param  string  $action  * @param  mixed   $parameters  * @param  bool    $absolute  * @return string  *  * @throws \invalidargumentexception  */ public function action($action, $parameters = [], $absolute = true) {     if ($this->rootnamespace && !(strpos($action, '\\') === 0)) {         $action = $this->rootnamespace.'\\'.$action;     } else {         $action = trim($action, '\\');     }      if (!is_null($route = $this->routes->getbyaction($action))) {         return $this->toroute($route, $parameters, $absolute);     }      throw new invalidargumentexception("action {$action} not defined."); } 

it search defined route specified action , in fact returns link based on route. have define route paypaycontroller@getdone work.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -