<?php
/* Smarty version 3.1.36, created on 2021-01-21 02:15:50
  from '/home/mycopjya/creamtask.com/prox-modules/paypal/views/paypal.order.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '3.1.36',
  'unifunc' => 'content_60092a26de39d6_68283884',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    '773d5058b64c10ea6f035d57bff917011d59e1cc' => 
    array (
      0 => '/home/mycopjya/creamtask.com/prox-modules/paypal/views/paypal.order.tpl',
      1 => 1597836354,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
  ),
),false)) {
function content_60092a26de39d6_68283884 (Smarty_Internal_Template $_smarty_tpl) {
?><div class="form-container">
    <div id="payment-form">
        <div class="form-header">
            <h1 class="Header-companyName"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['siteName']->value, ENT_QUOTES, 'UTF-8');?>
</h1>
            <h2 class="Header-purchaseDescription"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['title']->value, ENT_QUOTES, 'UTF-8');?>
</h2>
        </div>
        <div class="form-body">
            <div class="js_loader flat-spinner" style="display:none;"></div>
            <div id="paypal-button-container"></div>
            <a class="back_to_order" href="/dashboard/order/<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['order']->value['id'], ENT_QUOTES, 'UTF-8');?>
">Back to Order</a>
        </div>
    </div> 
</div> 

<?php echo '<script'; ?>

    src="https://www.paypal.com/sdk/js?client-id=<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['paypal_client']->value, ENT_QUOTES, 'UTF-8');?>
&currency=<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['currency']->value, ENT_QUOTES, 'UTF-8');?>
">
<?php echo '</script'; ?>
>

<?php echo '<script'; ?>
 type="text/javascript">
    paypal.Buttons({
        createOrder: function(data, actions) {
            return actions.order.create({
                purchase_units: [{
                    amount: {
                        value: '<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['amount']->value, ENT_QUOTES, 'UTF-8');?>
' 
                    },
                }],
                application_context: {
                    shipping_preference: 'NO_SHIPPING',
                }
            });
        },
        onApprove: function(data, actions) {
            return actions.order.capture().then(function(payment) {
                $('#paypal-button-container').hide();
                $('.js_loader').show();
                $.ajax({
                    method: "POST",
                    url: '<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['callback_url']->value, ENT_QUOTES, 'UTF-8');?>
',
                    data: { 
                        handle: 'order',
                        nodeId: '<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['order']->value['id'], ENT_QUOTES, 'UTF-8');?>
',
                        currency: '<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['currency']->value, ENT_QUOTES, 'UTF-8');?>
',
                        payment_method: '<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['payment_method']->value, ENT_QUOTES, 'UTF-8');?>
',
                        paymentId: payment.id,
                        payerId: payment.payer.payer_id
                    }
                })
                .done(function(response) {
                    if(response.success) {
                        window.location = '<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['success_url']->value, ENT_QUOTES, 'UTF-8');?>
';
                    } else {
                        window.location = '<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['decline_url']->value, ENT_QUOTES, 'UTF-8');?>
';
                    }
                });
            });
        }
    }).render('#paypal-button-container');
<?php echo '</script'; ?>
><?php }
}
