<?php $__env->startSection('content'); ?>
 <div class="page-content"><div class="container"><div class="row"><div class="main-content col-lg-12">

<div class="content-area card"><div class="card-innr">

<div class="content-area card"><div class="card-innr"><div class="card-head"><span class="card-sub-title text-primary font-mid">Step 2</span><h4 class="card-title">Payment Preview</h4></div><div class="card-text"><p>You have opted to pay using
<?php echo e(App\Gateway::whereId($data->gateway)->first()->name); ?>.

 Please find your pre-payment summary below.</p></div>


<div class="token-overview-wrap"><div class="token-overview"><div class="row"><div class="col-md-3 col-sm-6"><div class="token-bonus token-bonus-sale"><span class="token-overview-title">Amount</span><span class="token-overview-value bonus-on-sale">$<?php echo e(number_format($data->amount, $basic->decimal)); ?></span></div></div><div class="col-md-3"><div class="token-total"><span class="token-overview-title font-bold">Amount Payable</span><span class="token-overview-value token-total-amount text-primary">$<?php echo e(number_format($data->amount, $basic->decimal)); ?></span></div></div>

<div class="col-md-3"><div class="token-total"><span class="token-overview-title font-bold"><?php echo e($basic->currency); ?> Amount</span><span class="token-overview-value token-total-amount text-primary"><?php echo e($basic->currency_sym); ?><?php echo e(number_format($data->amount * $basic->rate, $basic->decimal)); ?></span></div></div>

</div></div><div class="note note-plane note-danger note-sm pdt-1x pl-0"><p>Your fundwilll be reversed if transaction is not concluded in 60 minutes.</p></div></div><div class="card-head"><span class="card-sub-title text-primary font-mid">Step 3</span>


<h4 class="card-title">Make Payment Using <?php echo e(App\Gateway::whereId($data->gateway)->first()->name); ?></h4></div>


<div class="pay-buttons"><div class="pay-button">
 <form method="POST" action="<?php echo e(route('deposit.confirm')); ?>" enctype="multipart/form-data">
                            <?php echo e(csrf_field()); ?>


<?php if($data->gateway == 100): ?>
<badge  onClick="payWithRave()" class="btn btn-primary btn-between w-100">Proceed To Pay <em class="ti ti-wallet"></em></badge>
<?php elseif($data->gateway == 107): ?>
<script src="https://js.paystack.co/v1/inline.js"></script>
<badge onclick="payWithPaystack()" class="btn btn-primary btn-between w-100">Proceed To Pay <em class="ti ti-wallet"></em></badge>
<?php elseif($data->gateway == 109): ?>
<script src="http://www.remitademo.net/payment/v1/remita-pay-inline.bundle.js"></script>
<badge onclick="makePayment()"  class="btn btn-primary btn-between w-100">Proceed To Pay <em class="ti ti-wallet"></em></badge>
<?php else: ?>
<button  type="submit" id="btn-confirm" class="btn btn-primary btn-between w-100">Proceed To Pay <em class="ti ti-wallet"></em></button>
</form><?php endif; ?>




</div><div class="pay-button-sap">or</div><div class="pay-button"><a href="<?php echo e(route('deposit')); ?>" class="btn btn-danger btn-between w-100">Cancel <em class="ti ti-arrow-right"></em></a></div></div><div class="pay-notes"><div class="note note-plane note-light note-md font-italic"><em class="fas fa-info-circle"></em><p>Fund will appear in your account after payment successfully made. </div></div></div> <!-- .card-innr --></div> <!-- .content-area --></div></div><!-- .page-content -->

