���Root Mod By V1rus_Alfa
User / IP
:
216.73.217.78
Host / Server
:
195.214.235.115 / npln.ir
System
:
Linux damavand.pws-dns.net 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
Command
|
Upload
|
Mass Deface
|
Create
:
/
home2
/
cutunixc
/
repositories
/
cutunix
/
app
/
Http
/
Controllers
/
General
/
Viewing: PaymentController.php
<?php namespace App\Http\Controllers\General; use App\Http\Controllers\Controller; use Illuminate\Http\Request; use Carbon\Carbon; use App\Models\User; use Illuminate\Support\Facades\Auth; use GuzzleHttp\Exception\RequestException; use Zarinpal\Zarinpal; use App\Models\PaymentLog; use App\Models\Config; use function App\Helpers\error_response; use function App\Helpers\call_back_payment; use function App\Helpers\pathReturn; use App\Helpers\HelperClass\GeneralUse; use Illuminate\Filesystem\Filesystem; use function App\Helpers\DateNow; use PDF; class PaymentController extends Controller { public function export_pdf($filesystem) { //pdf $data=[ ]; $path_all=pathReturn($filesystem,'factors'); $path_pdf=$path_all[0]; $address_pdf=$path_all[1]; PDF::loadView('cutshape', $data, [], [ 'format' => 'A5-L' ] )->save($path_pdf); return $address_pdf; } public function cut(Filesystem $filesystem) { // return $this->export_pdf($filesystem); return view('cutshape'); } public function zarinpal(Request $request,Zarinpal $zarinpal) { //validate $this->validate($request,[ 'user_id' => 'required', 'mobile' => 'required', ]); $user=User::where('id',$request->user_id)->where('mobile',$request->mobile)->first(); if($user){ $config=Config::where('key','payment_price')->first(); if($config){ $amount = (int)$config->value; // "http://shop.myworktest.ir/payment/res_zarinpal?id=".$user->id.'&mobile='.$user->mobile.'&type_device='.$type_device.'&address_id='.$request->address_id $payment = [ 'callback_url' => route('res_zarinpal', ['id'=>$user->id, 'mobile'=>$user->mobile]), // Required 'amount' => $amount, // Required 'description' => 'خرید محصول', // Required 'metadata' => [ 'mobile' => $user->mobile, // Optional ] ]; try { $response = $zarinpal->request($payment); $code = $response['data']['code']; $message = $zarinpal->getCodeMessage($code); if($code === 100) { $authority = $response['data']['authority']; return $zarinpal->redirect($authority); } return "Error, Code: ${code}, Message: ${message}"; } catch (RequestException $exception) { } }else{ return error_response('پکیج انتخاب شده وجود ندارد'); } }else{ return error_response('کاربر وجود ندارد'); } } public function res_zarinpal(Request $request, Zarinpal $zarinpal) { if($request->id && $request->mobile ){ $result=call_back_payment($request,$zarinpal); if($result == 'error'){ session()->flash('error_payment', 'خطا :: لطفا در صورت کسر شدن وجه از حسابتان به پشتیبان سایت گزارش دهید'); return redirect()->to('/payment_mobile'); }else{ session()->flash('success_payment', 'عملیات با موفقیت انجام گردید'); return redirect()->to('/payment_mobile'); } } } public function analyze_zarinpal(Request $request,Zarinpal $zarinpal) { //validate $this->validate($request,[ 'user_id' => 'required', 'mobile' => 'required', ]); $user=User::where('id',$request->user_id)->where('mobile',$request->mobile)->first(); if($user){ $payment_price='10000'; $config=Config::where('type','analyze')->where('key','payment_price_analyze')->first(); if($config){ $payment_price=$config->value; } $amount = (int)$payment_price; $payment = [ 'callback_url' => route('res_analyze_zarinpal', ['id'=>$user->id, 'mobile'=>$user->mobile]), // Required 'amount' => $amount, // Required 'description' => 'خرید محصول', // Required 'metadata' => [ 'mobile' => $user->mobile, // Optional ] ]; try { $response = $zarinpal->request($payment); $code = $response['data']['code']; $message = $zarinpal->getCodeMessage($code); if($code === 100) { $authority = $response['data']['authority']; return $zarinpal->redirect($authority); } return "Error, Code: ${code}, Message: ${message}"; } catch (RequestException $exception) { } }else{ return error_response('کاربر وجود ندارد'); } } public function res_analyze_zarinpal(Request $request, Zarinpal $zarinpal) { $result = 'true'; if($request->id && $request->mobile ){ $user=User::where('id',$request->id)->where('mobile',$request->mobile)->first(); if($user){ $payment_price='10000'; $config=Config::where('type','analyze')->where('key','payment_price_analyze')->first(); if($config){ $payment_price=$config->value; } $payment = [ 'authority' => $request->input('Authority'), // $_GET['Authority'] 'amount' => (int)$payment_price ]; if ($request->input('Status') != 'OK'){ PaymentLog::create([ 'authority'=>$request->input('Authority'), 'amount'=>$payment_price, 'status'=>$request->input('Status'), 'message'=>"Error", 'user_id'=>$user->id, ]); $result = 'error'; }else{ $response = $zarinpal->verify($payment); $code = $response['data']['code']; $message = $zarinpal->getCodeMessage($code); if($code === 100) { $month=12; $config_month=Config::where('type','analyze')->where('key','exp_analyze')->first(); if($config_month){ $month=$config_month->value; } $exp=DateNow('when',null,'month',1); User::where('id',$user->id)->update([ 'analyze_expire_date'=>$exp, ]); PaymentLog::create([ 'amount'=>$payment_price, 'authority'=>$request->input('Authority'), 'RefID'=>$response['data']['ref_id'], 'status'=>$request->input('Status'), 'message'=>"Payment was successful, RefID: ".$response['data']['ref_id'].", Message:".$message , 'user_id'=>$user->id, ]); if($user && $user->device_token){ $title_push='پرداخت انجام گردید'; $body='پرداخت با موفقیت انجام گردید'; GeneralUse::send_push_massage([$user->device_token],$title_push,$body); } }else{ PaymentLog::create([ 'authority'=>$request->input('Authority'), 'amount'=>$payment_price, 'status'=>$request->input('Status'), 'message'=>"Error", 'user_id'=>$user->id, ]); $result = 'error'; } } }else{ PaymentLog::create([ 'authority'=>$request->input('Authority'), 'amount'=>$payment_price, 'status'=>$request->input('Status'), 'message'=>"Error", 'user_id'=>$user->id, ]); $result = 'error'; } if($result == 'error'){ session()->flash('error_payment', 'خطا :: لطفا در صورت کسر شدن وجه از حسابتان به پشتیبان سایت گزارش دهید'); return redirect()->to('/payment_mobile?type=analyze'); }else{ session()->flash('success_payment', 'عملیات با موفقیت انجام گردید'); return redirect()->to('/payment_mobile?type=analyze'); } } } }
Coded With 💗 by
0x6ick Mod By V1rus_Alfa