| Server IP : 192.169.170.185 / Your IP : 216.73.216.97 Web Server : Apache System : Linux p3plmcpnl495852.prod.phx3.secureserver.net 4.18.0-553.52.1.lve.el8.x86_64 #1 SMP Wed May 21 15:31:29 UTC 2025 x86_64 User : akhilnew ( 1712764) PHP Version : 5.6.40 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/akhilnew/public_html/classes/ |
Upload File : |
<?php
class gateway {
public function __construct(){
}
public function convert_currency($amount, $from, $to){
$amount = urlencode($amount);
$from = urlencode($from);
$to = urlencode($to);
$rawdata = file_get_contents("https://finance.google.com/finance/converter?a=$amount&from=$from&to=$to");
$data = explode('bld>', $rawdata);
$data = explode($to, $data[1]);
return round($data[0], 2);
}
public function gen_txnid($id){
$chars = '';
foreach(range('A', 'Z') as $char):
$chars .= $char;
endforeach;
$txnid = substr(str_shuffle($chars), 0, 2).date('ymd').str_pad($id + 1, 6, 0, STR_PAD_LEFT).'ID';
return $txnid;
}
public function secretkey($param1, $param2){
$secretkey = strtoupper(hash('sha256', mt_rand().md5($param1).time().base64_encode($param2).uniqid(true)));
return $secretkey;
}
private function getDateTime(){
return date('Y:m:d-H:i:s');
}
private function createHash($storeid, $chargetotal, $currency, $sharedsecret){
$stringtohash = $storeid.$this->getDateTime().$chargetotal.$currency.$sharedsecret;
$ascii = bin2hex($stringtohash);
return sha1($ascii);
}
private function icici($name, $email, $phone, $txnid, $currency, $amount, $surl, $furl){
$storeids = array('INR' => '3396068416', 'USD' => '3396068424');
$storeid = (array_key_exists($currency, $storeids)) ? $storeids[$currency] : '';
$currencies = array('INR' => '356', 'USD' => '840');
$currencycode = (array_key_exists($currency, $currencies)) ? $currencies[$currency] : '';
$sharedsecrets = array('INR' => '[?]@q]jnv11vM', 'USD' => 'whq5A>yk@1HR');
$sharedsecret = (array_key_exists($currency, $sharedsecrets)) ? $sharedsecrets[$currency] : '';
if(empty($storeid)):
die(output(false, 'Internal server error. Please try again.'));
endif;
if(empty($currencycode)):
die(output(false, 'No valid currency found. Please try again.'));
endif;
if(empty($sharedsecret)):
die(output(false, 'Internal server error. Please try again.'));
endif;
$html = <<<EOJ
<form action="https://www4.ipg-online.com/connect/gateway/processing" method="post" name="redirect">
<input type="hidden" name="txntype" value="sale" readonly />
<input type="hidden" name="timezone" value="Asia/Kolkata" readonly />
<input type="hidden" name="authenticateTransaction" value="true" readonly />
<input type="hidden" name="txndatetime" value="{$this->getDateTime()}" readonly />
<input type="hidden" name="hash_algorithm" value="SHA1" readonly />
<input type="hidden" name="hash" value="{$this->createHash($storeid, $amount, $currencycode, $sharedsecret)}" readonly />
<input type="hidden" name="storename" value="{$storeid}" readonly />
<input type="hidden" name="mode" value="payonly" readonly />
<input type="hidden" name="chargetotal" value="{$amount}" readonly />
<input type="hidden" name="currency" value="{$currencycode}" readonly />
<input type="hidden" name="sharedsecret" value="{$sharedsecret}" readonly />
<input type="hidden" name="mobileMode" value="true" readonly />
<input type="hidden" name="customerid" value="{$txnid}" readonly />
<input type="hidden" name="merchantTransactionId" value="{$txnid}" readonly />
<input type="hidden" name="responseSuccessURL" value="{$surl}" readonly />
<input type="hidden" name="responseFailURL" value="{$furl}" readonly />
<input type="submit" value="Click Here" style="display:none" />
</form>
EOJ;
return $html;
}
private function payumoney($name, $email, $phone, $txnid, $amount, $surl, $furl){
$posted = array('key' => 'EPAfC8', 'txnid' => $txnid, 'amount' => $amount, 'productinfo' => 'Transaction', 'firstname' => $name, 'email' => $email, 'phone' => $phone);
$salt = '2eQBk83X';
$hash = '';
$hash_sequence = 'key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10';
if(sizeof($posted) > 0):
$hash_vars_seq = explode('|', $hash_sequence);
$hash_string = '';
foreach($hash_vars_seq as $hash_var):
$hash_string .= isset($posted[$hash_var]) ? $posted[$hash_var] : '';
$hash_string .= '|';
endforeach;
$hash_string .= $salt;
$hash = strtolower(hash('sha512', $hash_string));
endif;
$html = <<<EOJ
<form action="https://secure.payu.in/_payment" method="post" name="redirect">
<input type="hidden" name="key" value="EPAfC8" readonly />
<input type="hidden" name="txnid" value="{$txnid}" readonly />
<input type="hidden" name="amount" value="{$amount}" readonly />
<input type="hidden" name="productinfo" value="Transaction" readonly />
<input type="hidden" name="firstname" value="{$name}" readonly />
<input type="hidden" name="email" value="{$email}" readonly />
<input type="hidden" name="phone" value="{$phone}" readonly />
<input type="hidden" name="surl" value="{$surl}" readonly />
<input type="hidden" name="furl" value="{$furl}" readonly />
<input type="hidden" name="hash" value="{$hash}" readonly />
<input type="hidden" name="service_provider" value="payu_paisa" readonly />
<input type="submit" value="Click Here" style="display:none" />
</form>
EOJ;
return $html;
}
private function twocheckout($txnid, $currency, $amount, $surl, $furl){
$html = <<<EOJ
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" name="redirect">
<input type="hidden" name="business" value="jpbr.delhi@gmail.com" readonly />
<input type="hidden" name="cmd" value="_xclick" readonly />
<input type="hidden" name="item_name" value="Transaction" readonly />
<input type="hidden" name="amount" value="{$amount}" readonly />
<input type="hidden" name="currency_code" value="{$currency}" readonly />
<input type="hidden" name="invoice" value="{$txnid}" readonly />
<input type="hidden" name="return" value="{$surl}" readonly />
<input type="hidden" name="notify_url" value="{$furl}" readonly />
<input type="submit" value="Click Here" style="display:none" />
</form>
EOJ;
return $html;
}
private function paypal($txnid, $currency, $amount, $surl, $furl){
$sandbox = false;
$paypal_url = ($sandbox) ? 'https://www.sandbox.paypal.com/cgi-bin/webscr' : 'https://www.paypal.com/cgi-bin/webscr';
$html = <<<EOJ
<form action="{$paypal_url}" method="post" name="redirect">
<input type="hidden" name="business" value="jpbr.delhi@gmail.com">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="Transaction">
<input type="hidden" name="item_number" value="{$txnid}">
<input type="hidden" name="amount" value="{$amount}">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="notify_url" value="https://www.akinik.com/listener">
<input type="hidden" name="cancel_return" value="{$furl}">
<input type="hidden" name="return" value="{$surl}">
<input type="submit" value="Click Here" style="display:none" />
</form>
EOJ;
return $html;
}
public function set($paymentmode, $name, $email, $phone, $txnid, $currency, $amount, $surl, $furl){/*
if($paymentmode === 'DC_CARD'):
$html = $this->icici($name, $email, $phone, $txnid, $currency, $amount, $surl, $furl);
elseif($paymentmode === 'NET_BANKING'):
$html = $this->payumoney($name, $email, $phone, $txnid, $amount, $surl, $furl);
else:
die(output(false, 'Valid payment gateway not found. Please try again.'));
endif;*/
if($currency === 'INR'):
$html = $this->payumoney($name, $email, $phone, $txnid, $amount, $surl, $furl);
elseif($currency === 'USD'):
$html = $this->paypal($txnid, $currency, $amount, $surl, $furl);
else:
die(output(false, 'Valid payment gateway not found. Please try again.'));
endif;
die(output(true, $html, 'html'));
}
}
$gt = new gateway();
?>