コード例 #1
0
ファイル: WeixinAction.php プロジェクト: jerrylsxu/yiifcms
 public function run()
 {
     require_once Yii::getPathOfAlias('ext') . "/OAuth/weixin/weixin.class.php";
     Yii::import('application.extensions.qrcode.QrCode');
     $config = OAuth::getConf('weixin');
     $random_uuid = $this->_createUUid();
     $wx = new WeiXin($config['app_id'], $config['app_secret'], $config['callback'], $random_uuid);
     $qr = new QrCode();
     $qrcode_url = $qr->createCode($wx->auth_url, 8);
     $this->controller->layout = false;
     $this->controller->_seoTitle = '微信扫一扫登录' . ' - ' . $this->controller->_setting['site_name'];
     $this->controller->render('wx_qrcode', array('qrcode_url' => $qrcode_url));
 }
コード例 #2
0
 public function loginQR($size = 80)
 {
     if (!$this->login_token) {
         $this->entity->login_token = str_random(20);
         $this->entity->save();
     }
     return \QrCode::format('png')->size(200)->errorCorrection('L')->margin(0)->generate($this->github_name . ',' . $this->login_token);
 }
コード例 #3
0
 private function sendMail($fullName, $toEmail, $orderId, $date, $sector, $quantity, $amount, $line, $encrypt)
 {
     $purchaseNumber = str_pad($orderId, 10, '0', STR_PAD_LEFT);
     $datePurchase = date('d/m/Y', strtotime($date));
     $qrFile = public_path('tmp\\' . $orderId . '.png');
     QrCode::format('png')->size(200)->generate($encrypt, $qrFile);
     Mail::queue('users.mails.test', array('fullName' => $fullName, 'purchaseNumber' => $purchaseNumber, 'datePurchase' => $datePurchase, 'sector' => $sector, 'quantity' => $quantity, 'amount' => $amount, 'line' => $line, 'qrFile' => $qrFile), function ($message) use($fullName, $toEmail) {
         $message->to($toEmail, $fullName)->cc('*****@*****.**', 'TICKETEG')->subject('Gracias por comprar con Tigo Money!');
     });
     File::delete($qrFile);
 }
コード例 #4
0
 private function sendMail($toEmail, $orderId, $encrypt)
 {
     $purchaseNumber = str_pad($orderId, 10, '0', STR_PAD_LEFT);
     $qrFile = public_path('tmp\\[s]' . $orderId . '.png');
     QrCode::format('png')->size(200)->generate($encrypt, $qrFile);
     Mail::queue('users.mails.test-samsung', array('purchaseNumber' => $purchaseNumber, 'qrFile' => $qrFile), function ($message) use($toEmail) {
         $message->to($toEmail)->cc('*****@*****.**', 'TICKETEG')->subject('Recibiste una entrada adicional por cortesía de Samsung Club y Tigo!');
     });
     File::delete($qrFile);
 }
コード例 #5
0
ファイル: success.blade.php プロジェクト: LockGit/dsk
@extends('layouts.app')

@section('content')
<div class="container spark-screen">
    <div class="row">
        <div class="col-md-10 col-md-offset-1">
            <div class="panel panel-default">
                <div class="panel-heading">发布成功</div>

                <div class="panel-body">
                        可以通过分享和扫描以下的地址来实现报名的传播.<br>
                        <hr>
                        报名地址:<a href="{{$url}}">{{$url}}</a><br>
                        报名二维码:<br>

                         <?php 
echo QrCode::size(250)->color(150, 90, 10)->generate($url);
?>
                         <p>扫描链接分享给好友.</p>


                </div>
            </div>
        </div>
    </div>
</div>
@endsection
コード例 #6
0
 private function generateTickets(\App\Order $order, $payuResponse)
 {
     $order->data = json_encode($payuResponse);
     $order->status = 'success';
     $order->save();
     $carts = $this->user()->carts()->get();
     foreach ($carts as $cart) {
         $ticket = new \App\Ticket();
         $ticket->order_id = $order->id;
         $ticket->event_id = $cart->price->event->id;
         $ticket->price = $cart->price->value;
         $ticket->description = $cart->price->description;
         $ticket->quantity = $cart->quantity;
         $ticket->unique = '871fd7278c6b07b7a9777c42ab3a1a55' . md5($order->id) . md5($cart->price->event->id) . md5($cart->price->id);
         $ticket->save();
         \QrCode::format('png')->size(250)->generate($ticket->unique, public_path('qrcodes/' . $ticket->unique . '.png'));
     }
     $this->user()->carts()->delete();
     return true;
 }
