function order_confirmation_message($order, $cart_info = '') { global $tc; $order = tc_get_order_id_by_name($order); $order = new TC_Order($order->ID); $content = ''; if ($order->details->post_status == 'order_received') { $content .= '<p>' . sprintf(__('Your payment via %s for this order totaling <strong>%s</strong> is not yet complete.', 'tc'), $this->public_name, apply_filters('tc_cart_currency_and_format', $order->details->tc_payment_info['total'])) . '</p>'; $content .= '<p>' . __('Current order status:', 'tc') . ' <strong>' . __('Pending Review') . '</strong></p>'; } else { if ($order->details->post_status == 'order_fraud') { $content .= '<p>' . __('Your payment is under review. We will back to you soon.', 'tc') . '</p>'; } else { if ($order->details->post_status == 'order_paid') { $content .= '<p>' . sprintf(__('Your payment via %s for this order totaling <strong>%s</strong> is complete.', 'tc'), $this->public_name, apply_filters('tc_cart_currency_and_format', $order->details->tc_payment_info['total'])) . '</p>'; } } } $content = apply_filters('tc_order_confirmation_message_content_' . $this->plugin_name, $content); $content = apply_filters('tc_order_confirmation_message_content', $content, $order); $content .= '<br /><br />' . $tc->get_setting('gateways->free_orders->instructions'); $tc->remove_order_session_data(); $tc->maybe_skip_confirmation_screen($this, $order); return $content; }
function order_confirmation($order, $payment_info = '', $cart_info = '') { global $tc; if (isset($_POST['payment_status']) || isset($_POST['txn_type'])) { echo ''; $total = $_REQUEST['mc_gross']; $order_var = $_REQUEST['custom']; $order = tc_get_order_id_by_name($order_var); $raw_post_data = file_get_contents('php://input'); $raw_post_array = explode('&', $raw_post_data); $myPost = array(); foreach ($raw_post_array as $keyval) { $keyval = explode('=', $keyval); if (count($keyval) == 2) { $myPost[$keyval[0]] = urldecode($keyval[1]); } } $req = 'cmd=_notify-validate'; if (function_exists('get_magic_quotes_gpc')) { $get_magic_quotes_exists = true; } foreach ($myPost as $key => $value) { if ($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) { $value = urlencode(stripslashes($value)); } else { $value = urlencode($value); } $req .= "&{$key}={$value}"; } if ($this->get_option('mode', 'sandbox') == 'sandbox') { $url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; } else { $url = 'https://www.paypal.com/cgi-bin/webscr'; } $args['user-agent'] = $tc->title; $args['body'] = $req; $args['sslverify'] = false; $args['timeout'] = 60; $response = wp_remote_post($url, $args); if (is_wp_error($response) || wp_remote_retrieve_response_code($response) != 200) { //|| $response[ 'body' ] != 'VERIFIED' //do nothing, wait for IPN message } else { //request is verified switch ($_POST['payment_status']) { case 'Completed': $tc->update_order_payment_status($order->ID, true); break; case 'Processed': //$tc->update_order_payment_status( $order->ID, true ); break; case 'Canceled-Reversal': //$tc->update_order_payment_status( $order->ID, true ); break; default: //do nothing, wait for IPN message } $tc->remove_order_session_data(); } } }
function ipn() { global $tc; if (isset($_REQUEST['message_type']) && $_REQUEST['message_type'] == 'INVOICE_STATUS_CHANGED') { $sale_id = $_REQUEST['sale_id']; //just for calculating hash $tco_vendor_order_id = $_REQUEST['vendor_order_id']; //order "name" $total = $_REQUEST['invoice_list_amount']; $order_id = tc_get_order_id_by_name($tco_vendor_order_id); //get order id from order name $order_id = $order_id->ID; $order = new TC_Order($order_id); if (!$order) { header('HTTP/1.0 404 Not Found'); header('Content-type: text/plain; charset=UTF-8'); echo 'Invoice not found'; exit; } $hash = md5($sale_id . $this->get_option('sid', '', '2checkout') . $_REQUEST['invoice_id'] . $this->get_option('sid', 'secret_word', '2checkout')); if ($_REQUEST['md5_hash'] != strtolower($hash)) { header('HTTP/1.0 403 Forbidden'); header('Content-type: text/plain; charset=UTF-8'); echo "2Checkout hash key doesn't match"; exit; } if (strtolower($_REQUEST['invoice_status']) != "deposited") { header('HTTP/1.0 200 OK'); header('Content-type: text/plain; charset=UTF-8'); echo 'Waiting for deposited invoice status.'; exit; } if (intval(round($total, 2)) >= round($order->details->tc_payment_info['total'], 2)) { $tc->update_order_payment_status($order_id, true); header('HTTP/1.0 200 OK'); header('Content-type: text/plain; charset=UTF-8'); echo 'Order completed and verified.'; exit; } else { $tc->update_order_status($order_id, 'order_fraud'); header('HTTP/1.0 200 OK'); header('Content-type: text/plain; charset=UTF-8'); echo 'Fraudulent order detected and changed status.'; exit; } } }
<?php global $tc, $wp; $tc_order_return = isset($wp->query_vars['tc_order_return']) ? $wp->query_vars['tc_order_return'] : ''; if ($tc_order_return !== '') { $order = tc_get_order_id_by_name($tc_order_return); $order = new TC_Order($order->ID); $gateway_class = $order->details->tc_cart_info['gateway_class']; $payment_info = $order->details->tc_payment_info; $cart_info = $order->details->tc_cart_info; } $cart_info_cookie = $tc->get_cart_info_cookie(); $order_cookie = $tc->get_order_cookie(); $payment_class_name = $gateway_class; //isset($gateway_class) ? $gateway_class : isset($_SESSION[ 'cart_info' ]) && isset( $_SESSION[ 'cart_info' ][ 'gateway_class' ] ) ? $_SESSION[ 'cart_info' ][ 'gateway_class' ] : (isset($cart_info_cookie[ 'gateway_class' ]) ? $cart_info_cookie[ 'gateway_class' ] : ''); $payment_gateway = new $payment_class_name(); $order_id = isset($tc_order_return) ? $tc_order_return : (isset($_SESSION['tc_order']) ? $_SESSION['tc_order'] : (isset($order_cookie) && !empty($order_cookie) ? $order_cookie : '')); do_action('tc_track_order_confirmation', $order_id, isset($payment_info) ? $payment_info : '', isset($cart_info) ? $cart_info : ''); $payment_gateway->order_confirmation($order_id, isset($payment_info) ? $payment_info : '', isset($cart_info) ? $cart_info : ''); echo $payment_gateway->order_confirmation_message($order_id, isset($cart_info) ? $cart_info : '');
<?php global $wp, $tc; //$tc->remove_order_session_data(); //prevent search engine to index order pages for security reasons add_action('wp_head', 'tc_no_index_no_follow'); if (isset($wp->query_vars['tc_order']) && isset($wp->query_vars['tc_order_key'])) { $order_id = $wp->query_vars['tc_order']; $order_key = $wp->query_vars['tc_order_key']; $order = tc_get_order_id_by_name($order_id); $tc_general_settings = get_option('tc_general_setting', false); if (isset($tc_general_settings['force_login']) && $tc_general_settings['force_login'] == 'yes' && !is_user_logged_in()) { ?> <div class="force_login_message"><?php printf(__('Please %s to see this page', 'tc'), '<a href="' . wp_login_url(tc_current_url()) . '">' . __('Log In', 'tc') . '</a>'); ?> </div> <?php } else { ?> <div class="tc-container"> <?php if ($order) { ?> <div class="tickera"> <?php tc_get_order_details_front($order->ID, $order_key); ?> </div><!-- tickera --> <?php
function order_confirmation($order, $payment_info = '', $cart_info = '') { global $tc; $received_order = $order; $order = tc_get_order_id_by_name($order); $order_object = new TC_Order($order->ID); $transaction_id = $order_object->details->tc_payment_info['transaction_id']; if (isset($transaction_id)) { $this->init_mollie(); $payment = $this->mollie->payments->get($transaction_id); $order_id = $payment->metadata->order_id; if ($payment->isPaid() == TRUE) { $paid = true; $tc->update_order_payment_status($order->ID, $paid); } elseif ($payment->isOpen() == FALSE) { //do nothing, it's not paid yet } } }
function request($posted) { global $tc; if (!empty($posted['reference_sale'])) { $order = tc_get_order_id_by_name($posted['reference_sale']); if (!empty($posted['response_message_pol'])) { // We are here so lets check status and do actions if (isset($posted['response_message_pol']) && $posted['response_message_pol'] == 'APPROVED') { $tc->update_order_payment_status($order->ID, true); } } } }
function get_status() { global $tc; if (isset($_POST['REFERENCE'])) { $key = $_POST['REFERENCE']; //order id $order = tc_get_order_id_by_name($key); if ($_POST['TRANSACTION_STATUS'] == '1') { $tc->update_order_payment_status($order->ID, true); } else { //Payment failed } } }
function tc_order_created_email($order_id, $status, $cart_contents = false, $cart_info = false, $payment_info = false, $send_email_to_admin = true) { global $tc; $tc_email_settings = get_option('tc_email_setting', false); $email_send_type = isset($tc_email_settings['email_send_type']) ? $tc_email_settings['email_send_type'] : 'wp_mail'; $order_id = strtoupper($order_id); $order = tc_get_order_id_by_name($order_id); if ($cart_contents === false) { $cart_contents = get_post_meta($order->ID, 'tc_cart_contents', true); } if ($cart_info === false) { $cart_info = get_post_meta($order->ID, 'tc_cart_info', true); } $buyer_name = $cart_info['buyer_data']['first_name_post_meta'] . ' ' . $cart_info['buyer_data']['last_name_post_meta']; if ($payment_info === false) { $payment_info = get_post_meta($order->ID, 'tc_payment_info', true); } add_filter('wp_mail_content_type', 'set_content_type'); function set_content_type($content_type) { return 'text/html'; } do_action('tc_before_order_created_email'); if ($status == 'order_paid') { //Send e-mail to the client if (!isset($tc_email_settings['client_send_message']) || isset($tc_email_settings['client_send_message']) && $tc_email_settings['client_send_message'] == 'yes') { add_filter('wp_mail_from', 'client_email_from_email', 999); add_filter('wp_mail_from_name', 'client_email_from_name', 999); $subject = isset($tc_email_settings['client_order_subject']) ? $tc_email_settings['client_order_subject'] : __('Order Completed', 'tc'); $default_message = 'Hello, <br /><br />Your order (ORDER_ID) totalling <strong>ORDER_TOTAL</strong> is completed. <br /><br />You can download your tickets here: DOWNLOAD_URL'; $message = isset($tc_email_settings['client_order_message']) ? $tc_email_settings['client_order_message'] : $default_message; $order = new TC_Order($order->ID); $order_status_url = $tc->tc_order_status_url($order, $order->details->tc_order_date, '', false); $placeholders = array('ORDER_ID', 'ORDER_TOTAL', 'DOWNLOAD_URL', 'BUYER_NAME', 'ORDER_DETAILS'); $placeholder_values = array($order_id, apply_filters('tc_cart_currency_and_format', $payment_info['total']), $order_status_url, $buyer_name, tc_get_order_details_email($order->details->ID, $order->details->tc_order_date, true)); $to = $cart_info['buyer_data']['email_post_meta']; $message = str_replace(apply_filters('tc_order_completed_client_email_placeholders', $placeholders), apply_filters('tc_order_completed_client_email_placeholder_values', $placeholder_values), $message); $client_headers = ''; if ($email_send_type == 'wp_mail') { wp_mail($to, $subject, html_entity_decode(stripcslashes(apply_filters('tc_order_completed_admin_email_message', wpautop($message)))), apply_filters('tc_order_completed_client_email_headers', $client_headers)); } else { $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; $headers .= 'From: ' . client_email_from_email('') . "\r\n" . 'Reply-To: ' . client_email_from_email('') . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, stripcslashes(wpautop($message)), apply_filters('tc_order_completed_client_email_headers', $headers)); } } /* --------------------------------------------------------------------- */ //Send e-mail to the admin if ((!isset($tc_email_settings['admin_send_message']) || isset($tc_email_settings['admin_send_message']) && $tc_email_settings['admin_send_message'] == 'yes') && $send_email_to_admin) { add_filter('wp_mail_from', 'admin_email_from_email', 999); add_filter('wp_mail_from_name', 'admin_email_from_name', 999); $subject = isset($tc_email_settings['admin_order_subject']) ? $tc_email_settings['admin_order_subject'] : __('New Order Completed', 'tc'); $default_message = 'Hello, <br /><br />a new order (ORDER_ID) totalling <strong>ORDER_TOTAL</strong> has been placed. <br /><br />You can check the order details here: ORDER_ADMIN_URL'; $message = isset($tc_email_settings['admin_order_message']) ? $tc_email_settings['admin_order_message'] : $default_message; $order = tc_get_order_id_by_name($order_id); $order = new TC_Order($order->ID); $order_admin_url = admin_url('edit.php?post_type=tc_events&page=tc_orders&action=details&ID=' . $order->details->ID); $placeholders = array('ORDER_ID', 'ORDER_TOTAL', 'ORDER_ADMIN_URL', 'BUYER_NAME'); $placeholder_values = array($order_id, apply_filters('tc_cart_currency_and_format', $payment_info['total']), $order_admin_url, $buyer_name); $to = isset($tc_email_settings['admin_order_from_email']) ? $tc_email_settings['admin_order_from_email'] : get_option('admin_email'); $message = str_replace(apply_filters('tc_order_completed_admin_email_placeholders', $placeholders), apply_filters('tc_order_completed_admin_email_placeholder_values', $placeholder_values), $message); $admin_headers = ''; //'From: ' . admin_email_from_name( '' ) . ' <' . admin_email_from_email( '' ) . '>' . "\r\n"; if ($email_send_type == 'wp_mail') { wp_mail($to, $subject, html_entity_decode(stripcslashes(apply_filters('tc_order_completed_admin_email_message', wpautop($message)))), apply_filters('tc_order_completed_admin_email_headers', $admin_headers)); } else { $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; $headers .= 'From: ' . admin_email_from_email('') . "\r\n" . 'Reply-To: ' . admin_email_from_email('') . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, stripcslashes(wpautop($message)), apply_filters('tc_order_completed_admin_email_headers', $headers)); } } } if ($status == 'order_received') { //Send e-mail to the admin when order is placed / pending if (!isset($tc_email_settings['admin_send_placed_message']) || isset($tc_email_settings['admin_send_placed_message']) && $tc_email_settings['admin_send_placed_message'] == 'yes') { add_filter('wp_mail_from', 'admin_email_from_placed_email', 999); add_filter('wp_mail_from_name', 'admin_email_from_placed_name', 999); $subject = isset($tc_email_settings['admin_order_placed_subject']) ? $tc_email_settings['admin_order_placed_subject'] : __('New Order Placed', 'tc'); $default_message = 'Hello, <br /><br />a new order (ORDER_ID) totalling <strong>ORDER_TOTAL</strong> has been placed. <br /><br />You can check the order details here: ORDER_ADMIN_URL'; $message = isset($tc_email_settings['admin_order_placed_message']) ? $tc_email_settings['admin_order_placed_message'] : $default_message; $order = tc_get_order_id_by_name($order_id); $order = new TC_Order($order->ID); $order_admin_url = admin_url('edit.php?post_type=tc_events&page=tc_orders&action=details&ID=' . $order->details->ID); $placeholders = array('ORDER_ID', 'ORDER_TOTAL', 'ORDER_ADMIN_URL', 'BUYER_NAME'); $placeholder_values = array($order_id, apply_filters('tc_cart_currency_and_format', $payment_info['total']), $order_admin_url, $buyer_name); $to = isset($tc_email_settings['admin_order_placed_from_email']) ? $tc_email_settings['admin_order_placed_from_email'] : get_option('admin_email'); $message = str_replace(apply_filters('tc_order_completed_admin_email_placeholders', $placeholders), apply_filters('tc_order_completed_admin_email_placeholder_values', $placeholder_values), $message); $admin_headers = ''; //'From: ' . admin_email_from_name( '' ) . ' <' . admin_email_from_email( '' ) . '>' . "\r\n"; if ($email_send_type == 'wp_mail') { //echo $to.', '.$subject.', '.html_entity_decode( stripcslashes( apply_filters( 'tc_order_completed_admin_email_message', wpautop( $message ) ) ) ); wp_mail($to, $subject, html_entity_decode(stripcslashes(apply_filters('tc_order_completed_admin_email_message', wpautop($message)))), apply_filters('tc_order_completed_admin_email_headers', $admin_headers)); } else { $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; $headers .= 'From: ' . admin_email_from_email('') . "\r\n" . 'Reply-To: ' . admin_email_from_email('') . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, stripcslashes(wpautop($message)), apply_filters('tc_order_completed_admin_email_headers', $headers)); } } //exit; } do_action('tc_after_order_created_email'); }
function check_status_response_ipay88() { global $tc; $posted = stripslashes_deep($_POST); if ($this->validate_response()) { $refno = $_POST['RefNo']; $transid = $_POST['TransId']; $estatus = $_POST['Status']; $errdesc = $_POST['ErrDesc']; $order = tc_get_order_id_by_name($refno); if ($estatus == 1) { $tc->update_order_payment_status($order->ID, true); } else { //not paid } } else { //echo 'INVALID RESPONSE'; } }
function order_confirmation($order, $payment_info = '', $cart_info = '') { global $tc; $order = tc_get_order_id_by_name($order); // IPN if (isset($_POST['mihpayid'])) { if (isset($_POST['status'])) { if ($_POST['status'] == 'success') { $paid = true; $tc->update_order_payment_status($order->ID, true); } } $order = new TC_Order($order->ID); if (round($_POST['amount'], 2) >= round($order->details->tc_payment_info['total'], 2)) { //Amount is OK } else { $tc->update_order_status($order->details->ID, 'order_fraud'); } } }
function order_confirmation($order, $payment_info = '', $cart_info = '') { global $tc; $this->maybe_start_session(); $order = tc_get_order_id_by_name($order); if (isset($_REQUEST['payment_reference'])) { $request_string = array('api_key' => $_SESSION['api_key'], 'payment_reference' => $_REQUEST['payment_reference']); $gateway_url = $this->liveurl . 'api/verify_payment'; $getdataresponse = $this->sendRequest($gateway_url, $request_string); $object = json_decode($getdataresponse); if ($object->response == '3' || $object->response == '6') { $tc->update_order_payment_status($order->ID, true); } else { //do nothing, transaction still pending } } else { //do nothing } }
function ipn() { global $tc; if (isset($_POST['transaction_id'])) { $transaction_id = $_POST['transaction_id']; if ($this->merchant_id == 'demo') { $json = wp_remote_get('https://voguepay.com/?v_transaction_id=' . $transaction_id . '&type=json&demo=true'); } else { $json = wp_remote_get('https://voguepay.com/?v_transaction_id=' . $transaction_id . '&type=json'); } $transaction = json_decode($json['body'], true); $transaction_id = $transaction['transaction_id']; $merchant_ref = $transaction['merchant_ref']; $order_id = tc_get_order_id_by_name($merchant_ref); //get order id from order name $order_id = $order_id->ID; $order = new TC_Order($order_id); $order_total = $order->details->tc_payment_info['total']; $amount_paid = $transaction['total']; if ($transaction['status'] == 'Approved') { if (round($amount_paid, 2) < round($order_total, 2)) { $tc->update_order_status($order->ID, 'order_fraud'); //die('Fraud detected. Price paid ' . $amount_paid . ' and original price of ' . $order_total . ' do not match.'); $_SESSION['tc_gateway_error'] = sprintf(__('Something went wrong. Price paid %s and original price of %s do not match.', 'tc'), $amount_paid, $order_total); wp_redirect($tc->get_payment_slug(true)); tc_js_redirect($tc->get_payment_slug(true)); exit; } $tc->update_order_payment_status($order_id, true); //die( 'IPN Processed OK. Payment for order successfull.' ); } else { //die( 'IPN Processed OK. Payment Failed' ); } } }
function order_confirmation($order, $payment_info = '', $cart_info = '') { global $tc; $order = tc_get_order_id_by_name($order); if (isset($_GET['order_number'])) { $this->init_mijireh(); try { $mj_order = new Mijireh_Order(esc_attr($_GET['order_number'])); $payment_status = $mj_order->status; if ($payment_status == 'paid') { $paid = true; $tc->update_order_payment_status($order->ID, $paid); } else { //do nothing, waiting for paid status } } catch (Mijireh_Exception $e) { $_SESSION['tc_gateway_error'] = __('Mijireh Error : ', 'tc') . $e->getMessage(); wp_redirect($tc->get_payment_slug(true)); tc_js_redirect($tc->get_payment_slug(true)); exit; } } }
function ipn() { global $tc; if (isset($_GET['hmac'])) { $order_num = $_GET['transaction']['external_order_num']; $status = $_GET['transaction']['status']; $order = tc_get_order_id_by_name($order_num); if ($status == 'captured') { $tc->update_order_payment_status($order->ID, true); } } }