public function Queryorder($transaction_id) { $input = new WxPayOrderQuery(); $input->SetTransaction_id($transaction_id); $result = WxPayApi::orderQuery($input); \Log::info("query:" . json_encode($result)); if (array_key_exists("return_code", $result) && array_key_exists("result_code", $result) && $result["return_code"] == "SUCCESS" && $result["result_code"] == "SUCCESS") { // 处理订单 $pay = \App\Pay::find($result['out_trade_no']); $pay->pay($result['transaction_id']); if ($pay->state < 2) { $pay->state = '2'; $pay->bak_id = '0'; $pay->other_id = $result['transaction_id']; $pay->save(); } else { if ($pay->state == 2) { $pay->bak_id++; $pay->save(); } } return true; } return false; }
public function index(Request $request) { //get info for this payment $payTypeInfo = Pay::find(Pay::PAY_TYPE_MOBIO); //calc promo period $promoUntilDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') + $payTypeInfo->pay_promo_period, date('Y'))); //get incoming params $message = isset($request->message) ? $request->message : null; $item = isset($request->item) ? $request->item : null; $fromnum = isset($request->fromnum) ? $request->fromnum : null; $extid = isset($request->extid) ? $request->extid : null; $servID = isset($request->servID) ? $request->servID : null; //check if ping is comming from allowed ips $mobio_remote_address = explode(',', $payTypeInfo->pay_allowed_ip); if (in_array($request->ip(), $mobio_remote_address)) { $sms_reply = trans('payment_mobio.There is error, please contact us.'); $item = trim($item); if (!empty($item)) { try { $pay_type = mb_strtolower(mb_substr($item, 0, 1)); //make ad vip if ($pay_type == 'a') { $ad_id = mb_substr($item, 1); $adInfo = Ad::find($ad_id); if (!empty($adInfo)) { //update ad $adInfo->ad_promo = 1; $adInfo->ad_promo_until = $promoUntilDate; $adInfo->save(); //add money to wallet $wallet_data = ['user_id' => $adInfo->user_id, 'ad_id' => $ad_id, 'sum' => $payTypeInfo->pay_sum, 'wallet_date' => date('Y-m-d H:i:s'), 'wallet_description' => trans('payment_mobio.Payment via Mobio SMS')]; Wallet::create($wallet_data); //subtract money from wallet $wallet_data = ['user_id' => $adInfo->user_id, 'ad_id' => $ad_id, 'sum' => -$payTypeInfo->pay_sum, 'wallet_date' => date('Y-m-d H:i:s'), 'wallet_description' => trans('payment_fortumo.Your ad #:ad_id is Promo Until :date.', ['ad_id' => $ad_id, 'date' => $promoUntilDate])]; Wallet::create($wallet_data); $sms_reply = trans('payment_mobio.Your ad #:ad_id is Promo Until :date.', ['ad_id' => $ad_id, 'date' => $promoUntilDate]); Cache::flush(); } } //add money to wallet if ($pay_type == 'w') { $user_id = mb_substr($item, 1); $userInfo = User::find($user_id); if (!empty($userInfo)) { //save money to wallet $wallet_data = ['user_id' => $userInfo->user_id, 'sum' => $payTypeInfo->pay_sum, 'wallet_date' => date('Y-m-d H:i:s'), 'wallet_description' => trans('payment_mobio.Add Money to Wallet via Mobio SMS')]; Wallet::create($wallet_data); $sms_reply = trans('payment_mobio.You have added :money to your wallet.', ['money' => number_format($payTypeInfo->pay_sum, 2) . config('dc.site_price_sign')]); Cache::flush(); } } } catch (\Exception $e) { } } file_get_contents("http://mobio.bg/paynotify/pnsendsms.php?servID={$servID}&tonum={$fromnum}&extid={$extid}&message=" . urlencode($sms_reply)); } }
public function index(Request $request) { $sms_reply = trans('payment_fortumo.There is error, please contact us.'); //get info for this payment $payTypeInfo = Pay::find(Pay::PAY_TYPE_FORTUMO); //calc promo period $promoUntilDate = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') + $payTypeInfo->pay_promo_period, date('Y'))); //get incoming params $message = isset($request->message) ? $request->message : null; $status = isset($request->status) ? $request->status : null; $billing_type = isset($request->billing_type) ? $request->billing_type : null; //check if ping is comming from allowed ips $fortumo_remote_address = explode(',', $payTypeInfo->pay_allowed_ip); if (in_array($request->ip(), $fortumo_remote_address) && $this->check_signature($request->all(), $payTypeInfo->pay_secret)) { $message = trim($message); if (!empty($message) && (preg_match("/OK/i", $status) || preg_match("/MO/i", $billing_type) && preg_match("/pending/i", $status))) { try { $pay_type = mb_strtolower(mb_substr($message, 0, 1)); //make ad vip if ($pay_type == 'a') { $ad_id = mb_substr($message, 1); $adInfo = Ad::find($ad_id); if (!empty($adInfo)) { //update ad $adInfo->ad_promo = 1; $adInfo->ad_promo_until = $promoUntilDate; $adInfo->save(); //add money to wallet $wallet_data = ['user_id' => $adInfo->user_id, 'ad_id' => $ad_id, 'sum' => $payTypeInfo->pay_sum, 'wallet_date' => date('Y-m-d H:i:s'), 'wallet_description' => trans('payment_fortumo.Payment via Fortumo SMS')]; Wallet::create($wallet_data); //subtract money from wallet $wallet_data = ['user_id' => $adInfo->user_id, 'ad_id' => $ad_id, 'sum' => -$payTypeInfo->pay_sum, 'wallet_date' => date('Y-m-d H:i:s'), 'wallet_description' => trans('payment_fortumo.Your ad #:ad_id is Promo Until :date.', ['ad_id' => $ad_id, 'date' => $promoUntilDate])]; Wallet::create($wallet_data); $sms_reply = trans('payment_fortumo.Your ad #:ad_id is Promo Until :date.', ['ad_id' => $ad_id, 'date' => $promoUntilDate]); Cache::flush(); } } //add money to wallet if ($pay_type == 'w') { $user_id = mb_substr($message, 1); $userInfo = User::find($user_id); if (!empty($userInfo)) { //save money to wallet $wallet_data = ['user_id' => $userInfo->user_id, 'sum' => $payTypeInfo->pay_sum, 'wallet_date' => date('Y-m-d H:i:s'), 'wallet_description' => trans('payment_fortumo.Add Money to Wallet via Fortumo SMS')]; Wallet::create($wallet_data); $sms_reply = trans('payment_fortumo.You have added :money to your wallet.', ['money' => number_format($payTypeInfo->pay_sum, 2) . config('dc.site_price_sign')]); Cache::flush(); } } } catch (\Exception $e) { } } } echo $sms_reply; }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $pay = Pay::find($id); $pay->delete($id); return redirect()->route('pay.index'); }
/** * Store a newly created resource in storage. * Check, before buy * @return Response */ public function postCheckcart(Request $request) { if (\Auth::check()) { //MENU $mainMenu = Category::getParentMenu(); $allMenu = Category::getAllMenu($mainMenu); //HOT PRODUCTS. $hotProduct = Product::hotProduct(); //DISCOUNT PRODUCTS. $discountProduct = Product::discountProduct(); //PAY $pay = Pay::find($request->get('pay')); if ($request->get('pay') == 2) { $account_number = true; } else { $account_number = false; } //SHIP $ship = Ship::find($request->get('ship')); if (\Session::has('giohang')) { \Session::put('pay', $pay->id); \Session::put('ship', $ship->id); return view('fornindex.shopping_cart_detail', compact('account_number', 'ship', 'pay', 'data', 'allMenu', 'hotProduct', 'discountProduct')); } else { echo 'vui long chon san pham!!!'; } } else { return redirect('auth/login'); } }