<?php 
require_once 'admin-neuro/lib/Config.php';
?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php echo getRecord('id','metakeywords','1','metatitle');?></title>
<meta name="keywords" content="<?php echo getRecord('id','metakeywords','1','keywords');?>"/>
<meta name="description" content="<?php echo getRecord('id','metakeywords','1','description');?>"/>
    <link rel="shortcut icon" href="<?php echo getRecord('id','settings','1','image1');?>" type="image/x-icon">
    <!-- Stylesheets & Fonts -->
    <link href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,800,700,600|Montserrat:400,500,600,700|Raleway:100,300,600,700,800" rel="stylesheet" type="text/css" />
    <link href="css/plugins.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
    <link href="css/btn-styles.css" rel="stylesheet">
    <link href="css/responsive.css" rel="stylesheet"> 
    
    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet"> 
    
    <script src="https://js.stripe.com/v3/"></script>
    
    <!-- Event styles -->
    <link href="css/event-styles.css" rel="stylesheet"> 
    <link href="css/pgc.css" rel="stylesheet"> 
    
    <script type="text/javascript" src="js/countrycodes.js"></script>
    
    <?php include("script.php");?> 
    
    </head>

    <body class="no-page-loader">


    <!-- Wrapper -->
    <div id="wrapper">

		<!-- Header -->
		<?php include("links/menu.php");?>
		<!-- end: Header -->

                
        <section id="page-title" class=""style="background-image: url(images/background/11.jpg);">
            <div class="bg-overlay"></div>
            <div class="container">
                <div class="page-title">
                    <h1>Proceed To Payment</h1>
                </div>
                <div class="breadcrumb">
                    <ul>
                        <li><a href="index.php">Home</a> </li>
                        <li class="active"> Proceed To Payment </li>
                    </ul>
                </div>
            </div>
        </section>



     <!-- Speakers Section -->
   <section class="speakers-section">
   

    <div class="auto-container">
       

        <div class="row justify-content-center">

            <!-- Speaker block -->

 <div class="col-lg-10 baclpadtop ">

					<!-- section-title - start -->
					
						<div class="section-title text-justify mb-30 box-shadws">
						<div class="col-lg-12">
							
							<div class="row p-relative  fix">
    
 
                         
						  
						  
	 <div class="col-sm-7">
    
     <div class="paymentm">
         <h4>Payment Options</h4>
          <?php
         
	   $tot_price=$_SESSION['tot_price'];
	   
	   $percentage = 4.8;
	   
	   $tot=$tot_price;
	    
	    
	    $tp_price=($percentage / 100) * $tot;
	    
	    $totl_price=$tot+round($tp_price, 0);
	    $_SESSION['totl_price']=$totl_price;
	   
	   if(isset($_POST['pay_now'])){
	   
	   $data=array(
'merchant_email'=>'finance@precisionglobalconferences.com',
'product_name'=>'Neurology World Conference Registration',
'amount'=>$totl_price,
'currency_code'=>'USD',
'thanks_page'=>ROOT_PATH."/thanx.php",
'notify_url'=>ROOT_PATH."/ipn.php",
'cancel_url'=>ROOT_PATH."/cancel.php",
'paypal_mode'=>true,
);
function infotutsPaypal( $data) {
define( 'SSL_URL', 'https://www.paypal.com/cgi-bin/webscr' );
define( 'SSL_SAND_URL', 'https://www.paypal.com/cgi-bin/webscr' );
 
$action = '';
 //Is this a test transaction?
 $action = ($data['paypal_mode']) ? SSL_SAND_URL : SSL_URL;
 
$form = '';
 
$form .= '<form name="frm_payment_method" action="' . $action . '" method="post">';
 $form .= '<input type="hidden" name="business" value="' . $data['merchant_email'] . '" />';
 // Instant Payment Notification & Return Page Details /
 $form .= '<input type="hidden" name="notify_url" value="' . $data['notify_url'] . '" />';
 $form .= '<input type="hidden" name="cancel_return" value="' . $data['cancel_url'] . '" />';
 $form .= '<input type="hidden" name="return" value="' . $data['thanks_page'] . '" />';
 $form .= '<input type="hidden" name="rm" value="2" />';
 // Configures Basic Checkout Fields -->
 $form .= '<input type="hidden" name="lc" value="" />';
 $form .= '<input type="hidden" name="no_shipping" value="1" />';
 $form .= '<input type="hidden" name="no_note" value="1" />';
 // <input type="hidden" name="custom" value="localhost" />-->
 $form .= '<input type="hidden" name="currency_code" value="' . $data['currency_code'] . '" />';
 $form .= '<input type="hidden" name="page_style" value="paypal" />';
 $form .= '<input type="hidden" name="charset" value="utf-8" />';
 $form .= '<input type="hidden" name="item_name" value="' . $data['product_name'] . '" />';
 $form .= '<input type="hidden" value="_xclick" name="cmd"/>';
 
 $form .= '<input type="hidden" value="' . $_SESSION['regi_id'] . '" name="custom"/>';
 $form .= '<input type="hidden" name="amount" value="' . $data['amount'] . '" />';
 $form .= '<script>';
 $form .= 'setTimeout("document.frm_payment_method.submit()", 2);';
 $form .= '</script>';
 $form .= '</form>';
 return $form;
 }		
echo infotutsPaypal($data);
}
	   
	   ?> 
           
          <div class="paypalopt">
    <!--         <div class="row align-items-center">-->
    <!--          <div class="col-sm-5 mb-3 text-center">-->
    <!--          <h5><strong>Pay with PayPal</strong></h5>-->
            
    <!--         </div>-->
             
    <!--         <div class="col-sm-7 mb-3">-->
            
    <!--          <div class="about-area">-->
    <!--         <form method="post" id="paypal-info" action="">-->
    <!--          <button type="submit" name="pay_now" id="pay_now" onclick="proceed();" value="submit" class="btn mt-10 papallogo"><img src="images/PayPal_logo.png"> </button>-->
    <!--          </form>-->
    <!--          </div>-->
    <!--         </div>-->
    <!--     </div>-->
         
    <!--     <div class="clearfix"></div>-->
    <!--<h5 class="text-center mt-20 mb-20 bg-gray">(or)</h5>-->
         
            <div class="paypalopt">
              <div class="row my-3 align-items-center">
              <div class="col-sm-5 mb-3 text-center">
              <h5><strong>Pay with Stripe</strong></h5>
             
             </div>
             
             <div class="col-sm-7 mb-3">
                  <!-- Display errors returned by checkout session -->
		<div id="paymentResponse" class="hidden"></div>
             <!--<img src="images/stripe2.png" class="">-->
             <div class="about-area">
            <button class="stripe-button btn" id="payButton">
            <div class="spinner hidden" id="spinner"></div>
            <div class="stripebtn mb-2"> 
            <span id="buttonText">Pay Now</span>
            </div>
            <div class="power_sripe"> <img src="images/powered_stripe.png" alt="stripe"> </div>
        </button>
              </div>
             </div>
         </div>
        </div>
        <script>
