/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function getIndex()
 {
     if (Request::segment(2) == 'search') {
         $input = Session::get('search') && !Input::get('search_category') ? Session::get('search') : Input::only(array('search_category', 'search_keyword'));
         switch ($input['search_category']) {
             case '0':
                 return Redirect::to('gateway');
                 break;
             case 'owner':
                 $gateways = Gateway::whereHas('user', function ($q) {
                     $q->where('username', 'LIKE', '%' . Input::get('search_keyword') . '%');
                 })->get();
                 break;
             default:
                 if (Auth::user()->status == 2) {
                     $gateways = Gateway::where($input['search_category'], 'LIKE', '%' . $input['search_keyword'] . '%')->get();
                 } else {
                     $gateways = Gateway::where('user_id', Auth::user()->id)->where($input['search_category'], 'LIKE', '%' . $input['search_keyword'] . '%')->get();
                 }
                 break;
         }
         Session::set('search', $input);
     } else {
         Session::remove('search');
         $input = array('search_category' => '', 'search_keyword' => '');
         $gateways = Auth::user()->status == 2 ? Gateway::all() : Gateway::where('user_id', Auth::user()->id)->get();
     }
     return View::make('gateway.index')->with('gateways', $gateways)->with('selected', $input);
 }
 public function run()
 {
     Eloquent::unguard();
     $gateways = [array('name' => 'BeanStream', 'provider' => 'BeanStream', 'payment_library_id' => 2), array('name' => 'Psigate', 'provider' => 'Psigate', 'payment_library_id' => 2)];
     $updateProviders = array(0 => 'AuthorizeNet_AIM', 4 => 'PayPal_Pro', 5 => 'TwoCheckout');
     foreach ($gateways as $gateway) {
         Gateway::create($gateway);
     }
     Gateway::whereIn('provider', $updateProviders)->update(array('recommended' => 1));
     Gateway::where('provider', '=', 'AuthorizeNet_AIM')->update(array('sort_order' => 5, 'site_url' => 'http://reseller.authorize.net/application/?id=5560364'));
     //Gateway::where('provider', '=', 'BeanStream')->update(array('sort_order' => 10, 'site_url' => 'http://www.beanstream.com/'));
     //Gateway::where('provider', '=', 'FirstData_Connect')->update(array('sort_order' => 20, 'site_url' => 'https://www.firstdata.com/'));
     Gateway::where('provider', '=', 'PayPal_Pro')->update(array('sort_order' => 25, 'site_url' => 'https://www.paypal.com/'));
     Gateway::where('provider', '=', 'TwoCheckout')->update(array('sort_order' => 30, 'site_url' => 'https://www.2checkout.com/referral?r=2c37ac2298'));
 }
Exemple #3
0
 public function postGatewaylist()
 {
     $token = Input::only('token');
     $user_id = $this->_getUserId($token['token']);
     $gateways = [];
     $status = 0;
     if ($user_id) {
         $status = $this->_getUserStatus($user_id);
         if ($status == 3) {
             $gateways = Gateway::where('user_id', $user_id)->get();
             $error = array(0, "");
         } elseif ($status == 2) {
             $gateways = Gateway::all();
             $error = array(0, "");
         }
     } else {
         $error = array(403, "Invalid Token");
     }
     return View::make('api.gateway')->with('gateways', $gateways)->with('error', $error)->with('status', $status);
 }