<?php $__env->startSection('js'); ?>
 <?php if($data->gateway == 107): ?>
        <script>
						function payWithPaystack(){
						var handler = PaystackPop.setup({
						key: "<?php echo e(App\Gateway::whereId($data->gateway)->first()->val1); ?>",
						email: "<?php echo e(Auth::user()->email); ?>",
						amount: "<?php echo e(round($data->amount * $basic->rate, 2)*100); ?>",
						currency: "NGN",
						ref: ''+Math.floor((Math.random() * 1000000000) + 1), // generates a pseudo-unique reference. Please replace with a reference you generated. Or remove the line entirely so our API will generate one for you
						firstname: '',
						lastname: '',
						// label: "Optional string that replaces customer email"
						metadata: {
						custom_fields: [
						{
						display_name: "Mobile Number",
						variable_name: "",
						value: "+2348012345678"
						}
						]
						},
						callback: function(response){
						alert('Deposit successful. transaction refference number is ' + response.reference);
						window.location='javascript: submitform()';
						},
						onClose: function(){
						alert('window closed');
						}
						});
						handler.openIframe();
						}
						</script>


                    <script type="text/javascript">
			function submitform()
			{
			document.forms["myform"].submit();
			}
			</script>

			<form id="myform"  action="<?php echo e(route('marketpaid')); ?>" method="post">
			<?php echo e(csrf_field()); ?>

			<input type="hidden" name="trx" value="<?php echo e($data->trx); ?>" />
			<input type="hidden" name="id" value="<?php echo e($data->gateway); ?>" />
			</form>
 <?php elseif($data->gateway == 109): ?>
      <script>
					function makePayment() {
					  var paymentEngine = RmPaymentEngine.init({
					     key: "<?php echo e($data->gateway->val1); ?>",
					      customerId: "<?php echo e(Auth::user()->id); ?>",
					      firstName: "<?php echo e(Auth::user()->fname); ?>",
					      lastName: "<?php echo e(Auth::user()->lname); ?>",
					      email: "<?php echo e(Auth::user()->email); ?>",
					      narration: "<?php echo e($data->trx); ?>",
					      amount: "<?php echo e(round($data->amount+$data->charge, 2)*1); ?>",
					      onSuccess: function (response) {
					      window.location='javascript: submitform()';
					      },
					      onError: function (response) {
					      console.log('callback Error Response', response);
					      },
					      onClose: function () {
					      console.log("closed");
					      }
					      });
					      paymentEngine.showPaymentWidget();
					    }
					</script>

                    <script type="text/javascript">
			function submitform()
			{
			document.forms["myform"].submit();
			}
			</script>

			<form id="myform"  action="<?php echo e(route('cardpay')); ?>" method="post">
			<?php echo e(csrf_field()); ?>

			<input type="hidden" name="trx" value="<?php echo e($data->trx); ?>" />
			<input type="hidden" name="id" value="<?php echo e($data->gateway); ?>" />
			</form>
    <?php elseif($data->gateway == 100): ?>
    <script src="https://api.ravepay.co/flwv3-pug/getpaidx/api/flwpbf-inline.js"></script>

    <script>
			const API_publicKey = "<?php echo e($data->gateway->val1); ?>";
			function payWithRave() {
			var x = getpaidSetup({
			PBFPubKey: API_publicKey,
			customer_email: "<?php echo e(Auth::user()->email); ?>",
			amount: "<?php echo e(round($data->amount, 2)); ?>",
			customer_phone: "<?php echo e(Auth::user()->mobile); ?>",
			currency: "NGN",
			txref: "rave-123456",
		    payment_options: "card",
			meta: [{
			metaname: "flightID",
			metavalue: "AP1234"
			}],
			onclose: function() {},
			callback: function(response) {
			var txref = response.tx.txRef; // collect txRef returned and pass to a 					server page to complete status check.
			console.log("This is the response returned after a charge", response);
			if (
			response.tx.chargeResponseCode == "00" ||
			response.tx.chargeResponseCode == "0"
			) {
			window.location='javascript: submitform()';
			} else {
			// redirect to a failure page.
			}

			x.close(); // use this to close the modal immediately after payment.
			}
			});
			}
			</script>
			<script type="text/javascript">
			function submitform()
			{
			document.forms["myform"].submit();
			}
			</script>

			<form id="myform"  action="<?php echo e(route('cardpay')); ?>" method="post">
			<?php echo e(csrf_field()); ?>

			<input type="hidden" name="trx" value="<?php echo e($data->trx); ?>" />
			<input type="hidden" name="id" value="<?php echo e($data->gateway); ?>" />
			</form>
    <?php elseif($data->gateway == 108): ?>
        <script src="//voguepay.com/js/voguepay.js"></script>
        <script>
            closedFunction = function () {

            }
            successFunction = function (transaction_id) {
                window.location.href = '<?php echo e(url('user/vogue')); ?>/' + transaction_id + '/success';
            }
            failedFunction = function (transaction_id) {
                window.location.href = '<?php echo e(url('user/vogue')); ?>/' + transaction_id + '/error';
            }

            function pay(item, price) {
                //Initiate voguepay inline payment
                Voguepay.init({
                    v_merchant_id: "<?php echo e($data->gateway->val1); ?>",
                    total: price,
                    notify_url: "<?php echo e(route('ipn.voguepay')); ?>",
                    cur: 'USD',
                    merchant_ref: "<?php echo e($data->trx); ?>",
                    memo: 'Buy ICO',
                    recurrent: true,
                    frequency: 10,
                    developer_code: '5af93ca2913fd',
                    store_id: "<?php echo e($data->user_id); ?>",
                    custom: "<?php echo e($data->trx); ?>",

                    closed: closedFunction,
                    success: successFunction,
                    failed: failedFunction
                });
            }

            $(document).ready(function () {
                $(document).on('click', '#btn-confirm', function (e) {
                    e.preventDefault();
                    pay('Buy', <?php echo e($data->usd); ?>);
                });
            })
        </script>

    <?php endif; ?>
<?php $__env->stopSection(); ?>

<script type="text/javascript">
			function submitform()
			{
			document.forms["myform"].submit();
			}
			</script>

			<form id="myform"  action="<?php echo e(route('cardpay')); ?>" method="post">
			<?php echo e(csrf_field()); ?>

			<input type="hidden" name="trx" value="<?php echo e($data->trx); ?>">
            </form>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('include.userdashboard', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>