Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- global $wpdb, $_SESSION;
- $data = $wpdb->get_row( "SELECT * FROM ".$wpdb->prefix."dnu_donasi WHERE `id` ='".$_SESSION['dananu_donation_id']."'" );
- if(isset($_SESSION['dananu_guest_id'])){
- $user_id = $_SESSION['dananu_guest_id'];
- $guest = $wpdb->get_row( "SELECT * FROM ".$wpdb->prefix."dnu_guests WHERE `id` ='".$user_id."'" );
- $user_email = $guest->email;
- $user_handphone = $guest->handphone;
- $user_realname = $guest->nama_lengkap;
- }elseif(get_current_user_id() > 0){
- $user = wp_get_current_user();
- $user_id = $user->ID;
- $user_email = $user->user_email;
- $user_realname = $user->display_name;
- $user_meta = get_user_meta($user->id);
- $user_handphone = (!empty($user_meta['phone'][0])?$user_meta['phone'][0]:'0889995678');
- }
- $paymentPageId = get_option("dananu_e2pay_payment_page",0);
- $paymentPage = get_post($paymentPageId);
- if ( ! defined( 'ABSPATH' ) ) {
- exit( 'Direct script access denied.' );
- }
- wp_enqueue_script('dananu_main_script', plugins_url('dananu/assets/js/main.js'), array(), '1.12.0',true);
- wp_enqueue_style('dananu_style', plugins_url('dananu/assets/css/style.css'), array(), '1.0');
- ?>
- <?php get_header(); ?>
- <section id="content" <?php Avada()->layout->add_style( 'content_style' ); ?>>
- <?php while ( have_posts() ) : the_post(); ?>
- <div id="post-<?php the_ID(); ?>" <?php post_class(); ?> style="padding:20px 0px;">
- <?php
- if(isset($_GET['action']) && $_GET['action'] == 'show-form'){
- date_default_timezone_set('Asia/Jakarta');
- $user = wp_get_current_user();
- $e2pay_payments = dananu_e2pay_payments();
- $merchantKey = get_option('dananu_e2pay_merchant_key');
- $merchantCode = get_option('dananu_e2pay_merchant_code');
- $refNo = $data->id;
- $isTest = (get_option('dananu_e2pay_test_mode') == 'yes'?true:false);
- $getwayUrl = $isTest ? E2pay_Indonesia::URL_PAYMENT_SANDBOX : E2pay_Indonesia::URL_PAYMENT_PRODUCTION;
- $amount = $data->amount;
- $hashAmount = str_replace(".", "", str_replace(",", "", $amount)).'00';
- $currency = 'IDR';
- $str = $merchantKey . $merchantCode . $refNo . $hashAmount . $currency;
- $signature = new E2pay_Signature($str);
- $requestSignature = $signature->getSignature();
- $userInfo = '';//$this->get_billing_address($order);
- // $pageId = get_option("dananu_e2pay_payment_page",0);
- //$page = get_post($pageId);
- $backendUrl = get_permalink($paymentPage->ID).'?response=e2pay';
- $responseUrl = get_permalink($paymentPage->ID).'?action=show-form&payment=e2pay&responseURL=true';
- if(isset($_GET['payment']) AND $_GET['payment'] == 'e2pay'){
- $payment_description = '';
- if($_POST['Status'] == 0 AND !empty($_POST['ErrDesc'])){
- $payment_description = $_POST['ErrDesc'];
- ?>
- <div class="col-md-12">
- <p style="text-align:center"><strong><?php echo $_POST['ErrDesc'];?></strong></p>
- </div>
- <?php
- }
- $transaction = new E2pay_Transaction($_POST);
- $transaction->setMerchantKey($merchantKey);
- $transaction->setSignature($_POST['Signature']);
- if($transaction->isPaid()) {
- /*$wpdb->update( $wpdb->prefix.'dnu_donasi', array('payment_status' => 'completed','payment_date' => date('Y-m-d H:i:s'),'updated_at' => date('Y-m-d H:i:s')), array('id' => $data->id), array('%s','%s','%s'), array('%d') );
- unset($_SESSION['dananu_donation_id']);
- if(isset($_REQUEST['responseURL']) && $_REQUEST['responseURL'] == 'true') {
- $pageId = get_option("dananu_e2pay_thankyou_page",0);
- $page = get_post($pageId);
- wp_redirect($page->guid);
- exit;
- die();
- }else{
- die('RECEIVEOK');
- }
- */
- }elseif ($transaction->isWaitingPayment()) {
- $wpdb->update( $wpdb->prefix.'dnu_donasi', array('payment_status' => 'wait-payment','payment_date' => date('Y-m-d H:i:s'),'payment_description' => $payment_description,'updated_at' => date('Y-m-d H:i:s')), array('id' => $data->id), array('%s','%s','%s','%s'), array('%d') );
- // unset($_SESSION['dananu_donation_id']);
- ?>
- <div class="col-md-12">
- <p style="text-align:center"><strong>Donasi anda dalam proses menunggu pembayaran</strong><br />
- <a class="block-link" href="/">« Kembali ke Beranda</a></p>
- </div>
- <?php
- } else {
- $wpdb->update( $wpdb->prefix.'dnu_donasi', array('payment_status' => 'cancel','payment_date' => date('Y-m-d H:i:s'),'payment_description' => $payment_description, 'updated_at' => date('Y-m-d H:i:s')), array('id' => $data->id), array('%s','%s','%s','%s'), array('%d') );
- unset($_SESSION['dananu_donation_id']);
- //$order->cancel_order(__('Reason: ' . $_POST['ErrDesc'], E2P_TEXT_DOMAIN));
- ?>
- <div class="col-md-12">
- <p style="text-align:center"><strong>Donasi anda dibatalkan</strong><br />
- <a class="block-link" href="/">« Kembali ke Beranda</a></p>
- </div>
- <?php
- }
- if(isset($_SESSION['dananu_guest_id'])){
- unset($_SESSION['dananu_guest_id']);
- }
- }
- if(isset($_SESSION['dananu_donation_id'])){
- ?>
- <div class="col-sm-6">
- <div class="box-border">
- <h4>Informasi Donatur</h4>
- <div class="block-table">
- <table class="table table-normal">
- <tbody>
- <tr>
- <td width="30%">Nama</td>
- <td width="5%">:</td>
- <td><?php echo $user_realname;?></td>
- </tr>
- <tr>
- <td>Email</td>
- <td>:</td>
- <td><?php echo $user_email; ?></td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h3 style="margin-bottom:4px;">NO INVOICE <?php echo $data->invoice;?></h3>
- <div class="alert alert-success" style="background-color:#a5fdaf;font-size:12px;color:#000;">
- <strong>Langkah Donasi di halaman ini</strong>
- <p style="margin:2px 0 0 6px;line-height:18px;">1. Silahkan Periksa kembali Data Transaksi Anda</p>
- <p style="margin:2px 0 0 6px;line-height:18px;">2. Silahkan Pilih jenis Pembayaran(Debit Online,Bank Transfer, Kartu Kredit / Debit)</p>
- <p style="margin:2px 0 0 6px;line-height:18px;">3. Klik tombol Bayar </p>
- </div>
- <table class="table table-custom">
- <thead>
- <tr>
- <th width="10%">NO</th>
- <th>JENIS DONASI</th>
- <th>JUMLAH DONASI</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>1</td>
- <td><?php echo dananu_donations()[$data->type];?></td>
- <td><?php echo dananu_change_currency($data->amount);?></td>
- </tr>
- </tbody>
- <tfoot style="background-color:#f8f8f8;">
- <tr>
- <td colspan="2" style="text-align:right;">
- <strong>Total</strong>
- </td>
- <td>
- <?php echo dananu_change_currency($data->amount);?>
- </td>
- </tr>
- </tfoot>
- </table>
- <div class="clearfix vert-pass" style="padding-bottom:15px;">
- </div>
- </div>
- <div class="col-sm-6">
- <div class="box-border">
- <h6 style="font-weight:bold;margin-bottom:6px;">Pilih Pembayaran</h6>
- <div class="box-tabs">
- <ul class="tabber clearfix">
- <li><a class="active" data-target="#donasi_online">Debit Online <i class="fa fa-money" aria-hidden="true"></i></a></li>
- <li><a data-target="#transfer_bank">Bank Transfer <i class="fa fa-university" aria-hidden="true"></i></a></li>
- <li><a data-target="#kartu_kredit">Kartu Kredit / Debit <i class="fa fa-credit-card" aria-hidden="true"></i></a></li>
- </ul>
- <div class="content-tabs">
- <div id="donasi_online" class="this-tab">
- <form name="e2payPaymentRedirectForm" method="POST" action="<?php echo $getwayUrl;?>">
- <input type="hidden" name="MerchantCode" value="<?php echo $merchantCode;?>" />
- <input type="hidden" name="RefNo" value="<?php echo $data->id;?>" />
- <input type="hidden" name="Amount" value="<?php echo $amount;?>00" />
- <input type="hidden" name="Currency" value="<?php echo $currency;?>" />
- <input type="hidden" name="ProdDesc" value="'Order #<?php echo $data->id;?>" />
- <input type="hidden" name="UserName" value="<?php echo $user_realname;?>" />
- <input type="hidden" name="UserEmail" value="<?php echo $user_email;?>" />
- <input type="hidden" name="UserContact" value="<?php echo $user_handphone;?>" />
- <input type="hidden" name="Lang" value="UTF-8" />
- <input type="hidden" name="Signature" value="<?php echo $requestSignature;?>" />
- <input type="hidden" name="ResponseURL" value="<?php echo $responseUrl;?>" />
- <input type="hidden" name="BackendURL" value="<?php echo $backendUrl;?>" />
- <ul class="icon-payment">
- <?php foreach ($e2pay_payments as $key => $label){ ?>
- <?php
- if(($key <> 'credit_card' AND $key <> 'maybank') && get_option('dananu_e2pay_payment_'.$key,'no') == 'yes'){?>
- <li>
- <label>
- <input name="PaymentId" value="<?php echo dananu_e2pay_payment_method_id($key);?>" type="radio"> <img src="<?php echo plugins_url('dananu/assets/images/e2pay/'.$key.'.png');?>" alt="<?php echo $label;?>" width="90" />
- </label>
- </li>
- <?php
- } ?>
- <?php } ?>
- </ul>
- <input type="submit" value="Bayar" class="block-link" style="background-color:#017632;color:#fff;float:right;border:0 none;height:40px;margin:10px;"/>
- <div style="clear:both"></div>
- </form>
- </div>
- <div id="transfer_bank" class="this-tab" style="display:none;">
- <form name="e2payPaymentRedirectForm" method="POST" action="<?php echo $getwayUrl;?>">
- <input type="hidden" name="MerchantCode" value="<?php echo $merchantCode;?>" />
- <input type="hidden" name="RefNo" value="<?php echo $data->id;?>" />
- <input type="hidden" name="Amount" value="<?php echo $amount;?>00" />
- <input type="hidden" name="Currency" value="<?php echo $currency;?>" />
- <input type="hidden" name="ProdDesc" value="'Order #<?php echo $data->id;?>" />
- <input type="hidden" name="UserName" value="<?php echo $user_realname;?>" />
- <input type="hidden" name="UserEmail" value="<?php echo $user_email;?>" />
- <input type="hidden" name="UserContact" value="<?php echo $user_handphone;?>" />
- <input type="hidden" name="Lang" value="UTF-8" />
- <input type="hidden" name="Signature" value="<?php echo $requestSignature;?>" />
- <input type="hidden" name="ResponseURL" value="<?php echo $responseUrl;?>" />
- <input type="hidden" name="BackendURL" value="<?php echo $backendUrl;?>" />
- <ul class="icon-payment">
- <?php foreach ($e2pay_payments as $key => $label){ ?>
- <?php
- if($key == 'maybank' && get_option('dananu_e2pay_payment_'.$key,'no') == 'yes'){?>
- <li>
- <label>
- <input name="PaymentId" value="<?php echo dananu_e2pay_payment_method_id($key);?>" type="radio"> <img src="<?php echo plugins_url('dananu/assets/images/e2pay/'.$key.'.png');?>" alt="<?php echo $label;?>" width="90" style="margin-top:10px;"/>
- </label>
- </li>
- <?php
- } ?>
- <?php } ?>
- </ul>
- <input type="submit" value="Bayar" class="block-link" style="background-color:#017632;color:#fff;float:right;border:0 none;height:40px;margin:10px;"/>
- <div style="clear:both"></div>
- </form>
- </div>
- <div id="kartu_kredit" class="this-tab" style="display:none;">
- <form name="e2payPaymentRedirectForm" method="POST" action="<?php echo $getwayUrl;?>">
- <input type="hidden" name="MerchantCode" value="<?php echo $merchantCode;?>" />
- <input type="hidden" name="RefNo" value="<?php echo $data->id;?>" />
- <input type="hidden" name="Amount" value="<?php echo $amount;?>00" />
- <input type="hidden" name="Currency" value="<?php echo $currency;?>" />
- <input type="hidden" name="ProdDesc" value="'Order #<?php echo $data->id;?>" />
- <input type="hidden" name="UserName" value="<?php echo $user_realname;?>" />
- <input type="hidden" name="UserEmail" value="<?php echo $user_email;?>" />
- <input type="hidden" name="UserContact" value="<?php echo $user_handphone;?>" />
- <input type="hidden" name="Lang" value="UTF-8" />
- <input type="hidden" name="Signature" value="<?php echo $requestSignature;?>" />
- <input type="hidden" name="ResponseURL" value="<?php echo $responseUrl;?>" />
- <input type="hidden" name="BackendURL" value="<?php echo $backendUrl;?>" />
- <ul class="icon-payment">
- <?php foreach ($e2pay_payments as $key => $label){ ?>
- <?php
- if($key == 'credit_card' && get_option('dananu_e2pay_payment_'.$key,'no') == 'yes'){?>
- <li>
- <label>
- <input name="PaymentId" value="<?php echo dananu_e2pay_payment_method_id($key);?>" type="radio"> <img src="<?php echo plugins_url('dananu/assets/images/e2pay/'.$key.'.png');?>" alt="<?php echo $label;?>" width="90" style="margin-top:10px;"/>
- </label>
- </li>
- <?php
- } ?>
- <?php } ?>
- </ul>
- <input type="submit" value="Bayar" class="block-link" style="background-color:#017632;color:#fff;float:right;border:0 none;height:40px;margin:10px;"/>
- <div style="clear:both"></div>
- </form>
- </div>
- </div>
- </div>
- </div>
- </div><!--end payment block-->
- <?php } ?>
- </div>
- <?php
- }else{?>
- <div class="<?php echo (($user_id > 0 OR isset($_SESSION['dananu_guest_id']))? 'nopadding_dananu col-sm-8 col-sm-offset-2':'col-sm-8 ');?>">
- <h3 style="margin-bottom:4px;">NO INVOICE <?php echo $data->invoice;?></h3>
- <div class="alert alert-success" style="background-color:#a5fdaf;font-size:12px;color:#000;">
- <strong>Langkah Donasi di halaman ini</strong>
- <p style="margin:2px 0 0 6px;line-height:18px;">1. Silahkan Periksa kembali Data Transaksi Anda</p>
- <p style="margin:2px 0 0 6px;line-height:18px;">2. Silahkan Pilih jenis Pembayaran(Debit Online, Bank Transfer, Kartu Kredit / Debit)</p>
- <p style="margin:2px 0 0 6px;line-height:18px;">3. Klik tombol Metode Pembayaran</p>
- </div>
- <table class="table table-custom">
- <thead>
- <tr>
- <th width="10%">NO</th>
- <th>JENIS DONASI</th>
- <th>JUMLAH DONASI</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>1</td>
- <td><?php echo dananu_donations()[$data->type];?></td>
- <td><?php echo dananu_change_currency($data->amount);?></td>
- </tr>
- </tbody>
- <tfoot style="background-color:#f8f8f8;">
- <tr>
- <td colspan="2" style="text-align:right;">
- <strong>Total</strong>
- </td>
- <td>
- <?php echo dananu_change_currency($data->amount);?>
- </td>
- </tr>
- </tfoot>
- </table>
- <div class="clearfix vert-pass" style="padding-bottom:15px;">
- <a class="block-link" href="/">« Kembali ke Beranda</a>
- <?php if($user_id > 0 OR isset($_SESSION['dananu_guest_id'])){?>
- <a href="<?php echo get_permalink($paymentPage->ID);?>?action=show-form" class="block-link blok_pilh_dananu_ijo" style="">PILIH METODE PEMBAYARAN</a>
- <?php } ?>
- </div>
- <?php } ?>
- </div>
- <?php
- if($user_id > 0 OR isset($_SESSION['dananu_guest_id'])){
- }else{
- ?>
- <div class="hidez col-sm-4">
- <?php wp_login_form();?>
- </div>
- <?php
- }
- ?>
- <?php endwhile; ?>
- <?php wp_reset_postdata(); ?>
- </div>
- </section>
- <?php do_action( 'avada_after_content' ); ?>
- <?php get_footer();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement