JezK
Edit File: paypal.php
<?php global $wpdb; $tb_booking = $wpdb->prefix . 'bookingan'; $tb_konfirmasi = $wpdb->prefix . 'konfirmasi'; //--- Paypal Callback Page if ($redirect == 'thanks' && $_POST) { date_default_timezone_set('Asia/Jakarta'); $trx_id = $_POST['txn_id']; $trx_time = $_POST['payment_date']; $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $payer_email = $_POST['payer_email']; $ammount = $_POST['payment_gross']; $is_ammount = 'USD '.$ammount; $invoice_raw = explode("-",$_POST['invoice']); $invoice = $invoice_raw[0]; $payment_status = $_POST['payment_status']; $channel = 'Paypal'; $item_name = $_POST['item_name']; $gateway_notice = 'Pembayaran diverifikasi otomatis oleh sistem (Paypal)'; $timestamp = current_time('mysql'); $etime = current_time('d M Y h:i a'); $tanggal = current_time('d M Y'); $x = $wpdb->get_row( "SELECT * FROM $tb_booking WHERE invoice = '$invoice'" ); $y = $wpdb->get_row( "SELECT * FROM $tb_konfirmasi WHERE txn_id = '$trx_id'" ); $nama = $first_name.' '.$last_name; $email_cust = $payer_email; $nohp = $x->hp_cust; $dp = $x->dp; $status = $x->status; if (!$y && $payment_status == 'Completed') { // ubah status booking (dp paid) if ($dp != '100' && $status == 'unpaid') { $sql = $wpdb->query(" UPDATE $tb_booking SET status = 'dp', payment = 'paypal', paystatus = 'dp-paid', dp_paydata = '$trx_time|$trx_id|$channel|DP $dp%' WHERE invoice = '$invoice' "); $pesan_cust = 'Down Payment '.$dp.'%<br>'.$gateway_notice; $is_dp = 'DP '.$dp.'%'; } else { // ubah status booking (full paid) $sql = $wpdb->query(" UPDATE $tb_booking SET dp = '100', status = 'paid', payment = 'paypal', paystatus = 'paid', paydata = '$trx_time|$trx_id|$channel|$gateway_notice' WHERE invoice = '$invoice' "); $pesan_cust = 'Full Payment<br>'.$gateway_notice; $is_dp = false; } if($sql) { // insert data konfirmasi (verified) $wpdb->insert( $tb_konfirmasi, array( 'time' => $timestamp, 'etime' => $etime, 'nama_cust' => $nama, 'email_cust' => $email_cust, 'hp_cust' => null, 'pesan_cust' => $pesan_cust, 'invoice' => $invoice, 'txn_id' => $trx_id, 'tgl_transfer' => $tanggal, 'jmlh_transfer' => $ammount, 'rek_tujuan' => $channel, 'imgcode' => 'paypal', 'status' => 'verified', ) ); // kirim notifikasi pembayaran valid include(get_template_directory().'/functions/notifikasi/pay-paid.php'); } } ?> <div id="headback"> <div class="titleheader"> <?php if ($oketheme['translate'] == 'id') { ?> <h1>Transaksi Sukses</h1> <p>Hooray.. transaksi pembayaran Anda telah berhasil diproses</p> <?php } else { ?> <h1>Successful Transaction</h1> <p>Hooray.. Your payment transaction has been successfully processed</p> <?php } ?> </div> </div> <div id="conwrap"> <div class="elementjudul"><i class="glyphicon glyphicon-ok"></i> Status: <?php echo $payment_status?></div> <div class="toursent"> <?php if ($oketheme['translate'] == 'id') { ?> Berikut ini adalah detail transaksi pembayaran Anda: <ul> <li>Total Pembayaran : <strong class="t1"><?php echo $is_ammount?></strong></li> <li>Pembayaran via <img style="margin-left:5px" src="<?php echo get_template_directory_uri(); ?>/images/bank/paypal.png" alt="Paypal"></li> <li>ID Transaksi Paypal : <strong class="t1"><?php echo $trx_id?></strong></li> <li>Nama Item : <strong class="t1"><?php echo $item_name?></strong></li> <li>Invoice ID : <strong class="t1"><?php echo $invoice?></strong></li> </ul> <?php } else { ?> Here is the details of your payment transactions: <ul> <li>Total Payment : <strong class="t1"><?php echo $is_ammount?></strong></li> <li>Payment via <img style="margin-left:5px" src="<?php echo get_template_directory_uri(); ?>/images/bank/paypal.png" alt="Paypal"></li> <li>Paypal Transaction ID : <strong class="t1"><?php echo $trx_id?></strong></li> <li>Item Name : <strong class="t1"><?php echo $item_name?></strong></li> <li>Invoice ID : <strong class="t1"><?php echo $invoice?></strong></li> </ul> <?php } if ($oketheme['thanks_text']) { ?> <div class="wrap-post info" style="border-color:#F2F2F2;background:#FFF"> <?php echo $oketheme['thanks_text'];?> </div> <?php } ?> </div> </div> <?php // Else direct to homepage } else { ?> <meta http-equiv="Refresh" content="5;url=<?php echo home_url(); ?>"> <div id="headback"> <div class="titleheader"> <?php if ($t == 'id') { echo '<h1>Opsss... Maaf!</h1><p>Seharusnya Anda tidak berada di halaman ini...</p>'; } else { echo '<h1>Opsss... Sorry!</h1><p>You should not be on this page...</p>'; } ?> </div> </div> <div id="conwrap"> <?php if ($t == 'id') { ?> <div class="wrap-post" style="text-align:center"> <h2>Anda akan diarahkan ke halaman beranda dalam beberapa detik...</h2> <img src="<?php echo get_template_directory_uri(); ?>/images/loading.gif"><br/> Apabila tidak berhasil diarahkan, silahkan <a href="<?php echo home_url(); ?>">klik disini</a> </div> <p align="center" style="margin-top:40px"> Bila ada pertanyaan, silahkan hubungi <a href="#kontak" data-fancybox="kontak" class="pop">layanan pelanggan</a> kami. </p> <?php } else { ?> <div class="wrap-post" style="text-align:center"> <h2>You'll be redirected to the home page in a few seconds...</h2> <img src="<?php echo get_template_directory_uri(); ?>/images/loading.gif"><br/> If it is not successfully directed, please <a href="<?php echo home_url(); ?>">click here</a> </div> <p align="center" style="margin-top:40px"> If you have any questions, please <a href="#kontak" data-fancybox="kontak" class="pop">contact</a> our customer service. </p> <?php } ?> </div> <?php } ?>