<?php
//Start Session
include_once($_SERVER['DOCUMENT_ROOT'] . '/student_portal/acceptance_pay/includes/startSecureSession.php');
sec_session_start();

//INCLUDES;
include_once($_SERVER['DOCUMENT_ROOT'] . '/student_portal/acceptance_pay/includes/paymentParameters.php');
include_once($_SERVER['DOCUMENT_ROOT'] . '/student_portal/acceptance_pay/includes/print_R2.php');
include_once($_SERVER['DOCUMENT_ROOT'] . '/student_portal/acceptance_pay/includes/getTransactionRef.php');
include_once($_SERVER['DOCUMENT_ROOT'] . '/student_portal/acceptance_pay/includes/functions.php');
//echo $cust_id;
//echo $cust_name;
//$studentName = $_POST["FirstName"]." ".$_POST["LastName"];
//echo $Firstname;

echo "DEAR STUDENT YOU'RE GOING TO BE DEBITED THE BELOW AMOUNT:-";
echo "<br/>";
echo '<b>N ' . ($_POST['amount'] + 500) . '</b>';
echo "<br/>";
echo 'CLICK BACK TO CANCEL TRANSACTION';
echo "<br/>";echo "<br/>";echo "<br/>";

echo "OTHER TRANSACTION INFORMATION";echo "<br/>";
echo '---------------------------------------------------------';echo "<br/>";echo "<br/>";
echo "POST DATA";
print_R2($_POST);
echo "<br/>";


$txn_ref=$_SESSION['txn_ref'];
$_SESSION["txn_ref"] = $txn_ref;

$_SESSION["macKey"] = $macKey;

$_SESSION["currency"] = $currency;

$amount = $_POST["amount"] * 100;
$main_amount = $amount + 50000;
//$amount = getAmount("amount"); /* Use this method to pass the transaction fee to the customer */
$_SESSION["amount"] = $main_amount;

$xml_data = generateSplitXMLData($txn_ref, $amount);

//$cust_id = getOrderIdValue();
$_SESSION["cust_id"] = $cust_id;

$securityHash  = getHashValue( $txn_ref . $product_id . $pay_item_id . $main_amount . $site_redirect_url . $macKey);   

echo "other data";
print_R2($_SESSION);
echo "<br/>";

?>
<html>
    <head>
        <meta charset="UTF-8">
        <title>COLLEGEPAY DEMO APP</title>
    </head>
    <body>
        
        <form method="post" action="prePaymentPage.php">           
           <!-- REQUIRED HIDDEN FIELDS -->
           <input name="product_id" type="hidden" value="<?php echo $product_id; ?>" />
           <input name="pay_item_id" type="hidden" value="<?php echo $pay_item_id; ?>" />
           <input name="amount" type="hidden" value="<?php echo $main_amount; ?>" />
           <input name="currency" type="hidden" value="<?php echo $currency; ?>" />
           <input name="site_redirect_url" type="hidden" value="<?php echo $site_redirect_url; ?>" />
           <input name="txn_ref" type="hidden" value="<?php echo $txn_ref; ?>" />
           <input name="cust_id" type="hidden" value="<?php echo $_SESSION['cust_id']; ?>" />

           <input name="payment_params" type="hidden" value="college_split" /> 
            <input name="xml_data" type="hidden" value='<?php echo $xml_data; ?>' />
           
                <input name="site_name" type="hidden" value="My WEbsite Name"/>
           <input name="cust_name" type="hidden" value="<?php echo $_SESSION['cust_name']; ?>" />
           <input name="hash" type="hidden" value="<?php echo $securityHash;  ?>" />
           </br></br>
           <a href="CollegePayX/index.php">Back</a>
           <input type="submit" value="CONTINUE WITH PAYMENT"></input>
       </form> 	

        <a href="testpayment/">HOME</a>
        <a href="/testpayment/requery.php">Requery</a>
    </body>
    <br/><br/>
    <img src="images/isw_logo_new_combined.png" title="INTERSWITCH_LOGO" alt="INTERSWITCH LOGO" />
</html>
