<?php 
ob_start();session_start();
require_once('../includes/initialize.php');

date_default_timezone_set('Africa/Lagos');
// if ($session->is_logged_in()) {
//     //redirect_to("dashboard.php");
// }


//If link is clicked from the mail, kindly activate the link and proceed with payment or scratch card page//


$error=array(
1=>'RRR could not be generated',
2=>'Admission type not selected !',
3=>'Your password confirmation do not match.',
4=>'Activation link could not be sent, check your internet connection.'

);

if (isset($_SESSION['paymentID'])){
 
 
   $stid= $_SESSION['paymentID'];
    
    $amount= $_GET['amount'];
    $message= $_GET['message']; 
    $paymentDate= $_GET['paymentDate']; 
    $transactiontime= $_GET['transactiontime']; 
    $status= $_GET['status']; 
    
 
   
 //echo   $message= substr($message, 1, -1);
 //echo   $paymentDate= substr($paymentDate, 1, -1);
 //echo   $transactiontime= substr($transactiontime, 1, -1);
 //echo   $status= substr($status, 1, -1);
    
    
    
    $paydetails= Biodata::updatebankpayment($stid,$amount,$message,$paymentDate,$transactiontime,$status );
    
    if ($paydetails)
    {
       redirect_to('https://odfel.oscotechesaoke.edu.ng/student_portal/dashboard.php?type=transhistory');
    }else{
        echo 'Not save';
    }
    
    
    
    
    
    
     
    // $paydetails= Biodata::updatepayment($stid,$amount,$paymentReference,$transactionId, $current_date);
    
    // if ($paydetails)
    // {
    //   // echo 'Reference: '.$_GET['reference'];
    //     //echo 'Trans ID: '. $_GET['transid'];
    //     //echo 'save';
    //     redirect_to('https://odfel.oscotechesaoke.edu.ng/student_portal/dashboard.php?type=transhistory');
    // }else{
    //     echo 'Not save';
    // }
    
    
    
    
    
    
   // $data='';
   // echo $paydetails->payerName;
    // if (isset($paydetails->payerName) and isset($paydetails->payerEmail) and isset($paydetails->payerPhone))
    // {
    //      $data=array(
    //     'name'=>$paydetails->payerName,
    //     'email'=>$paydetails->payerEmail,
    //     'phone'=>$paydetails->payerPhone,
    //     'stid'=>$paydetails->acc_id
    //     );
    // }
   
    // if (sizeof($data)>0){
     
    //   echo json_encode($data);   
    // }
  
    
    // $rawrrr=$paydetails->merchantId.$paydetails->serviceTypeId.$paydetails->amount.$paydetails->orderId.$paydetails->apiKey;
    //echo $rrr = hash('sha512',$rawrrr);
}else{
    echo 'Not set'; 
}
?>