function getStart($method = 'shopify', $shop = '', $id = 0)
 {
     $api = $this->integrationMethods->getMethodClass($method);
     $api->prepareAuth();
     \Session::put('integration_id', $id);
     return \Redirect::away($api->generateAuthUrl($shop));
 }
 /**
  * 3rd party (redirect) OAuth based authentication
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function login()
 {
     $request_token_url = $this->build_url(self::F1_REQUEST_TOKEN_PATH);
     $request_token = $this->oauthClient->getRequestToken($request_token_url);
     $this->storeRequestToken($request_token);
     $login_url = $this->build_url(self::F1_PORTAL_LOGIN_PATH) . '?oauth_token=' . $request_token['oauth_token'] . '&oauth_callback=' . url(route('login'));
     return \Redirect::away($login_url);
 }
Example #3
0
 public function postPayment()
 {
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     //        $item_1 = new Item();
     //        $item_1->setName('Item 1') // item name
     //            ->setCurrency('PHP')
     //            ->setQuantity('1')
     //            ->setPrice('0.01'); // unit price
     $package1 = Input::get('packname');
     $amount1 = Input::get('amount');
     $item_1 = new Item();
     $item_1->setName($package1)->setCurrency('PHP')->setQuantity('1')->setPrice($amount1);
     // unit price
     // add item to list
     $item_list = new ItemList();
     $item_list->setItems(array($item_1));
     $amount = new Amount();
     $amount->setCurrency('PHP')->setTotal($package1);
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Your transaction description');
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(URL::route('payment.status'))->setCancelUrl(URL::route('payment.status'));
     $payment = new Payment();
     $payment->setIntent('Sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions(array($transaction));
     //        try {
     //            $payment->create($this->_api_context);
     //        } catch (\PayPal\Exception\PPConnectionException $ex) {
     //
     //            if (\Config::get('app.debug')) {
     //                echo "Exception: " . $ex->getMessage() . PHP_EOL;
     //                $err_data = json_decode($ex->getData(), true);
     //                exit;
     //            } else {
     //                die('Some error occur, sorry for inconvenient');
     //            }
     //        }
     try {
         $payment->create($this->_api_context);
     } catch (PayPal\Exception\PayPalConnectionException $e) {
         echo $e->getData();
         // This will print a JSON which has specific details about the error.
         exit;
     }
     foreach ($payment->getLinks() as $link) {
         if ($link->getRel() == 'approval_url') {
             $redirect_url = $link->getHref();
             break;
         }
     }
     // add payment ID to session
     Session::put('paypal_payment_id', $payment->getId());
     if (isset($redirect_url)) {
         // redirect to paypal
         return Redirect::away($redirect_url);
     }
     return Redirect::route('original.route')->with('error', 'Unknown error occurred');
 }
 /** @inheritdoc */
 public function getKibana()
 {
     $url = env('DFE_AUDIT_CLIENT_HOST') ? env('DFE_AUDIT_CLIENT_HOST') : env('DFE_AUDIT_HOST');
     $url .= ':' . (env('DFE_AUDIT_CLIENT_PORT') ? env('DFE_AUDIT_CLIENT_PORT') : '5601');
     if (strpos($url, 'http') === false) {
         $url = env('DFE_DEFAULT_DOMAIN_PROTOCOL') . '://' . $url;
     }
     return \Redirect::away($url);
 }
