コード例 #1
0
 /**
  * @return \Illuminate\Http\RedirectResponse
  * Lands to this page right after the Payment Process
  */
 public function getFinal()
 {
     $token = Input::get('t');
     // site generated token
     $payment = $this->paymentRepository->findByToken($token);
     if (!$payment) {
         return Redirect::action('EventsController@index')->with('error', trans('word.invalid_token'));
     }
     $payment->payer_id = Input::get('PayerID');
     $payment->payment_token = Input::get('token');
     // token from the payment vendor
     if (Input::get('success') == true) {
         $payer = new Paypal();
         $payer->executePayment($payment->transaction_id, $payment->payer_id);
         $payment->status = 'CONFIRMED';
         $payment->token = '';
         // set token to null
         $payment->save();
         // Subscribe the User
         $controller = App::make('SubscriptionsController');
         // Get The Event to Pass to the Subscription Function
         $event = $payment->payable->event;
         $controller->callAction('subscribe', [$event->id, 'PAYMENT']);
         //todo pass the event ID
         return Redirect::action('EventsController@getSuggestedEvents', $event->id)->with('success', trans('general.subscribed'));
     }
     // If Transaction Failed
     $payment->status = 'REJECTED';
     $payment->save();
     return Redirect::action('EventsController@index')->with('error', trans('general.subscription_error'));
 }
コード例 #2
0
 public function index()
 {
     $status = Input::get('status');
     $type = Input::get('type');
     if (!isset($type)) {
         $type = 'payment';
     }
     if ($type == 'payment') {
         if (isset($status)) {
             $payments = $this->paymentRepository->getAllByStatus($status, ['user', 'payable.event']);
         } else {
             $payments = $this->paymentRepository->getAll(['user', 'payable.event']);
         }
     } else {
         // refunds
         dd('Not Yet Implemented');
     }
     $this->render('admin.payments.index', compact('payments', 'type', 'status'));
 }