 <?php 
 
 
 //collect invoice id
 if(isset($_POST['iid'],$_POST['qlk']))
 {
	 
	 //collect it
	 $iid = mysqli_real_escape_string($dbc, $_POST['iid']);
	 
	 //pass iid to a reference
	 $_SESSION['iida'] = $iid;
	 
	 
	 //collect application number
	 $appno = get_user_application_number($user_id);
	 
	 
	 
	 

	 
	 
	 //invoice to
	 $invoice_type  = get_invoice_type($iid);//get invoice type
	 $invoice_to = get_invoice_invoice_to($iid);
	 $pay_to = get_invoice_pay_to($iid); //get who to pay the invoce to
	 $invoice_for = get_invoice_for($iid); //get what the invoice is made for 
	 $title = get_invoice_title($iid); // get the invocie title
	 $description = get_invoice_desc($iid); //get the invoice desc
	 $amount = get_invoice_amount($iid); //get the invocie amount
	 $total_amount = get_invoice_total_amount($iid); //get invoice total amount
	 $credit = get_invoiced_credit($iid); //get invoice credit
	 
	 
	 $payment_status = get_invoice_payment_status($iid); //get the invoice payment status
	 
 
 //get current session 
 //$session = get_current_session($id = 1); //get current session
 //$session_title = get_session_title($session); //get session title
 
 //get current semester
 // $semester = get_current_semester($id = 1); //get current semester
 //$semester_title = get_semester_title($semester); //get semester title
 
 //for interswitch
 //echo $txn_ref = generate_interswitch_txn_ref();
 $txnref = mysqli_real_escape_string($dbc, $_POST['txnref']);
 
 //redirect url
 //$redirect_url =  'http://schoolofhealthtechnologyminna.com/eportal/students/gateway.php?act=payments_response';
 
 
 
 
 //developement url
 //$product_id = '6207';
 
 
 
 //test product id
 //$product_id = '6205';
 
 
 //live product id
 //$product_id = '7199';

 
 //developement payment id
 //$payment_item_id = '101';
 
 
 //test payment id
 //$payment_item_id = '101';
 
 
 //live payment id
 //$payment_item_id = '101';

 
 //developemnt mac key
 //$mac_key = 'CEF793CBBE838AA0CBB29B74D571113B4EA6586D3BA77E7CFA0B95E278364EFC4526ED7BD255A366CDDE11F1F607F0F844B09D93B16F7CFE87563B2272007AB3';

 //test mac key
 //$mac_key = 'D3D1D05AFE42AD50818167EAC73C109168A0F108F32645C8B59E897FA930DA44F9230910DAC9E20641823799A107A02068F7BC0F4CC41D2952E249552255710F';

 //live mac key
 //$mac_key = '0055AE9C1E7AB28D77A23F83B6CB65812C9888BD7EC08C4D828486EF9699F67A7EB22715F9B2EB6F5A84F3D798C010FA7F8221C0ECBE1830E87914F25716AB12';
			


  //$total_amountt =  $total_amount * 100;
  $total_amountt = $_POST['amount'];
  
  //pass it to session
   $_SESSION['amntt'] = $total_amountt;

 


 //$data = $txn_ref.$product_id.$payment_item_id.$total_amountt.$redirect_url.$mac_key;
 //$hashed = hash('sha512', $data);
 
 $full_name = get_user_fullname($invoice_to);
 
 //splitting of the money
 //$lusa_share = 165000; //lusa share 
 //$school_share = $total_amountt  - $lusa_share;
 
 
 
 //interswitch share 
 //$jdlab_share = 200;
 
 //final school share 
 //$ss = $school_share - $interswitch_share;

 
 
 
 //echo $_SERVER['HTTP_USER_AGENT'];
 
              $transaction_type = 0; //applicants
			  $transaction_for = 0; //application fee
			  $payment_method = 1; //1 for vogue pay
			  
			  
			  $iid2 = $iid;//pass invoice id
			  $title2 = $title;
			  $desc2 = $description;
			  
			 
			  //get payment status using 
			 // $payment_status = get_payment_status_by_resp_code($statt);
			  //$amt = $amt / 100;
			  //$amt = $tot;
			  
			  
			  
			    if(!v_trf_exist($txnref, $invoice_to) && $txnref != '')
			    {
				

			  
					  $qry23="INSERT INTO `vogue_webpay_transaction_log` (`invoice_id`, `transaction_type`, `user_id`, `transaction_for`,
					   `transaction_reference`, `title`, `description`, `amount`, `date_added`) 
						 
						VALUES ('".$iid2."','$transaction_type','".$invoice_to."','$transaction_for','$txnref','".$title2."','".$desc2."','$total_amountt',NOW())";
						 
					  $rst23 =  mysqli_query($dbc, $qry23);
				  
					  //if(mysqli_affected_rows($dbc))
					  if($rst23)
					  {//end of if update is successful
					  
							 
							 
							 //clear some sessions
							 
							 //unset($_SESSION['iid']);
							 //unset($_SESSION['amnt']);
							 
							 
							
					  
					  
					  //do nothing for now
					  
					  }
					  else
					  {
						   $msg =   '&nbsp;&nbsp;SERVER ERROR: Transaction Log has issues, we are sorry for the incovenience.';
								
						   header("Location: dashboard.php?act=view_invoices&error=".urlencode($msg)."&qlk=".md5(8)."&iid=".$iid);
				  
					  }

 
				}//en dof if check
				
			  
 
 ?>
 <!--<div style="height:20px; displat:block;"></div>-->
  <ul class="breadcrumb">
    
        <li><a href="dashboard.php?act=payments&qlk=<?php echo md5(8); ?>">Payments</a> <span class="divider"></span> </li>
        <li><a href="dashboard.php?act=view_invoices&qlk=<?php echo md5(8); ?>&auth=<?php echo sha1(md5(2))?>&iid=<?php echo $iid; ?>">View Invoice</a> <span class="divider"></span> </li>

        <li class="active" > Confirmation Page <span class="divider"></span> </li>
        
        
        
    </ul>
  
  
