Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.21.105.222
<?php
include ("../database.php");
include ("../consts.php");
$funivcode = $_REQUEST['funivcode'];
$appno = $_REQUEST['appno'];
$fdegree = $_REQUEST['fdegree'];
$fheadcode = $_REQUEST['fheadcode'];
$get_data = "select * from dbname";
$result1=$conn->query($get_data);
if (mysqli_num_rows($result1) > 0)
{
$dbnames = array();
while($row = mysqli_fetch_assoc($result1))
{
$dbnames[$row['FUNIVCODE']] = $row['FDBNAME'];
}
}
$fdigi = substr($appno,0,1);
$type = "";
include_once('easebuzz-lib/easebuzz_payment_gateway.php');
$apiname = "initiate_payment";
$dbname = $dbnames[$funivcode];
$servername = SERVERNAME;
$username = USERNAME;
$password = PASSWORD;
$conn = new mysqli($servername, $username, $password, $dbname);
if($funivcode =='060'){
$query = "select a.finst from adm_studfeesum s inner join adm_studfee f on f.fappno = s.fappno
inner join adm_lead a on f.fappno = a.fleadid
where s.fintno = '$appno'";
$result=$conn->query($query);
$pgcred = mysqli_fetch_assoc($result);
$fdegree = $pgcred['finst'];
}
$get_data = "";
$get_query = "select * from maspg
where funivcode = '{$funivcode}'
and fbank = 'Easebuzz' and FENTTYPE = '{$fdegree}'";
$result1=$conn->query($get_query);
$pgcred = mysqli_fetch_assoc($result1);
$MERCHANT_KEY = $pgcred['fkey'];
$SALT = $pgcred['fworkingid'];
$rurl = $pgcred['freturnurl'];
if($fheadcode == 'App'){
$fjoin = 'adm_lead st on st.fleadid';
$paymentType = "Application Fee";
}else{
$fjoin = 'adm_stud st on st.fappno';
$paymentType = "Seat Blocking Amount";
}
$get_data = "select a.fappno, a.fdegree, st.fcollcode, a.fyear, ifnull(s.FAMOUNT, 0) as ftotalfee,
st.fname, control.funivname, pdf_logo_path, IFNULL(st.FMOBILE,'') as fmobileno,
IFNULL(st.FEMAIL,'') as femail from control, adm_studfee a
inner join adm_studfeesum s on s.fappno = a.fappno
inner join $fjoin = a.fappno
where s.fintno ='{$appno}'";
$result=$conn->query($get_data);
if (mysqli_num_rows($result) > 0)
{
// output data of each row
while($row = mysqli_fetch_assoc($result))
{
// var_dump($row['fmobileno']);
$fregno = $row['fappno'];
$fdegree = $row['fdegree'];
$fcollcode = $row['fcollcode'];
$fyear = $row['fyear'];
$fexamtype = '1';
$ftotalfee = $row['ftotalfee'];
$fname = $row['fname'];
$fmobileno = $row['fmobileno'];
$femail = $row['femail'];
$funivname = $row['funivname'];
$logo = $row['pdf_logo_path'];
}
// die();
}
else {
echo "Some thing went wrong";
die();
}
//$ENV = "test"; // setup test enviroment (testpay.easebuzz.in).
$ENV = "prod"; // setup production enviroment (pay.easebuzz.in).
$easebuzzObj = new Easebuzz($MERCHANT_KEY, $SALT, $ENV);
$tranid = (int)date("Ymds").rand(10000000,99999999);
$query = "update adm_studfeesum set forderid = '{$tranid}', FPAYTYPE = 'Easebuzz'
where fintno = '{$appno}'";
$result1 =$conn->query($query);
$query = "insert into pgdet(ftype, appno, fappdate, fpaygateway, fregno, fdegree, fcollcode, famount,
forderid, fyear, fexamtype, fcreatedate)
values('{$degree}', '{$appno}', current_date(), 'Easebuzz',
'{$fregno}', '{$fdegree}', '{$fcollcode}', '{$ftotalfee}',
'{$tranid}', '{$fyear}', '{$fexamtype}', now())";
$result1 =$conn->query($query);
if($apiname === "initiate_payment"){
$_POST['txnid'] = $tranid;
$_POST['amount'] = $ftotalfee;
$_POST['firstname'] = $fname;
$_POST['email'] = $femail;
$_POST['phone'] = $fmobileno;
$_POST['productinfo'] = $appno;
$_POST['udf1'] = $fregno;
if($funivcode == '098' || $funivcode == '060')
$_POST['sub_merchant_id'] = "S138645KIIQ";
$_POST['surl'] = $rurl."?univcode=$funivcode&appno=$appno&fregno=$fregno&fheadcode=$fheadcode&femail=$femail°ree=$fdegree";
$_POST['furl'] = $rurl."?univcode=$funivcode&appno=$appno&fregno=$fregno&fheadcode=$fheadcode&femail=$femail°ree=$fdegree";
$query = "insert into pgdet(ftype, appno, fappdate, fpaygateway, fregno, fdegree, fcollcode, famount,
forderid, fyear, fexamtype, fcreatedate)
values('{$type}', '{$appno}', current_date(), 'Easebuzz', '{$fregno}', '{$fdegree}', '{$fcollcode}', '{$ftotalfee}',
'{$tranid}', '{$fyear}', '{$fexamtype}', now())";
$result1 =$conn->query($query);
$result = $easebuzzObj->initiatePaymentAPI($_POST);
easebuzzAPIResponse($result);
}
else if($apiname === "initiate_payment_iframe"){
/* Very Important Notes
*
* Post Data should be below format.
*
Array ( [txnid] => T3SAT0B5OL [amount] => 100.0 [firstname] => jitendra [email] => test@gmail.com [phone] => 1231231235 [productinfo] => Laptop [surl] => http://localhost:3000/response.php [furl] => http://localhost:3000/response.php [udf1] => aaaa [udf2] => aa [udf3] => aaaa [udf4] => aaaa [udf5] => aaaa [address1] => aaaa [address2] => aaaa [city] => aaaa [state] => aaaa [country] => aaaa [zipcode] => 123123 )
*/
$result = $easebuzzObj->initiatePaymentAPI($_POST);
easebuzzAPIResponse($result);
}
else if($apiname === "transaction"){
/* Very Important Notes
*
* Post Data should be below format.
*
Array ( [txnid] => TZIF0SS24C [amount] => 1.03 [email] => test@gmail.com [phone] => 1231231235 )
*/
$result = $easebuzzObj->transactionAPI($_POST);
easebuzzAPIResponse($result);
}
else if($apiname === "transaction_date" || $apiname === "transaction_date_api"){
/* Very Important Notes
*
* Post Data should be below format.
*
Array ( [merchant_email] => jitendra@gmail.com [transaction_date] => 06-06-2018 )
*/
$result = $easebuzzObj->transactionDateAPI($_POST);
easebuzzAPIResponse($result);
}else if($apiname === "refund"){
/* Very Important Notes
*
* Post Data should be below format.
*
Array ( [txnid] => ASD20088 [refund_amount] => 1.03 [phone] => 1231231235 [email] => test@gmail.com [amount] => 1.03 )
*/
$result = $easebuzzObj->refundAPI($_POST);
easebuzzAPIResponse($result);
}else if($apiname === "payout"){
/* Very Important Notes
*
* Post Data should be below format.
*
Array ( [merchant_email] => jitendra@gmail.com [payout_date] => 08-06-2018 )
*/
$result = $easebuzzObj->payoutAPI($_POST);
easebuzzAPIResponse($result);
}else{
echo '<h1>You called wrong API, Pleae try again</h1>';
}
// }else{
// echo '<h1>Please fill all mandatory fields.</h1>';
// }
/*
* Show All API Response except initiate Payment API
*/
function easebuzzAPIResponse($data){
print_r($data);
}
?>
|