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.189.192.214
<?php
function pushStudExamFee($aobj_context)
{
include("genToken.php");
include("const.php");
$tokenArry = getToken(client_id,client_secret,username,password,grant_type);
$tokendet = json_decode($tokenArry,true);
$token = $tokendet['access_token'];
$iurl = $tokendet['instance_url'];
$username = username;
$password = password;
$hbody = 'Basic '.base64_encode((username.':'.password));
$headers = array
(
"Authorization:Bearer $token",
"Content-Type: application/json"
);
$query = "select a.appno,a.fregno,d.fexamdate,date_format(a.fapplastdate,'%d/%m/%Y') as applastdate,
a.ftotalfee
from appcandsum a inner join degree d on a.fdegree = d.fdegree and d.fexamno = 'A'
where appno = '130221210118'";
$res1 = $aobj_context->mobj_db->getRow($query);
$finalarry = [];
$subarry = [];
$subarry['StudentExamAppNo'] = $res1['appno'];
$subarry['StudentSrnNumber'] = 'R20EJ033';//$res1['fregno'];
$subarry['FeeName'] = $res1['fexamdate'];
$subarry['DueDate'] = '15/07/2022';//$res1['applastdate'];
$subarry['Amount'] = $res1['ftotalfee'];
array_push($finalarry,$subarry);
$req['studentfee'] = $finalarry;
$url = $iurl."/services/apexrest/StudentExamFeeAPI";
$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, $url);
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $req ) );
$result2 = curl_exec($ch);
//var_dump($result2);
$res = json_decode($result2,true);
if($res['status'] == 'Success')
{
$resarry = $res['result'];
$appno = $resarry[0]['studentExamAppNo'];
$upd = "update appcandsum set fstype = 'E', fepushdate = now()
where appno = '{$appno}'";
$res1 = $aobj_context->mobj_db->Execute($upd);
echo $appno." - ".$res['status'];
}
curl_close( $ch );
//130201129679 - R21MCS01
//130221211755 - R21MCS01;
//130221210183 - R21MCS02;
}
function updateStudExamFee($aobj_context)
{
$data_json = file_get_contents("php://input");
$data = json_decode($data_json,true);
if($_SERVER['PHP_AUTH_USER'] == 'sjbitapiuser' && $_SERVER['PHP_AUTH_PW'] == 'logsjbit@124')
{
}else
{
$arry='Unauthorized User';
echo $aobj_context->mobj_output->ToJSONEnvelope($arry,-1,"Failure");
return;
}
if(count($data) <=0)
{
$arry='Kindaly Pass Data';
echo $aobj_context->mobj_output->ToJSONEnvelope($arry,-1,"Failure");
return;
}
$resrayy = [];
$error = 0;
$succes = 0;
foreach($data['studentFeePayment'] as $val)
{
$appno = $val['RequestID'];
$regno = $val['USN'];
$amount = $val['Amount'];
$tranid = $val['TransactionID'];
$ackdate = $val['PaidDate'];
$paystatus = $val['Status'];
if($val['RequestID'] == '' || $val['RequestID'] == NULL)
{
$res['status'] = "F";
$res['msg'] = "Pass Application No.";
$res['RequestID'] =$appno;
$res['USN'] =$regno;
$error++;
}else if($val['USN'] == '' || $val['USN'] == NULL)
{
$res['status'] = "F";
$res['msg'] = "Pass USN No.";
$res['RequestID'] =$appno;
$res['USN'] =$regno;
$error++;
}
else
{
if( strtoupper($paystatus) == 'SUCCESS')
{
$res['status'] = "T";
$res['msg'] = "Updated Successfully";
$res['RequestID'] =$appno;
$res['USN'] =$regno;
$succes++;
}else
{
$res['status'] = "F";
$res['msg'] = "Updatetion Failure";
$res['RequestID'] =$appno;
$res['USN'] =$regno;
$error++;
}
}
array_push($resrayy,$res);
}
$msg = "success";
if($succes >'0' && $error == '0')
{
$msg = "success";
}else if($error>'0' && $succes == '0')
{
$msg = "Failure";
}else if($succes >'0' && $error>'0')
{
$msg = "Partial";
}
$arry['resdata'] = $resrayy;
echo $aobj_context->mobj_output->ToJSONEnvelope($arry,0,$msg);
return;
}
?>
|