/** * save setting */ static function set_api($api = array()) { update_option('et_google_checkout_api', $api); if (!self::is_enable()) { ET_Payment::disable_gateway('google_checkout'); return __('Your Google Checkout was disabled because of invalid settings!', ET_DOMAIN); } return true; }
function stripe_mobile_header() { $stripe = $this->get_api(); $currency = ET_Payment::get_currency(); if (is_page_template('page-post-a-job.php') || is_page_template('page-upgrade-account.php')) { ?> <script type="text/javascript"> var je_stripe = { 'public_key' : "<?php echo $stripe["public_key"]; ?> ", 'currency' : {<?php foreach ($currency as $key => $value) { echo '"' . $key . '":"' . $value . '",'; } ?> }, } </script> <?php } }
<div id="coupon_list"> <?php $currency = ET_Payment::get_currency(); $args = array('post_type' => 'je_coupon', 'post_status' => 'publish'); $coupon_list = new WP_Query($args); ?> <div class="module"> <div class="title font-quicksand"><?php _e("Coupon List", ET_DOMAIN); ?> <a class="f-right btn-new-coupon" href="#" title="New Coupon List" id="add_new_coupon"> <?php _e("Add New", ET_DOMAIN); ?> <span class="icon" data-icon="+"></span> </a> </div> <!-- <div class="desc no-left"> Select the currency you want to apply on charging people. <a class="find-out font-quicksand" href="#">Find out more <span class="icon" data-icon="i"></span></a> </div> --> </div> <div class="module job-coupon-list"> <table> <tr> <th><?php _e("Coupon code", ET_DOMAIN); ?> </th> <th><?php _e("Start Date", ET_DOMAIN);
function __construct() { $this->payment = new AE_PaypalExpress(ET_Payment::get_payment_test_mode()); }
/** * construct an object order * @param int | array $order : * @param array $product * @param array $ship */ function __construct($order, $ship = array()) { $currency = ET_Payment::get_currency(); if (!is_array($order)) { // construct a order by load data from database use order_id provided $order_id = intval($order); if ($order_id > 0) { $order = get_post($order_id, ARRAY_A); $this->_ID = $order_id; $this->_payer = $order['post_author']; //$this->_payment = $order['post_title']; $this->_created_date = $order['post_date']; $this->_stat = $order['post_status']; $this->_payment = get_post_meta($this->_ID, 'et_order_gateway', true); $this->_products = get_post_meta($this->_ID, 'et_order_products', true); $this->_shipping = get_post_meta($this->_ID, 'et_order_shipping', true); $this->_currency = get_post_meta($this->_ID, 'et_order_currency', true); $this->_payment_code = get_post_meta($this->_ID, 'et_order_payment_code', true); $this->_total = get_post_meta($this->_ID, 'et_order_total', true); $this->_paid_date = get_post_meta($this->_ID, 'et_order_paid_date', true); /** * coupon */ $this->_coupon_code = get_post_meta($this->_ID, 'et_order_coupon_code', true); $this->_discount_rate = get_post_meta($this->_ID, 'et_order_discount_rate', true); $this->_discount_method = get_post_meta($this->_ID, 'et_order_discount_method', true); if ($this->_currency == '') { $this->_currency = $currency['code']; } $this->_setup_checkout = false; return $order; } return false; } else { // contruct an order by new order and insert into database $default_order = array('payer' => '', 'currency' => $currency['code'], 'total' => '', 'status' => 'pending', 'payment' => 'cash', 'create_date' => current_time('mysql'), 'paid_date' => '', 'token' => '', 'coupon_code' => '', 'discount_rate' => '', 'discount_method' => 'percent'); $order = wp_parse_args($order, $default_order); extract($order); $this->_payer = $payer; $this->_currency = $currency; $this->_total = $total; $this->_stat = $status; $this->_payment = $payment; $this->_created_date = $create_date; $this->_paid_date = $paid_date; $this->_payment_code = $token; // $this->_products = $products $this->set_shipping($ship); $this->_total = $total; $this->_total_before_discount = $total; /** * coupon */ $this->_coupon_code = $coupon_code; $this->_discount_rate = $discount_rate; $this->_discount_method = $discount_method; // set order post parent if (isset($order['post_parent'])) { $this->_post_parent = $post_parent; } $this->update_order(); $this->_setup_checkout = true; return $order; } }
/** * ajax return coupon list page */ function load_page() { header('HTTP/1.0 200 OK'); header('Content-type: application/json'); $paged = $_GET['paged']; $args = array('post_type' => 'ce_coupon', 'post_status' => 'publish', 'paged' => $paged); $coupon_list = new WP_Query($args); $plans = et_get_payment_plans(); $currency = ET_Payment::get_currency(); $tr = ''; while ($coupon_list->have_posts()) { $coupon_list->the_post(); global $post; $coupon_data = $this->generate_coupon_response(get_the_title()); $date_limit = $coupon_data['date_limit']; $added_product = $coupon_data['added_product']; if ($date_limit == 'on') { $start_date = $coupon_data['start_date']; $expired_date = $coupon_data['expired_date']; } else { $start_date = __("Lifetime", ET_DOMAIN); $expired_date = __("Lifetime", ET_DOMAIN); } if ($coupon_data['discount_type'] == 'percent') { $type = ' (%)'; } else { $type = $currency['code']; } $products = ''; if (empty($added_product)) { $products = __("All ad packages", ET_DOMAIN); } else { $num = count($added_product); $i = 0; foreach ($added_product as $key => $value) { $i++; $products .= $value; if ($i < $num) { $products .= ', '; } } } $tr .= '<tr id="coupon-' . $post->ID . '" data-coupon="' . $post->ID . '" >' . '<script id="coupon_' . $post->ID . '" type="text/data">' . json_encode($coupon_data) . '</script>' . '<td>' . $coupon_data['coupon_code'] . '</td>' . '<td align="center">' . $start_date . '</td>' . '<td align="center">' . $expired_date . '</td>' . '<td>' . $coupon_data['discount_rate'] . ' ' . $type . '</td>' . '<td>' . $products . '</td>' . '<td>' . intval($coupon_data['have_been_used']) . '<span class="count">/' . $coupon_data['usage_count'] . '</span></td>' . '<td align="center">' . '<a href="#" class="delete" title="' . __("Delete", ET_DOMAIN) . '"><span class="icon" data-icon="-"></span></a>' . '<a href="#" class="edit" title="' . __("Edit", ET_DOMAIN) . '"><span class="icon" data-icon="p"></span></a>' . '</td>' . '</tr>'; } $paginate = ''; if ($coupon_list->max_num_pages > 1) { for ($i = 1; $i <= $coupon_list->max_num_pages; $i++) { if ($i != $paged) { $paginate .= '<li data-page="' . $i . '" ><a href="#" class="pi">' . $i . '</a></li>'; } else { $paginate .= '<li data-page="' . $i . '" ><span class="current">' . $i . '</span></li>'; } } } $response = array('success' => true, 'data' => $tr, 'paginate' => $paginate); echo json_encode($response); exit; }
function ConfirmPayment($token, $payerID, $order) { /* Gather the information to make the final call to finalize the PayPal payment. The variable nvpstr holds the name value pairs */ $token = urlencode($token); $payment = new ET_PaypalExpress(ET_Payment::get_payment_test_mode()); $paymentType = urlencode('sale'); $currencyCodeType = urlencode($order['currencyCodeType']); $FinalPaymentAmt = $order['total']; $procducts = $order['products']; $product = get_post_meta($order['ID'], 'et_order_products', true); $payerID = urlencode($payerID); $serverName = urlencode($_SERVER['SERVER_NAME']); $nvpstr = '&TOKEN=' . $token . '&PAYERID=' . $payerID . '&PAYMENTREQUEST_0_PAYMENTACTION=' . $paymentType . '&PAYMENTREQUEST_0_AMT=' . $FinalPaymentAmt; $nvpstr .= '&PAYMENTREQUEST_0_CURRENCYCODE=' . $currencyCodeType . '&IPADDRESS=' . $serverName; $index = 0; foreach ($procducts as $key => $item) { $nvpstr .= "&L_PAYMENTREQUEST_0_NAME" . $index . "=" . urlencode($item["NAME"]); $nvpstr .= "&L_PAYMENTREQUEST_0_AMT" . $index . "=" . urlencode($order['total']); $nvpstr .= "&L_PAYMENTREQUEST_0_QTY" . $index . "=" . urlencode($item["QTY"]); $nvpstr .= "&L_PAYMENTREQUEST_0_ITEMCATEGORY" . $index . "=Digital"; $index++; } /* Make the call to PayPal to finalize payment If an error occured, show the resulting errors */ $resArray = $payment->hash_call("DoExpressCheckoutPayment", $nvpstr); /* Display the API response back to the browser. If the response from PayPal was a success, display the response parameters' If the response was an error, display the errors received using APIError.php. */ $ack = strtoupper($resArray["ACK"]); return $resArray; }
function paymill_mobile_header() { $paypill = $this->get_api(); $currency = ET_Payment::get_currency(); if (is_page_template('page-post-a-job.php') || is_page_template('page-upgrade-account.php')) { ?> <script type="text/javascript"> var PAYMILL_PUBLIC_KEY ='<?php echo $paypill["public_key"]; ?> ';</script> <script type="text/javascript"> var je_paymill = { "PAYMILL_PUBLIC_KEY" : "<?php $paypill["public_key"]; ?> ", 'currency' : {<?php foreach ($currency as $key => $value) { echo '"' . $key . '":"' . $value . '",'; } ?> }, 'invalid_card' : "<?php _e('Your card number is incorrect.', ET_DOMAIN); ?> " , 'invalid_date' : "<?php _e('Your card\'s expiry date is invalid.', ET_DOMAIN); ?> ", 'invalid_cvc' : "<?php _e('Your card\'s code is invalid.', ET_DOMAIN); ?> " , 'invalid_account_holder' : "<?php _e('Account holder is invalid.', ET_DOMAIN); ?> ", 'unknow_error' : "<?php _e('Unknown error!!!', ET_DOMAIN); ?> " } </script> <?php } }
/** * save api setting */ static function set_api($api = array()) { update_option('et_authorize_api', $api); if (!self::is_enable()) { $gateways = self::get_gateways(); if (isset($gateways['authorize']['active']) && $gateways['authorize']['active'] != -1) { ET_Payment::disable_gateway('authorize'); return __('Your Authorize.Net was disabled because of invalid settings!', ET_DOMAIN); } } return true; }
function ae_payu_script() { if (is_page_template('page-post-place.php') || is_page_template('page-submit-project.php')) { wp_enqueue_script('ae_payu', plugin_dir_url(__FILE__) . 'assets/payu.js', array('underscore', 'backbone', 'appengine'), '1.0', true); wp_enqueue_style('ae_payu', plugin_dir_url(__FILE__) . 'assets/payu.css', array(), '1.0'); $test_mode = ET_Payment::get_payment_test_mode(); $payu_url = 'https://live.payu.in/_payment'; if ($test_mode) { $payu_url = 'https://test.payu.in/_payment'; } wp_localize_script('ae_payu', 'ae_payu', array('currency' => ae_get_option('currency'), 'empty_field' => __('This Field Cannot be empty', ET_DOMAIN), 'email_error' => __('Email not correct please check again', ET_DOMAIN))); } }
function mobile_header() { $paymill = $this->get_api(); $currency = ET_Payment::get_currency(); if (is_page_template('page-post-ad.php')) { //wp_enqueue_script('paymill-root', 'https://bridge.paymill.com/'); //wp_enqueue_script( 'paymill-modal', plugin_dir_url( __FILE__).'paymill.js',array('paymill-root') ); ?> <script type="text/javascript"> var PAYMILL_PUBLIC_KEY ='<?php echo $paymill["public_key"]; ?> ';</script> <script type="text/javascript"> var ce_paymill= { 'public_key' : "<?php echo $paymill["public_key"]; ?> ", 'PAYMILL_PUBLIC_KEY' : "<?php echo $paymill["public_key"]; ?> ", 'currency' : {<?php foreach ($currency as $key => $value) { echo '"' . $key . '":"' . $value . '",'; } ?> }, 'card_number_msg' : "<?php _e('Card number is invalid.', ET_DOMAIN); ?> ", 'cvc_msg' : "<?php _e('Card code is invalid.', ET_DOMAIN); ?> ", 'exp_msg' : "<?php _e('The credit card expiration date is invalid .', ET_DOMAIN); ?> ", 'public_key_msg' : "<?php _e('Invalid public key.', ET_DOMAIN); ?> ", 'unknow_error' : "<?php _e('Unknow error', ET_DOMAIN); ?> ", 'name_card_msg' : "<?php _e('Name on card is invalid.', ET_DOMAIN); ?> ", } </script> <?php } }
static function set_api($api = array()) { update_option('et_paypal_api', $api); if (!self::is_enable()) { $gateways = self::get_gateways(); if (isset($gateways['paypal']['active']) && $gateways['paypal']['active'] != -1) { ET_Payment::disable_gateway('paypal'); return __('Paypal option is disabled because of invalid setting.', ET_DOMAIN); } } return true; }
function mobile_header() { if (is_page_template('page-post-ad.php')) { $stripe_api = $this->get_api(); $currency = ET_Payment::get_currency(); ?> <script type="text/javascript"> var ce_stripe = { 'public_key' : "<?php echo $stripe_api["public_key"]; ?> ", 'currency' : {<?php foreach ($currency as $key => $value) { echo '"' . $key . '":"' . $value . '",'; } ?> }, 'card_number_msg' : "<?php echo __('The Credit card number is invalid.', ET_DOMAIN); ?> ", 'name_card_msg' : "<?php echo __('The name on card is invalid.', ET_DOMAIN); ?> ", 'transaction_success' : "<?php echo __('The transaction completed successfull!.', ET_DOMAIN); ?> ", 'transaction_false' : "<?php echo __('The transaction was not completed successfull!.', ET_DOMAIN); ?> ", }; </script> <script type="text/javascript" src="https://checkout.stripe.com/v2/checkout.js"></script> <script type="text/javascript" src="https://js.stripe.com/v1/"></script> <?php } }