コード例 #1
0
 /**
  * @param Order $order
  * @return QrCode|null
  * @throws \ErrorException
  */
 public function renderQRCodeForOrder(Order $order)
 {
     if (!$order->loaded()) {
         throw new \ErrorException("Invalid order");
     }
     $df = RUtils::dt();
     $date = new \DateTime($order->created_at);
     $purpose = "Оплата по счету №" . $order->uid . " от " . $df->ruStrFTime(['format' => 'j F Y', 'monthInflected' => true, 'date' => $date]);
     return $this->renderQRCode($this->generateStringForQRCode($order->amount, $purpose));
 }
コード例 #2
0
 /**
  * 显示订单内容
  *
  * @param  int $id
  * @param  string $type 内容模型类型
  * @return Illuminate\Support\Collection
  */
 public function show($id)
 {
     $order = $this->order->findOrFail($id);
     $order->merchant = $this->merchant->findOrFail($order->merchant_id);
     $order->goods = json_decode($order->product_json);
     return $order;
 }
コード例 #3
0
ファイル: NotifyController.php プロジェクト: Lazybin/huisa
 public function yinlian()
 {
     include_once '../vendor/yinlian_sdk/acp_service.php';
     if (isset($_POST['signature'])) {
         if (\AcpService::validate($_POST) && ($_POST['respCode'] == '00' || $_POST['respCode'] == 'A6')) {
             $order = Order::where('out_trade_no', $_POST['orderId'])->first();
             if ($order != null) {
                 $orderId = $order->id;
                 $order->status = 1;
                 $time = date("Y-m-d H:i:s", time());
                 $order->payment_time = $time;
                 $order->payment_way = 3;
                 $order->save();
                 $useCouponRecords = UseCouponRecords::where('order_id', $orderId)->first();
                 if ($useCouponRecords != null) {
                     $useCouponRecords->status = 2;
                     //礼券金额
                     $apiParam = ['accessToken' => $useCouponRecords->access_token, 'coupon' => $useCouponRecords->coupon, 'orderId' => $_POST['orderId']];
                     $res = $this->post('/zhmf/member/consumerCoupon/useCoupon', $apiParam);
                     $res = json_decode($res);
                     if ($res->Code == 0) {
                         $useCouponRecords->status = 1;
                     }
                     $useCouponRecords->save();
                 }
                 echo 'success';
             }
         } else {
             @header('HTTP/1.1 500 Internal Server Error');
         }
     } else {
         @header('HTTP/1.1 500 Internal Server Error');
     }
 }
コード例 #4
0
ファイル: OrdersController.php プロジェクト: Lazybin/huisa
 public function detail($id)
 {
     $order = Order::find($id)->toArray();
     $ret['meta']['code'] = 1;
     $ret['meta']['data'] = $order;
     echo json_encode($ret);
 }
コード例 #5
0
 /**
  *
  * @SWG\Api(
  *   path="/comments",
  *   description="评论(新20160216)",
  *   @SWG\Operation(
  *     method="GET", summary="评论列表", notes="评论列表",
  *     type="UserComment",
  *     @SWG\ResponseMessage(code=0, message="成功"),
  *     @SWG\Parameter(
  *         name="type",
  *         description="类型,0---》商品 1---》主题",
  *         paramType="query",
  *         required=true,
  *         allowMultiple=false,
  *         type="integer"
  *     ),@SWG\Parameter(
  *         name="item_id",
  *         description="项id",
  *         paramType="query",
  *         required=true,
  *         allowMultiple=false,
  *         type="integer"
  *     ),
  *     @SWG\Parameter(
  *         name="PageNum",
  *         description="分页开始位置",
  *         paramType="query",
  *         required=false,
  *         allowMultiple=false,
  *         type="integer",
  *         defaultValue=1
  *     ),@SWG\Parameter(
  *         name="PerPage",
  *         description="取得长度",
  *         paramType="query",
  *         required=false,
  *         allowMultiple=false,
  *         type="integer",
  *         defaultValue=10
  *     )
  *   )
  * )
  */
 public function index(Request $request)
 {
     $start = $request->input('PageNum', 0);
     $length = $request->input('PerPage', 10);
     $type = $request->input('type');
     $item_id = $request->input('item_id');
     $start = ($start - 1) * $length;
     $response = new BaseResponse();
     $comments = UserComment::select('user_comments.*', 'user_infos.nick_name', 'user_infos.head_icon')->leftJoin('user_infos', 'user_infos.id', '=', 'user_comments.user_id')->where('user_comments.type', $type)->where('user_comments.item_id', $item_id);
     $rows = $comments->skip($start)->take($length)->orderBy('user_comments.id', 'desc')->get()->toArray();
     foreach ($rows as &$v) {
         //$v['']
         $sum = Order::select(DB::raw('SUM(total_fee) as total_pay'))->where('user_id', $v['user_id'])->where('status', 4)->first()->toArray();
         if ($sum == null || $sum['total_pay'] == null) {
             $sum = 0;
         } else {
             $sum = $sum['total_pay'];
         }
         $level = UserLevel::where('sum_lowest', '<=', $sum)->where('sum_highest', '>', $sum)->first()->toArray();
         //var_dump($level);exit;
         $v['level'] = $level['img'];
     }
     $response->rows = $rows;
     $response->total = $comments->count();
     return $response->toJson();
 }
コード例 #6
0
ファイル: UseCouponRecords.php プロジェクト: Lazybin/huisa
 public function getOrderAttribute()
 {
     //$goodsList=OrderGoods::with('goods')->where('order_id',$this->id)->get();
     $order = Order::find($this->order_id);
     if ($order == null) {
         return '';
     }
     return $order->toArray();
 }
コード例 #7
0
 public function order_detail($id)
 {
     if (!$this->obj->checkMemberLogin()) {
         return redirect('memberLogin');
     }
     $order_list = Order::find($id);
     if ($order_list == '') {
         return redirect('order-history');
     }
     $order_items_list = $order_list->AllOrderItems;
     //echo "<pre>";print_r($order_list);exit;
     return view('frontend.order.member_order_details', compact('order_list', 'order_items_list'), array('title' => 'MIRAMIX | My Past Order'));
 }
