⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.142
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
/
mydetails.biz
/
app
/
Http
/
Controllers
/
View File Name :
PaymentWallPaymentController.php
all(); $admin_payment_setting = Utility::getAdminPaymentSetting(); return view('plan.paymentwall',compact('data','admin_payment_setting')); } public function paymenterror(Request $request,$flag){ if($flag == 1){ return redirect()->route("plans.index")->with('error', __('Transaction has been Successfull! ')); }else{ return redirect()->route("plans.index")->with('error', __('Transaction has been failed! ')); } } public function planPayWithPaymentwall(Request $request,$plan_id) { $planID = \Illuminate\Support\Facades\Crypt::decrypt($plan_id); $plan = Plan::find($planID); $user = Auth::user(); $result = array(); if(\Auth::user()->type == 'company') { $payment_setting = Utility::getAdminPaymentSetting(); } else { $payment_setting = Utility::getCompanyPaymentSetting(); } if($plan) { try { $orderID = strtoupper(str_replace('.', '', uniqid('', true))); \Paymentwall_Config::getInstance()->set(array( 'private_key' => $payment_setting['paymentwall_private_key'] )); $parameters = $_POST; $chargeInfo = array( 'email' => $parameters['email'], 'history[registration_date]' => '1489655092', 'amount' => $plan->price, 'currency' => !empty(env('CURRENCY')) ? env('CURRENCY') : 'USD', 'token' => $parameters['brick_token'], 'fingerprint' => $parameters['brick_fingerprint'], 'description' => 'Order #123' ); $charge = new \Paymentwall_Charge(); $charge->create($chargeInfo); $responseData = json_decode($charge->getRawResponseData(),true); $response = $charge->getPublicData(); if ($charge->isSuccessful() AND empty($responseData['secure'])) { if ($charge->isCaptured()) { $price = $plan->price; if(isset($request->coupon) && !empty($request->coupon)) { $request->coupon = trim($request->coupon); $coupons = Coupon::where('code', strtoupper($request->coupon))->where('is_active', '1')->first(); if(!empty($coupons)) { $usedCoupun = $coupons->used_coupon(); $discount_value = ($price / 100) * $coupons->discount; $plan->discounted_price = $price - $discount_value; $coupons_id = $coupons->id; if($usedCoupun >= $coupons->limit) { return redirect()->back()->with('error', __('This coupon code has expired.')); } $price = $price - $discount_value; } else { return redirect()->back()->with('error', __('This coupon code is invalid or has expired.')); } } $user->plan = $plan->id; $user->save(); $assignPlan = $authuser->assignPlan($plan->id); $orderID = time(); PlanOrder::create( [ 'order_id' => $orderID, 'name' => null, 'email' => null, 'card_number' => null, 'card_exp_month' => null, 'card_exp_year' => null, 'plan_name' => $plan->name, 'plan_id' => $plan->id, 'price' => $plan->price == null ? 0 : $plan->price, 'price_currency' => !empty(env('CURRENCY')) ? env('CURRENCY') : 'USD', 'txn_id' => '', 'payment_type' => __('Paymentwall'), 'payment_status' => 'succeeded', 'receipt' => null, 'user_id' => $user->id, ] ); $assignPlan = $user->assignPlan($plan->id); if($assignPlan['is_success']) { $res['flag'] = 1; return $res; } else { $res['flag'] = 2; return $res; } } elseif($charge->isUnderReview()) { $res['flag'] = 2; return $res; } }else { $res['flag'] = 2; return $res; } } catch(\Exception $e) { $res['flag'] = 2; return $res; } } else { return redirect()->route('plan.index')->with('error', __('Plan is deleted.')); } } }