⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.63
Server IP:
217.76.53.76
Server:
Linux vmi1397931.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64
Server Software:
Apache
PHP Version:
8.2.27
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
www
/
wwwroot
/
jumo.com.ng
/
app
/
Http
/
Controllers
/
View File Name :
PaymentController.php
first(); $items[] = [ 'id' => $package->id, 'title' => sanitize($package->name), 'subtitle' => sanitize($package->sub_title), 'price' => sanitize($package->price), 'period' => $package->period, 'discount_price' => 0, ]; $payment_details = [ 'items' => $items, 'custom_field' => [ 'item_type' => 'Package', 'pay_for' => 'Package payment', 'user_id' => auth()->user()->id, 'user_photo' => auth()->user()->photo, ], 'success_method' => [ 'model_name' => 'PurchasePackage', 'function_name' => 'purchase_package', ], 'tax' => '', 'coupon' => '', 'payable_amount' => round($package->price, 2), 'cancel_url' => route('pricing'), 'success_url' => route('payment.success', ''), ]; Session::put('payment_details', $payment_details); $payment_details = session('payment_details'); $page_data['payment_details'] = $payment_details; $page_data['package'] = $package; $page_data['payment_gateways'] = DB::table('payment_geteways')->where('status', 1)->get(); return view('payment.index', $page_data); } public function payment_index($id) { return view('payment.index', $page_data); } public function payment_bank_transfer($id) { $user= auth()->user(); if(!$user){ return response()->json( ['status' => false,'message' => "Something Wrong"], 400); } $price = Pricing::findOrFail($id); $payment = new UserBankTransfer(); $payment->user_id = $user->id; $payment->package_id = $id; $payment->status = 0; $payment->amount = $price->price; $payment->save(); $payment->order = md5($payment->id); $payment->save(); return response()->json([ 'status' => true, 'orderid' => $payment->order, 'created_at' => Carbon::parse($payment->created_at)->format('d/m/Y H:i:s'), ]); } public function show_payment_gateway_by_ajax($identifier) { $page_data['payment_details'] = session('payment_details'); $page_data['payment_gateway'] = DB::table('payment_geteways')->where('identifier', $identifier)->first(); return view('payment.' . $identifier . '.index', $page_data); } public function payment_success($identifier, Request $request) { $payment_details = session('payment_details'); $payment_gateway = DB::table('payment_geteways')->where('identifier', $identifier)->first(); $model_name = $payment_gateway->model_name; $model_full_path = str_replace(' ', '', 'App\Models\payment_gateway\ ' . $model_name); // $status = $model_full_path::payment_status($identifier, $request->all()); // Instantiate the payment gateway class $paystack = new $model_full_path(); // Call the payment_status method on the instantiated object if($paystack){ $status = $paystack->payment_status($identifier, $request->all()); }else{ $status = $model_full_path::payment_status($identifier, $request->all()); } if ($status === true) { $success_model = $payment_details['success_method']['model_name']; $success_function = $payment_details['success_method']['function_name']; $model_full_path = str_replace(' ', '', 'App\Models\ ' . $success_model); return $model_full_path::$success_function($identifier); } else { Session::flash('error', get_phrase('Payment failed! Please try again.')); return redirect()->to($payment_details['cancel_url']); } } public function payment_create($identifier) { $payment_details = session('payment_details'); $payment_gateway = DB::table('payment_geteways')->where('identifier', $identifier)->first(); $model_name = $payment_gateway->model_name; $model_full_path = str_replace(' ', '', 'App\Models\payment_gateway\ ' . $model_name); $created_payment_link = $model_full_path::payment_create($identifier); return redirect()->to($created_payment_link); } public function payment_razorpay($identifier) { $payment_details = session('payment_details'); $payment_gateway = DB::table('payment_geteways')->where('identifier', $identifier)->first(); $model_name = $payment_gateway->model_name; $model_full_path = str_replace(' ', '', 'App\Models\payment_gateway\ ' . $model_name); $data = $model_full_path::payment_create($identifier); return view('payment.razorpay.payment', compact('data')); } public function make_paytm_order(Request $request) { return view('payment.paytm.paytm_merchant_checkout'); } public function paytm_paymentCallback() { $transaction = PaytmWallet::with('receive'); $response = $transaction->response(); $order_id = $transaction->getOrderId(); // return a order id $transaction->getTransactionId(); // return a transaction id // update the db data as per result from api call if ($transaction->isSuccessful()) { Paytm::where('order_id', $order_id)->update(['status' => 1, 'transaction_id' => $transaction->getTransactionId()]); return redirect(route('initiate.payment'))->with('message', "Your payment is successfull."); } else if ($transaction->isFailed()) { Paytm::where('order_id', $order_id)->update(['status' => 0, 'transaction_id' => $transaction->getTransactionId()]); return redirect(route('initiate.payment'))->with('message', "Your payment is failed."); } else if ($transaction->isOpen()) { Paytm::where('order_id', $order_id)->update(['status' => 2, 'transaction_id' => $transaction->getTransactionId()]); return redirect(route('initiate.payment'))->with('message', "Your payment is processing."); } $transaction->getResponseMessage(); //Get Response Message If Available } public function webRedirectToPayFee(Request $request) { // Check if the 'auth' query parameter is present if (!$request->has('auth')) { return redirect()->route('login')->withErrors([ 'email' => 'Authentication token is missing.', ]); } // Remove the 'Basic ' prefix // $base64Credentials = $request->query('auth'); // Remove the 'Basic ' prefix $base64Credentials = substr($request->query('auth'), 6); // Decode the base64-encoded string $credentials = base64_decode($base64Credentials); // Split the decoded string into email, password, and timestamp list($email, $password, $timestamp) = explode(':', $credentials); // Get the current timestamp $timestamp1 = strtotime(date('Y-m-d')); // Calculate the difference $difference = $timestamp1 - $timestamp; if ($difference < 86400) { if (auth()->attempt(['email' => $email, 'password' => $password])) { // Authentication passed... return redirect(route('cart')); } return redirect()->route('login')->withErrors([ 'email' => 'Invalid email or password', ]); } else { return redirect()->route('login')->withErrors([ 'email' => 'Token expired!', ]); } } }