コード例 #7
0
ファイル: OrderController.php プロジェクト: labs7in0/E-cash
 public function doOrder(Request $request, $order_id)
 {
     $order = Order::findOrFail($order_id);
     $gateway = $request->input('gateway');
     $returnUrl = route('back', ['order_id' => $order_id, 'gateway' => $gateway]);
     $order_id = str_pad($order_id, 8, '0', STR_PAD_LEFT);
     $amount = $order->amount;
     $description = '';
     $items = unserialize($order->items);
     foreach ($items as $item) {
         $description .= $item['name'] . ' x ' . $item['quantity'] . ', ';
     }
     switch ($gateway) {
         case 'alipay':
             $omnipay = Omnipay::create('Alipay_Express');
             $params = ['out_trade_no' => $order_id, 'returnUrl' => $returnUrl, 'notifyUrl' => $returnUrl, 'subject' => $description, 'total_fee' => $amount];
             $omnipay->setPartner(getenv('payment.alipay.partner'));
             $omnipay->setKey(getenv('payment.alipay.key'));
             $omnipay->setSellerEmail(getenv('payment.alipay.seller_email'));
             $response = $omnipay->purchase($params)->send();
             if ($response->isRedirect()) {
                 $order->gateway = $gateway;
                 $this->js($response->getRedirectUrl());
             } else {
                 return trans('message.faild_processing');
             }
             break;
         case 'paypal':
             $omnipay = Omnipay::create('PayPal_Express');
             $amount = $this->xfee($this->xchange($amount), 0.044, 0.3);
             $params = ['transactionId' => $order_id, 'cancelUrl' => $returnUrl, 'returnUrl' => $returnUrl, 'notifyUrl' => $returnUrl, 'description' => $description, 'amount' => $amount, 'currency' => 'USD'];
             $omnipay->setUsername(getenv('payment.paypal.user'));
             $omnipay->setPassword(getenv('payment.paypal.pass'));
             $omnipay->setSignature(getenv('payment.paypal.sign'));
             $omnipay->setTestMode(getenv('payment.paypal.test'));
             $response = $omnipay->purchase($params)->send();
             if ($response->isRedirect()) {
                 $order->gateway = $gateway;
                 $this->js($response->getRedirectUrl());
             } else {
                 return trans('message.faild_processing');
             }
             break;
         case 'unionpay':
             $omnipay = Omnipay::create('UnionPay_Express');
             $params = ['orderId' => $order_id, 'txnTime' => date('YmdHis'), 'orderDesc' => $description, 'txnAmt' => $amount * 100, 'returnUrl' => $returnUrl, 'notifyUrl' => $returnUrl];
             $omnipay->setMerId(getenv('payment.unionpay.partner'));
             $omnipay->setCertPath(getenv('payment.unionpay.cert'));
             $omnipay->setCertPassword(getenv('payment.unionpay.certpass'));
             $response = $omnipay->purchase($params)->send();
             if ($response->isRedirect()) {
                 $order->gateway = $gateway;
                 $response->redirect();
             } else {
                 return trans('message.faild_processing');
             }
             break;
         case 'wechat':
             $omnipay = Omnipay::create('WechatPay_Native');
             $params = ['out_trade_no' => $order_id, 'notify_url' => $returnUrl, 'body' => $description, 'total_fee' => $amount, 'fee_type' => 'CNY'];
             $omnipay->setAppId(getenv('payment.wechat.app_id'));
             $omnipay->setMchId(getenv('payment.wechat.partner'));
             $omnipay->setApiKey(getenv('payment.wechat.pay_sign_key'));
             $response = $omnipay->purchase($params)->send();
             if ($response->isSuccessful()) {
                 $order->gateway = $gateway;
                 $qrCode = new QrCode();
                 $image = $qrCode->setText($response->getCodeUrl())->setSize(120)->setPadding(0)->getDataUri();
             } else {
                 return trans('message.faild_processing');
             }
             break;
         default:
             return trans('message.unsupported_gateway');
     }
     $order->save();
 }