// Set Stripe publishable key to initialize Stripe.js
const stripe = Stripe('<?php echo STRIPE_PUBLISHABLE_KEY; ?>');

// Select payment button
const payBtn = document.querySelector("#payButton");

// Payment request handler
payBtn.addEventListener("click", function (evt) {
    setLoading(true);

    createCheckoutSession().then(function (data) {
        if(data.sessionId){
            stripe.redirectToCheckout({
                sessionId: data.sessionId,
            }).then(handleResult);
        }else{
            handleResult(data);
        }
    });
});
    
// Create a Checkout Session with the selected product
const createCheckoutSession = function (stripe) {
    return fetch("payment_init.php", {
        method: "POST",
        headers: {
            "Content-Type": "application/json",
        },
        body: JSON.stringify({
            createCheckoutSession: 1,
        }),
    }).then(function (result) {
        return result.json();
    });
};

// Handle any errors returned from Checkout
const handleResult = function (result) {
    if (result.error) {
        showMessage(result.error.message);
    }
    
    setLoading(false);
};

// Show a spinner on payment processing
function setLoading(isLoading) {
	if (isLoading) {
		// Disable the button and show a spinner
		payBtn.disabled = true;
		document.querySelector("#spinner").classList.remove("hidden");
        document.querySelector("#buttonText").classList.add("hidden");
	} else {
		// Enable the button and hide spinner
		payBtn.disabled = false;
		document.querySelector("#spinner").classList.add("hidden");
        document.querySelector("#buttonText").classList.remove("hidden");
	}
}

// Display message
function showMessage(messageText) {
	const messageContainer = document.querySelector("#paymentResponse");
	
	messageContainer.classList.remove("hidden");
	messageContainer.textContent = messageText;
	
	setTimeout(function () {
		messageContainer.classList.add("hidden");
		messageText.textContent = "";
	}, 5000);
}
</script>
         </div>
  
      
      </div>  
      </div>
      
      	<div class="col-sm-5">
      	
      	<div class="paymnttotal  px-3">
            <div id="field1" class="quanty totalprccc"><span>Total Price $ <?php echo $totl_price;?></span>
               <!-- <input type="text" readonly="" id="tot_price" class="contact-input " name="tot_price" value="699" placeholder="Enter Price" required="">-->
            </div>
          
            <p>Once the Payment has been done successfully. You can find the Registration Fee details  in the Card statement under the name of Precision Global Conference</p>
      </div>
      	
      	 				
      </div> 				  					  
		 				
                                          
   
                         
 </div>
							
						</div>
						</div>
					</div>

       

        </div>
    </div>
</section>
<!-- End Speakers Section -->
    
  



        <!-- FOOTER -->
        <?php include("links/footer.php");?> 
        <!-- end: FOOTER -->
        
    </div>    
    <!-- end: Wrapper -->

    <!--Plugins-->
<script src="js/jquery.js"></script>
<script src="js/plugins.js"></script>

<!--Template functions-->
<script src="js/functions.js"></script> 

<script>
$(document).ready(function(){
  $("#c-captcha1").click(function(){
      var cap=$('#input-group-addon1').text().trim();
      var in_cap=$('#captcha-input1').val().trim();
      $('#error-captcha1').text('');
      if(cap!==in_cap){
          $('#error-captcha1').text('Captch Invalid');
          return false;
      }
  });
});
</script>

</body>

</html>
