!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/classify.picotech.app/public_html/app/Http/Controllers/Payment/   drwxr-xr-x
Free 28.35 GB of 117.98 GB (24.03%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     SslCommerzPaymentController.php (10.04 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace App\Http\Controllers\Payment;

use 
App\Http\Controllers\Controller;
use 
App\Http\Traits\PaymentTrait;
use 
App\Library\SslCommerz\SslCommerzNotification;
use 
Illuminate\Http\Request;
use 
Illuminate\Support\Facades\DB;

class 
SslCommerzPaymentController extends Controller
{
    use 
PaymentTrait;

    public function 
payViaAjax(Request $request)
    {
        
$plan session('plan');
        
$converted_amount currencyConversion($plan->price);
        
$amount currencyConversion($plan->pricenull'BDT'1);

        
session(['order_payment' => [
            
'payment_provider' => 'sslcommerz',
            
'amount' => $amount,
            
'currency_symbol' => '৳',
            
'usd_amount' => $converted_amount,
        ]]);

        
$requestData = (array) json_decode($request->cart_json);

        
$post_data = [];
        
$post_data['total_amount'] = $requestData['amount']; // You cant not pay less than 10
        
$post_data['currency'] = 'BDT';
        
$post_data['tran_id'] = uniqid();
        
$post_data['plan_id'] = $plan->id;

        
// CUSTOMER INFORMATION
        
$post_data['cus_name'] = 'Customer Name';
        
$post_data['cus_email'] = 'customer@mail.com';
        
$post_data['cus_add1'] = 'Customer Address';
        
$post_data['cus_add2'] = '';
        
$post_data['cus_city'] = '';
        
$post_data['cus_state'] = '';
        
$post_data['cus_postcode'] = '';
        
$post_data['cus_country'] = 'Bangladesh';
        
$post_data['cus_phone'] = '8801XXXXXXXXX';
        
$post_data['cus_fax'] = '';

        
// SHIPMENT INFORMATION
        
$post_data['ship_name'] = 'Store Test';
        
$post_data['ship_add1'] = 'Dhaka';
        
$post_data['ship_add2'] = 'Dhaka';
        
$post_data['ship_city'] = 'Dhaka';
        
$post_data['ship_state'] = 'Dhaka';
        
$post_data['ship_postcode'] = '1000';
        
$post_data['ship_phone'] = '';
        
$post_data['ship_country'] = 'Bangladesh';

        
$post_data['shipping_method'] = 'NO';
        
$post_data['product_name'] = 'Computer';
        
$post_data['product_category'] = 'Goods';
        
$post_data['product_profile'] = 'physical-goods';

        
// OPTIONAL PARAMETERS
        
$post_data['value_a'] = 'ref001';
        
$post_data['value_b'] = 'ref002';
        
$post_data['value_c'] = 'ref003';
        
$post_data['value_d'] = 'ref004';

        
//Before  going to initiate the payment order status need to update as Pending.
        
$update_product DB::table('orders')
            ->
where('transaction_id'$post_data['tran_id'])
            ->
updateOrInsert([
                
'name' => $post_data['cus_name'],
                
'email' => $post_data['cus_email'],
                
'phone' => $post_data['cus_phone'],
                
'amount' => $post_data['total_amount'],
                
'status' => 'Pending',
                
'address' => $post_data['cus_add1'],
                
'transaction_id' => $post_data['tran_id'],
                
'plan_id' => $post_data['plan_id'],
                
'currency' => $post_data['currency'],
            ]);

        
$sslc = new SslCommerzNotification;
        
// initiate(Transaction Data , false: Redirect to SSLCOMMERZ gateway/ true: Show all the Payement gateway here )
        
$payment_options $sslc->makePayment($post_data'checkout''json');

        if (! 
is_array($payment_options)) {
            
print_r($payment_options);
            
$payment_options = [];
        }
    }

    public function 
success(Request $request)
    {
        
$tran_id $request->input('tran_id');
        
$amount $request->input('amount');
        
$currency $request->input('currency');

        
$sslc = new SslCommerzNotification;

        
$order_detials DB::table('orders')
            ->
where('transaction_id'$tran_id)
            ->
select('transaction_id''status''currency''amount''plan_id')->first();

        if (
$order_detials->status == 'Pending') {
            
$validation $sslc->orderValidate($request->all(), $tran_id$amount$currency);

            if (
$validation == true) {
                
$update_product DB::table('orders')
                    ->
where('transaction_id'$tran_id)
                    ->
update(['status' => 'Processing']);

                
// After Payment Successfully
                
session(['transaction_id' => $tran_id ?? null]);

                
$this->orderPlacing();
                echo 
'<br >Transaction is successfully Completed';
            } else {
                
$update_product DB::table('orders')
                    ->
where('transaction_id'$tran_id)
                    ->
update(['status' => 'Failed']);

                
session()->flash('error''Payment Failed');

                return 
back();
                echo 
'validation Fail';
            }
        } elseif (
$order_detials->status == 'Processing' || $order_detials->status == 'Complete') {
            
session()->flash('success''Payment Successfully');

            return 
redirect()->route('frontend.plans-billing');

            echo 
'Transaction is successfully Completed';
        } else {
            
session()->flash('error''Invalid Transaction');

            return 
back();
            
//That means something wrong happened. You can redirect customer to your product page.
            
echo 'Invalid Transaction';
        }
    }

    public function 
fail(Request $request)
    {
        
$tran_id $request->input('tran_id');

        
$order_detials DB::table('orders')
            ->
where('transaction_id'$tran_id)
            ->
select('transaction_id''status''currency''amount')->first();

        if (
$order_detials->status == 'Pending') {
            
$update_product DB::table('orders')
                ->
where('transaction_id'$tran_id)
                ->
update(['status' => 'Failed']);

            
session()->flash('error''Payment Failed');

            return 
back();
            echo 
'Transaction is Falied';
        } elseif (
$order_detials->status == 'Processing' || $order_detials->status == 'Complete') {
            
session()->flash('success''Transaction is already Successful');

            return 
back();

            echo 
'Transaction is already Successful';
        } else {
            
session()->flash('error''Transaction is Invalid');

            return 
back();

            echo 
'Transaction is Invalid';
        }
    }

    public function 
cancel(Request $request)
    {
        
$tran_id $request->input('tran_id');

        
$order_detials DB::table('orders')
            ->
where('transaction_id'$tran_id)
            ->
select('transaction_id''status''currency''amount')->first();

        if (
$order_detials->status == 'Pending') {
            
$update_product DB::table('orders')
                ->
where('transaction_id'$tran_id)
                ->
update(['status' => 'Canceled']);

            
session()->flash('success''Payment is Cancelled');

            return 
back();
            echo 
'Transaction is Cancel';
        } elseif (
$order_detials->status == 'Processing' || $order_detials->status == 'Complete') {
            
session()->flash('error''Transaction is Invalid');

            return 
back();

            echo 
'Transaction is already Successful';
        } else {
            
session()->flash('error''Transaction is Invalid');

            return 
back();
            echo 
'Transaction is Invalid';
        }
    }

    public function 
ipn(Request $request)
    {
        
//Received all the payement information from the gateway
        
if ($request->input('tran_id')) { //Check transation id is posted or not.

            
$tran_id $request->input('tran_id');

            
//Check order status in order tabel against the transaction id or order id.
            
$order_details DB::table('orders')
                ->
where('transaction_id'$tran_id)
                ->
select('transaction_id''status''currency''amount')->first();

            if (
$order_details->status == 'Pending') {
                
$sslc = new SslCommerzNotification;
                
$validation $sslc->orderValidate($request->all(), $tran_id$order_details->amount$order_details->currency);
                if (
$validation == true) {
                    
/*
                    That means IPN worked. Here you need to update order status
                    in order table as Processing or Complete.
                    Here you can also sent sms or email for successful transaction to customer
                    */
                    
$update_product DB::table('orders')
                        ->
where('transaction_id'$tran_id)
                        ->
update(['status' => 'Processing']);

                    
session()->flash('success''Payment Successfully');

                    return 
redirect()->route('frontend.plans-billing');
                    echo 
'Transaction is successfully Completed';
                } else {
                    
/*
                    That means IPN worked, but Transation validation failed.
                    Here you need to update order status as Failed in order table.
                    */
                    
$update_product DB::table('orders')
                        ->
where('transaction_id'$tran_id)
                        ->
update(['status' => 'Failed']);

                    
session()->flash('error''Payment Failed');

                    return 
back();
                    echo 
'validation Fail';
                }
            } elseif (
$order_details->status == 'Processing' || $order_details->status == 'Complete') {

                
//That means Order status already updated. No need to udate database.

                
session()->flash('success''Payment is already successfully Completed');

                return 
redirect()->route('frontend.plans-billing');
                echo 
'Transaction is already successfully Completed';
            } else {
                
//That means something wrong happened. You can redirect customer to your product page.

                
session()->flash('error''Payment Failed');

                return 
back();
                echo 
'Invalid Transaction';
            }
        } else {
            
session()->flash('error''Payment Failed');

            return 
back();
            echo 
'Invalid Data';
        }
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0036 ]--