コード例 #8
0
ファイル: UserController.php プロジェクト: om-innctech/ila
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     try {
         $rules = array('first_name' => 'required|min:2|max:20', 'last_name' => 'required|min:2|max:20', 'city' => 'required|max:50', 'pincode' => 'required|between:6,10');
         $messages = array('first_name.required' => 'First name is required.', 'last_name.required' => 'Last name is required.', 'city.required' => 'City is required.', 'pincode.required' => 'Pincode is required.');
         $validator = Validator::make(Input::all(), $rules, $messages);
         if ($validator->fails()) {
             $ers = json_decode($validator->messages()->toJson());
             $ermsg = "";
             foreach ($ers as $errs) {
                 foreach ($errs as $key => $value) {
                     $ermsg .= $value . "<br/>";
                 }
             }
             return $this->response(array('statusCode' => 400, 'statusDescription' => 'Bad Request', 'errors' => $ermsg));
         } else {
             $uid = Auth::id();
             if ($id == $uid) {
                 $user = Auth::user();
                 $user->fname = Input::get('first_name');
                 $user->lname = Input::get('last_name');
                 $user->address = Input::get('address');
                 $user->colony = Input::get('colony');
                 $user->area = Input::get('area');
                 $user->city = Input::get('city');
                 $user->pincode = Input::get('pincode');
                 $user->save();
                 $bike = Bike::where('user_id', '=', $uid)->where('status', '=', 0, 'AND')->orderBy('id', 'desc')->first();
                 if ($bike) {
                     $unique_id = $user->city . "-" . $user->pincode . "-";
                     for ($i = 0; $i < 11; $i++) {
                         $unique_id .= rand(0, 9);
                     }
                     $bike->unique_id = $unique_id;
                     $bike->status = 1;
                     $bike->qr_code = base64_encode(QrCode::format('png')->size(150)->encoding('UTF-8')->color(150, 90, 10)->backgroundColor(125, 184, '#808040')->generate($unique_id));
                     $bike->updatedon = date("Y-m-d H:i:s");
                     $bike->save();
                 }
                 return $this->response(array('statusCode' => 100, 'statusDescription' => 'Success', 'data' => $user));
             } else {
                 return $this->response(array('statusCode' => 400, 'statusDescription' => "Bad Request", "errors" => "You cannot change profile of others."));
             }
         }
     } catch (Exception $e) {
         return $this->response(array('statusCode' => 401, 'statusDescription' => "Bad Request", "errors" => $e->getMessage()));
     }
 }
コード例 #9
0
ファイル: routes.php プロジェクト: vicenteguerra/Flashbuy
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    return view('welcome');
});
Route::post('auth/login', 'AuthController@postLogin');
Route::resource('api/customer', 'Api\\customerController');
Route::resource('api/payment', 'Api\\paymentController');
Route::resource('api/social', 'Api\\socialController');
Route::get('get/code/{id}', function ($id) {
    return QrCode::size(300)->generate($id);
});
Route::get('mastercard/transaction', 'MastercardController@transaction');
コード例 #10
0
ファイル: class.snapscan.php プロジェクト: GavinCS/SnapScan
 static function QR($amount = false, $id = false, $strict = true, $size = 300, $margin = 0)
 {
     $query = '';
     $parts = [];
     // Ensure that we have data as well
     if (!empty($amount) && !is_numeric($amount)) {
         throw new Exception("class.SnapScan.php |\n                QR Code :: expects {$amount} to be a number", 1);
         return '';
     } else {
         $amount = self::$instance->getNominalValue($amount);
         $parts['amount'] = $amount;
     }
     // Add the id to the url if we have it
     if (!empty($id)) {
         $parts['id'] = $id;
     }
     // Ensure we have a size
     if (!empty($size) && !is_numeric($size)) {
         throw new Exception("class.SnapScan.php |\n                QR Code :: expects {$size} to be a number", 1);
         return '';
     }
     // Ensure we have a margin
     if (!empty($margin) && !is_numeric($margin)) {
         throw new Exception("class.SnapScan.php |\n                QR Code :: expects {$margin} to be a number", 1);
         return '';
     }
     // Ensure we have extra components
     if (!empty($parts)) {
         $query = http_build_query($parts);
     }
     $data = urlencode(self::$instance->qrEndPoint . '/' . self::$instance->merchantId . '?' . $query);
     $QR = new QrCode($size, $data);
     $QR->setMargin($margin);
     $url = $QR->getUrl();
     if (empty($url)) {
         return '';
     }
     return $url;
 }
コード例 #11
0
 public function qr($hash)
 {
     $contents = \QrCode::format('png')->size(300)->generate('http://local.suaray.com/');
     $response = \Response::make($contents, 200);
     $response->header('Content-Type', 'image/png');
     return $response;
 }