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

//error_reporting(0);
//define('INCLUDE_CHECK', true);
//session_start();

date_default_timezone_set('Africa/Lagos');

if (!isset($_SESSION['stdid'])) {
    redirect_to("index.php");
}else{
     $stdid = $_SESSION['stdid'];
}

//echo "ffkffk: ".$stdid;
$msg='';

$error=array(
1=>'Student data could not be retrieve',
2=>'Your password must be between 6 and 32 characters!',
3=>'Your password confirmation do not match.',
4=>'Activation link could not be sent, check your internet connection.'

);










//$siteRedirectUrl = GATEWAY;
//$siteRedirectName = GATEWAYSHORT;


$txt_ref=$_SESSION['txn_ref'];
$srows= Online::fetch_stu_data($stdid,$amount,$txt_ref);

  // $fullname = $srows->surname . " " . $srows->othernames;


 $siteRedirectUrl = GATEWAY;
 $siteRedirectName = GATEWAYSHORT;
 if (isset($srows)) {

//     $srows = mysql_fetch_array($sql);

    $fullname = $srows->surname . " " . $srows->othernames;
    $department = $srows->department;
    
    $level = $srows->level;
    
   $cust_id = $srows->acc_id;
   
     $txn_ref = $srows->txt_ref;

    $amount_fetch = $srows->amount;

    $_SESSION['txn_ref']=$txn_ref;


    $email=$srows->email;
    $token=$srows->token;
    $amount = ($amount_fetch) * 100;
    $amounts = preg_replace("/\.?0*$/", '', $amount_fetch); //not txt_fee
    $amsplit = ($amounts-600)*100;
    //$_SESSION['amsplit'] = $amsplit;
    $omoluabi=$srows->txt_fee;
    $interswitch_fee=300;
  //  $amounts=($amount_fetch - ($omoluabi+$interswitch_fee))*100;
    
   
     $_SESSION['email'] = $email;
    $_SESSION['surname'] = $fullname;
    $_SESSION['amt4hash'] = $amount;
    $product_id = PRODID;
    $pay_item_id = 116;
    $cur = CUR;
    $mackey = MACKEY;
     $ash_codes = ($txn_ref . $product_id . $pay_item_id . $amount . "$siteRedirectUrl" . $mackey);

    $ash_code = hash('sha512', $ash_codes);
    
    
    
    
//echo "Session Details:";	print_r($_SESSION);
    ?>

    <!--<h1></h1>-->
    
   


    
<?php include_layout_template('headers.php')?>


<center>
<div class="headers" style="width:90%; font-size:25px; padding:20px;  font-weight:bolder">

<span  style="float:left;">Online Screening Payment</span>

<span  style="float:right;">Preview Page</span>

</div>

</center>
<hr style="border:inset 1px solid">
    
<div class="row">

  <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
    <center>


      <div class="page-container">
      <div class="page-header-text">
        <h2>Payment Verification</h2>
        </div>

        <div class="page-content-text" >


<center>
  






    <!--<h1>Payment Verification</h1>-->
    <div class="" style="width:50%">
      <!--  <code>You can Copy/Print this Transaction Number for future reference</code> <br/><br/>
        <p class="btn btn-primary">Your Transaction Reference No: <span
                class="btn btn-warning"><?php //echo $txn_ref ?></span></p>-->
        <div class="well" style="background:#FFF; color: #000; padding: 20px">


            <table class="table table-bordered table-hover" style="width:100%; margin-bottom:20px">
                <tr style="line-height:30px">
                    <td align="right"><strong>Full Name:</strong></td>
                    <td colspan="3"><?php echo $fullname ?></td>
                    
                </tr>
                <tr style="line-height:30px">
                     <td align="right"><strong>Department:</strong></td>
                    <td><?php echo $department ?></td>
                    
                    <td align="right"><strong>Level:</strong></td>
                    <td><?php echo $level ?><level/td>
                   
                </tr>
                
                <tr>
                <tr style="line-height:30px">
                    <td align="right" ><strong>Email:</strong></td>
                    <td width="814" colspan="3"><?php echo $email ?></td>
                   
                </tr>
                <tr style="line-height:30px">
                    <td colspan="4"><h1>Total Amount: <?php echo number_format($amount / 100, 2) ?></h1>
                    </td>
                </tr>
            </table>
            <p><strong>NOTE</strong>: The Total Amount of
                <strike>N</strike><?php echo number_format($amount / 100, 2) ?> will be
                deducted from your account. Thanks</p>
        </div>
        <br>
        <!--<form name="form1" action= "https://webpay.interswitchng.com/paydirect/pay" method="post">-->
        <?php



        $string_to_interswitch = "<form name='form1' action='https://webpay.interswitchng.com/paydirect/pay' method='post'>
<input name='product_id' type='hidden' value='$product_id' />
                    <input name='cust_id' type='hidden' value='$cust_id' />
                    <input name='cust_name' type='hidden' value='$fullname' />
                    <input name='pay_item_id' type='hidden' value='$pay_item_id' />
                    <input name='pay_item_name' type='hidden' value='OSCOTECH - Application Fee COLPAYOSCOAPPFE' />
                    <input name='amount' type='hidden' value='$amount' />
                    <input name='currency' type='hidden' value='$cur' />
                    <input name='site_redirect_url' type='hidden' value='$siteRedirectUrl'/>
                    <input name='site_name' type='hidden' value='$siteRedirectName' />

                    <input name='txn_ref' type='hidden' value='" . $_SESSION['txn_ref'] . "' />
                    <input name='hash' type='hidden' value='$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";
        $string_to_interswitch .= "='" . trim($_SESSION["txn_ref"]) . "' college='OSCOTECH' 
                    department='$department' faculty='$department'> 
                    <item_detail item_id='1' item_name='Omoluabi fees:' item_amt='" . ($omoluabi * 100) . "'
                     bank_id='76' acct_num='0213965027' />
					<item_detail item_id='2' item_name='Application Fee:' item_amt='$amsplit'
					 bank_id='76' acct_num='0213965027' />
					</item_details>
					</payment_item_detail>" . '"' . " />
                    <a href='view-bill.php?email=$email&token=$token' class='pointer' >
                    <button class='btn btn-default pointer' onclick='javascript(void)' type='button'>
                    Back
</button>
                    
                    </a>
                    <button class='btn btn-danger pointer' type='submit'>
                    Pay Now
</button>

              
              
              
                    </form>";



        echo($string_to_interswitch);


        echo(' <div>
                    <div class="row">
                        <span class="col-md-3 col-lg-3 col-sm-3 col-xs-3" style="top:15px">
                       
                        <img src="images/image001.png" class="img-responsive bankImg" alt="">
                    
                        </span>
                        <span class="col-md-3 col-lg-3 col-sm-3 col-xs-3">
                            <img src="images/mc.jpg" class="img-responsive bankImg bankFix" alt="">

                        </span>
                        <span class="col-md-3 col-lg-3 col-sm-3 col-xs-3" style="top:22px">
                            <img src="images/visa.png" class="img-responsive bankImg" alt="">

                        </span>
                        <span class="col-md-3 col-lg-3 col-sm-3 col-xs-3" style="top:17px">
                            <img src="images/verve.jpg" class="img-responsive bankImg" alt="">

                        </span>
                    </div>
                </div>');

        ?>
    </div>
    <!--    //this last two important for the menu (for now)-->
    
    <!--<button class='btn btn-success pointer' type='button'>-->
<!--Print-->
<!--</button>-->
    </div> </div>
    <?php

} else {
    die("Unable to get transaction from database");
}

?>


</center>
    
    </div>
    </div>
    </div>
    
    <?php echo enquiryMsg();?>
    </div>




















































  
    <?php
    
     /*
    $srows='';
  // $sql = mysql_query
<!--$srows= Online::fetch_stu_data($stdid,$amount,$txt_ref);-->

   


<!-- $siteRedirectUrl = GATEWAY;-->
<!-- $siteRedirectName = GATEWAYSHORT;-->

<!-- if (isset($srows) > 0) {-->

     //$srows = mysql_fetch_array($sql);
    
    
    
<!--    $fullname = $srows->surname . " " . $srows->othernames;-->

    //$fullname = $srows['surname'] . " " . $srows['othernames'];
<!--    $department = $srows->department;-->
<!--    $email = $srows->email;-->
   
<!--    $token=$srows->token;-->
<!--    $level = $srows->level;-->
<!--    $fno = $srows->acc_id;-->
<!--    $txn_ref = $srows->txt_ref;-->
//$amount_fetch = preg_replace("/\.?0*$/", '', $srows['amount']);
<!--    $amount_fetch = $srows->amount;-->
//$overhead = preg_replace("/\.?0*$/", '', $srows['overhead']);
   //$overhead = ($srows['overhead']);
   
  
   //echo $txn_fee = preg_replace("/\.?0*$/", '', $srows->txt_fee); //not txt_fee
   
    $txn_fee = $srows->txt_fee; //not txt_fee

    
<!--     $amount = $amount_fetch * 100;-->
//$overheads = $overhead * 100;
    // $faculty = $srows['faculty'];
    // $session = $srows['session'];

    // if ($overhead == "0") {
    //     $overheads = ($overhead * 100) and $ict_overheads = 0 * 100;
    // }
    // if ($overhead != "0") {
    //     //$overheads = (($overhead - 150) * 100) and $ict_overheads = 150 * 100;

    //     $overhead1 = (($overhead - 200) * 100);
    //     $to_interswitch = $overhead1;

    //     $overhead2 = (($overhead - 300) * 100);
    //     $to_omoluabi = $overhead2; //wrong
    //     //echo "Omoluabi ".$to_omoluabi;
    // }
    
<!--      $_SESSION['txn_ref'] = $txn_ref;-->
<!--    $_SESSION['email'] = $email;-->
<!--   $_SESSION['surname'] = $fullname;-->
<!--   echo $_SESSION['amount'] = $amount;-->
<!--    $product_id = PRODID;-->
<!--   $pay_item_id = 121;-->
<!--    $cur = CUR;-->
<!--    $mackey = MACKEY;-->
<!--    $ash_codes = ($txn_ref. $product_id. $pay_item_id. $amount. "$siteRedirectUrl". $mackey);-->

<!--    $ash_code = hash('sha512', $ash_codes);-->
//echo "Session Details:";	print_r($_SESSION);
<!--    ?>-->

    <!--<h1>Payment Verification</h1>-->
<!--    <div class="" style="width:50%">-->
      <!--  <code>You can Copy/Print this Transaction Number for future reference</code> <br/><br/>
<!--        <p class="btn btn-primary">Your Transaction Reference No: <span-->
                class="btn btn-warning"><?php //echo $txn_ref ?></span></p>-->
<!--        <div class="well" style="background:#FFF"  >-->


<!--            <table class="table table-bordered table-hover" style=width:100% >-->
<!--                <tr>-->
<!--                    <td align="right"><strong>Full Name:</strong></td>-->
<!--                    <td colspan="3"><?php echo $fullname ?></td>-->
                    <!--<td align="right"><strong>FormNo/MatricNo:</strong></td>-->
                    <!--<td><?php //echo $fno ?></td>-->
<!--                </tr>-->
<!--                <tr>-->
                    
<!--                    <td align="right"><strong>Department:</strong></td>-->
<!--                    <td><?php echo $department ?></td>-->
                    
<!--                     <td align="right"><strong>Level:</strong></td>-->
<!--                    <td><?php echo $level ?></td>-->
<!--                </tr>-->
               
               
<!--                <tr>-->
<!--                    <td align="right"><strong>Email:</strong></td>-->
<!--                    <td width="814" colspan="4"><?php echo $email ?></td>-->
                    
<!--                </tr>-->
<!--                <tr>-->
<!--                    <td colspan="4"><h1>Total Amount: <?php echo number_format($amount / 100, 2) ?></h1>-->
<!--                    </td>-->
<!--                </tr>-->
<!--            </table>-->
<!--            <p><strong>NOTE</strong>: The Total Amount of-->
<!--                <strike>N</strike><?php echo number_format($amount / 100, 2) ?> will be-->
<!--                deducted from your account. Thanks</p>-->
<!--        </div>-->
        <!--<form name="form1" action= "https://webpay.interswitchng.com/paydirect/pay" method="post">-->
<!--        <?php-->

<!--        $string_to_interswitch = "<form name='form1' action='https://webpay.interswitchng.com/paydirect/pay' method='post'>-->
<!--<input name='product_id' type='hidden' value='$product_id' />-->
<!--                    <input name='cust_id' type='hidden' value='$fno' />-->
<!--                    <input name='cust_name' type='hidden' value='$fullname' />-->
<!--                    <input name='pay_item_id' type='hidden' value='$pay_item_id' />-->
<!--                    <input name='pay_item_name' type='hidden' value='OSCOTECH Payment' />-->
<!--                    <input name='amount' type='hidden' value='$amount' />-->
<!--                    <input name='currency' type='hidden' value='$cur' />-->
<!--                    <input name='site_redirect_url' type='hidden' value='$siteRedirectUrl'/>-->
<!--                    <input name='site_name' type='hidden' value='admission.oscotechesaoke.edu.ng' />-->

<!--                    <input name='txn_ref' type='hidden' value='".$_SESSION['txn_ref']."' />-->
<!--                    <input name='hash' type='hidden' value='$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";-->
<!--        $string_to_interswitch .= "='" . trim($txn_ref) . "' college='OSCOTECH' -->
<!--                    department='$department'> <item_detail item_id='1' item_name='overhead fees' item_amt='" . ($txn_fee * 100) . "'-->
<!--                     bank_id='76' acct_num='0213965027' />-->
<!--					<item_detail item_id='2' item_name='Application fees' item_amt='$amount'-->
<!--					 bank_id='76' acct_num='0213965027' />-->
<!--					</item_details>-->
<!--					</payment_item_detail>" . '"' . " />-->
<!--                    <a href='view-bill.php?email=$email&token=$token' class='pointer' >-->
<!--                    <button class='btn btn-default pointer' onclick='javascript(void)' type='button'>-->
<!--                    Back-->
<!--</button>-->
                    
<!--                    </a>-->
<!--                    <button class='btn btn-danger pointer' type='submit'>-->
<!--                    Pay Now-->
<!--</button>-->

              
              
              
<!--                    </form>";-->



<!--        echo($string_to_interswitch);-


<!--        echo(' <div>-->
<!--                    <div class="row">-->
<!--                        <span class="col-md-3 col-lg-3 col-sm-3 col-xs-3" style="margin-top:25px">-->
                       
<!--                        <img src="images/image001.png" class="img-responsive bankImg" alt="">-->
                    
<!--                        </span>-->
<!--                        <span class="col-md-3 col-lg-3 col-sm-3 col-xs-3">-->
<!--                            <img src="images/mc.jpg" class="img-responsive bankImg bankFix" alt="">-->

<!--                        </span>-->
<!--                        <span class="col-md-3 col-lg-3 col-sm-3 col-xs-3" style="margin-top:25px">-->
<!--                            <img src="images/visa.png" class="img-responsive bankImg" alt="">-->

<!--                        </span>-->
<!--                        <span class="col-md-3 col-lg-3 col-sm-3 col-xs-3" style="margin-top:20px">-->
<!--                            <img src="images/verve.jpg" class="img-responsive bankImg" alt="">-->

<!--                        </span>-->
<!--                    </div>-->
<!--                </div>');-->

<!--        ?>-->
<!--    </div>-->
    <!--    //this last two important for the menu (for now)-->
    
    <!--<button class='btn btn-success pointer' type='button'>-->
<!--Print-->
<!--</button>-->
<!--    </div> </div>-->
<!--    <?php-->
<!--} else {-->
<!--    //die("Unable to get transaction from database");-->
<!--}-->

<!--?>-->


<!--</center>-->-->
    
<!--    </div>-->
<!--    </div>-->
<!--    </div>-->
    
<!--    <?php //echo enquiryMsg();?>-->
<!--    </div>-->


*/