����JFIF��x�x����'
Server IP : 66.29.137.217 / Your IP : 18.188.171.53 Web Server : LiteSpeed System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : gltevjme ( 1095) PHP Version : 7.0.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/gltevjme/gle.gltechlimited.com/app/Http/Controllers/ |
Upload File : |
<?php namespace App\Http\Controllers; use App\Package; use Illuminate\Http\Request; use Illuminate\Support\Facades\Cookie; use Illuminate\Support\Facades\Session; class PayViaInstamojoController extends Controller { public function __construct() { $this->api = new \Instamojo\Instamojo( config('services.instamojo.api_key'), config('services.instamojo.auth_token'), config('services.instamojo.url') ); } public function pay(Request $request) { $plan = Package::find($request->plan_id); Cookie::queue('plan', $plan, 10); Session::put('plan', $plan); if (!isset($plan) && $plan == null) { return back()->with('deleted', 'Plan Not Found !'); } try { $response = $this->api->paymentRequestCreate(array( "purpose" => "Membership Plan for " . $plan->name, "amount" => $request->amount, "buyer_name" => $request->name, "send_email" => true, "email" => $request->email, "phone" => $request->mobile, "redirect_url" => url('/instamojo/pay-success'), )); header('Location: ' . $response['longurl']); exit(); } catch (\Exception $e) { print('Error: ' . $e->getMessage()); } } public function success(Request $request) { try { $plan = Session::get('plan'); $api = new \Instamojo\Instamojo( config('services.instamojo.api_key'), config('services.instamojo.auth_token'), config('services.instamojo.url') ); $response = $api->paymentRequestStatus(request('payment_request_id')); if (!isset($response['payments'][0]['status'])) { return back()->with('deleted', 'Payment failed !'); } else if ($response['payments'][0]['status'] != 'Credit') { return back()->with('deleted', 'Payment failed !'); } else { $payment_id = $response['payments'][0]['payment_id']; $payment_amount = $response['payments'][0]['amount']; $payment_method = 'instamojo'; $payment_status = 1; $plan_id = $plan->id; $checkout = new SubscriptionController; return $checkout->subscribe($payment_id, $payment_method, $plan_id, $payment_status, $payment_amount); } } catch (\Exception $e) { return back()->with('deleted', $e->getMessage()); } } }