diff --git a/app/Http/Controllers/ApiController.php b/app/Http/Controllers/ApiController.php index e10603b4..4cff9052 100644 --- a/app/Http/Controllers/ApiController.php +++ b/app/Http/Controllers/ApiController.php @@ -189,30 +189,6 @@ class ApiController extends Controller $resit->total_payment = 10; $resit->save(); - // foreach($array_payment as $index1=>$arraypay) - // { - // $previous_siri = Http::get(config('api.url') . '/api/online/transaction')->json(); - // if($previous_siri){ - // $nosiri = $previous_siri['nosiri'] + 1; - // }else{ - // $nosiri = 1; - // } - - // $reference_no = 'LPKB' . $day . $month . $year . sprintf("%08d", $nosiri); - - // $new_transaction = Http::post(config('api.url') . '/api/online/transaction',[ - // 'nokp'=> Auth::user()->icno, - // 'reference_no'=> $reference_no, - // 'nosiri'=> $nosiri, - // 'billplz_id' => $billcode['id'], - // 'norujukan' => $arraypay['norujukan'], - // 'kodcaw' => $arraypay['kodcaw'], - // 'total_payment'=> $arraypay['bayaran'], - // 'customer_name' => Auth::user()->name, - // ])->json(); - - // } - return redirect($billcode['url'] . '?auto_submit=true'); @@ -242,10 +218,17 @@ class ApiController extends Controller $resit->paid_at = $data['billplz']['paid_at']; $resit->save(); + $payment = new Payment; + $payment->user_id = $resit->user_id; + $payment->total_payment = $resit->total_payment; + $payment->resit_id = $resit->id; + $payment->status_payment_opt = 2; //bayar secara online 2 + $payment->status = 1; //fee rm10 - 1 + $payment->remark = 'Bayaran Online'; + $payment->save(); + event(new PaymentNotify('PAID',$resit->user_id)); - // $transactionOnline = Http::get(config('api.url') . '/api/transaction/online/express',[ - // 'billplz_id' => $data['billplz']['id'] - // ])->json(); + return response()->json([ 'success' => true, 'resit' => $resit @@ -289,10 +272,17 @@ class ApiController extends Controller $resit->paid_at = $data['paid_at']; $resit->save(); - // $transactionOnline = Http::get(config('api.url') . '/api/transaction/online/express',[ - // 'billplz_id' => $data['billplz']['id'] - // ])->json(); + $payment = new Payment; + $payment->user_id = $resit->user_id; + $payment->total_payment = $resit->total_payment; + $payment->resit_id = $resit->id; + $payment->status_payment_opt = 2; //bayar secara online 2 + $payment->status = 1; //fee rm10 - 1 + $payment->remark = 'Bayaran Online'; + $payment->save(); + event(new PaymentNotify('PAID',$resit->user_id)); + return response()->json([ 'success' => true, 'resit' => $resit diff --git a/app/Http/Controllers/Mobile/LelongMobileController.php b/app/Http/Controllers/Mobile/LelongMobileController.php index daf427fc..ae0c8efc 100644 --- a/app/Http/Controllers/Mobile/LelongMobileController.php +++ b/app/Http/Controllers/Mobile/LelongMobileController.php @@ -64,15 +64,17 @@ class LelongMobileController extends Controller public function bidderSelectBidItem(Request $request){ - $feepayment = Payment::where('status', '=', 1)->first(); + $feepayment = Payment::where('lelong_id', '=', $request->lelong_id)->first(); if($feepayment != null){ $user = User::where('id', '=', $request->user_id) ->first(); - $selectBid = Cart::join('lelongbid', 'carts.lelongbid_id', '=', 'lelongbid.id') - ->where('lelongbid.norujukan', $request->norujukan) + $carts = Cart::join('lelongbid', 'carts.lelongbid_id', '=', 'lelongbid.id') + join('lelong', 'lelongbid.lelong_id', '=', 'lelong.id') + ->where('lelong.sts_lelong','=',1) + ->where('carts.user_id', $user->id) ->select('lelongbid.id as lelongbid_id', 'lelongbid.t_lelong', 'lelongbid.nilaimarhun', @@ -84,16 +86,20 @@ class LelongMobileController extends Controller $currentdate = Carbon::now()->toDateTimeString(); - $lelongBidder = new LelongBidder(); - $lelongBidder->nama_bidder = $request->name; - $lelongBidder->user_id = $user->id; - $lelongBidder->notelbimbit = $user->notelbimbit; - $lelongBidder->hargabida = $selectBid[0]->hargabida; - $lelongBidder->lelongbid_id = $selectBid[0]->lelongbid_id; - $lelongBidder->nilaimarhun = $selectBid[0]->nilaimarhun; - $lelongBidder->cajlelong = $selectBid[0]->cajlelong; - $lelongBidder->masa_bidaan = $currentdate; - $lelongBidder->save(); + foreach($carts as $cart) + { + $lelongBidder = new LelongBidder(); + $lelongBidder->nama_bidder = $request->name; + $lelongBidder->user_id = $user->id; + $lelongBidder->notelbimbit = $user->notelbimbit; + $lelongBidder->hargabida = $cart->hargabida; + $lelongBidder->lelongbid_id = $cart->lelongbid_id; + $lelongBidder->nilaimarhun = $cart->nilaimarhun; + $lelongBidder->cajlelong = $cart->cajlelong; + $lelongBidder->masa_bidaan = $currentdate; + $lelongBidder->save(); + + } return response()->json("success", 201); }