<?php
	error_reporting(0);
	define('INCLUDE_CHECK',true);
	session_start();
	require ('classes/config.php');
	
	if($_SESSION['txn_ref']=="") {
		header("location: index.php?action=payment_processing");	
	}
	
	 $sql = mysql_query("SELECT * FROM tranzact_t WHERE txn_ref='$_SESSION[txn_ref]' AND status='UNPAID' LIMIT 1");			
	 		while($srows = mysql_fetch_array($sql)){
			
				$fullname = $srows['surname']. " " . $srows['othername'] ; 
				$courses = $srows['department'];
				$email = $srows['email'];
				$phone = $srows['phone'];
				$level = $srows['level'];
				$fno = $srows['fno'];
				$txn_ref = $srows['txn_ref'];
				$amount = preg_replace("/\.?0*$/",'',$srows['amount']);
				$amounts = $amount * 100;
				$faculty = $srows['faculty'];
				$session = $srows['session'];
			}
$_SESSION['amt4hash']= $amounts;				
$product_id = 6207 ;
$pay_item_id= 101;
$cur = 566;
$mackey = CEF793CBBE838AA0CBB29B74D571111B4EA6586D3BA77E7CFA0B95E278364EFC4526ED7BD255A366CDDE11F1F607F0F844B09D93B16F7CFE87563B2272007AB3;
$ash_codes= ($txn_ref . $product_id.  $pay_item_id . $amounts . "http://eportal.oscotechesaoke.edu.ng/collegepayment/index.php?action=web_service_feedback" . $mackey);
$ash_code= hash('sha512',$ash_codes);
//echo "Session Details:";	print_r($_SESSION);	
?>


       		<div class="rightp">
            	<h1>Payment Verification</h1>
                <div class="kontent">
           
                <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-12">
                                    <code>You can Copy/Print this Transaction Number for future reference</code> <br /><br />
                                    <p class="btn btn-primary">Your Transaction Reference No:</p> <span class="btn btn-warning"><?php echo $txn_ref ?></span><br /><br />
                                <div class="well" style="background:#FFF">
 
 
<table class="table table-bordered table-hover">
  <tr>
    <td align="right"><strong>Full Name:</strong></td>
    <td><?php echo $fullname ?></td>
    <td align="right"><strong>FormNo/MatricNo:</strong></td>
    <td><?php echo $fno ?></td>
  </tr>
  <tr>
    <td align="right"><strong>Faculty:</strong></td>
    <td><?php echo $faculty ?></td>
    <td align="right"><strong>Department:</strong></td>
    <td><?php echo $courses ?></td>
  </tr>
 <tr>
    <td align="right"><strong>Level:</strong></td>
    <td><?php echo $level ?></td>
     <td align="right"><strong>Phone:</strong></td>
    <td><?php echo $phone ?></td>
  </tr>  
  <tr>
  <tr>
    <td align="right"><strong>Email:</strong></td>
    <td width="814"><?php echo $email ?></td>
     <td align="right"><strong>Session:</strong></td>
    <td width="814"><?php echo $session ?></td>
  </tr>  
  <tr>
  	 <td  colspan="4"><h1>Total Amount: <?php echo number_format($amount,2) ?></h1></td> 
  </tr>
</table>
  <p><strong>NOTE</strong>: The Total Amount of <strike>N</strike><?php echo number_format($amount,2)?>  will be deducted from your account. Thanks</p>    
</div>
<form name="form1" action= "https://webpay.interswitchng.com/paydirect/pay" method="post">
<input name="product_id" type="hidden" value="<?php echo $product_id; ?>" />
<input name="cust_id" type="hidden" value="<?php echo $fno; ?>" />
<input name="cust_name" type="hidden" value="<?php echo $fullname; ?>" />
<input name="pay_item_id" type="hidden" value="<?php echo $pay_item_id; ?>" />
<input name="pay_item_name" type="hidden" value="OSCOTECH Payment" />
<input name="amount" type="hidden" value="<?php echo $amounts; ?>" />
<input name="currency" type="hidden" value="<?php echo $cur; ?>" />
<input name="site_redirect_url" type="hidden" value="http://eportal.oscotechesaoke.edu.ng/collegepayment/index.php?action=web_service_feedback"/>
<input name="site_name" type="hidden" value="http://oscotechesaoke.edu.ng"/>
<input name="txn_ref" type="hidden" value="<?php echo $_SESSION['txn_ref']; ?>" />
<input name="hash" type="hidden" value="<?php echo $ash_code; ?>" />
<input name="payment_params" type="hidden" value="college_split"/>
<input name="xml_data" type="hidden" value=
                                '<payment_item_detail>
			  <item_details detail_ref="<?php echo $_SESSION['txn_ref']; ?>" college="OSCOTECH" department="<?php echo $courses; ?>" faculty="<?php echo $faculty; ?>">
			  <item_detail item_id="1" item_name="school fees" item_amt="<?php echo $amounts; ?>" bank_id="8" acct_num="12345678910" />
			   </item_details> </payment_item_detail>'/>
<a href="index.php?action=payment_processing" class="btn btn-default" >BACK</a>
<input type="submit" name="submit" class="btn btn-danger" value="PAY NOW" /> 
<input type="button" name="print" class="btn btn-success" value="PRINT" /> 
</form>

                
                </div>
            </div>
        </div><!-- content -->    
        