<div class="well"><!-- well starts -->


      <div class="row" style="padding-left:0px; padding-right:0px;">
      
                      <ul class="list-group">
                          <li class="list-group-item list-group-item-danger">
                              <h5>PLEASE CONFIRM YOUR PAYMENT DETAILS, IF THEY ARE ALL CORRECT?</h5>
                          </li>
                      </ul>
                      
                      <div class="col-md-12">
                      
                      
                       <p><span style="color:#foo" > *</span> Please note that the convenience fee is N300 only</p><br/><br/> 
                       
                            
                      <h4><span class="glyphicon glyphicon-pushpin"></span> Your Reference: (<span style="color:#F00"><?php echo $txnref; ?></span>) </h4>
                      <p style="color:#F00"> <strong>Please copy this  reference somewhere incase of transaction challenges </strong></p>
                          <div class="form-actions pull-right" style="margin-top:10px; padding-left:0px; padding-right:0px;">
                          			
                                      <form method='POST' action='https://voguepay.com/pay/'>

                                         <!-- demo key -->
                                       <!-- <input type='hidden' name='v_merchant_id' value='demo' />-->
                                        
                                       
                                        
                                       
                                        <!-- live key -->
                                        <input type='hidden' name='v_merchant_id' value='5389-0052061' />
                                        
                                        
                                        
                                        <input type='hidden' name='merchant_ref' value='<?php echo $txnref; ?>' />
                                        <input type='hidden' name='memo' value='APPLICATION FEE FOR DIPLOMA PROGRAMME' />
                                        
                                        
                                        
                                        <!-- i inserted this on my own -->
                                        <!--<input type='hidden' name='item_1' value='Face Cap' />-->
                                        <input type='hidden' name='item_1' value='<?php echo $title; ?>' />

                                        
                                        <!--<input type='hidden' name='description_1' value='Blue Zizi facecap' />-->
                                        
                                        
                                        <input type='hidden' name='description_1' value='<?php echo $description; ?>' />
                                        
                                        <!--<input type='hidden' name='price_1' value='2000' />-->
                                        <input type='hidden' name='price_1' value='<?php echo $total_amount; ?>' />
                                        
                                        <input type='hidden' name='item_2' value='Convenience Fee' />
                                        <input type='hidden' name='description_2' value='Transaction & Processing Fee' />
                                        <input type='hidden' name='price_2' value='300' />
                                        
                                        
                                         <input type='hidden' name='notify_url' value='https://apply.ndp.ibbuconsult.com.ng/applications_1/dashboard.php?act=appfee_response&qlk=c9f0f895fb98ab9159f51fd0297e236d' />
                                         <input type='hidden' name='success_url' value='https://apply.ndp.ibbuconsult.com.ng/applications_1/dashboard.php?act=appfee_response&qlk=c9f0f895fb98ab9159f51fd0297e236d&is=success' />
                                         <input type='hidden' name='fail_url' value='https://apply.ndp.ibbuconsult.com.ng/applications_1/dashboard.php?act=appfee_response&qlk=c9f0f895fb98ab9159f51fd0297e236d&error=fail' />
                                      
                                        
                                        <!--
                                        live key 
                                        <input type='hidden' name='notify_url' value='https://eportals.ibbuconsult.com.ng/executive_cert_programmes/applications_1/dashboard.php?act=appfee_response' />
                                        <input type='hidden' name='success_url' value='https://eportals.ibbuconsult.com.ng/executive_cert_programmes/applications_1/dashboard.php?act=appfee_response&is=success' />
                                        <input type='hidden' name='fail_url' value='https://eportals.ibbuconsult.com.ng/executive_cert_programmes/applications_1/dashboard.php?act=appfee_response&error=fail' />
                                        -->
                                        
                                       
                                         
                                         
                                        <input type='hidden' name='developer_code' value='59297faf4d849' />
                                        <input type='hidden' name='store_id' value='3374' />
                                        
                                        <input type='hidden' name='total' value='<?php echo $total_amountt; ?>' />
                                        
                                       
                                        
                                       
                          		
                          			
                                    
                                    <?php if($payment_status == '1'){ ?>
                                    <div ><input type="submit" name="" class="btn btn-info" value="Paid"  data-toggle="tooltip" data-placement="top" title="You have made payment for this invoice" disabled="disabled"/></div>
                                    <?php }else{ ?>
                                    <div class="pull-right">
                                     <input type='image' src='http://voguepay.com/images/buttons/make_payment_blue.png' alt='Submit' height="35" width="160" />
                                   <!-- <button type="submit"  class="btn btn-info"  data-toggle="tooltip" data-placement="top" title="Click here to Pay"> YES, PAY!</button>-->
         
                                    </div>
                                    <?php } ?>
                                    
                                    
                                   
                                   
                                   
                                   
                                    </form><!-- end of form for the inst -->

                                  	   
                                 	
                              </div>
                      
      
                    </div><!-- /.col md 12 -->          
                     
                      <div class="col-md-12">
                      	
                        <div class="col-md-4 help-block">
                      		<p class="help-block">Invoice # <span class="badge badge-success"><?php echo $iid ;?></span></p>
                            Invoice Date: <?php echo get_invoice_date($iid) ;?><br>
                            Due Date: <?php echo get_invoice_due_date($iid) ;?><br>
                            Expire Date / Time: <?php echo get_invoice_exp_date($iid) ;?>
                            
                        </div><!-- /.col  md 4-->
                        
                        <div class="col-md-4">
                        	<p class="help-block">Invoice To </p>
                            <?php echo get_user_fullname($invoice_to); ?><br><?php echo '<b>APPLICATION No.: '.$appno.'</b><br/>'; ?>

                            <?php echo get_user_address($invoice_to); ?><br>
                            <?php echo show_state(get_user_state_id($invoice_to)); ?><br>
                             <?php //echo show_country(get_user_country_id($invoice_to)); ?>.<br>
                         
                        
                      	</div><!-- /.col  md 4-->
                      	
                        
                        <div class="col-md-4">
                        
                       		<p class="help-block">Pay To </p>
                            <?php echo $pay_to; ?><br>
                           
                      	</div><!-- /.col  md 4-->
                      	
                      	
                        
                      
                      </div><!-- /.col  md 12-->
                      
                         <div style="height:100px"></div><!-- giv space -->
                     
                        <div class="col-md-12">
                       		
                            
                            
                            
                            <li class="list-group-item help-block" style="min-height:60px;">
                            	 <span>Total Amount: 
                                </span> 
                                <span class="pull-right text-success" style="font-size:35px; font-weight:bold;"><?php echo 'N'.number_format($total_amountt ,2).'K'; ?> 
                                </span>
                               
                            </li>
                            
                            
                         </div>
                         
                        <div class="clearfix"></div>

                         <br/><br/>
                         
                    
      
      </div><!-- /.col md 12 -->
      
      
      
		
	
</div><!-- /.well -->	

<div class="col-md-12">
       
       <br/><br/><br/>
          
        <hr> 
       
       </div>
         
        
        <div class="col-md-12">
              <div class="col-sm-6  help-block">     
                    
                     
                     
                     <img src="images/secured pay opt.png" class="img-responsive" />
                  
                  </div>    
              
                <div class="col-sm-6  help-block">     
                    <h4>For Support, Email or Call : </h4>
                    <h5><span class="glyphicon glyphicon-envelope"></span> eportals@ibbuconsult.com.ng </h5>
                     <h5><span class="glyphicon glyphicon-phone"></span> +234- 08142411717 OR 07068401380 </h5>
                     
                     
                     <img src="images/support.png" class="pull-right" />
                  
                  </div>
         </div>
           	

<?php

 }//end of iid exist
else
{
	//do nothing for now
}
?>