コード例 #8
0
 /**
  *
  * @SWG\Api(
  *   path="/user_levels/{user_id}",
  *   description="用户等级(新20160220)",
  *   @SWG\Operation(
  *     method="GET", summary="查询用户等级", notes="查询用户等级 level代表用户当前等级(1-5中的一个)sum代表用户消费总金额",
  *     @SWG\ResponseMessage(code=0, message="成功"),
  *     @SWG\Parameter(
  *         name="user_id",
  *         description="用户id",
  *         paramType="path",
  *         required=true,
  *         allowMultiple=false,
  *         type="integer",
  *     )
  *
  *   )
  * )
  */
 public function show($id)
 {
     $response = new BaseResponse();
     $sum = Order::select(DB::raw('SUM(total_fee) as total_pay'))->where('user_id', $id)->where('status', 4)->first()->toArray();
     if ($sum == null || $sum['total_pay'] == null) {
         $sum = 0;
     } else {
         $sum = $sum['total_pay'];
     }
     $level = UserLevel::where('sum_lowest', '<=', $sum)->where('sum_highest', '>', $sum)->first()->toArray();
     $ret['level'] = $level['id'];
     $ret['sum'] = $sum;
     $response->Data = $ret;
     return $response->toJson();
 }
コード例 #9
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request)
 {
     $bill = Bill::findOrNew($request->get('id'));
     $bill->is_paid = 1;
     $bill->save();
     $order = Order::where('server_order_id', '=', $request->get('order_id'))->first();
     $order->is_paid = 1;
     $order->save();
     $passingData = array('order_id' => $request->get('order_id'));
     $data_string = json_encode($passingData);
     $url = curl_init('http://localhost:8000/api/order/updatepaid');
     curl_setopt($url, CURLOPT_CUSTOMREQUEST, "POST");
     curl_setopt($url, CURLOPT_POSTFIELDS, $data_string);
     curl_setopt($url, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($url, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($data_string)));
     $result = curl_exec($url);
     return redirect('/bill');
 }
コード例 #10
0
ファイル: RefundsController.php プロジェクト: Lazybin/huisa
 private function dealOrder($content, $refund)
 {
     $order = Order::find($content->order_id);
     switch ($order->status) {
         case 1:
             $order->status = 5;
             $order->save();
             break;
         case 3:
             $order->status = 6;
             $order->save();
             break;
         default:
             $refund->delete();
             return false;
     }
     return true;
 }
コード例 #11
0
 public function destroy($id)
 {
     Order::find($id)->delete();
     return redirect('admin/orders');
     Session::flash('success', 'Order deleted successfully');
     return redirect('admin/orders');
 }
