本文整理汇总了PHP中transaction_results函数的典型用法代码示例。如果您正苦于以下问题:PHP transaction_results函数的具体用法?PHP transaction_results怎么用?PHP transaction_results使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了transaction_results函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: parse_gateway_notification
/**
* parse_gateway_notification method, receives data from the payment gateway
* @access private
*/
function parse_gateway_notification()
{
/// PayPal first expects the IPN variables to be returned to it within 30 seconds, so we do this first.
if ('sandbox' == get_option('paypal_certified_server_type')) {
$paypal_url = "https://www.sandbox.paypal.com/webscr";
} else {
$API_Endpoint = "https://api-3t.paypal.com/nvp";
$paypal_url = "https://www.paypal.com/cgi-bin/webscr";
}
$received_values = array();
$received_values['cmd'] = '_notify-validate';
$received_values += stripslashes_deep($_POST);
$options = array('timeout' => 5, 'body' => $received_values, 'user-agent' => 'WP e-Commerce/' . WPSC_PRESENTABLE_VERSION);
$response = wp_remote_post($paypal_url, $options);
do_action('wpsc_paypal_express_ipn', $received_values, $this);
if ('VERIFIED' == $response['body']) {
$this->paypal_ipn_values = $received_values;
$this->session_id = $received_values['invoice'];
if (strtolower($received_values['payment_status']) == 'completed') {
$this->set_purchase_processed_by_sessionid(3);
transaction_results($this->session_id, false);
} elseif (strtolower($received_values['payment_status']) == 'denied') {
$this->set_purchase_processed_by_sessionid(6);
}
} else {
exit("IPN Request Failure");
}
}
开发者ID:arturo-mayorga,项目名称:am_com,代码行数:32,代码来源:paypal-express.merchant.php
示例2: wpsc_admin_ajax
/**
* WP eCommerce Admin AJAX functions
*
* These are the WPSC Admin AJAX functions
*
* @package wp-e-commerce
* @since 3.7
*
* @uses update_option() Updates option in the database given key and value
* @uses wp_delete_term() Removes term from the database
* @uses fetch_rss() DEPRECATED
* @uses wpsc_member_dedeactivate_subscriptions() @todo docs
* @uses wpsc_member_deactivate_subscriptions() @todo docs
* @uses wpsc_update_purchase_log_status() Updates the status of the logs for a purchase
* @uses transaction_results() Main function for creating purchase reports
* @uses wpsc_find_purchlog_status_name() Finds name of given status
*/
function wpsc_admin_ajax()
{
if (!wpsc_is_store_admin()) {
return;
}
global $wpdb;
if (isset($_POST['action']) && $_POST['action'] == 'product-page-order') {
$current_order = get_option('wpsc_product_page_order');
$new_order = $_POST['order'];
if (isset($new_order["advanced"])) {
$current_order["advanced"] = array_unique(explode(',', $new_order["advanced"]));
}
if (isset($new_order["side"])) {
$current_order["side"] = array_unique(explode(',', $new_order["side"]));
}
update_option('wpsc_product_page_order', $current_order);
exit(print_r($order, 1));
}
if (isset($_POST['save_image_upload_state']) && $_POST['save_image_upload_state'] == 'true' && is_numeric($_POST['image_upload_state'])) {
$upload_state = (int) (bool) $_POST['image_upload_state'];
update_option('wpsc_use_flash_uploader', $upload_state);
exit("done");
}
if (isset($_POST['remove_variation_value']) && $_POST['remove_variation_value'] == "true" && is_numeric($_POST['variation_value_id'])) {
$value_id = absint($_GET['variation_value_id']);
echo wp_delete_term($value_id, 'wpsc-variation');
exit;
}
if (isset($_REQUEST['log_state']) && $_REQUEST['log_state'] == "true" && is_numeric($_POST['id']) && is_numeric($_POST['value'])) {
$newvalue = $_POST['value'];
if ($_REQUEST['suspend'] == 'true') {
if ($_REQUEST['value'] == 1 && function_exists('wpsc_member_dedeactivate_subscriptions')) {
wpsc_member_dedeactivate_subscriptions($_POST['id']);
} elseif (function_exists('wpsc_member_deactivate_subscriptions')) {
wpsc_member_deactivate_subscriptions($_POST['id']);
}
exit;
} else {
$log_data = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id` = '%d' LIMIT 1", $_POST['id']), ARRAY_A);
if ($newvalue == 2 && function_exists('wpsc_member_activate_subscriptions')) {
wpsc_member_activate_subscriptions($_POST['id']);
}
wpsc_update_purchase_log_status($_POST['id'], $newvalue);
if ($newvalue > $log_data['processed'] && $log_data['processed'] < 2) {
transaction_results($log_data['sessionid'], false);
}
$status_name = wpsc_find_purchlog_status_name($purchase['processed']);
echo "document.getElementById(\"form_group_" . absint($_POST['id']) . "_text\").innerHTML = '" . $status_name . "';\n";
$year = date("Y");
$month = date("m");
$start_timestamp = mktime(0, 0, 0, $month, 1, $year);
$end_timestamp = mktime(0, 0, 0, $month + 1, 0, $year);
echo "document.getElementById(\"log_total_month\").innerHTML = '" . addslashes(wpsc_currency_display(admin_display_total_price($start_timestamp, $end_timestamp))) . "';\n";
echo "document.getElementById(\"log_total_absolute\").innerHTML = '" . addslashes(wpsc_currency_display(admin_display_total_price())) . "';\n";
exit;
}
}
}
开发者ID:VanessaGarcia-Freelance,项目名称:ButtonHut,代码行数:75,代码来源:ajax-and-init.php
示例3: wpsc_transaction_theme
/**
* WP eCommerce transaction results class
*
* This class is responsible for theming the transaction results page.
*
* @package wp-e-commerce
* @since 3.8
*/
function wpsc_transaction_theme()
{
global $wpdb, $user_ID, $nzshpcrt_gateways, $sessionid, $cart_log_id, $errorcode;
$errorcode = '';
$transactid = '';
$dont_show_transaction_results = false;
if (isset($_GET['sessionid'])) {
$sessionid = $_GET['sessionid'];
}
if (!isset($_GET['sessionid']) && isset($_GET['ms'])) {
$sessionid = $_GET['ms'];
}
if (isset($_GET['gateway']) && 'google' == $_GET['gateway']) {
wpsc_google_checkout_submit();
unset($_SESSION['wpsc_sessionid']);
}
if ('paypal_certified' == $_SESSION['wpsc_previous_selected_gateway']) {
$sessionid = $_SESSION['paypalexpresssessionid'];
}
if (isset($_REQUEST['eway']) && '1' == $_REQUEST['eway']) {
$sessionid = $_GET['result'];
} elseif (isset($_REQUEST['eway']) && '0' == $_REQUEST['eway']) {
echo $_SESSION['eway_message'];
} elseif (isset($_REQUEST['payflow']) && '1' == $_REQUEST['payflow']) {
echo $_SESSION['payflow_message'];
$_SESSION['payflow_message'] = '';
}
// Replaces the ugly if else for gateways
switch ($_SESSION['wpsc_previous_selected_gateway']) {
case 'paypal_certified':
case 'wpsc_merchant_paypal_express':
echo $_SESSION['paypalExpressMessage'];
if (isset($_SESSION['reshash']['TRANSACTIONTYPE']) && 'expresscheckout' == $_SESSION['reshash']['TRANSACTIONTYPE']) {
$dont_show_transaction_results = false;
} else {
$dont_show_transaction_results = true;
}
break;
case 'dps':
$sessionid = decrypt_dps_response();
break;
}
if (!$dont_show_transaction_results) {
if (!empty($sessionid)) {
$cart_log_id = $wpdb->get_var("SELECT `id` FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid`= " . $sessionid . " LIMIT 1");
return transaction_results($sessionid, true);
} else {
printf(__('Sorry your transaction was not accepted.<br /><a href="%1$s">Click here to go back to checkout page</a>.', 'wpsc'), get_option("shopping_cart_url"));
}
}
}
开发者ID:hornet9,项目名称:Morato,代码行数:59,代码来源:wpsc-transaction_results_functions.php
示例4: submit
function submit()
{
global $wpdb, $purchase_log, $wpsc_cart;
$sessionid = $this->cart_data['session_id'];
$options = get_option('wpcb_options');
// Trouver la page où le shortcode [wpcb] se situe. Bug si plusieurs fois le shortcode [wpcb], à résoudre todo
$wpcb_checkout_page = $wpdb->get_row("SELECT ID FROM {$wpdb->posts} WHERE `post_content` LIKE '%[wpcb]%' AND `post_status`='publish'");
if (array_key_exists('test', $options) && $options['test']) {
// Mode test, on considère que la CB a été acceptée automatiquement.
// Affiche la page de la fin de transaction et on met à jour la base de donnée avec un vente réussie
$wpdb->query("UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET `processed`= '3' WHERE `sessionid`=" . $sessionid);
// redirection is inside transaction result :
transaction_results($sessionid, false);
} else {
// Affiche les icônes des cartes bancaires :
$action = 'CB';
// On va vers la page ou se trouve le shortcode
wp_redirect(site_url('?p=' . $wpcb_checkout_page->ID . '&sessionid=' . $sessionid . '&action=' . $action));
}
exit;
}
开发者ID:Reghyz,项目名称:wpcb,代码行数:21,代码来源:atos.merchant.php
示例5: callback_ipn
public function callback_ipn()
{
$ipn = new PHP_Merchant_Paypal_IPN(false, (bool) $this->setting->get('sandbox_mode', false));
if ($ipn->is_verified()) {
$sessionid = $ipn->get('invoice');
$this->set_purchase_log_for_callbacks($sessionid);
if ($ipn->is_payment_denied()) {
$this->purchase_log->set('processed', WPSC_Purchase_Log::PAYMENT_DECLINED);
} elseif ($ipn->is_payment_refunded()) {
$this->purchase_log->set('processed', WPSC_Purchase_Log::REFUNDED);
} elseif ($ipn->is_payment_completed()) {
$this->purchase_log->set('processed', WPSC_Purchase_Log::ACCEPTED_PAYMENT);
} elseif ($ipn->is_payment_pending()) {
if ($ipn->is_payment_refund_pending()) {
$this->purchase_log->set('processed', WPSC_Purchase_Log::REFUND_PENDING);
} else {
$this->purchase_log->set('processed', WPSC_Purchase_Log::ORDER_RECEIVED);
}
}
$this->purchase_log->save();
transaction_results($sessionid, false);
}
exit;
}
开发者ID:nikitanaumov,项目名称:WP-e-Commerce,代码行数:24,代码来源:paypal-express-checkout.php
示例6: nzshpcrt_paypal_ipn
function nzshpcrt_paypal_ipn()
{
global $wpdb;
// needs to execute on page start
// look at page 36
//exit(WPSC_GATEWAY_DEBUG );
if ($_GET['ipn_request'] == 'true' && get_option('paypal_ipn') == 1) {
// read the post from PayPal system and add 'cmd'
$fields = 'cmd=_notify-validate';
$message = "";
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$fields .= "&{$key}={$value}";
}
// post back to PayPal system to validate
$results = '';
if (function_exists('curl_init')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, get_option('paypal_multiple_url'));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_NOPROGRESS, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_USERAGENT, "WP e-Commerce " . WPSC_PRESENTABLE_VERSION);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$results = curl_exec($ch);
curl_close($ch);
} else {
$replace_strings[0] = 'http://';
$replace_strings[1] = 'https://';
$replace_strings[2] = '/cgi-bin/webscr';
$paypal_url = str_replace($replace_strings, "", get_option('paypal_multiple_url'));
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen($paypal_url, 80, $errno, $errstr, 30);
if ($fp) {
fputs($fp, $header . $fields);
while (!feof($fp)) {
$res = fgets($fp, 1024);
$results .= $fields;
}
fclose($fp);
}
}
// assign posted variables to local variables
$sessionid = $_POST['invoice'];
$transaction_id = $_POST['txn_id'];
$verification_data['item_name'] = $_POST['item_name'];
$verification_data['item_number'] = $_POST['item_number'];
$verification_data['payment_status'] = $_POST['payment_status'];
$verification_data['payment_amount'] = $_POST['mc_gross'];
$verification_data['payment_currency'] = $_POST['mc_currency'];
$verification_data['txn_id'] = $_POST['txn_id'];
$verification_data['receiver_email'] = $_POST['receiver_email'];
$verification_data['payer_email'] = $_POST['payer_email'];
if (strcmp($results, "VERIFIED") == 0) {
switch ($verification_data['payment_status']) {
case 'Processed':
// I think this is mostly equivalent to Completed
// I think this is mostly equivalent to Completed
case 'Completed':
$wpdb->query("UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET `processed` = '2' WHERE `sessionid` = " . $sessionid . " LIMIT 1");
transaction_results($sessionid, false, $transaction_id);
break;
case 'Failed':
// if it fails, delete it
$log_id = $wpdb->get_var("SELECT `id` FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid`='{$sessionid}' LIMIT 1");
$delete_log_form_sql = "SELECT * FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`='{$log_id}'";
$cart_content = $wpdb->get_results($delete_log_form_sql, ARRAY_A);
foreach ((array) $cart_content as $cart_item) {
$cart_item_variations = $wpdb->query("DELETE FROM `" . WPSC_TABLE_CART_ITEM_VARIATIONS . "` WHERE `cart_id` = '" . $cart_item['id'] . "'", ARRAY_A);
}
$wpdb->query("DELETE FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`='{$log_id}'");
$wpdb->query("DELETE FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` WHERE `log_id` IN ('{$log_id}')");
$wpdb->query("DELETE FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id`='{$log_id}' LIMIT 1");
break;
case 'Pending':
// need to wait for "Completed" before processing
$sql = "UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET `transactid` = '" . $transaction_id . "', `date` = '" . time() . "' WHERE `sessionid` = " . $sessionid . " LIMIT 1";
$wpdb->query($sql);
break;
default:
// if nothing, do nothing, safest course of action here.
break;
}
} else {
if (strcmp($results, "INVALID") == 0) {
// Its already logged, not much need to do more
}
}
/*
* Detect use of sandbox mode, if sandbox mode is present, send debugging email.
*/
if (stristr(get_option('paypal_multiple_url'), "sandbox") || (defined('WPSC_ADD_DEBUG_PAGE') and WPSC_ADD_DEBUG_PAGE == true)) {
$message = "This is a debugging message sent because it appears that you are using sandbox mode.\n\rIt is only sent if the paypal URL contains the word \"sandbox\"\n\r\n\r";
$message .= "RESULTS:\n\r" . print_r($results, true) . "\n\r\n\r";
//.........这里部分代码省略.........
开发者ID:BGCX261,项目名称:zombie-craft-svn-to-git,代码行数:101,代码来源:paypal_multiple.php
示例7: MAX
/*
* this updates the processing status of an item
*/
if (is_numeric($_GET['id']) && is_numeric($_GET['value'])) {
$max_stage = $wpdb->get_var("SELECT MAX(*) AS `max` FROM `" . $wpdb->prefix . "purchase_statuses` WHERE `active`='1'");
if (is_numeric($_GET['value']) && $_GET['value'] <= $max_stage) {
$newvalue = $_GET['value'];
} else {
$newvalue = 1;
}
$log_data = $wpdb->get_row("SELECT * FROM `" . $wpdb->prefix . "purchase_logs` WHERE `id` = '" . $_GET['id'] . "' LIMIT 1");
$update_sql = "UPDATE `" . $wpdb->prefix . "purchase_logs` SET `processed` = '" . $newvalue . "' WHERE `id` = '" . $_GET['id'] . "' LIMIT 1";
$wpdb->query($update_sql);
if ($newvalue > $log_data['processed'] && $log_data['processed'] <= 1) {
transaction_results($log_data['sessionid'], false);
}
}
if (is_numeric($_GET['deleteid'])) {
$delete_id = $_GET['deleteid'];
$delete_log_form_sql = "SELECT * FROM `" . $wpdb->prefix . "cart_contents` WHERE `purchaseid`='{$delete_id}'";
$cart_content = $wpdb->get_results($delete_log_form_sql, ARRAY_A);
foreach ((array) $cart_content as $cart_item) {
$cart_item_variations = $wpdb->query("DELETE FROM `" . $wpdb->prefix . "cart_item_variations` WHERE `cart_id` = '" . $cart_item['id'] . "'", ARRAY_A);
}
$wpdb->query("DELETE FROM `" . $wpdb->prefix . "cart_contents` WHERE `purchaseid`='{$delete_id}'");
$wpdb->query("DELETE FROM `" . $wpdb->prefix . "submited_form_data` WHERE `log_id` IN ('{$delete_id}')");
$wpdb->query("DELETE FROM `" . $wpdb->prefix . "purchase_logs` WHERE `id`='{$delete_id}' LIMIT 1");
echo '<div id="message" class="updated fade"><p>' . TXT_WPSC_THANKS_DELETED . '</p></div>';
}
if (isset($_GET['clear_locks']) && $_GET['clear_locks'] == 'true' && is_numeric($_GET['purchaseid'])) {
开发者ID:alx,项目名称:barceloneta,代码行数:30,代码来源:display-log.php
示例8: wpsc_transaction_theme
function wpsc_transaction_theme()
{
global $wpdb, $user_ID, $nzshpcrt_gateways, $sessionid, $cart_log_id, $errorcode;
$errorcode = '';
$transactid = '';
$dont_show_transaction_results = false;
if (isset($_GET['sessionid'])) {
$sessionid = $_GET['sessionid'];
}
if (!isset($_GET['sessionid']) && isset($_GET['ms'])) {
$sessionid = $_GET['ms'];
}
$selected_gateway = wpsc_get_customer_meta('selected_gateway');
if ($selected_gateway && in_array($selected_gateway, array('paypal_certified', 'wpsc_merchant_paypal_express'))) {
$sessionid = wpsc_get_customer_meta('paypal_express_sessionid');
}
if (isset($_REQUEST['eway']) && '1' == $_REQUEST['eway']) {
$sessionid = $_GET['result'];
} elseif (isset($_REQUEST['eway']) && '0' == $_REQUEST['eway']) {
echo wpsc_get_customer_meta('eway_message');
} elseif (isset($_REQUEST['payflow']) && '1' == $_REQUEST['payflow']) {
echo wpsc_get_customer_meta('payflow_message');
wpsc_delete_customer_meta('payflow_message');
}
$dont_show_transaction_results = false;
if ($selected_gateway) {
// Replaces the ugly if else for gateways
switch ($selected_gateway) {
case 'paypal_certified':
case 'wpsc_merchant_paypal_express':
echo wpsc_get_customer_meta('paypal_express_message');
$reshash = wpsc_get_customer_meta('paypal_express_reshash');
if (isset($reshash['PAYMENTINFO_0_TRANSACTIONTYPE']) && in_array($reshash['PAYMENTINFO_0_TRANSACTIONTYPE'], array('expresscheckout', 'cart'))) {
$dont_show_transaction_results = false;
} else {
$dont_show_transaction_results = true;
}
break;
case 'dps':
$sessionid = decrypt_dps_response();
break;
//paystation was not updating the purchase logs for successful payment - this is ugly as need to have the databse update done in one place by all gatways on a sucsessful transaction hook not some within the gateway and some within here and some not at all??? This is getting a major overhaul but for here and now it just needs to work for the gold cart people!
//paystation was not updating the purchase logs for successful payment - this is ugly as need to have the databse update done in one place by all gatways on a sucsessful transaction hook not some within the gateway and some within here and some not at all??? This is getting a major overhaul but for here and now it just needs to work for the gold cart people!
case 'paystation':
$ec = $_GET['ec'];
$result = $_GET['em'];
if ($result == 'Transaction successful' && $ec == 0) {
$processed_id = '3';
}
if ($result == 'Insufficient Funds' && $ec == 5) {
$processed_id = '6';
}
if ($processed_id) {
wpsc_update_purchase_log_status($sessionid, $processed_id, 'sessionid');
}
break;
case 'wpsc_merchant_paymentexpress':
// Payment Express sends back there own session id, which is temporarily stored in the Auth field
// so just swapping that over here
$query = "SELECT `sessionid` FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `authcode` ='" . $sessionid . "'";
$result = $wpdb->get_var($query);
if ($result != null) {
// just in case they are using an older version old gold cart (pre 2.9.5)
$sessionid = $result;
$dont_show_transaction_results = true;
}
break;
case 'eway_hosted':
$sessionid = decrypt_eway_uk_response();
break;
//default filter for other payment gateways to use
//default filter for other payment gateways to use
default:
$sessionid = apply_filters('wpsc_previous_selected_gateway_' . $selected_gateway, $sessionid);
break;
}
}
if (!$dont_show_transaction_results) {
if (!empty($sessionid)) {
$cart_log_id = $wpdb->get_var($wpdb->prepare("SELECT `id` FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid`= %s LIMIT 1", $sessionid));
echo transaction_results($sessionid, true);
} else {
printf(__('Sorry your transaction was not accepted.<br /><a href="%1$s">Click here to go back to checkout page</a>.', 'wp-e-commerce'), wpsc_get_checkout_url());
}
}
}
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:86,代码来源:checkout-results.php
示例9: wpsc_submit_checkout
//.........这里部分代码省略.........
//exit('<pre>'.print_r($_POST, true).'</pre>');
$selectedCountry = $wpdb->get_results("SELECT id, country FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE isocode='" . $wpdb->escape($_SESSION['wpsc_delivery_country']) . "'", ARRAY_A);
// exit('valid >'.$is_valid.'\r\n'.$_SESSION['wpsc_delivery_country']);
foreach ($wpsc_cart->cart_items as $cartitem) {
// exit('<pre>'.print_r($cartitem, true).'</pre>');
$categoriesIDs = $wpdb->get_col("SELECT category_id FROM `" . WPSC_TABLE_ITEM_CATEGORY_ASSOC . "` WHERE product_id=" . $cartitem->product_id);
foreach ((array) $categoriesIDs as $catid) {
if (is_array($catid)) {
$sql = "SELECT `countryid` FROM `" . WPSC_TABLE_CATEGORY_TM . "` WHERE `visible`=0 AND `categoryid`=" . $catid[0];
} else {
$sql = "SELECT `countryid` FROM `" . WPSC_TABLE_CATEGORY_TM . "` WHERE `visible`=0 AND `categoryid`=" . $catid;
}
$countries = $wpdb->get_col($sql);
if (in_array($selectedCountry[0]['id'], (array) $countries)) {
$errormessage = sprintf(TXT_WPSC_CATEGORY_TARGETMARKET, $cartitem->product_name, $selectedCountry[0]['country']);
$_SESSION['categoryAndShippingCountryConflict'] = $errormessage;
$is_valid = false;
}
}
//count number of items, and number of items using shipping
$num_items++;
if ($cartitem->uses_shipping != 1) {
$disregard_shipping++;
} else {
$use_shipping++;
}
}
// exit('valid >'.$is_valid);
if (array_search($submitted_gateway, $selected_gateways) !== false) {
$_SESSION['wpsc_previous_selected_gateway'] = $submitted_gateway;
} else {
$is_valid = false;
}
if (get_option('do_not_use_shipping') != 1 && in_array('ups', (array) $options) && $_SESSION['wpsc_zipcode'] == '') {
//exit('Not being called');
if ($num_items != $disregard_shipping) {
//<-- new line of code
$_SESSION['categoryAndShippingCountryConflict'] = __('Please enter a Zipcode and click calculate to proceed');
$is_valid = false;
}
}
if ($is_valid == true || $_GET['gateway'] == 'noca') {
$_SESSION['categoryAndShippingCountryConflict'] = '';
// check that the submitted gateway is in the list of selected ones
$sessionid = mt_rand(100, 999) . time();
$_SESSION['wpsc_sessionid'] = $sessionid;
$subtotal = $wpsc_cart->calculate_subtotal();
if ($wpsc_cart->has_total_shipping_discount() == false) {
$base_shipping = $wpsc_cart->calculate_base_shipping();
} else {
$base_shipping = 0;
}
if (isset($_POST['how_find_us'])) {
$find_us = $_POST['how_find_us'];
} else {
$find_us = '';
}
$tax = $wpsc_cart->calculate_total_tax();
$total = $wpsc_cart->calculate_total_price();
$sql = "INSERT INTO `" . WPSC_TABLE_PURCHASE_LOGS . "` (`totalprice`,`statusno`, `sessionid`, `user_ID`, `date`, `gateway`, `billing_country`,`shipping_country`, `billing_region`, `shipping_region`, `base_shipping`,`shipping_method`, `shipping_option`, `plugin_version`, `discount_value`, `discount_data`,`find_us`) VALUES ('{$total}' ,'0', '{$sessionid}', '" . (int) $user_ID . "', UNIX_TIMESTAMP(), '{$submitted_gateway}', '{$wpsc_cart->delivery_country}', '{$wpsc_cart->selected_country}','{$wpsc_cart->selected_region}', '{$wpsc_cart->delivery_region}', '{$base_shipping}', '{$wpsc_cart->selected_shipping_method}', '{$wpsc_cart->selected_shipping_option}', '" . WPSC_VERSION . "', '{$wpsc_cart->coupons_amount}','{$wpsc_cart->coupons_name}', '{$find_us}')";
//exit($sql);
$wpdb->query($sql);
$purchase_log_id = $wpdb->get_var("SELECT `id` FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid` IN('{$sessionid}') LIMIT 1");
//exit('PurchLog id'.$purchase_log_id);
$wpsc_checkout->save_forms_to_db($purchase_log_id);
$wpsc_cart->save_to_db($purchase_log_id);
$wpsc_cart->submit_stock_claims($purchase_log_id);
if (get_option('wpsc_also_bought') == 1) {
wpsc_populate_also_bought_list();
}
do_action('wpsc_submit_checkout', array("purchase_log_id" => $purchase_log_id, "our_user_id" => $our_user_id));
if (get_option('permalink_structure') != '') {
$seperator = "?";
} else {
$seperator = "&";
}
// submit to gateway
foreach ($nzshpcrt_gateways as $gateway) {
if ($gateway['internalname'] == $submitted_gateway && $gateway['internalname'] != 'google') {
$gateway_used = $gateway['internalname'];
$wpdb->query("UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET `gateway` = '" . $gateway_used . "' WHERE `id` = '" . $log_id . "' LIMIT 1 ;");
$gateway['function']($seperator, $sessionid);
break;
} elseif ($gateway['internalname'] == 'google' && $gateway['internalname'] == $submitted_gateway) {
$gateway_used = $gateway['internalname'];
$wpdb->query("UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET `gateway` = '" . $gateway_used . "' WHERE `id` = '" . $log_id . "' LIMIT 1 ;");
$_SESSION['gateway'] = 'google';
header('Location: ' . get_option('shopping_cart_url'));
break;
}
}
if (isset($_GET['gateway']) && $_GET['gateway'] == 'noca') {
//exit('HERE2');
echo transaction_results($sessionid, true);
} else {
//exit('HERE');
}
} else {
}
}
开发者ID:papayalabs,项目名称:htdocs,代码行数:101,代码来源:ajax.functions.php
示例10: gateway_eway
//.........这里部分代码省略.........
break;
case 'm':
$member_ship_unit = '3';
break;
case 'y':
$member_ship_unit = '4';
break;
}
$objRebill->RebillIntervalType($member_ship_unit);
$objRebill->eWAYCustomerID($user);
$objConnector = new GatewayConnector($gateway);
if ($objConnector->ProcessRequest($objRebill)) {
$objResponse = $objConnector->Response();
if ($objResponse != null) {
$lblResult = $objResponse->Result();
if ($lblResult == 'Success') {
wpsc_member_activate_subscriptions($purchase_log['id']);
$_SESSION['nzshpcrt_cart'] = '';
$_SESSION['nzshpcrt_cart'] = array();
header("Location:" . get_option('product_list_url'));
}
$lblErrorDescription = $objResponse->ErrorDetails();
$lblErrorSeverity = $objResponse->ErrorSeverity();
// This is woefully inadequate!!!
exit('An Error has occured >' . $lblResult . " " . $lblErrorDescription . " " . $lblErrorSeverity);
}
} else {
exit("Rebill Gateway failed: " . $objConnector->Response());
}
} else {
require WPSC_GOLD_FILE_PATH . '/merchants/ewaylib/EwayPaymentLive.php';
//echo WPSC_GOLD_FILE_PATH.'/ewaylib/EwayPaymentLive.php';
if (get_option('eway_cvn')) {
$method = 'REAL_TIME_CVN';
} else {
$method = 'REAL_TIME';
}
$eway = new EwayPaymentLive($user, $method, $gateway);
$amount = number_format($purchase_log['totalprice'], 2, '.', '') * 100;
$eway->setTransactionData("TotalAmount", $amount);
//mandatory field
$eway->setTransactionData("CustomerFirstName", $data['first_name']);
$eway->setTransactionData("CustomerLastName", $data['last_name']);
$eway->setTransactionData("CustomerEmail", $data['email']);
$eway->setTransactionData("CustomerAddress", $data['address1'] . ' ' . $data['state']);
$eway->setTransactionData("CustomerPostcode", $data['zip']);
$eway->setTransactionData("CustomerInvoiceDescription", $itemsName);
$eway->setTransactionData("CustomerInvoiceRef", $purchase_log['id']);
$eway->setTransactionData("CardHoldersName", $data['first_name'] . ' ' . $data['last_name']);
//mandatory field
$eway->setTransactionData("CardNumber", $_POST['card_number']);
//mandatory field
$eway->setTransactionData("CardExpiryMonth", $_POST['expiry']['month']);
//mandatory field
$eway->setTransactionData("CardExpiryYear", $_POST['expiry']['year']);
//mandatory field
$eway->setTransactionData("TrxnNumber", $purchase_log['id']);
$eway->setTransactionData("Option1", "");
$eway->setTransactionData("Option2", "");
$eway->setTransactionData("Option3", "");
//for REAL_TIME_CVN
$eway->setTransactionData("CVN", $_POST['cvn']);
//for GEO_IP_ANTI_FRAUD
$eway->setTransactionData("CustomerIPAddress", $eway->getVisitorIP());
//mandatory field when using Geo-IP Anti-Fraud
$eway->setTransactionData("CustomerBillingCountry", $data['country']);
//mandatory field when using Geo-IP Anti-Fraud
//special preferences for php Curl
$eway->setCurlPreferences(CURLOPT_SSL_VERIFYPEER, 0);
//pass a long that is set to a zero value to stop curl from verifying the peer's certificate
//$eway->setCurlPreferences(CURLOPT_CAINFO, "/usr/share/ssl/certs/my.cert.crt"); //Pass a filename of a file holding one or more certificates to verify the peer with. This only makes sense when used in combination with the CURLOPT_SSL_VERIFYPEER option.
//$eway->setCurlPreferences(CURLOPT_CAPATH, "/usr/share/ssl/certs/my.cert.path");
//$eway->setCurlPreferences(CURLOPT_PROXYTYPE, CURLPROXY_HTTP); //use CURL proxy, for example godaddy.com hosting requires it
//$eway->setCurlPreferences(CURLOPT_PROXY, "http://proxy.shr.secureserver.net:3128"); //use CURL proxy, for example godaddy.com hosting requires it
$ewayResponseFields = $eway->doPayment();
//exit(print_r($ewayResponseFields,1));
//print_r($ewayResponseFields);
if ($ewayResponseFields["EWAYTRXNSTATUS"] == "False") {
$message .= "<h3>Please Check the Payment Results</h3>";
$message .= "Your transaction was not successful." . "<br><br>";
$message .= $ewayResponseFields['EWAYTRXNERROR'] . "<br><br>";
$message .= "<a href=" . get_option('shopping_cart_url') . ">Click here to go back to checkout page.</a>";
$_SESSION['eway_message'] = $message;
header("Location:" . get_option('transact_url') . $seperator . "eway=0&result=" . $sessionid . "&message=1");
//exit();
} else {
if ($ewayResponseFields["EWAYTRXNSTATUS"] == "True") {
$wpdb->query("UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET `processed`='2' WHERE `sessionid`='" . $sessionid . "' LIMIT 1");
transaction_results($sessionid, false);
$message .= "Your transaction was successful." . "<br><br>";
$message .= $ewayResponseFields['EWAYTRXNERROR'] . "<br><br>";
$_SESSION['eway_message'] = $message;
header("Location:" . get_option('transact_url') . $seperator . "eway=1&result=" . $sessionid . "&message=1");
//exit();
}
}
}
//echo $_SESSION['eway_message'];
exit;
}
开发者ID:hornet9,项目名称:Morato,代码行数:101,代码来源:eway.php
示例11: wpec_vmerchant_return
function wpec_vmerchant_return()
{
global $sessionid, $wpdb;
$sessionid = $_GET['ssl_invoice_number'];
if ($_GET['ssl_result_message'] == 'APPROVED' || $_GET['ssl_result_message'] == 'APPROVAL') {
// success
$purchase_log = new WPSC_Purchase_Log($sessionid, 'sessionid');
$purchase_log->set(array('processed' => WPSC_Purchase_Log::ACCEPTED_PAYMENT, 'transactid' => $_GET['ssl_txn_id'], 'notes' => 'Virtual Merchant time : "' . $_GET['ssl_txn_time'] . '"'));
$purchase_log->save();
// set this global, wonder if this is ok
transaction_results($sessionid, true);
} else {
// success
$purchase_log = new WPSC_Purchase_Log($sessionid, 'sessionid');
$purchase_log->set(array('processed' => WPSC_Purchase_Log::INCOMPLETE_SALE, 'transactid' => $_GET['ssl_txn_id'], 'notes' => 'Virtual Merchant time : "' . $_GET['ssl_txn_time'] . '"'));
$purchase_log->save();
$error_messages = wpsc_get_customer_meta('checkout_misc_error_messages');
if (!is_array($error_messages)) {
$error_messages = array();
}
$error_messages[] = '<strong style="color:red">' . urldecode($_GET['ssl_result_message']) . ' </strong>';
wpsc_update_customer_meta('checkout_misc_error_messages', $error_messages);
$checkout_page_url = get_option('shopping_cart_url');
if ($checkout_page_url) {
header('Location: ' . $checkout_page_url);
exit;
}
}
}
开发者ID:benhuson,项目名称:Gold-Cart,代码行数:29,代码来源:vmerchant.php
示例12: bitpay_callback
function bitpay_callback()
{
global $wpdb;
try {
if (isset($_GET['bitpay_callback'])) {
$post = file_get_contents("php://input");
if (true === empty($post)) {
return array('error' => 'No post data');
}
$json = json_decode($post, true);
if (true === is_string($json)) {
return array('error' => $json);
}
if (false === array_key_exists('posData', $json)) {
return array('error' => 'no posData');
}
if (false === array_key_exists('id', $json)) {
return 'Cannot find invoice ID';
}
// Don't trust parameters from the scary internet.
// Use invoice ID from the $json in getInvoice($invoice_id) and get status from that.
$client = new \Bitpay\Client\Client();
$adapter = new \Bitpay\Client\Adapter\CurlAdapter();
$network = strpos($json['url'], 'test') === false ? new \Bitpay\Network\Livenet() : new \Bitpay\Network\Testnet();
$client->setAdapter($adapter);
$client->setNetwork($network);
// Checking invoice is valid...
$response = $client->getInvoice($json['id']);
$sessionid = $response->getPosData();
// get buyer email
$sql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid`=" . $sessionid;
$purchase_log = $wpdb->get_results($sql, ARRAY_A);
$email_form_field = $wpdb->get_var("SELECT `id` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `type` IN ('email') AND `active` = '1' ORDER BY `checkout_order` ASC LIMIT 1");
$email = $wpdb->get_var($wpdb->prepare("SELECT `value` FROM `" . WPSC_TABLE_SUBMITTED_FORM_DATA . "` WHERE `log_id` = %d AND `form_id` = %d LIMIT 1", $purchase_log[0]['id'], $email_form_field));
// get cart contents
$sql = "SELECT * FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`=" . $purchase_log[0]['id'];
$cart_contents = $wpdb->get_results($sql, ARRAY_A);
// get currency symbol
$currency_id = get_option('currency_type');
$sql = "SELECT * FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`=" . $currency_id;
$currency_data = $wpdb->get_results($sql, ARRAY_A);
$currency_symbol = $currency_data[0]['symbol'];
// list products and individual prices in the email
$message_product = "\r\n\r\nTransaction Details:\r\n\r\n";
$pnp = 0.0;
$subtotal = 0.0;
foreach ($cart_contents as $product) {
// shipping for each item
$pnp += $product['pnp'];
$message_product .= 'x' . $product['quantity'] . ' ' . $product['name'] . ' - ' . $currency_symbol . $product['price'] * $product['quantity'] . "\r\n";
$subtotal += $product['price'] * $product['quantity'];
}
//list subtotal
$subtotal = number_format($subtotal, 2, '.', ',');
$message_product .= "\r\n" . 'Subtotal: ' . $currency_symbol . $subtotal . "\r\n";
//list total taxes and total shipping costs in the email
$message_product .= 'Taxes: ' . $currency_symbol . $purchase_log[0]['wpec_taxes_total'] . "\r\n";
$message_product .= 'Shipping: ' . $currency_symbol . ($purchase_log[0]['base_shipping'] + $pnp) . "\r\n\r\n";
//display total price in the email
$message_product .= 'Total Price: ' . $currency_symbol . $purchase_log[0]['totalprice'];
switch ($response->getStatus()) {
//For low and medium transaction speeds, the order status is set to "Order Received" . The customer receives
//an initial email stating that the transaction has been paid.
case 'paid':
if (true === is_numeric($sessionid)) {
$sql = "UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET `processed`= '2' WHERE `sessionid`=" . $sessionid;
$wpdb->query($sql);
$message = 'Thank you! Your payment has been received, but the transaction has not been confirmed on the bitcoin network. You will receive another email when the transaction has been confirmed.';
$message .= $message_product;
$sql = "UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET `notes`= 'The payment has been received, but the transaction has not been confirmed on the bitcoin network. This will be updated when the transaction has been confirmed.' WHERE `sessionid`=" . $sessionid;
$wpdb->query($sql);
if (wp_mail($email, 'Payment Received', $message)) {
$mail_sql = "UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET `email_sent`= '1' WHERE `sessionid`=" . $sessionid;
$wpdb->query($mail_sql);
}
transaction_results($sessionid, false);
//false because this is just for email notification
}
break;
//For low and medium transaction speeds, the order status will not change. For high transaction speed, the order
//status is set to "Order Received" here. For all speeds, an email will be sent stating that the transaction has
//been confirmed.
//For low and medium transaction speeds, the order status will not change. For high transaction speed, the order
//status is set to "Order Received" here. For all speeds, an email will be sent stating that the transaction has
//been confirmed.
case 'confirmed':
if (true === is_numeric($sessionid)) {
$sql = "UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET `processed`= '2' WHERE `sessionid`=" . $sessionid;
$wpdb->query($sql);
$mail_sql = "UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET `email_sent`= '1' WHERE `sessionid`=" . $sessionid;
//display initial "thank you" if transaction speed is high, as the 'paid' status is skipped on high speed
if (get_option('bitpay_transaction_speed') == 'high') {
$message = 'Thank you! Your payment has been received, and the transaction has been confirmed on the bitcoin network. You will receive another email when the transaction is complete.';
$message .= $message_product;
$sql = "UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET `notes`= 'The payment has been received, and the transaction has been confirmed on the bitcoin network. This will be updated when the transaction has been completed.' WHERE `sessionid`=" . $sessionid;
$wpdb->query($sql);
if (wp_mail($email, 'Payment Received', $message)) {
$wpdb->query($mail_sql);
}
} else {
//.........这里部分代码省略.........
开发者ID:cryptocurrent,项目名称:wordpress-ecommerce-plugin,代码行数:101,代码来源:bitpay.merchant.php
|
请发表评论