<?php


//includes functions and classes for remita constants
require 'remita_constants.php';

$orderId = "";
if( isset( $_GET['txnref'] )) {
$orderId = $_GET["txnref"];
}

$response_code ="";
$rrr = "";
$response_message = "";
//Verify Transaction
function remita_transaction_details($orderId){
		$mert =  MERCHANTID;
		$api_key =  APIKEY;
		$concatString = $orderId . $api_key . $mert;
		$hash = hash('sha512', $concatString);
		$url 	= CHECKSTATUSURL . '/' . $mert  . '/' . $orderId . '/' . $hash . '/' . 'orderstatus.reg';
		//  Initiate curl
		$ch = curl_init();
		// Disable SSL verification
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
		// Will return the response, if false it print the response
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		// Set the url
		curl_setopt($ch, CURLOPT_URL,$url);
		// Execute
		$result=curl_exec($ch);
		// Closing
		curl_close($ch);
		$response = json_decode($result, true);
		return $response;
	}

	if($orderId !=null){
		$response = remita_transaction_details($orderId);
		$response_code = $response['status'];
		if (isset($response['RRR']))
			{
			$rrr = $response['RRR'];
			}
		$response_message = $response['message'];
		//print_r($response);
	}




?>
	
    
<ul class="breadcrumb">
     
     <!--  <li><a href="gateway.php?act=view_admission_reports">  Admission Manager</a> <span class="divider"></span></li>
       <li><a href="gateway.php?act=view_admitted_applicants">Applicants  Reports Per Programmes Menu </a> <span class="divider"></span></li>-->
        <li class="active"> <img src="images/remitalogosmaller" /> Remita Transaction Requery  </li>
            
</ul>


<div class="well">
	

      <ul class="tabs"> 
        <li><a href="#view1">Remita Transaction Requery</a></li> 
       
       </ul> 
      <div class="tabcontents"> 
       
        
        <div id="view1">
        
        		
               
        	
        	                   
             <div style="text-align: center;">


				  <?php 
				  
				  		//getting applicant id for passing app or Matric number
				  		//$user_ID = 'dfdfd';
				  		//echo $user_ID;
				  		if($response_code == '01' || $response_code == '00')
						{

				  			include_once('activate_applicant.php');

				  		//echo $response_code ;
				  			

				  		}


				  ?>
    
                   
                   
                   
                   
                   <?php 
                   		echo remita_response_code($response_code, $rrr, $response_message, $orderId, $user_ID = 0); 

                   ?>


              </div>
              
        
        </div> 
	
 
      </div>
</div>

</form>