Example #5
0
 protected function authenticated($request, $user)
 {
     $continue = \Input::get('continue');
     if ($continue) {
         return \Redirect::away($continue);
     } else {
         return redirect()->intended($this->redirectPath());
     }
 }
 public function postPayment()
 {
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     $items = array();
     $subtotal = 0;
     $cart = \Session::get('cart');
     $currency = 'MXN';
     foreach ($cart as $producto) {
         $item = new Item();
         $item->setName($producto->name)->setCurrency($currency)->setDescription($producto->extract)->setQuantity($producto->quantity)->setPrice($producto->price);
         $items[] = $item;
         $subtotal += $producto->quantity * $producto->price;
     }
     $item_list = new ItemList();
     $item_list->setItems($items);
     //costo de envio de la compra
     $details = new Details();
     $details->setSubtotal($subtotal)->setShipping(100);
     //total de envio sumando el subtotal mas el envio
     $total = $subtotal + 100;
     $amount = new Amount();
     $amount->setCurrency($currency)->setTotal($total)->setDetails($details);
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Pedido de prueba con laravel para La Central Mueblera');
     //la ruta  para direccionar si se cancela o se envia conrectamente el pedido
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(\URL::route('payment.status'))->setCancelUrl(\URL::route('payment.status'));
     $payment = new Payment();
     $payment->setIntent('Sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions(array($transaction));
     try {
         $payment->create($this->_api_context);
     } catch (\PayPal\Exception\PPConnectionException $ex) {
         if (\Config::get('app.debug')) {
             echo "Exception: " . $ex->getMessage() . PHP_EOL;
             $err_data = json_decode($ex->getData(), true);
             exit;
         } else {
             die('Ups! Algo salió mal');
         }
     }
     foreach ($payment->getLinks() as $link) {
         if ($link->getRel() == 'approval_url') {
             $redirect_url = $link->getHref();
             break;
         }
     }
     // add payment ID to session
     \Session::put('paypal_payment_id', $payment->getId());
     if (isset($redirect_url)) {
         // redirect to paypal
         return \Redirect::away($redirect_url);
     }
     return \Redirect::route('cart-show')->with('error', 'Ups! Error desconocido.');
 }
Example #7
0
 public function facebookSqueeb($id)
 {
     //update the number of shared times
     $squeeb = Lecture::where('id', '=', $id);
     if ($squeeb->count()) {
         $squeeb = $squeeb->first();
         if ($squeeb->save()) {
             return Redirect::away('https://www.facebook.com/sharer.php?u={{URL::current()}}');
         }
     }
 }
Example #8
0
 public function postPayment()
 {
     $name = 'Transaction';
     /*$mmnumber      = Input::get('number');
       $amounttosend     = Input::get('amount');
       $currency   = Input::get('currency');*/
     $mmnumber = Input::get('number');
     $amounttosend = Input::get('amount');
     $currency = Input::get('currency');
     $charges = new PlatformCharges($amounttosend, $currency);
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     $item_1 = new Item();
     $item_1->setName('Transaction')->setCurrency('USD')->setQuantity(1)->setPrice((int) $charges->getDueAmountForPayPalToMobileMoney());
     // unit price
     // add item to list
     $item_list = new ItemList();
     $item_list->setItems(array($item_1));
     $amount = new Amount();
     $amount->setCurrency('USD')->setTotal((int) $charges->getDueAmountForPayPalToMobileMoney());
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Send money To a Mobile Money User');
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(URL::route('payment-status'))->setCancelUrl(URL::route('payment-status'));
     $payment = new Payment();
     $payment->setIntent('sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions(array($transaction));
     try {
         $payment->create($this->_api_context);
     } catch (\PayPal\Exception\PPConnectionException $ex) {
         if (\Config::get('app.debug')) {
             echo "Exception: " . $ex->getMessage() . PHP_EOL;
             $err_data = json_decode($ex->getData(), true);
             exit;
         } else {
             die('Some error occurred, sorry for inconvenient');
         }
     }
     foreach ($payment->getLinks() as $link) {
         if ($link->getRel() == 'approval_url') {
             $redirect_url = $link->getHref();
             break;
         }
     }
     // add payment ID to session
     Session::put('paypal_payment_id', $payment->getId());
     if (isset($redirect_url)) {
         // redirect to paypal
         return Redirect::away($redirect_url);
     }
     return "Error!!!!";
     /*Redirect::route('original.route')
       ->with('error', 'Unknown error occurred'); */
 }
 public function postPayment()
 {
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     $item_1 = new Item();
     $item_1->setName('Item 1')->setCurrency('USD')->setQuantity(2)->setPrice('150');
     // unit price
     $item_2 = new Item();
     $item_2->setName('Item 2')->setCurrency('USD')->setQuantity(4)->setPrice('70');
     $item_3 = new Item();
     $item_3->setName('Item 3')->setCurrency('USD')->setQuantity(1)->setPrice('20');
     // add item to list
     $item_list = new ItemList();
     $item_list->setItems(array($item_1, $item_2, $item_3));
     $amount = new Amount();
     $amount->setCurrency('USD')->setTotal(580);
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Your transaction description');
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(URL::route('payment.status'))->setCancelUrl(URL::route('payment.status'));
     $payment = new Payment();
     $payment->setIntent('Sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions(array($transaction));
     try {
         $payment->create($this->_api_context);
         //            echo'hello';
         //            print_r($test);die;
     } catch (\PayPal\Exception\PPConnectionException $ex) {
         if (\Config::get('app.debug')) {
             echo "Exception: " . $ex->getMessage() . PHP_EOL;
             $err_data = json_decode($ex->getData(), true);
             exit;
         } else {
             die('Some error occur, sorry for inconvenient');
         }
     }
     if (is_array($payment->getLinks()) || is_object($payment->getLinks())) {
         foreach ($payment->getLinks() as $link) {
             echo 'reached';
             if ($link->getRel() == 'approval_url') {
                 $redirect_url = $link->getHref();
                 break;
             }
         }
     }
     // add payment ID to session
     Session::put('paypal_payment_id', $payment->getId());
     dd(Session::all());
     if (isset($redirect_url)) {
         // redirect to paypal
         return Redirect::away($redirect_url);
     }
     return Redirect::route('original.route')->with('error', 'Unknown error occurred');
 }
Example #10
0
 function insert_or_update($page_name, $mode = '+')
 {
     $page = unref(Page::import($page_name));
     if ($r = $this->user_accessibility($page, $mode)) {
         return $r;
     }
     $table_values = Input::get('v');
     if ($mode == '.') {
         $input_d_1 = Input::get('d');
     }
     foreach ($table_values as $table_name => $values) {
         $table = $page->table($table_name);
         $res = FALSE;
         foreach ($values as $col_name => $col_value) {
             if (isset($col_value['null'])) {
                 $res1 = $table->col($col_name)->set_client_value($new_value = NULL);
             } else {
                 $res1 = $table->col($col_name)->set_client_value($new_value = $col_value['value']);
             }
             if (!$res) {
                 $res = $res1;
             }
             if ($mode == '.' && isset($input_d_1[$table_name][$col_name])) {
                 $input_d_1[$table_name][$col_name] = $new_value;
             }
         }
         if ($res) {
             if ($mode == '+') {
                 $res = $table->insert_from_client_values();
                 if ($res) {
                     return \Redirect::back()->with('message_type', 'success')->with('message', 'Successfully Saved!')->with('other_data', ['opener_refresh' => true]);
                 }
             } else {
                 if ($mode == '.') {
                     $input_d = Input::get('d');
                     if (!$input_d[$table_name]) {
                         return view('panel.errors.5xx', ['msg' => 'Table with no primary keys cannot be updated!']);
                     }
                     $res = $table->update_from_client_values_and_edit_args($input_d[$table_name]);
                     if ($res) {
                         return \Redirect::away(action('PageController@getEdit', [$page_name]) . '?' . http_build_query(['d' => $input_d_1]))->with('message_type', 'success')->with('message', 'Successfully Saved!')->with('other_data', ['opener_refresh' => true]);
                     } else {
                         return \Redirect::away(action('PageController@getEdit', [$page_name]) . '?' . http_build_query(['d' => $input_d_1]))->with('message_type', 'warning')->with('message', 'Nothing to save!');
                     }
                 }
             }
         } else {
             return \Redirect::back()->with('message_type', 'warning')->with('message', 'Nothing to save!');
         }
         return \Redirect::back()->with('message_type', 'danger')->with('message', 'Cannot Save! Some error has occurred!');
     }
 }
Example #11
0
 public function postPayment()
 {
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     $items = array();
     $subtotal = 0;
     $cart = \Session::get('cart');
     $currency = 'USD';
     foreach ($cart as $producto) {
         $item = new Item();
         $item->setName($producto->tipograno)->setCurrency($currency)->setDescription($producto->descripcion)->setQuantity($producto->cantidad)->setPrice($producto->precio);
         $items[] = $item;
         $subtotal += $producto->cantidad * $producto->precio;
     }
     $item_list = new ItemList();
     $item_list->setItems($items);
     $total = $subtotal;
     $amount = new Amount();
     $amount->setCurrency($currency)->setTotal($total);
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Pedido de prueba en Agricola Grain App');
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(\URL::route('payment.status'))->setCancelUrl(\URL::route('payment.status'));
     $payment = new Payment();
     $payment->setIntent('Sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions(array($transaction));
     try {
         $payment->create($this->_api_context);
     } catch (\PayPal\Exception\PPConnectionException $ex) {
         if (\Config::get('app.debug')) {
             echo "Exception: " . $ex->getMessage() . PHP_EOL;
             $err_data = json_decode($ex->getData(), true);
             exit;
         } else {
             die('Ups! Algo salió mal');
         }
     }
     foreach ($payment->getLinks() as $link) {
         if ($link->getRel() == 'approval_url') {
             $redirect_url = $link->getHref();
             break;
         }
     }
     // add payment ID to session
     \Session::put('paypal_payment_id', $payment->getId());
     if (isset($redirect_url)) {
         // redirect to paypal
         return \Redirect::away($redirect_url);
     }
     return \Redirect::route('cart-show')->with('error', 'Ups! Error desconocido.');
 }
 public function getRedirect($username, $id)
 {
     $link = Link::where('id', '=', $id)->first();
     /*Get user ip address*/
     $ip_address = $_SERVER['REMOTE_ADDR'];
     $device = Device::where('ip', '=', $ip_address);
     if (!$device->count()) {
         //record the device
         $user = Device::create(array('ip' => $ip_address));
         $link->clicks = $link->clicks + 1;
         $link_save = $link->save();
     }
     return Redirect::away($link->link_name);
 }
 public function pay()
 {
     #dd(Input::all());
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     $counter = 0;
     $items = [];
     foreach (Input::all() as $input) {
         if (Input::has('item_name' . $counter)) {
             $item = new Item();
             $item->setName(Input::get('item_name' . $counter))->setCurrency('EUR')->setQuantity(Input::get('item_qtt' . $counter))->setPrice(Input::get('item_price' . $counter));
             $items[] = $item;
         }
         $counter++;
     }
     $item_list = new ItemList();
     $item_list->setItems($items);
     $amount = new Amount();
     $amount->setCurrency('EUR')->setTotal(Input::get('total'));
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('This is just a demo transaction');
     $redirect_url = new RedirectUrls();
     $redirect_url->setReturnUrl(URL::route('paymentStatus'))->setCancelUrl(URL::route('paymentStatus'));
     $payment = new Payment();
     $payment->setIntent('sale')->setPayer($payer)->setRedirectUrls($redirect_url)->setTransactions(array($transaction));
     try {
         $payment->create($this->_api_context);
     } catch (\PayPal\Exception\PPConnectionException $ex) {
         if (\Config::get('app.debug')) {
             echo "Exception: " . $ex->getMessage() . PHP_EOL;
             $err_data = json_decode($ex->getData(), true);
             exit;
         } else {
             die('Some error occur, sorry for inconvenient');
         }
     }
     foreach ($payment->getLinks() as $link) {
         if ($link->getRel() == 'approval_url') {
             $redirect_url = $link->getHref();
             break;
         }
     }
     // add payment ID to session
     Session::put('paypal_payment_id', $payment->getId());
     if (isset($redirect_url)) {
         // redirect to paypal
         return Redirect::away($redirect_url);
     }
     return Redirect::route('original.route')->with('error', 'Unknown error occurred');
 }
 public function postPayment()
 {
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     $items = array();
     $subtotal = 0;
     $cart = \Session::get('product');
     $currency = 'USD';
     $item = new Item();
     $item->setName($cart->name)->setCurrency($currency)->setDescription($cart->description)->setQuantity(1)->setPrice($cart->price);
     $items[] = $item;
     $subtotal += $cart->price;
     $item_list = new ItemList();
     $item_list->setItems($items);
     $details = new Details();
     $details->setSubtotal($subtotal)->setShipping(0);
     $total = $subtotal + 0;
     $amount = new Amount();
     $amount->setCurrency($currency)->setTotal($total)->setDetails($details);
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Order plan in hdsports.in');
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(\URL::route('payment.status'))->setCancelUrl(\URL::route('payment.status'));
     $payment = new Payment();
     $payment->setIntent('Sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions(array($transaction));
     try {
         $payment->create($this->_api_context);
     } catch (\PayPal\Exception\PPConnectionException $ex) {
         if (\Config::get('app.debug')) {
             echo "Exception: " . $ex->getMessage() . PHP_EOL;
             $err_data = json_decode($ex->getData(), true);
             exit;
         } else {
             die('Ups! something went wrong');
         }
     }
     foreach ($payment->getLinks() as $link) {
         if ($link->getRel() == 'approval_url') {
             $redirect_url = $link->getHref();
             break;
         }
     }
     // add payment ID to session
     \Session::put('paypal_payment_id', $payment->getId());
     if (isset($redirect_url)) {
         // redirect to paypal
         return \Redirect::away($redirect_url);
     }
     return \Redirect::to('/')->with('message', 'Ups! Unknown mistake.');
 }
Example #15
0
 public function postPayment()
 {
     // echo '123123';exit;
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     $total = Input::get('total');
     $qty = Input::get('qty');
     $price = Input::get('price');
     $bill_id = Input::get('bill_id');
     $item_1 = new Item();
     $item_1->setName(Input::get('service_name'))->setCurrency('USD')->setQuantity($qty)->setPrice($price);
     // unit price
     // add item to list
     $item_list = new ItemList();
     $item_list->setItems(array($item_1));
     $amount = new Amount();
     $amount->setCurrency('USD')->setTotal($total);
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Your transaction description');
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(URL::route('payment.status'))->setCancelUrl(URL::route('payment.status'));
     $payment = new Payment();
     $payment->setIntent('Sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions(array($transaction));
     try {
         $payment->create($this->_api_context);
     } catch (\PayPal\Exception\PPConnectionException $ex) {
         if (\Config::get('app.debug')) {
             echo "Exception: " . $ex->getMessage() . PHP_EOL;
             $err_data = json_decode($ex->getData(), true);
             exit;
         } else {
             die('Some error occur, sorry for inconvenient');
         }
     }
     foreach ($payment->getLinks() as $link) {
         if ($link->getRel() == 'approval_url') {
             $redirect_url = $link->getHref();
             break;
         }
     }
     // add payment ID to session
     Session::put('paypal_payment_id', $payment->getId());
     Session::put('bill_id', $bill_id);
     if (isset($redirect_url)) {
         // redirect to paypal
         return Redirect::away($redirect_url);
     }
     return Redirect::route('original.route')->with('error', 'Unknown error occurred');
 }
Example #16
0
 /**
  * Displays the user administration
  */
 public function download($id)
 {
     $request = \App\Models\SharedFile::find($id);
     $now = \Carbon\Carbon::now();
     $expires = $request->request->expires_at;
     if ($now->timestamp < $expires->timestamp) {
         $file = $request->file;
         $path = $file->path;
         $rackRepo = new \App\Repositories\Rackspace();
         $container = $rackRepo->getRackspaceContainer();
         $distantFile = $container->getObject($path);
         $url = $distantFile->getTemporaryUrl(60, 'GET');
         return \Redirect::away($url);
     } else {
         return view('share.expired');
     }
 }
Example #17
0
 public function reRoute()
 {
     \Route::any('r{id}', function ($id) {
         $record = \DB::table('urlshortner')->where('short_url', trim($id))->first();
         if ($record === null) {
             echo 'URL not found!';
             exit;
         } else {
             $timeDiff = time() - strtotime($record->created_at);
             if ($timeDiff < 3600 && $record->expired == 0) {
                 return \Redirect::away($record->actual_url);
             } else {
                 \DB::table('urlshortner')->where('short_url', $record->short_url)->update(array('expired' => 1));
                 echo 'URL expired! or does not exist!';
                 exit;
             }
         }
     })->where('id', '[A-Za-z0-9]+');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     // Form Processing
     $result = $this->loginForm->save(Input::all());
     if ($result['success']) {
         Event::fire('user.login', array('userId' => $result['sessionData']['userId'], 'email' => $result['sessionData']['email']));
         // Success!
         return Redirect::route('dashboard', array('lang' => App::getLocale()));
     } else {
         if (User::where('email', '=', Input::get('email', ''))->count()) {
             $check_email = User::where('email', '=', Input::get('email', ''))->first();
             if ($check_email->emf_user_id) {
                 return Redirect::away(Config::get('kuu.emf_login_page'));
             }
         }
         Session::flash('error', $result['message']);
         return Redirect::route('login', array('lang' => App::getLocale()))->withInput()->withErrors($this->loginForm->errors());
     }
 }
Example #19
0
 public function makePayment(Payment $payment, $data = [])
 {
     $payPalCustom = md5($payment->getId() . '-' . time());
     $payPalTransaction = new PaypalTransaction();
     $payPalTransaction->setAmount($payment->getCreditAmount())->setDonationAmount($payment->getDonationAmount())->setPaypalTransactionFee($payment->getTransactionFee())->setTotalAmount($payment->getTotalAmount())->setStatus('START')->setCustom($payPalCustom)->setPaymentId($payment->getId());
     $payPalTransaction->save();
     $paymentDetail = $this->setPaypalCheckoutCart($payment);
     $expressCheckoutRequestDetails = new SetExpressCheckoutRequestDetailsType();
     $expressCheckoutRequestDetails->Custom = $payPalCustom;
     $expressCheckoutRequestDetails->PaymentDetails = $paymentDetail;
     $expressCheckoutRequestDetails->CancelURL = action('PayPalController@getCancel');
     $expressCheckoutRequestDetails->ReturnURL = action('PayPalController@getReturn');
     // Display options
     $expressCheckoutRequestDetails->cpplogoimage = 'https://www.zidisha.org/static/images/logo/zidisha-logo-small.png';
     $expressCheckoutRequestDetails->BrandName = 'Zidisha';
     //Shipping options if required.
     $expressCheckoutRequestDetails->NoShipping = 1;
     $expressCheckoutRequestDetails->ReqConfirmShipping = 0;
     //Set and configure express checkout
     $setExpressCheckoutRequestType = new SetExpressCheckoutRequestType();
     $setExpressCheckoutRequestType->SetExpressCheckoutRequestDetails = $expressCheckoutRequestDetails;
     $setExpressCheckoutRequest = new SetExpressCheckoutReq();
     $setExpressCheckoutRequest->SetExpressCheckoutRequest = $setExpressCheckoutRequestType;
     try {
         //Try Express Checkout.
         $setExpressCheckoutResponse = $this->payPalApi->SetExpressCheckout($setExpressCheckoutRequest);
     } catch (PPConnectionException $e) {
         $paymentError = new PaymentError('Error Connecting to PayPal.', $e);
         return $this->paymentBus->getFailedHandler($payment, $paymentError)->redirect();
     }
     //Check if we get a Successful acknowledgment from the server.
     if ($setExpressCheckoutResponse->Ack != 'Success') {
         $this->logPayPalErrors($payment, $setExpressCheckoutResponse);
         $paymentError = new PaymentError('Error Connecting to PayPal.');
         return $this->paymentBus->getFailedHandler($payment, $paymentError)->redirect();
     }
     $payPalTransaction->setToken($setExpressCheckoutResponse->Token);
     $payPalTransaction->save();
     $paypalUrl = 'https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=' . $setExpressCheckoutResponse->Token;
     return \Redirect::away($paypalUrl);
 }
 /**
  * Follow the leader...
  *
  * @return void
  */
 public function leader()
 {
     if (count(Input::all()) == 0) {
         return Redirect::to('/generator');
     }
     $this->text['fonts'] = ['normal' => public_path() . '/fonts/Arial.ttf', 'bold' => public_path() . '/fonts/Arial-Bold.ttf'];
     $result = Input::only(['user', 'num', 'type', 'error']);
     // I use this for error testing...
     $forceError = isset($result['error']) ? true : false;
     // The validation rules
     $rules = ['user' => ['required', 'regex:/^[a-z]([a-z0-9_-]){2,14}$/i', 'min:2', 'max:15'], 'num' => 'required|integer|between:1,10', 'type' => 'in:,link'];
     $messages = ['user.required' => 'Your Last.fm <code>user</code>name is required', 'user.regex' => 'Your Last.fm <code>user</code>name contains invalid characters', 'user.min' => 'Your Last.fm <code>user</code>name is too short', 'user.max' => 'Your Last.fm <code>user</code>name is too long', 'num.required' => 'You must supply an album number', 'num.integer' => 'The var number must be a number', 'num.min' => 'The number is too short', 'type.in' => 'The <code>type</code> should be link, otherwise don\'t supply it'];
     $validator = Validator::make($result, $rules, $messages);
     if ($validator->passes()) {
         $this->username = $result['user'];
         $this->number = $result['num'];
         $this->type = $result['type'];
     } else {
         return Redirect::to('/generator')->withErrors($validator);
     }
     $client = new GuzzleHttp\Client(['base_url' => ['http://ws.audioscrobbler.com/2.0/?method=library.getalbums&api_key=561e763a09d252d2bbf70beec4897d91&user={username}&limit=10&format=json', ['username' => $this->username]], 'headers' => ['User-Agent' => 'yesdevnull.net/lastfm Last.fm Album Image Generator'], 'timeout' => 5]);
     $response = $client->get();
     // Ruh-roh!
     if ($response->getStatusCode() != 200) {
         Log::error('Unable to connect to Last.fm', ['message' => 'Guzzle Error: ' . $response->getReasonPhrase(), 'url' => $response->getEffectiveUrl(), 'code' => $response->getStatusCode()]);
         // Unknown error connecting to Last.fm
         return $this->generateImage(false, $response->getStatusCode() . ' Error when connecting to Last.fm');
     }
     $this->result = $this->getApiResult($response->json(), $this->number);
     if ($this->type == 'link') {
         Log::info('Sending user away to Last.fm', ['url' => $this->result['url'], 'code' => 307, 'user' => $this->username, 'number' => $this->number]);
         // Redirect time, send them to Last.fm
         return Redirect::away($this->result['url'], 307);
     }
     $image = $this->generateImage($this->imageUrl, $forceError);
     /**
      * Browser Caching from: http://laravelsnippets.com/snippets/display-php-loaded-image-with-browser-cache-support
      * Thanks, Philo!
      */
     $request = Request::instance();
     $responseImage = gettype($image) == 'resource' ? $image->encoded : $image;
     $size = strlen($responseImage);
     $headers = ['Content-Type' => 'image/png', 'Content-Length' => $size, 'X-Powered-By' => 'yesdevnull.net/lastfm Last.fm Album Image Generator'];
     $response = Response::make($responseImage, 200, $headers);
     $filetime = filemtime($this->filename);
     $etag = md5($filetime);
     $time = Carbon::createFromTimeStamp($filetime)->toRFC2822String();
     $expires = Carbon::createFromTimeStamp($filetime)->addWeeks(1)->toRFC2822String();
     $response->setEtag($etag);
     $response->setLastModified(new DateTime($time));
     $response->setExpires(new DateTime($expires));
     $response->setPublic();
     if ($response->isNotModified($request)) {
         Log::info('Request is not modified, send empty response', ['filesize' => $size]);
         return $response;
     } else {
         Log::info('Request is modified, send new response', ['filesize' => $size]);
         $response->prepare($request);
         return $response;
     }
 }
Example #21
0
    }
    \Apigenci\Model\Repo::queueBuild($id);
    \Apigenci\Model\Github::webhookRegister($id);
});
Route::post('repo/{id}/disable', function ($id) {
    $id = \Apigenci\Model::repoDecodeWeb($id);
    $repo = \Apigenci\Model\Repo::find($id);
    \Eloquent::unguard();
    $repo->update(['enabled' => 0, 'queued' => 0, 'failed' => 0, 'built' => 0]);
    \Queue::pushOn('low', new \App\Jobs\Apigenci\DeleteGeneratedHtml($repo));
});
Route::get('github/{owner}/{repo}', function ($owner, $repo) {
    return view('apigenci.github.invite', ['owner' => $owner, 'repo' => $repo]);
});
Route::get('github/{owner}/{repo}/tag/{tag}', function ($owner, $repo, $tag) {
    // Make sure repo exists, redirect to invite if not
    if (!\Apigenci\Model::localRepoExists($owner, $repo)) {
        return \Redirect::away("/github/{$owner}/{$repo}");
    }
    return view('apigenci.github.tag', ['owner' => $owner, 'repo' => $repo, 'tag' => $tag]);
});
Route::get('privacy', function () {
    return view('apigenci.privacy');
});
Route::any('webhook', function () {
    $raw = file_get_contents('php://input');
    $id = json_decode($raw)->repository->id;
    // Write a log entry
    \Log::info("[apigen.ci] Got a webhook for repo: {$id}");
    \Apigenci\Model\Repo::queueBuild($id);
});
Example #22
0
 public function postPayment()
 {
     $name = 'Transaction';
     $mmnumber = Input::get('number');
     $amounttosend = Input::get('amount');
     $currency = Input::get('currency');
     $type = Input::get('target');
     //destination/receipient's payment Provider
     $cno = Input::get('cardnumber');
     $charges = new PlatformCharges($amounttosend, $currency, $type);
     $desc = $charges->getReceiverType($type);
     Session::set('destProvider', $type);
     Session::set('destination', $mmnumber);
     if ($type == 'pp') {
         return Redirect::route('dashboard')->with('alertError', 'You need to select different payment provider for sender and receiver');
     }
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     // Valid Values: ["credit_card", "bank", "paypal", "pay_upon_invoice", "carrier"]
     //TODO:: try to deduce the receiver type (email or number) and set the payerinfo data correctly for consistency
     $payerInfo = new PayerInfo();
     $payerInfo->setFirstName($mmnumber);
     //used to represent the receiver name/number/email
     $payerInfo->setLastName('Paypal to ' . $desc);
     //used to pass the transaction type in the request
     $payer->setPayerInfo($payerInfo);
     $item_1 = new Item();
     $item_1->setName('Money Transfer')->setDescription("Send money to a {$desc} User")->setCurrency('USD')->setQuantity(1)->setPrice($charges->getDueAmount('pp', $type));
     // unit price)
     // add item to list
     $item_list = new ItemList();
     $item_list->setItems(array($item_1));
     $amount = new Amount();
     $amount->setCurrency('USD')->setTotal($charges->getDueAmount('pp', $type));
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Send money To a Mobile Money User');
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(URL::route('payment-status'))->setCancelUrl(URL::route('payment-status'));
     $payment = new Payment();
     $payment->setIntent('sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions(array($transaction));
     try {
         $payment->create($this->_api_context);
         foreach ($payment->getLinks() as $link) {
             if ($link->getRel() == 'approval_url') {
                 $redirect_url = $link->getHref();
                 break;
             }
         }
         // add payment ID to session
         Session::put('paypal_payment_id', $payment->getId());
         if (isset($redirect_url)) {
             // redirect to paypal
             return Redirect::away($redirect_url);
         }
         return "Error!!!!";
     } catch (\PayPal\Exception\PPConnectionException $ex) {
         if (\Config::get('app.debug')) {
             echo "Exception: " . $ex->getMessage() . PHP_EOL;
             $err_data = json_decode($ex->getData(), true);
             return Redirect::route('dashboard')->with('alertError', 'Connection error. $err_data');
             exit;
         } else {
             return Redirect::route('dashboard')->with('alertError', 'Connection error occured. Please try again later. ' . $ex->getMessage());
             //            die('Some error occurred, sorry for the inconvenience. Our team has been notified to correct this error.');
         }
     } catch (Exception $ex) {
         return Redirect::route('dashboard')->with('alertError', 'Error! ' . $ex->getMessage());
     }
 }
});
Route::get('/contactus', function () {
    return view('contact_us');
});
Route::get('/login', function () {
    //$_SESSION['session_name'] = 1;
    if (isset($_SESSION['session_name'])) {
        $id = $_SESSION['session_name'];
        Session::put('id', $id);
        Auth::loginUsingId($id, true);
        return Redirect::to('listings');
    } else {
        return Redirect::to('dashboard');
    }
});
Route::get('/logout', function () {
    Auth::logout();
    $actual_link = "http://{$_SERVER['HTTP_HOST']}";
    return Redirect::away($actual_link . "/authentication/secure/dashboard/logout.php");
});
Route::get('completed', 'ListingsController@completed');
Route::get('listings', 'ListingsController@index');
Route::get('listings/my', 'ListingsController@my');
Route::get('listings/add', 'ListingsController@create');
Route::get('listings/delete/{id}', 'ListingsController@delete');
Route::get('listings/edit/{id}', 'ListingsController@edit');
Route::get('listings/show/{id}', 'ListingsController@show');
Route::get('listings/search', 'ListingsController@search');
Route::get('payment', 'ListingsController@pay');
Route::post('listings/add', 'ListingsController@store');
Route::post('listings/edit', 'ListingsController@update');
Example #24
0
 public function postPayment()
 {
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     //==================== LIST ITEMS IN SHOPPING CART ========= //
     $_contentCart = Cart::instance('shopping')->content();
     $_itemsCount = Cart::instance('shopping')->count();
     $_arryItems = array();
     $_i = 0;
     foreach ($_contentCart as $row) {
         if ($_i < $_itemsCount) {
             $item = new Item();
             $item->setName($row->name)->setDescription($row->name)->setCurrency('USD')->setQuantity((double) $row->qty)->setTax((double) ($row->price * 10) / 100)->setPrice((double) $row->price);
             //$435.00
             $_arryItems[$_i] = $item;
             $_i++;
         }
     }
     $item_list = new ItemList();
     $item_list->setItems(array($_arryItems));
     // add item to list
     $item_list = new ItemList();
     $item_list->setItems($_arryItems);
     //==================== LIST ITEMS IN SHOPPING CART ========= //
     $details = new Details();
     $details->setShipping("0")->setTax((string) (Cart::instance('shopping')->total() * 10) / 100)->setSubtotal((string) Cart::instance('shopping')->total());
     $amount = new Amount();
     $amount->setCurrency("USD")->setTotal((string) Cart::instance('shopping')->total() + Cart::instance('shopping')->total() * 10 / 100)->setDetails($details);
     // ### Transaction
     // A transaction defines the contract of a
     // payment - what is the payment for and who
     // is fulfilling it. Transaction is created with
     // a `Payee` and `Amount` types
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Your transaction description');
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(URL::route('payment.status'))->setCancelUrl(URL::route('payment.status'));
     $payment = new Payment();
     $payment->setIntent('Sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions(array($transaction));
     try {
         $payment->create($this->_api_context);
     } catch (PayPal\Exception\PayPalConnectionException $ex) {
         echo $ex->getCode();
         // Prints the Error Code
         echo $ex->getData();
         // Prints the detailed error message
         die($ex);
     } catch (Exception $ex) {
         die($ex);
     }
     foreach ($payment->getLinks() as $link) {
         if ($link->getRel() == 'approval_url') {
             $redirect_url = $link->getHref();
             break;
         }
     }
     // add payment ID to session
     Session::put('paypal_payment_id', $payment->getId());
     if (isset($redirect_url)) {
         // redirect to paypal
         return Redirect::away($redirect_url);
     }
     return View::make('pages.home');
 }
<?php

/**
 * Defender - Laravel 5 ACL Package
 * Author: PHPArtisans.
 */
return ['role_model' => 'Artesaos\\Defender\\Role', 'permission_model' => 'Artesaos\\Defender\\Permission', 'role_table' => 'roles', 'role_key' => 'role_id', 'permission_table' => 'permissions', 'permission_key' => 'permission_id', 'role_user_table' => 'role_user', 'permission_role_table' => 'permission_role', 'permission_user_table' => 'permission_user', 'forbidden_callback' => function () {
    if ($request->ajax()) {
        return response('Unauthorized.', 401);
    } else {
        return \Redirect::away('/wcli');
    }
    //throw new \Artesaos\Defender\Exceptions\ForbiddenException();
}, 'template_helpers' => true];
 public function postPayment()
 {
     $input_amount = \Input::get('amount');
     $input_user_id = \Input::get('user_id');
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     $item_1 = new Item();
     $item_1->setName('Υπηρεσίες freelancing')->setCurrency('EUR')->setQuantity(1)->setPrice($input_amount);
     // unit price
     // add item to list
     $item_list = new ItemList();
     $item_list->setItems(array($item_1));
     $amount = new Amount();
     $amount->setCurrency('EUR')->setTotal($input_amount);
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Ειμαι η περιγραφή');
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(\URL::route('payment.status'))->setCancelUrl(\URL::route('payment'));
     $payment = new Payment();
     $payment->setIntent('Sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setId("2014031400023")->setTransactions(array($transaction));
     try {
         $payment->create($this->_api_context);
     } catch (\PayPal\Exception\PPConnectionException $ex) {
         if (\Config::get('app.debug')) {
             echo "Exception: " . $ex->getMessage() . PHP_EOL;
             $err_data = json_decode($ex->getData(), true);
             exit;
         } else {
             die('Some error occur, sorry for inconvenient');
         }
     }
     foreach ($payment->getLinks() as $link) {
         if ($link->getRel() == 'approval_url') {
             $redirect_url = $link->getHref();
             break;
         }
     }
     // add payment ID to session
     \Session::put('paypal_payment_id', $payment->getId());
     \Session::put('user_id', $input_user_id);
     \Session::put('amount', $input_amount);
     if (isset($redirect_url)) {
         // redirect to paypal
         return \Redirect::away($redirect_url);
     }
     return \Redirect::route('original.route')->with('error', 'Unknown error occurred');
 }
 public function checkout()
 {
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     $items = [];
     $session = Session::get('cart.songs');
     $bundles = Session::get('cart.bundles');
     $total = 0;
     if (count($session) == 0 && count($bundles) == 0) {
         die('No Items in you cart');
     }
     $songs_string = "";
     $bundles_string = "";
     if (count($session) != 0) {
         foreach ($session as $s) {
             $song = Song::find($s['id']);
             $item = new Item();
             $item->setName($song->title)->setCurrency('AUD')->setQuantity(1)->setPrice($song->price);
             $items[] = $item;
             $total += $song->price;
             $songs_string .= "," . $song->id;
         }
     }
     if (count($bundles) != 0) {
         foreach ($bundles as $s) {
             $bundles = Bundle::find($s['id']);
             $item = new Item();
             $item->setName($bundles->name)->setCurrency('AUD')->setQuantity(1)->setPrice($bundles->price);
             $items[] = $item;
             $total += $bundles->price;
             $bundles_string .= "," . $bundles->id;
         }
     }
     $item_list = new ItemList();
     $item_list->setItems($items);
     $amount = new Amount();
     $amount->setCurrency('AUD')->setTotal($total);
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Music Equity Song Purchase');
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(URL::route('payment.status'))->setCancelUrl(URL::route('payment.status'));
     $payment = new Payment();
     $payment->setIntent('Sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions(array($transaction));
     try {
         $payment->create($this->_api_context);
     } catch (\PayPal\Exception\PPConnectionException $ex) {
         if (\Config::get('app.debug')) {
             echo "Exception: " . $ex->getMessage() . PHP_EOL;
             $err_data = json_decode($ex->getData(), true);
             exit;
         } else {
             die('Some error occur, sorry for inconvenient');
         }
     }
     foreach ($payment->getLinks() as $link) {
         if ($link->getRel() == 'approval_url') {
             $redirect_url = $link->getHref();
             break;
         }
     }
     $t = new MyTransaction();
     $t->amount = $total;
     if (Auth::check()) {
         $t->customer = Auth::user()->id;
     } else {
         $t->customer = '0';
     }
     $t->songs = $songs_string;
     $t->bundles = $bundles_string;
     $t->status = 'OPEN';
     $t->paypal_id = $payment->getId();
     $t->save();
     // add payment ID to session
     Session::put('paypal_payment_id', $payment->getId());
     if (isset($redirect_url)) {
         // redirect to paypal
         return Redirect::away($redirect_url);
     }
 }
Example #28
0
 /**
  * Search page, using google's.
  */
 public function search()
 {
     $query = Purifier::clean(Input::get('q'));
     return Redirect::away('https://www.google.com/search?q=site:phphub++.com ' . $query, 301);
 }
 public function saveDatabase()
 {
     $buyer1 = Input::get('buyer');
     $seller = Input::get('seller');
     $review = Input::get('review');
     $urls = Input::get('urls');
     $rating_num = Input::get('rating');
     $rating = new Rating();
     //$rating->rating_id = 2;
     $rating->seller = $seller;
     $rating->buyer = $buyer1;
     $rating->review = $review;
     $rating->rating_number = $rating_num;
     $rating->save();
     return Redirect::away("http://localhost/authentication/secure/dashboard/modules/problem_sharing/donors");
     //		return Response::json(array('status'=>'done'));
 }
Example #30
0
<?php

Route::get('/', 'HomeController@ShowIndex');
Route::get('/settings', 'AccountController@ShowIndex');
Route::get('glyphs', function () {
    return Redirect::away('http://nodebox.github.io/opentype.js/glyph-inspector.html');
});
Route::get('projects', 'AccountController@ShowPage');
Route::post('projects/create/{name}', 'AccountController@CreateProject');
Route::post('projects/{project}/rename/{name}', 'AccountController@RenameProject');
Route::post('projects/{project}/add/user/{user}', 'AccountController@AddUser');
Route::post('projects/{project}/remove/user/{user}', 'AccountController@RemoveUser');
Route::post('projects/{project}/change/user/{user}/role/{role}', 'AccountController@ChangeRole');
Route::post('projects/{project}/create/syllabary/{name}', 'AccountController@NewSyllabary');
Route::post('projects/rename/syllabary/{syllabary}/name/{name}', 'AccountController@RenameSyllabary');
Route::get('syllabary/{syllabaryId}', 'SyllabaryController@ShowGrid');
Route::get('syllabary/grid/{syllabaryId}', 'SyllabaryController@GetGrid');
Route::get('json/syllabary/grid/{syllabaryId}', 'SyllabaryController@GetGridJson');
Route::get('syllabary/testsvg/{symbolId}', 'SyllabaryController@TestSvg');
Route::get('syllabary/symbol/{symbolId}/data', 'SyllabaryController@GetSymbolData');
Route::get('syllabary/{syllabaryId}/column/{columnId}/getAudio', 'AudioController@GetColumnAudioSample');
Route::get('syllabary/{syllabaryId}/row/{rowId}/getAudio', 'AudioController@GetRowAudioSample');
Route::get('syllabary/{syllabaryId}/cell/{rowId}/{colId}/customSymbolId', 'SyllabaryController@GetCellCustomSymbolId');
Route::post('syllabary/{syllabaryId}/undoAction', 'SyllabaryController@UndoAction');
Route::post('syllabary/{syllabaryId}/symbol/{symbolId}/update', 'SyllabaryController@UpdateSymbol');
Route::post('syllabary/{syllabaryId}/column/add/{relativeId?}', 'SyllabaryController@AddColumn');
Route::post('syllabary/{syllabaryId}/column/{columnId}/remove', 'SyllabaryController@RemoveColumn');
Route::post('syllabary/{syllabaryId}/column/{columnId}/vowel/{vowel}', 'SyllabaryController@EditVowel');
Route::post('syllabary/{syllabaryId}/column/{columnId}/uploadAudio', 'AudioController@UploadColumnHeaderSample');
Route::any('syllabary/{syllabaryId}/column/{columnId}/removeAudio', 'AudioController@RemoveColumnAudioSample');
Route::post('syllabary/{syllabaryId}/row/add/{relativeId?}', 'SyllabaryController@AddRow');