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 : 18.224.45.82
<?php
include ("../database.php");
include ("../consts.php");
$funivcode = $_REQUEST['funivcode'];
$appno = $_REQUEST['appno'];
$fdegree = $_REQUEST['fdegree'];
$fheadcode = $_REQUEST['fheadcode'];
$fadmid = $_REQUEST['fadmid'];
$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'){
if($fheadcode == 'App'){
$cond = "f.fleadid = s.fleadid";
$cond0 = "f.fleadid = a.fleadid";
$cond1 = "a.fleadid";
}else{
$cond = "f.fappno = s.fappno";
$cond0 = "f.fappno = a.fappno";
$cond1 = "a.fappno";
}
$query = "select a.finst from adm_studfeesum s
inner join adm_studfee f on $cond
inner join adm_lead a on $cond0
where s.fintno = '{$fadmid}' and $cond1 = '{$appno}'";
// $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_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 = a.fleadid';
$paymentType = "Application Fee";
$fjoined = "s.fleadid = a.fleadid";
$ftype = "a.fleadid";
}else{
$fjoin = 'adm_stud st on st.fappno = a.fappno';
$paymentType = "Seat Blocking Amount";
$fjoined = "s.fappno = a.fappno";
$ftype = "a.fappno";
}
$get_data = "select {$ftype} as fappno, a.fdegree, st.finst, a.fyear, ifnull(s.FAMOUNT, 0) as ftotalfee,
st.fname, control.funivname, pdf_logo_path, IFNULL(st.FMOBILE,'') as fmobileno,
ifnull(fadmyear,'')as fadmyear,
IFNULL(st.FEMAIL,'') as femail from control, adm_studfee a
inner join adm_studfeesum s on $fjoined
inner join $fjoin
where s.fintno ='{$fadmid}'";
$result=$conn->query($get_data);
if (mysqli_num_rows($result) > 0)
{
// output data of each row
while($row = mysqli_fetch_assoc($result))
{
$fregno = $row['fappno'];
$fdegree = $row['fdegree'];
$fcollcode = $row['finst'];
$fyear = $row['fadmyear'];
$fexamtype = '1';
$ftotalfee = $row['ftotalfee'];
$fname = $row['fname'];
$fmobileno = $row['fmobileno'];
$femail = $row['femail'];
$funivname = $row['funivname'];
$logo = $row['pdf_logo_path'];
}
}
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 = '{$fadmid}'";
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;
$_POST['easepayid'] = $feasepayid;
$_POST['status'] = $fstatus;
if($funivcode == '098' || $funivcode == '060')
$_POST['sub_merchant_id'] = "S138645KIIQ";
$_POST['surl'] = $rurl."?univcode=$funivcode&appno=$fadmid&fregno=$fregno&fheadcode=$fheadcode&femail=$femail°ree=$fdegree&fadmyear=$fyear";
$_POST['furl'] = $rurl."?univcode=$funivcode&appno=$fadmid&fregno=$fregno&fheadcode=$fheadcode&femail=$femail°ree=$fdegree&fadmyear=$fyear";
$query = "insert into pgdet(ftype, appno, fappdate, fpaygateway, fregno, fdegree, fcollcode, famount,
forderid, feasepayid,fyear, fexamtype, fcreatedate,fstatus)
values('{$fheadcode}', '{$appno}', current_date(), 'Easebuzz', '{$fregno}', '{$fdegree}', '{$fcollcode}', '{$ftotalfee}',
'{$tranid}', '{$feasepayid}' ,'{$fyear}', '{$fexamtype}', now(), '{fstatus}')";
$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);
}
?>
|