コード例 #12
0
 public function checkoutStep4()
 {
     $obj = new helpers();
     if ($obj->checkMemberLogin() && !$obj->checkBrandLogin()) {
         $sitesettings = DB::table('sitesettings')->get();
         if (!empty($sitesettings)) {
             foreach ($sitesettings as $each_sitesetting) {
                 if ($each_sitesetting->name == 'shipping_rate') {
                     $shipping_rate = (int) $each_sitesetting->value;
                 }
             }
         }
         if (Request::isMethod('post')) {
             $shp_address = DB::table('addresses')->where('mem_brand_id', Session::get('member_userid'))->where('id', Session::get('selected_address_id'))->first();
             // Serialize the Shipping Address because If user delete there address from "addresses" table,After that the address also store in the "order" table for  getting order history//
             $shiping_address = array('address_title' => $shp_address->address_title, 'mem_brand_id' => $shp_address->mem_brand_id, 'first_name' => $shp_address->first_name, 'last_name' => $shp_address->last_name, 'email' => $shp_address->email, 'phone' => $shp_address->phone, 'address' => $shp_address->address, 'address2' => $shp_address->address2, 'city' => $shp_address->city, 'zone_id' => $shp_address->zone_id, 'country_id' => $shp_address->country_id, 'postcode' => $shp_address->postcode);
             $shiping_address_serial = serialize($shiping_address);
             $order = Order::create(['order_total' => Request::input('grand_total'), 'sub_total' => Request::input('sub_total'), 'order_status' => 'pending', 'shipping_address_id' => Session::get('selected_address_id'), 'shipping_cost' => $shipping_rate, 'shipping_type' => 'flat', 'user_id' => Session::get('member_userid'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'payment_method' => Session::get('payment_method'), 'transaction_id' => '', 'transaction_status' => '', 'shiping_address_serialize' => $shiping_address_serial, 'created_at' => date('Y-m-d H:s:i'), 'updated_at' => date('Y-m-d H:s:i')]);
             $last_order_id = $order->id;
             $allCart = DB::table('carts')->where('user_id', Session::get('member_userid'))->get();
             foreach ($allCart as $eachCart) {
                 $product_details = DB::table('products')->where('id', $eachCart->product_id)->first();
                 // echo $each_content->brandmember_id; exit;
                 $brandmember_deatils = DB::table('products')->leftJoin('brandmembers', 'brandmembers.id', '=', 'products.brandmember_id')->select('products.*', 'brandmembers.fname', 'brandmembers.lname', 'brandmembers.username', 'brandmembers.slug', 'brandmembers.pro_image', 'brandmembers.brand_details', 'brandmembers.brand_sitelink', 'brandmembers.status', 'brandmembers.admin_status')->where('products.id', '=', $eachCart->product_id)->first();
                 //echo "<pre>";print_r($brandmember_deatils); exit;
                 //echo $brandmember->slug ; exit;
                 $brand_member_name = $brandmember_deatils->fname ? $brandmember_deatils->fname . ' ' . $brandmember_deatils->lname : $brandmember_deatils->username;
                 $formfactor = DB::table('form_factors')->where('id', '=', $eachCart->form_factor)->first();
                 $order_item = OrderItems::create(['order_id' => $last_order_id, 'brand_id' => $brandmember_deatils->brandmember_id, 'brand_name' => $brand_member_name, 'product_id' => $eachCart->product_id, 'product_name' => $eachCart->product_name, 'product_image' => $product_details->image1, 'quantity' => $eachCart->quantity, 'price' => $eachCart->amount, 'form_factor_id' => $formfactor->id, 'form_factor_name' => $formfactor->name]);
                 // All Cart deleted from cart table after inserting all data to order and order_item table.
                 //$deleteCart =  Cart::where('user_id', '=', Session::get('member_userid'))->delete();
             }
             if (Session::get('payment_method') == 'creditcard') {
                 return redirect('/checkout-authorize/' . $last_order_id);
             } elseif (Session::get('payment_method') == 'paypal') {
                 return redirect('/checkout-paypal/' . $last_order_id);
             }
         }
         // All Cart Contain  In Session Will Display Here //
         $content = DB::table('carts')->where('user_id', Session::get('member_userid'))->get();
         //echo "<pre>";print_r($content); exit;
         foreach ($content as $each_content) {
             $product_res = DB::table('products')->where('id', $each_content->product_id)->first();
             // echo $each_content->brandmember_id; exit;
             $brandmember = DB::table('products')->leftJoin('brandmembers', 'brandmembers.id', '=', 'products.brandmember_id')->select('products.*', 'brandmembers.fname', 'brandmembers.lname', 'brandmembers.username', 'brandmembers.slug', 'brandmembers.pro_image', 'brandmembers.brand_details', 'brandmembers.brand_sitelink', 'brandmembers.status', 'brandmembers.admin_status')->where('products.id', '=', $each_content->product_id)->first();
             //echo "<pre>";print_r($brandmember);
             //echo $brandmember->slug ; exit;
             $brand_name = $brandmember->fname ? $brandmember->fname . ' ' . $brandmember->lname : $brandmember->username;
             $formfactor = DB::table('form_factors')->where('id', '=', $each_content->form_factor)->first();
             $formfactor_name = $formfactor->name;
             $formfactor_id = $formfactor->id;
             $cart_result[] = array('rowid' => $each_content->row_id, 'product_name' => $each_content->product_name, 'product_slug' => $brandmember->product_slug, 'product_image' => $product_res->image1, 'qty' => $each_content->quantity, 'price' => $each_content->amount, 'duration' => $each_content->duration, 'formfactor_name' => $formfactor_name, 'formfactor_id' => $formfactor_id, 'brand_name' => $brand_name, 'brand_slug' => $brandmember->slug, 'subtotal' => $each_content->sub_total);
         }
         //echo "sph= ".$shipping_rate; exit;
         return view('frontend.checkout.checkout_setp4', compact('body_class', 'cart_result', 'shipping_rate'), array('title' => 'MIRAMIX | Checkout-Step4'));
     } else {
         redirect('/checkout-step1');
     }
 }
コード例 #13
0
ファイル: OrderController.php プロジェクト: amittier5/miramix
 public function push_order_process($param = false)
 {
     //echo $param;exit;
     $usps_obj = new Usps();
     $obj = new helpers();
     $all_process_orders = DB::table('add_process_order_labels')->get();
     $all_filename = array();
     $flag = 0;
     if (!empty($all_process_orders)) {
         foreach ($all_process_orders as $key => $value) {
             // Get details for each order
             $ord_dtls = Order::find($value->order_id);
             $serialize_add = unserialize($ord_dtls['shiping_address_serialize']);
             $user_email = $serialize_add['email'];
             $user_name = $serialize_add['first_name'] . " " . $serialize_add['last_name'];
             $phone = $serialize_add['phone'];
             $address = $serialize_add['address'];
             $address2 = $serialize_add['address2'];
             $city = $serialize_add['city'];
             $zone_id = $serialize_add['zone_id'];
             $country_id = $serialize_add['country_id'];
             $postcode = $serialize_add['postcode'];
             $ToState = '';
             if (is_numeric($zone_id)) {
                 $ToState = $obj->get_statecode($zone_id);
             } else {
                 $ToState = $obj->get_statecode_by_name($zone_id);
             }
             // Call USPS API
             $parameters_array = array('ToName' => $user_name, 'ToFirm' => '', 'ToAddress1' => $address2, 'ToAddress2' => $address, 'ToCity' => $city, 'ToState' => $ToState, 'ToZip5' => $postcode, 'order_id' => $value->order_id);
             $ret_array = $usps_obj->USPSLabel($parameters_array);
             //echo "<pre>";print_r($ret_array);exit;
             if ($ret_array['filename'] != "") {
                 $flag = 1;
             }
             $all_filename[] = $filename = $ret_array['filename'];
             $tracking_number = $ret_array['tracking_no'];
             // Update label name in DB
             Order::where('id', $value->order_id)->update(['tracking_number' => $tracking_number, 'shipping_carrier' => 'USPS', 'usps_label' => $filename, 'order_status' => 'shipped']);
             // change order status and send mail
             $order = Order::find($value->order_id);
             $subject = 'Order status change of : #' . $order->order_number;
             $cmessage = 'Your order status is changed to ' . $order->order_status . '. Please visit your account for details.';
             $tracking = '';
             $shipping = '';
             if ($order->order_status == 'shipped') {
                 $tracking = 'Tracking Number is : ' . $tracking_number;
                 $shipping = 'Shipping Method is : USPS<br />Please visit your account for details';
             }
             $setting = DB::table('sitesettings')->where('name', 'email')->first();
             $admin_users_email = $setting->value;
             /*$sent = Mail::send('admin.order.statusemail', array('name'=>$user_name,'email'=>$user_email,'messages'=>$cmessage,'admin_users_email'=>$admin_users_email,'tracking'=>$tracking,'shipping'=>$shipping), 
             		
             		function($message) use ($admin_users_email, $user_email,$user_name,$subject)
             		{
             			$message->from($admin_users_email);
             			$message->to($user_email, $user_name)->cc($admin_users_email)->subject($subject);
             			//$message->to('*****@*****.**', $user_name)->cc($admin_users_email)->subject($subject);
             			
             		});*/
         }
     }
     // Delete from add_process_order_labels
     DB::table('add_process_order_labels')->delete();
     if ($param == 1) {
         $full_path = array();
         if (!empty($all_filename)) {
             foreach ($all_filename as $file) {
                 if ($file != "") {
                     $full_path[] = './uploads/pdf/' . $file;
                 }
             }
         }
         if (!empty($full_path)) {
             $usps_obj->new_printPdf($full_path);
         }
     }
     //echo $flag;print_r($all_filename);exit;
     if ($flag == 1) {
         Session::flash('success', 'Message is sent to user and order status is updated successfully.');
     } else {
         Session::flash('error', 'No label is created.');
     }
     return redirect('admin/orders');
 }
コード例 #14
0
ファイル: OrdersController.php プロジェクト: Lazybin/huisa
 /**
  *
  * @SWG\Api(
  *   path="/orders/{out_trade_no}",
  *   @SWG\Operation(
  *     method="DELETE", summary="删除订单", notes="删除订单",
  *     @SWG\ResponseMessage(code=0, message="成功"),
  *     @SWG\Parameter(
  *         name="out_trade_no",
  *         description="订单号",
  *         paramType="path",
  *         required=true,
  *         type="string"
  *     ),
  *   )
  * )
  */
 public function destroy($out_trade_no)
 {
     $response = new BaseResponse();
     $order = Order::where('out_trade_no', $out_trade_no)->first();
     if ($order != null) {
         $order->delete_at = date("Y-m-d H:i:s", time());
         $order->save();
     }
     return $response->toJson();
 }
コード例 #15
0
ファイル: PaymentTest.php プロジェクト: nchervyakov/evolve2
 protected function addOrder($price, $orderBase)
 {
     $order = new Order($this->pixie);
     $order->amount = $price;
     $order->created_at = date('Y-m-d H:i:s');
     $order->customer_email = '*****@*****.**';
     $order->customer_firstname = 'Николай';
     $order->customer_id = 1;
     $order->customer_lastname = 'Червяков';
     $order->payment_method = 'credit_card';
     $order->shipping_method = 'post';
     $order->status = Order::STATUS_WAITING_PAYMENT;
     $order->uid = $orderBase + $price * 10;
     $order->updated_at = date('Y-m-d H:i:s');
     $order->save();
     $orderItem = new OrderItems($this->pixie);
     $orderItem->product_id = 22;
     $orderItem->order_id = $order->id();
     $orderItem->price = 38;
     $orderItem->name = "Запасной ремень All Terrain";
     $orderItem->created_at = date('Y-m-d H:i:s');
     $orderItem->updated_at = date('Y-m-d H:i:s');
     $orderItem->qty = 1;
     $orderItem->save();
     return $order;
 }
コード例 #16
0
ファイル: Order.php プロジェクト: nchervyakov/evolve2
 protected function getEditFields()
 {
     return ['id' => [], 'status' => ['type' => 'select', 'option_list' => ArraysHelper::arrayFillEqualPairs(\App\Model\Order::getOrderStatuses()), 'required' => true, 'label' => 'Статус'], 'customer_id' => ['label' => 'Клиент', 'type' => 'select', 'option_list' => 'App\\Admin\\Controller\\User::getAvailableUsers', 'required' => true], 'customer_firstname' => ['label' => 'Имя клиента'], 'customer_lastname' => ['label' => 'Фамилия клиента'], 'customer_email' => ['label' => 'Email'], 'amount' => ['label' => 'Сумма'], 'comment' => ['type' => 'textarea', 'label' => 'Комментарий'], 'created_at' => ['data_type' => 'date', 'label' => 'Создан'], 'updated_at' => ['data_type' => 'date', 'label' => 'Обновлён']];
 }
コード例 #17
0
 public function checkoutStep4()
 {
     $obj = new helpers();
     $shp_address = array();
     $sitesettings = DB::table('sitesettings')->get();
     if (!empty($sitesettings)) {
         foreach ($sitesettings as $each_sitesetting) {
             if ($each_sitesetting->name == 'shipping_rate') {
                 $shipping_rate = (double) $each_sitesetting->value;
             }
             if ($each_sitesetting->name == 'free_discount_rate') {
                 $free_discount_rate = (double) $each_sitesetting->value;
             }
         }
     }
     if (Request::isMethod('post')) {
         Session::put('name_card', Input::get('name_card'));
         //Input::get('name_card');
         Session::put('card_number', Input::get('card_number'));
         //Input::get('card_number'); //"4042760173301988";//
         Session::put('card_exp_month', Input::get('card_exp_month'));
         // "03"; //
         Session::put('card_exp_year', Input::get('card_exp_year'));
         // "19"; //
         //checkout as guest
         if (!Session::has('member_userid')) {
             $guestdata = Session::get('guest_array');
             $shiping_address = array('address_title' => 'default address', 'first_name' => $guestdata["guest_fname"], 'last_name' => $guestdata["guest_lname"], 'email' => $guestdata["guest_email"], 'phone' => $guestdata["guest_phone"], 'address' => $guestdata["guest_address"], 'address2' => $guestdata["guest_address2"], 'city' => $guestdata["guest_city"], 'zone_id' => $guestdata["guest_state"], 'country_id' => $guestdata["guest_country_id"], 'postcode' => $guestdata["guest_zip_code"]);
             $want_reg = Request::input('register_user');
             if ($want_reg == 'register') {
                 //register the member
                 Session::put('guest_username_sess', Request::input('guest_username'));
                 $brandmember = Brandmember::create(['fname' => $guestdata['guest_fname'], 'lname' => $guestdata['guest_lname'], 'email' => $guestdata['guest_email'], 'username' => Request::input('guest_username'), 'password' => Hash::make(Request::input('guest_password')), 'role' => 0, 'admin_status' => 1, 'status' => 1, 'updated_at' => date('Y-m-d H:i:s'), 'created_at' => date('Y-m-d H:i:s')]);
                 $lastInsertedId = $brandmember->id;
                 $shiping_address['mem_brand_id'] = $brandmember->id;
                 $shp_address = Address::create($shiping_address);
                 $lastAddressId = DB::getPdo()->lastInsertId();
                 $user_id = $brandmember->id;
                 // Update Address id in brandmember table
                 $addressId = $shp_address->id;
                 $dataUpdateAddress = DB::table('brandmembers')->where('id', $brandmember->id)->update(['address' => $addressId]);
             } else {
                 //set userid for not loggedin users to pass the order
                 $user_id = NULL;
                 $shp_address['id'] = NULL;
                 $shp_address = (object) $shp_address;
                 //print_r($shp_address); exit;
             }
             // End of registration ==================================================
             /* To get the country code And Zone code */
             $shp_country = DB::table('countries')->where('country_id', $guestdata["guest_country_id"])->first();
             $shp_zone = DB::table('zones')->where('zone_id', $guestdata["guest_state"])->first();
             $shiping_address = array('address_title' => 'default address', 'first_name' => $guestdata["guest_fname"], 'last_name' => $guestdata["guest_lname"], 'email' => $guestdata["guest_email"], 'phone' => $guestdata["guest_phone"], 'address' => $guestdata["guest_address"], 'address2' => $guestdata["guest_address2"], 'city' => $guestdata["guest_city"], 'zone_id' => $shp_zone->code, 'country_id' => $shp_country->iso_code_3, 'postcode' => $guestdata["guest_zip_code"]);
             //print_r($shiping_address); exit;
             $shiping_address_serial = serialize($shiping_address);
         } else {
             //for logged-in users
             $shp_address = DB::table('addresses')->leftjoin('countries', 'countries.country_id', '=', 'addresses.country_id')->leftjoin('zones', 'zones.zone_id', '=', 'addresses.zone_id')->select('addresses.*', 'countries.name as country_name', 'countries.iso_code_3 as country_code', 'zones.name as zone_name', 'zones.code as zone_code')->where('mem_brand_id', Session::get('member_userid'))->where('id', Session::get('selected_address_id'))->first();
             //echo "<pre>111111";print_r($shp_address); exit;
             // Serialize the Shipping Address because If user delete there address from "addresses" table,After that the address also store in the "order" table for  getting order history//
             $shiping_address = array('address_title' => $shp_address->address_title, 'mem_brand_id' => $shp_address->mem_brand_id, 'first_name' => $shp_address->first_name, 'last_name' => $shp_address->last_name, 'email' => $shp_address->email, 'phone' => $shp_address->phone, 'address' => $shp_address->address, 'address2' => $shp_address->address2, 'city' => $shp_address->city, 'zone_id' => $shp_address->zone_code, 'country_id' => $shp_address->country_code, 'postcode' => $shp_address->postcode);
             $shiping_address_serial = serialize($shiping_address);
             //echo "pm= ".Session::get('payment_method'); exit;
             $user_id = Session::get('member_userid');
         }
         $order = Order::create(['order_total' => Request::input('grand_total'), 'sub_total' => Request::input('sub_total'), 'discount' => Request::input('discount'), 'redeem_amount' => Request::input('redeem_amount'), 'order_status' => 'pending', 'shipping_address_id' => $shp_address->id, 'shipping_cost' => Request::input('shipping_rate'), 'shipping_type' => 'flat', 'user_id' => $user_id, 'ip_address' => $_SERVER['REMOTE_ADDR'], 'payment_method' => Session::get('payment_method'), 'transaction_id' => '', 'transaction_status' => '', 'shiping_address_serialize' => $shiping_address_serial, 'created_at' => date('Y-m-d H:s:i'), 'updated_at' => date('Y-m-d H:s:i')]);
         $last_order_id = $order->id;
         $obj = new helpers();
         $order_number = 'ORD-' . $obj->random_string(5) . '-' . $last_order_id;
         // Generate random String for order number
         $update_order_number = DB::table('orders')->where('id', $last_order_id)->update(['order_number' => $order_number]);
         Session::put('order_number', $order_number);
         Session::put('order_id', $last_order_id);
         ///we are not storing new registered cart in cart table as it will be destroyed soon
         if (Session::has('member_userid')) {
             $allCart = DB::table('carts')->where('user_id', Session::get('member_userid'))->get();
         } else {
             $allCart = $obj->content();
             foreach ($allCart as $each_content) {
                 $each_content->product_id = $each_content->id;
                 $each_content->form_factor = $each_content->options->form_factor;
                 $each_content->row_id = $each_content->rowid;
                 $each_content->product_name = $each_content->name;
                 $each_content->quantity = $each_content->qty;
                 $each_content->amount = $each_content->price;
                 $each_content->duration = $each_content->options->duration;
                 $each_content->sub_total = $each_content->subtotal;
                 $each_content->no_of_days = $each_content->options->no_of_days;
             }
         }
         foreach ($allCart as $eachCart) {
             $product_details = DB::table('products')->where('id', $eachCart->product_id)->first();
             // echo $each_content->brandmember_id; exit;
             $brandmember_deatils = DB::table('products')->leftJoin('brandmembers', 'brandmembers.id', '=', 'products.brandmember_id')->select('products.*', 'brandmembers.fname', 'brandmembers.lname', 'brandmembers.username', 'brandmembers.email', 'brandmembers.slug', 'brandmembers.pro_image', 'brandmembers.brand_details', 'brandmembers.brand_sitelink', 'brandmembers.status', 'brandmembers.admin_status')->where('products.id', '=', $eachCart->product_id)->first();
             //echo "<pre>";print_r($brandmember_deatils); exit;
             //echo $brandmember->slug ; exit;
             $brand_member_name = $brandmember_deatils->fname ? $brandmember_deatils->fname . ' ' . $brandmember_deatils->lname : $brandmember_deatils->username;
             $formfactor = DB::table('form_factors')->where('id', '=', $eachCart->form_factor)->first();
             $order_item = OrderItems::create(['order_id' => $last_order_id, 'brand_id' => $brandmember_deatils->brandmember_id, 'brand_name' => $brand_member_name, 'brand_email' => $brandmember_deatils->email, 'product_id' => $eachCart->product_id, 'product_name' => $eachCart->product_name, 'product_image' => $product_details->image1, 'quantity' => $eachCart->quantity, 'price' => $eachCart->amount, 'form_factor_id' => $formfactor->id, 'form_factor_name' => $formfactor->name, 'duration' => $eachCart->duration, 'no_of_days' => $eachCart->no_of_days]);
             //All Cart deleted from cart table after inserting all data to order and order_item table.
             if (Session::has('member_userid')) {
                 $deleteCart = DB::table('carts')->where('user_id', '=', Session::get('member_userid'))->delete();
             }
             Cart::destroy();
             // After inserting all cart data into Order and Order_item Table database
         }
         //set points for users on purchase
         if (Session::get('payment_method') == 'creditcard') {
             return redirect('/checkout-authorize/' . $last_order_id);
         } elseif (Session::get('payment_method') == 'paypal') {
             return redirect('/checkout-paypal/' . $last_order_id);
         }
     }
     //end of post
     /*
     		
     
     // All Cart Contain  In Session Will Display Here //
     $content = DB::table('carts')->where('user_id',Session::get('member_userid'))->get();
     //echo "<pre>";print_r($content); exit;
     foreach($content as $each_content)
     	        {
     	            
     	            $product_res = DB::table('products')->where('id',$each_content->product_id)->first();
     	           // echo $each_content->brandmember_id; exit;
     	            $brandmember = DB::table('products')
     	                                ->leftJoin('brandmembers', 'brandmembers.id', '=', 'products.brandmember_id')
     	                                ->select('products.*', 'brandmembers.fname', 'brandmembers.lname', 'brandmembers.username', 'brandmembers.slug', 'brandmembers.pro_image', 'brandmembers.brand_details', 'brandmembers.brand_sitelink', 'brandmembers.status', 'brandmembers.admin_status')
     	                                ->where('products.id','=',$each_content->product_id)
     	                                ->first();
     	                                //echo "<pre>";print_r($brandmember); 
     	                                //echo $brandmember->slug ; exit;
     	            $brand_name = ($brandmember->fname)?($brandmember->fname.' '.$brandmember->lname):$brandmember->username;
     
     	            $formfactor = DB::table('form_factors')->where('id','=',$each_content->form_factor)->first();
     	            $formfactor_name = $formfactor->name;
     	            $formfactor_id = $formfactor->id;
     
     	            $cart_result[] = array('rowid'=>$each_content->row_id,
     	                'product_name'=>$each_content->product_name,
     	                'product_slug'=>$brandmember->product_slug,
     	                'product_image'=>$product_res->image1,
     	                'qty'=>$each_content->quantity,
     	                'price'=>$each_content->amount,
     	                'duration'=>$each_content->duration,
     	                'formfactor_name'=>$formfactor_name,
     	                'formfactor_id'=>$formfactor_id,
     	                'brand_name'=>$brand_name,
     	                'brand_slug'=>$brandmember->slug,
     	                'subtotal'=>$each_content->sub_total);
     
     	        }
     	    
     
                 //echo "sph= ".$shipping_rate; exit;
     return view('frontend.checkout.checkout_setp4',compact('body_class','cart_result','shipping_rate'),array('title'=>'MIRAMIX | Checkout-Step4'));
     */
 }
コード例 #18
0
ファイル: CustomerController.php プロジェクト: whplay/eShop
 public function getOrders(Request $request)
 {
     $customer_id = $request->input('customer_id');
     $orders = Order::where('customer_id', $customer_id)->with('orderItems.product.productUnit', 'orderState', 'orderItems.orderItemState')->get();
     return response()->json(['success' => true, 'data' => ['orders' => $orders]]);
 }
コード例 #19
0
ファイル: OrderController.php プロジェクト: Germey/WaiMai
 /**
  * Editable ajax change status.
  *
  * @param Request $request
  * @return mixed
  */
 public function postChangeStatus(Request $request)
 {
     $data = $request->all();
     if (Order::where('id', '=', $data['pk'])->update(['delivery_status' => $data['value']])) {
         return Response::json(['status' => 200]);
     } else {
         return Response::json(['status' => 502]);
     }
 }
コード例 #20
0
ファイル: Payment.php プロジェクト: nchervyakov/evolve2
 /**
  * @param Order $order
  * @param PaymentOperation $operation
  * @param mixed $transactionType
  */
 protected function processPaymentOperation($order, $operation, $transactionType)
 {
     $this->pixie->dispatcher->dispatch(Events::PAYMENT_OPERATION_SUCCEEDED, new PaymentOperationSucceededEvent($order->payment, $operation, $this->request));
     if ($transactionType == PaymentOperation::TR_TYPE_IMMEDIATE_PAYMENT) {
         if ($order->payment->isPayable()) {
             $order->payment->status = PaymentModel::STATUS_PAYED;
             $order->payment->save();
             $this->pixie->dispatcher->dispatch(Events::PAYMENT_PAYED, new PaymentPayedEvent($order->payment));
         }
         if ($order->isPayable()) {
             $order->status = Order::STATUS_PROCESSING;
             $order->save();
             $this->pixie->dispatcher->dispatch(Events::ORDER_STATUS_CHANGED, new OrderStatusChangedEvent($order, $order->status));
             $this->pixie->dispatcher->dispatch(Events::ORDER_PAYED, new OrderPayedEvent($order, $order->payment));
         }
         $this->redirect('/checkout/order/' . $order->uid);
     } else {
         if ($transactionType == PaymentOperation::TR_TYPE_REFUND) {
             if ($order->payment->isRefundable()) {
                 $order->payment->status = PaymentModel::STATUS_REFUNDED;
                 $order->payment->save();
                 $this->pixie->dispatcher->dispatch(Events::PAYMENT_REFUNDED, new PaymentRefundedEvent($order->payment));
             }
             if ($order->isRefundable()) {
                 $order->status = Order::STATUS_REFUNDED;
                 $order->save();
                 $this->pixie->dispatcher->dispatch(Events::ORDER_STATUS_CHANGED, new OrderStatusChangedEvent($order, $order->status));
                 $this->pixie->dispatcher->dispatch(Events::ORDER_REFUNDED, new OrderRefundedEvent($order, $order->payment));
             }
             $this->redirect('/account/orders/' . $order->uid);
         }
     }
 }
コード例 #21
0
ファイル: GoodsController.php プロジェクト: Lazybin/huisa
 /**
  *
  * @SWG\Api(
  *   path="/goods/{id}",
  *   description="商品",
  *   @SWG\Operation(
  *     method="GET", summary="获得商品详情", notes="获得商品详情",
  *     type="Goods",
  *     @SWG\ResponseMessage(code=0, message="成功"),
  *     @SWG\Parameter(
  *         name="id",
  *         description="商品id",
  *         paramType="path",
  *         required=true,
  *         allowMultiple=false,
  *         type="integer",
  *     ),
  *     @SWG\Parameter(
  *         name="user_id",
  *         description="用户id",
  *         paramType="query",
  *         required=false,
  *         allowMultiple=false,
  *         type="integer",
  *         defaultValue=-1
  *     )
  *
  *   )
  * )
  */
 public function show(Request $request, $id)
 {
     $user_id = $request->input('user_id', -1);
     $response = new BaseResponse();
     $theme = Goods::find($id);
     $theme['has_collection'] = 0;
     if ($user_id != -1) {
         $c = Collection::where('user_id', $user_id)->where('type', 0)->where('item_id', $theme['id'])->first();
         if ($c != null) {
             $theme['has_collection'] = 1;
         }
     }
     //var_dump($theme);exit;
     $comments = UserComment::select('user_comments.*', 'user_infos.nick_name', 'user_infos.head_icon')->leftJoin('user_infos', 'user_infos.id', '=', 'user_comments.user_id')->where('user_comments.type', 0)->where('user_comments.item_id', $theme['id']);
     $rows = $comments->skip(0)->take(10)->orderBy('id', 'desc')->get()->toArray();
     foreach ($rows as &$v) {
         //$v['']
         $sum = Order::select(DB::raw('SUM(total_fee) as total_pay'))->where('user_id', $v['user_id'])->where('status', 4)->first()->toArray();
         if ($sum == null || $sum['total_pay'] == null) {
             $sum = 0;
         } else {
             $sum = $sum['total_pay'];
         }
         $level = UserLevel::where('sum_lowest', '<=', $sum)->where('sum_highest', '>', $sum)->first()->toArray();
         //var_dump($level);exit;
         $v['level'] = $level['img'];
     }
     $theme['comments'] = $rows;
     $response->Data = $theme;
     return $response->toJson();
 }
コード例 #22
0
ファイル: HomeController.php プロジェクト: Lazybin/huisa
 /**
  *
  * @SWG\Api(
  *   path="/home/{id}",
  *   description="获取首页项详情",
  *   @SWG\Operation(
  *     method="GET", summary="获得主题详情", notes="获得主题详情",
  *     type="Home",
  *     @SWG\ResponseMessage(code=0, message="成功"),
  *     @SWG\Parameter(
  *         name="id",
  *         description="id",
  *         paramType="path",
  *         required=true,
  *         allowMultiple=false,
  *         type="integer",
  *     ),@SWG\Parameter(
  *         name="device_token",
  *         description="设备号",
  *         paramType="query",
  *         required=true,
  *         allowMultiple=false,
  *         type="integer"
  *     ),@SWG\Parameter(
  *         name="user_id",
  *         description="用户id",
  *         paramType="query",
  *         required=false,
  *         allowMultiple=false,
  *         type="integer",
  *         defaultValue=-1
  *     ),
  *
  *   )
  * )
  */
 public function show(Request $request, $id)
 {
     //
     $response = new BaseResponse();
     $user_id = $request->input('user_id', -1);
     $device_token = $request->input('device_token', '');
     $home = Home::find($id);
     if ($home == null) {
         $response->Code = BaseResponse::CODE_ERROR_BUSINESS;
         $response->Message = '数据不存在';
         return $response->toJson();
     }
     if ($device_token != '') {
         $readRecords = new ReadRecords();
         $readRecords->device_token = $device_token;
         $readRecords->home_id = $id;
         $readRecords->save();
     }
     $home = $home->toArray();
     if ($home['type'] == 1) {
         $home['has_collection'] = 0;
         if ($user_id != -1) {
             $collection = Collection::where('user_id', $user_id)->where('type', 1)->where('item_id', $home['item_id'])->first();
             if ($collection != null) {
                 $home['has_collection'] = 1;
             }
         }
         $comments = UserComment::select('user_comments.*', 'user_infos.nick_name', 'user_infos.head_icon')->leftJoin('user_infos', 'user_infos.id', '=', 'user_comments.user_id')->where('user_comments.type', 1)->where('user_comments.item_id', $home['item']['id']);
         $rows = $comments->skip(0)->take(10)->orderBy('id', 'desc')->get()->toArray();
         foreach ($rows as &$v) {
             //$v['']
             $sum = Order::select(DB::raw('SUM(total_fee) as total_pay'))->where('user_id', $v['user_id'])->where('status', 4)->first()->toArray();
             if ($sum == null || $sum['total_pay'] == null) {
                 $sum = 0;
             } else {
                 $sum = $sum['total_pay'];
             }
             $level = UserLevel::where('sum_lowest', '<=', $sum)->where('sum_highest', '>', $sum)->first()->toArray();
             //var_dump($level);exit;
             $v['level'] = $level['name'];
         }
         $home['comments'] = $rows;
     }
     $response->Data = $home;
     return $response->toJson();
 }
コード例 #23
0
 public function updatepaid(Request $request)
 {
     $order = Order::findOrNew($request->get('order_id'));
     $order->is_paid = 1;
     //canceled
     $order->save();
     return $order->id;
 }
コード例 #24
0
 /**
  * @param PaymentOperation $operation
  * @param Order $order
  */
 public function fillPaymentOperationWithOrderData(PaymentOperation $operation, Order $order)
 {
     $operation->setOrder($order->uid);
     $operation->setAmount($order->amount);
     $operation->setCustomerEmail($order->customer_email);
     $operation->setDescription($order->getItemsDescription());
 }
コード例 #25
0
 public function getBackOrderId($serverOrderId, $id)
 {
     $order = Order::findOrNew($id);
     $order->server_order_id = $serverOrderId;
     $order->save();
 }
コード例 #26
0
ファイル: Order.php プロジェクト: brennantom/hackazon
 protected function getEditFields()
 {
     return ['id' => [], 'status' => ['type' => 'select', 'option_list' => ArraysHelper::arrayFillEqualPairs(\App\Model\Order::getOrderStatuses()), 'required' => true], 'customer_id' => ['label' => 'Customer', 'type' => 'select', 'option_list' => 'App\\Admin\\Controller\\User::getAvailableUsers', 'required' => true], 'customer_firstname', 'customer_lastname', 'customer_email', 'payment_method' => ['required' => true], 'shipping_method' => ['required' => true], 'comment' => ['type' => 'textarea'], 'created_at' => ['data_type' => 'date'], 'updated_at' => ['data_type' => 'date']];
 }
コード例 #27
0
ファイル: HomepagePresenter.php プロジェクト: vitush93/kryo
 function orderFormSucceeded(Form $form, $values)
 {
     $user = $this->findUser();
     $order = new Order($user);
     $order->setType($values->type);
     $order->setAmount($values->amount);
     $order->setName($values->name);
     $order->setPhone($values->phone);
     $order->setBusinessName($values->business_name);
     $order->setIc($values->ic);
     $order->setDic($values->dic);
     $order->setAddress($values->address);
     $order->setInvoiceAddress($values->invoice_address);
     $order->setShippingMethod($values->shipping_method);
     $order->setNote($values->note);
     $price_index = $values->type . '.price_per_unit';
     $order->setPricePerUnit(Settings::get($price_index));
     $this->em->persist($order);
     $this->em->flush();
     $order->createNum();
     $this->em->flush();
     $this->orderManager->invoice($order, true);
     $mail = new Message();
     $mail->setFrom(Settings::get('contact.name') . ' <' . Settings::get('contact.email') . '>')->addTo($order->getUser()->getEmail())->setSubject('Your order ' . $order->getNum())->setBody('You have placed a new order on kryo.mossbauer.cz. Please follow payment instructions in attachment.');
     $mail->addAttachment(WWW_DIR . '/../temp/' . $order->getInvoiceFileName());
     $this->mailer->send($mail);
     $this->flashMessage('Order has been successfully created!', 'success');
     $this->redirect('this');
 }
コード例 #28
0
ファイル: Orders.php プロジェクト: vitush93/kryo
 function invoice(Order $order, $toFile = false)
 {
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'windows-1250', false);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Nicola Asuni');
     $pdf->SetTitle('TCPDF Example 049');
     $pdf->SetSubject('TCPDF Tutorial');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     $pdf->SetFont('freesans', '', 12, '', 'false');
     $pdf->AddPage();
     $total_price = $order->getPricePerUnit() * $order->getAmount();
     $html = "\n<h1>Faktura F{$order->getNum()}</h1>\n<h3>Dodavatel</h3>\n<table>\n    <tr>\n        <td>" . str_replace("\n", "<br>", Settings::get('supply.address')) . "</td>\n        <td></td>\n    </tr>\n    <tr>\n        <td>IČ:</td>\n        <td>" . Settings::get('supply.ic') . "</td>\n    </tr>\n    <tr>\n        <td>DIČ:</td>\n        <td>" . Settings::get('supply.dic') . "</td>\n    </tr>\n</table>\n\n<h3>Odběratel</h3>\n<table>\n    <tr>\n        <td>{$order->getName()}</td>\n        <td></td>\n    </tr>\n    <tr>\n        <td>" . str_replace("\n", "<br>", $order->getInvoiceAddress()) . "</td>\n        <td></td>\n    </tr>\n    <tr>\n        <td>IČ:</td>\n        <td>{$order->getIc()}</td>\n    </tr>\n    <tr>\n        <td>DIČ:</td>\n        <td>{$order->getDic()}</td>\n    </tr>\n</table>\n\n<h3>Položky</h3>\n<table>\n    <tr>\n        <th><strong>Označení dodávky</strong></th>\n        <th><strong>Počet m. j.</strong></th>\n        <th><strong>Cena za m.j.</strong></th>\n        <th><strong>Celkem</strong></th>\n    </tr>\n    <tr>\n        <td>{$order->getType(true)}</td>\n        <td>{$order->getAmount()}</td>\n        <td>{$order->getPricePerUnit()},00</td>\n        <td>{$total_price},00</td>\n    </tr>\n</table>\n\n<h3>Celkem k úhradě: {$total_price},00 Kč</h3>\n        ";
     $pdf->writeHTML($html);
     $filename = $order->getInvoiceFileName();
     if ($toFile) {
         $pathToFile = WWW_DIR . '/../temp/' . $filename;
         if (file_exists($pathToFile)) {
             unlink($pathToFile);
         }
         $pdf->Output($pathToFile, 'F');
     } else {
         $pdf->Output($filename, 'I');
     }
 }