• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP WPSC_Purchase_Log类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中WPSC_Purchase_Log的典型用法代码示例。如果您正苦于以下问题:PHP WPSC_Purchase_Log类的具体用法?PHP WPSC_Purchase_Log怎么用?PHP WPSC_Purchase_Log使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了WPSC_Purchase_Log类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: decrypt_dps_response

function decrypt_dps_response()
{
    $PxAccess_Url = get_option('access_url');
    $PxAccess_Userid = get_option('access_userid');
    $PxAccess_Key = get_option('access_key');
    $Mac_Key = get_option('mac_key');
    $pxaccess = new PxAccess($PxAccess_Url, $PxAccess_Userid, $PxAccess_Key, $Mac_Key);
    $curgateway = get_option('payment_gateway');
    $_GET = array();
    $params = explode('&', $_SERVER['QUERY_STRING']);
    foreach ($params as $pair) {
        list($key, $value) = explode('=', $pair);
        $_GET[urldecode($key)] = urldecode($value);
    }
    $enc_hex = $_GET['result'];
    if ($enc_hex != null) {
        $rsp = $pxaccess->getResponse($enc_hex);
        $siteurl = get_option('siteurl');
        $total_weight = 0;
        if ($rsp->getResponseText() == 'APPROVED') {
            $sessionid = $rsp->getMerchantReference();
            $purchase_log = new WPSC_Purchase_Log($sessionid, 'sessionid');
            if (!$purchase_log->is_transaction_completed()) {
                $purchase_log->set('processed', WPSC_Purchase_Log::ACCEPTED_PAYMENT);
                $purchase_log->save();
            }
        }
    }
    return $sessionid;
}
开发者ID:benhuson,项目名称:Gold-Cart,代码行数:30,代码来源:dps.php


示例2: _wpsc_filter_merchant_v2_payment_method_form_fields

function _wpsc_filter_merchant_v2_payment_method_form_fields($fields)
{
    $selected_value = isset($_POST['wpsc_payment_method']) ? $_POST['wpsc_payment_method'] : '';
    if (empty($selected_value)) {
        $current_purchase_log_id = wpsc_get_customer_meta('current_purchase_log_id');
        $purchase_log = new WPSC_Purchase_Log($current_purchase_log_id);
        $selected_value = $purchase_log->get('gateway');
    }
    $gateways = _wpsc_merchant_v2_get_active_gateways();
    if (empty($gateways)) {
        return $fields;
    }
    foreach (_wpsc_merchant_v2_get_active_gateways() as $gateway) {
        $gateway = (object) $gateway;
        $title = $gateway->name;
        if (!empty($gateway->image)) {
            $title .= ' <img src="' . $gateway->image . '" alt="' . $gateway->name . '" />';
        }
        $field = array('title' => $title, 'type' => 'radio', 'value' => $gateway->internalname, 'name' => 'wpsc_payment_method', 'checked' => $selected_value == $gateway->internalname);
        $fields[] = $field;
    }
    // check the first payment gateway by default
    if (empty($selected_value)) {
        $fields[0]['checked'] = true;
    }
    return $fields;
}
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:27,代码来源:checkout.php


示例3: _wpsc_action_update_product_stats

/**
 * Update product stats when a purchase log containing it changes status
 *
 * @since 3.8.13
 *
 * @param int               $log_id     Purchase Log ID
 * @param int               $new_status New status
 * @param int               $old_status Old status
 * @param WPSC_Purchase_Log $log        Purchase Log
 */
function _wpsc_action_update_product_stats($log_id, $new_status, $old_status, $log)
{
    $cart_contents = $log->get_cart_contents();
    $new_status_completed = $log->is_transaction_completed();
    $old_status_completed = WPSC_Purchase_Log::is_order_status_completed($old_status);
    if ($new_status_completed && !$old_status_completed) {
        // if the order went through without any trouble, then it's a positive thing!
        $yay_or_boo = 1;
    } elseif (!$new_status_completed && $old_status_completed) {
        // if the order is declined or invalid, sad face :(
        $yay_or_boo = -1;
    } else {
        // Not one of the above options then we will be indifferent
        $yay_or_boo = 0;
    }
    // this dramatic mood swing affects the stats of each products in the cart
    foreach ($cart_contents as $cart_item) {
        $product = new WPSC_Product($cart_item->prodid);
        if ($product->exists()) {
            $diff_sales = $yay_or_boo * (int) $cart_item->quantity;
            $diff_earnings = $yay_or_boo * (int) $cart_item->price * (int) $cart_item->quantity;
            $product->sales += $diff_sales;
            $product->earnings += $diff_earnings;
            // if this product has parent, make the same changes to the parent
            if ($product->post->post_parent) {
                $parent = WPSC_Product::get_instance($product->post->post_parent);
                $parent->sales += $diff_sales;
                $parent->earnings += $diff_earnings;
            }
        }
    }
}
开发者ID:ashik968,项目名称:digiplot,代码行数:42,代码来源:stats.functions.php


示例4: save_attendee_meta_to_ticket

 /**
  * Sets attendee data on attendee posts
  *
  * @since 4.1
  *
  * @param int $attendee_id Attendee Ticket Post ID
  * @param WPSC_Purchase_Log $purchase_log WPEC purchase log object
  * @param int $product_id WPEC Product ID
  * @param int $order_attendee_id Attendee number in submitted order
  */
 public function save_attendee_meta_to_ticket($attendee_id, $purchase_log, $product_id, $order_attendee_id)
 {
     $meta = wpsc_get_purchase_meta($purchase_log->get('id'), Tribe__Tickets_Plus__Meta::META_KEY, true);
     if (!isset($meta[$product_id])) {
         return;
     }
     if (!isset($meta[$product_id][$order_attendee_id])) {
         return;
     }
     update_post_meta($attendee_id, Tribe__Tickets_Plus__Meta::META_KEY, $meta[$product_id][$order_attendee_id]);
 }
开发者ID:TakenCdosG,项目名称:chefs,代码行数:21,代码来源:Meta.php


示例5: set_purchase_log_for_callbacks

 private function set_purchase_log_for_callbacks($sessionid = false)
 {
     if ($sessionid === false) {
         $sessionid = $_REQUEST['sessionid'];
     }
     $purchase_log = new WPSC_Purchase_Log($sessionid, 'sessionid');
     if (!$purchase_log->exists()) {
         return;
     }
     $this->set_purchase_log($purchase_log);
 }
开发者ID:nikitanaumov,项目名称:WP-e-Commerce,代码行数:11,代码来源:paypal-express-checkout.php


示例6: transaction_results

/**
 * transaction_results function main function for creating the purchase reports, transaction results page, and email receipts
 * @access public
 *
 * @since 3.7
 * @param $sessionid (string) unique session id
 * @param echo_to_screen (boolean) whether to output the results or return them (potentially redundant)
 * @param $transaction_id (int) the transaction id
 */
function transaction_results($sessionid, $display_to_screen = true, $transaction_id = null)
{
    global $message_html, $echo_to_screen, $wpsc_cart, $purchase_log;
    // pre-3.8.9 variable
    $echo_to_screen = $display_to_screen;
    $purchase_log_object = new WPSC_Purchase_Log($sessionid, 'sessionid');
    // compatibility with pre-3.8.9 templates where they use a global
    // $purchase_log object which is simply just a database row
    $purchase_log = $purchase_log_object->get_data();
    // pre-3.8.9 templates also use this global variable
    $message_html = wpsc_get_transaction_html_output($purchase_log_object);
    $wpsc_cart->empty_cart();
    do_action('wpsc_transaction_results_shutdown', $purchase_log_object, $sessionid, $display_to_screen);
    return $message_html;
}
开发者ID:parkesma,项目名称:WP-e-Commerce,代码行数:24,代码来源:wpsc-transaction_results_functions.php


示例7: eCommerceThankYou

 function eCommerceThankYou($order)
 {
     global $tcm;
     $orderId = intval($order['purchase_id']);
     $tcm->Log->debug('Ecommerce: ECOMMERCE THANKYOU');
     $tcm->Log->debug('Ecommerce: NEW ECOMMERCE ORDERID=%s', $orderId);
     $order = new WPSC_Purchase_Log($orderId);
     $items = $order->get_cart_contents();
     $productsIds = array();
     foreach ($items as $v) {
         if (isset($v->prodid)) {
             $k = intval($v->prodid);
             if ($k) {
                 $v = $v->name;
                 $productsIds[] = $k;
                 $tcm->Log->debug('Ecommerce: ITEM %s=%s IN CART', $k, $v);
             }
         }
     }
     $args = array('pluginId' => TCM_PLUGINS_WP_ECOMMERCE, 'productsIds' => $productsIds, 'categoriesIds' => array(), 'tagsIds' => array());
     $tcm->Options->pushConversionSnippets($args);
     return '';
 }
开发者ID:Vatia13,项目名称:tofido,代码行数:23,代码来源:Ecommerce.php


示例8: wpsc_submit_checkout


//.........这里部分代码省略.........
        if ($cartitem->uses_shipping != 1) {
            $disregard_shipping++;
        } else {
            $use_shipping++;
        }
    }
    if (array_search($submitted_gateway, $selected_gateways) !== false) {
        wpsc_update_customer_meta('selected_gateway', $submitted_gateway);
    } else {
        $is_valid = false;
    }
    if ($collected_data) {
        if (get_option('do_not_use_shipping') == 0 && ($wpsc_cart->selected_shipping_method == null || $wpsc_cart->selected_shipping_option == null) && $num_items != $disregard_shipping) {
            $error_messages[] = __('You must select a shipping method, otherwise we cannot process your order.', 'wpsc');
            $is_valid = false;
        }
        if (get_option('do_not_use_shipping') != 1 && in_array('ups', (array) $options) && !wpsc_get_customer_meta('shipping_zip') && $num_items != $disregard_shipping) {
            wpsc_update_customer_meta('category_shipping_conflict', __('Please enter a Zipcode and click calculate to proceed', 'wpsc'));
            $is_valid = false;
        }
    }
    wpsc_update_customer_meta('checkout_misc_error_messages', $error_messages);
    if ($is_valid == true) {
        wpsc_delete_customer_meta('category_shipping_conflict');
        // check that the submitted gateway is in the list of selected ones
        $sessionid = mt_rand(100, 999) . time();
        wpsc_update_customer_meta('checkout_session_id', $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;
        }
        $delivery_country = $wpsc_cart->delivery_country;
        $delivery_region = $wpsc_cart->delivery_region;
        if (wpsc_uses_shipping()) {
            $shipping_method = $wpsc_cart->selected_shipping_method;
            $shipping_option = $wpsc_cart->selected_shipping_option;
        } else {
            $shipping_method = '';
            $shipping_option = '';
        }
        if (isset($_POST['how_find_us'])) {
            $find_us = $_POST['how_find_us'];
        } else {
            $find_us = '';
        }
        //keep track of tax if taxes are exclusive
        $wpec_taxes_controller = new wpec_taxes_controller();
        if (!$wpec_taxes_controller->wpec_taxes_isincluded()) {
            $tax = $wpsc_cart->calculate_total_tax();
            $tax_percentage = $wpsc_cart->tax_percentage;
        } else {
            $tax = 0.0;
            $tax_percentage = 0.0;
        }
        $total = $wpsc_cart->calculate_total_price();
        $args = array('totalprice' => $total, 'statusno' => '0', 'sessionid' => $sessionid, 'user_ID' => (int) $user_ID, 'date' => time(), 'gateway' => $submitted_gateway, 'billing_country' => $wpsc_cart->selected_country, 'shipping_country' => $delivery_country, 'billing_region' => $wpsc_cart->selected_region, 'shipping_region' => $delivery_region, 'base_shipping' => $base_shipping, 'shipping_method' => $shipping_method, 'shipping_option' => $shipping_option, 'plugin_version' => WPSC_VERSION, 'discount_value' => $wpsc_cart->coupons_amount, 'discount_data' => $wpsc_cart->coupons_name, 'find_us' => $find_us, 'wpec_taxes_total' => $tax, 'wpec_taxes_rate' => $tax_percentage);
        $purchase_log = new WPSC_Purchase_Log($args);
        $purchase_log->save();
        $purchase_log_id = $purchase_log->get('id');
        if ($collected_data) {
            $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();
        }
        if (!isset($our_user_id) && isset($user_ID)) {
            $our_user_id = $user_ID;
        }
        $wpsc_cart->log_id = $purchase_log_id;
        do_action('wpsc_submit_checkout', array("purchase_log_id" => $purchase_log_id, "our_user_id" => $our_user_id));
        if (get_option('permalink_structure') != '') {
            $separator = "?";
        } else {
            $separator = "&";
        }
        // submit to gateway
        $current_gateway_data =& $wpsc_gateways[$submitted_gateway];
        if (isset($current_gateway_data['api_version']) && $current_gateway_data['api_version'] >= 2.0) {
            $merchant_instance = new $current_gateway_data['class_name']($purchase_log_id);
            $merchant_instance->construct_value_array();
            do_action_ref_array('wpsc_pre_submit_gateway', array(&$merchant_instance));
            $merchant_instance->submit();
        } elseif ($current_gateway_data['internalname'] == $submitted_gateway && $current_gateway_data['internalname'] != 'google') {
            $gateway_used = $current_gateway_data['internalname'];
            $purchase_log->set('gateway', $gateway_used);
            $purchase_log->save();
            $current_gateway_data['function']($separator, $sessionid);
        } elseif ($current_gateway_data['internalname'] == 'google' && $current_gateway_data['internalname'] == $submitted_gateway) {
            $gateway_used = $current_gateway_data['internalname'];
            $purchase_log->set('gateway', $gateway_used);
            wpsc_update_customer_meta('google_checkout', 'google');
            wp_redirect(get_option('shopping_cart_url'));
            exit;
        }
    }
}
开发者ID:pankajsinghjarial,项目名称:SYLC,代码行数:101,代码来源:ajax.functions.php


示例9: response_handler

function response_handler($nvpArray, $fraud, $sessionid, $data = null, $recurring = null)
{
    global $wpdb;
    $result_code = $nvpArray['RESULT'];
    //$RespMsg = 'General Error.  Please contact Customer Support.';
    //    echo ($result_code);
    if ($result_code == 1 || $result_code == 26) {
        wpsc_update_customer_meta('payflow_message', __('Account configuration issue.  Please verify your login credentials.', 'wpsc_gold_cart'));
    } else {
        if ($result_code == '0') {
            $purchase_log = new WPSC_Purchase_Log($sessionid, 'sessionid');
            $purchase_log->set('processed', WPSC_Purchase_Log::ACCEPTED_PAYMENT);
            $purchase_log->save();
            $log_id = $purchase_log->get('id');
            if (isset($nvpArray['CVV2MATCH'])) {
                if ($nvpArray['CVV2MATCH'] != "Y") {
                    $RespMsg = __('Your billing (cvv2) information does not match. Please re-enter.', 'wpsc_gold_cart');
                }
            }
        } else {
            if ($result_code == 12) {
                $log_id = $wpdb->get_var("SELECT `id` FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid`='{$sessionid}' LIMIT 1");
                $delete_log_form_sql = "SELECT * FROM `" . $wpdb->prefix . "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 `".$wpdb->prefix."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");
                wpsc_update_customer_meta('payflow_message', __('Your credit card has been declined.  You may press the back button in your browser and check that you\'ve entered your card information correctly, otherwise please contact your credit card issuer.', 'wpsc_gold_cart'));
                header("Location:" . get_option('transact_url') . $seperator . "payflow=1&message=1");
            } else {
                if ($result_code == 13) {
                    $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);
                    }
                    */
                    $RespMsg = __('Invalid credit card information. Please use the back button in your browser and re-enter if you feel that you have received this message in error', 'wpsc_gold_cart');
                    wp_die($RespMsg);
                    //die before deleting cart information
                    $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");
                } else {
                    if ($result_code == 23 || $result_code == 24) {
                        $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 `".$wpdb->prefix."cart_item_variations` WHERE `cart_id` = '".$cart_item['id']."'", ARRAY_A);
                              }
                        */
                        $RespMsg = __('Invalid credit card information. Please use the back button in your browser and re-enter if you feel that you have received this message in error', 'wpsc_gold_cart');
                        wp_die($RespMsg);
                        //die before deleting cart information
                        $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");
                        $RespMsg = __('Invalid credit card information. Please use the back button in your browser and re-enter. If you feel that you received this message in error.', 'wpsc_gold_cart');
                    } else {
                        $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 `".$wpdb->prefix."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");
                        $RespMsg = __('Invalid credit card information. Please use the back button in your browser and re-enter. If you feel that you received this message in error.', 'wpsc_gold_cart');
                    }
                }
            }
        }
    }
    if ($fraud == 'YES') {
        if ($result_code == 125) {
            $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 `".$wpdb->prefix."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");
        } else {
            if ($result_code == 126) {
//.........这里部分代码省略.........
开发者ID:benhuson,项目名称:Gold-Cart,代码行数:101,代码来源:paypal_payflowpro.php


示例10: submit_payment_method

 private function submit_payment_method()
 {
     global $wpsc_cart;
     if (!$this->verify_nonce('wpsc-checkout-form-payment-method')) {
         return;
     }
     if (empty($_POST['wpsc_payment_method']) && !wpsc_is_free_cart()) {
         $this->message_collection->add(__('Please select a payment method', 'wpsc'), 'validation');
     }
     $valid = apply_filters('_wpsc_merchant_v2_validate_payment_method', true, $this);
     if (!$valid) {
         return;
     }
     $submitted_gateway = $_POST['wpsc_payment_method'];
     $purchase_log_id = wpsc_get_customer_meta('current_purchase_log_id');
     $purchase_log = new WPSC_Purchase_Log($purchase_log_id);
     $purchase_log->set('gateway', $submitted_gateway);
     $purchase_log->set(array('gateway' => $submitted_gateway, 'base_shipping' => $wpsc_cart->calculate_base_shipping(), 'totalprice' => $wpsc_cart->calculate_total_price()));
     $purchase_log->save();
     $wpsc_cart->empty_db($purchase_log_id);
     $wpsc_cart->save_to_db($purchase_log_id);
     $wpsc_cart->submit_stock_claims($purchase_log_id);
     $wpsc_cart->log_id = $purchase_log_id;
     $this->wizard->completed_step('payment');
     do_action('wpsc_submit_checkout', array("purchase_log_id" => $purchase_log_id, "our_user_id" => get_current_user_id()));
     do_action('wpsc_submit_checkout_gateway', $submitted_gateway, $purchase_log);
 }
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:27,代码来源:checkout.php


示例11: wpsc_free_checkout_update_processed_status

/**
 * Updates the 'processed' parameter after a new order is submitted with a free cart.
 *
 * @param  string            $gateway  Name of gateway.  In the case of a free cart, this will be empty.
 * @param  WPSC_Purchase_Log $log      WPSC_Purchase_Log object.
 * @uses   apply_filters               'wpsc_free_checkout_order_status' allows developers to change the status a free cart is saved with.
 * @since  3.9.0
 *
 */
function wpsc_free_checkout_update_processed_status($gateway, $log)
{
    wpsc_update_purchase_log_status($log->get('id'), apply_filters('wpsc_free_checkout_order_status', WPSC_Purchase_Log::ACCEPTED_PAYMENT));
    wp_safe_redirect(add_query_arg('sessionid', $log->get('sessionid'), get_option('transact_url')));
    exit;
}
开发者ID:parkesma,项目名称:WP-e-Commerce,代码行数:15,代码来源:cart-template-api.php


示例12: is_valid_ipn_response

 public function is_valid_ipn_response()
 {
     $valid = true;
     // Validate Currency
     if ($this->paypal_ipn_values['mc_currency'] !== $this->get_paypal_currency_code()) {
         $valid = false;
     }
     $purchase_log = new WPSC_Purchase_Log($this->cart_data['session_id'], 'sessionid');
     if (!$purchase_log->exists()) {
         $valid = false;
     }
     // Validate amount
     // It is worth noting, there are edge cases here that may need to be addressed via filter.
     // @link https://github.com/wp-e-commerce/WP-e-Commerce/issues/1232.
     if ($this->paypal_ipn_values['mc_gross'] != $this->convert($purchase_log->get('totalprice'))) {
         $valid = false;
     }
     return apply_filters('wpsc_paypal_standard_is_valid_ipn_response', $valid, $this);
 }
开发者ID:ashik968,项目名称:digiplot,代码行数:19,代码来源:paypal-standard.merchant.php


示例13: wpsc_get_transaction_html_output

function wpsc_get_transaction_html_output($purchase_log)
{
    if (!is_object($purchase_log)) {
        $purchase_log = new WPSC_Purchase_Log($purchase_log);
    }
    if (!$purchase_log->is_transaction_completed() && !$purchase_log->is_order_received()) {
        return '';
    }
    $notification = new WPSC_Purchase_Log_Customer_HTML_Notification($purchase_log);
    $output = $notification->get_html_message();
    $output = apply_filters('wpsc_get_transaction_html_output', $output, $notification);
    return $output;
}
开发者ID:pankajsinghjarial,项目名称:SYLC,代码行数:13,代码来源:purchase-log.helpers.php


示例14: wpsc_get_transaction_html_output

function wpsc_get_transaction_html_output($purchase_log)
{
    if (!is_object($purchase_log)) {
        $purchase_log = new WPSC_Purchase_Log($purchase_log);
    }
    $notification = new WPSC_Purchase_Log_Customer_HTML_Notification($purchase_log);
    $output = $notification->get_html_message();
    // see if the customer trying to view this transaction output is the person
    // who made the purchase.
    $checkout_session_id = wpsc_get_customer_meta('checkout_session_id');
    if ($checkout_session_id == $purchase_log->get('sessionid')) {
        $output = apply_filters('wpsc_get_transaction_html_output', $output, $notification);
    } else {
        $output = apply_filters('wpsc_get_transaction_unauthorized_view', __("You don't have the permission to view this page", 'wp-e-commerce'), $output, $notification);
    }
    return $output;
}
开发者ID:ashik968,项目名称:digiplot,代码行数:17,代码来源:purchase-log.helpers.php


示例15: submit_payment_method

 private function submit_payment_method()
 {
     global $wpsc_cart;
     if (!$this->verify_nonce('wpsc-checkout-form-payment-method')) {
         return;
     }
     if (empty($_POST['wpsc_payment_method']) && !wpsc_is_free_cart()) {
         $this->message_collection->add(__('Please select a payment method', 'wp-e-commerce'), 'validation');
     }
     $valid = apply_filters('_wpsc_merchant_v2_validate_payment_method', true, $this);
     if (!$valid) {
         return;
     }
     $purchase_log_id = wpsc_get_customer_meta('current_purchase_log_id');
     $purchase_log = new WPSC_Purchase_Log($purchase_log_id);
     $submitted_gateway = $_POST['wpsc_payment_method'];
     $purchase_log->set(array('gateway' => $submitted_gateway, 'base_shipping' => $wpsc_cart->calculate_base_shipping(), 'totalprice' => $wpsc_cart->calculate_total_price()));
     if ($this->maybe_add_guest_account() && isset($_POST['wpsc_create_account'])) {
         $email = wpsc_get_customer_meta('billingemail');
         $user_id = wpsc_register_customer($email, $email, false);
         $purchase_log->set('user_ID', $user_id);
         wpsc_update_customer_meta('checkout_details', wpsc_get_customer_meta('checkout_details'), $user_id);
         update_user_meta($user_id, '_wpsc_visitor_id', wpsc_get_current_customer_id());
     }
     $purchase_log->save();
     $wpsc_cart->empty_db($purchase_log_id);
     $wpsc_cart->save_to_db($purchase_log_id);
     $wpsc_cart->submit_stock_claims($purchase_log_id);
     $wpsc_cart->log_id = $purchase_log_id;
     $this->wizard->completed_step('payment');
     do_action('wpsc_submit_checkout', array('purchase_log_id' => $purchase_log_id, 'our_user_id' => isset($user_id) ? $user_id : get_current_user_id()));
     do_action('wpsc_submit_checkout_gateway', $submitted_gateway, $purchase_log);
 }
开发者ID:androidprojectwork,项目名称:WP-e-Commerce,代码行数:33,代码来源:checkout.php


示例16: get_stats

 /**
  * Get stats of the products, specifying some more arguments
  *
  * @since 3.8.14
  * @param  array $args Arguments. See {@link WPSC_Purchase_Log::fetch_stats()}.
  * @return array       'earnings' and 'sales' stats
  */
 public function get_stats($args)
 {
     $this->fetch_products();
     $args['products'] = $this->products;
     return WPSC_Purchase_Log::fetch_stats($args);
 }
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:13,代码来源:product.class.php


示例17: save_form

 /**
  * Save Submitted Form Fields to the wpsc_submited_form_data table.
  *
  * @param WPSC_Purchase_Log $purchase_log
  * @param array $fields
  * @return void
  */
 public static function save_form($purchase_log, $fields, $data = array())
 {
     global $wpdb;
     $log_id = $purchase_log->get('id');
     // delete previous field values
     $sql = $wpdb->prepare("DELETE FROM " . WPSC_TABLE_SUBMITTED_FORM_DATA . " WHERE log_id = %d", $log_id);
     $wpdb->query($sql);
     if (empty($data) && isset($_POST['wpsc_checkout_details'])) {
         $data = $_POST['wpsc_checkout_details'];
     }
     $customer_details = array();
     foreach ($fields as $field) {
         if ($field->type == 'heading') {
             continue;
         }
         $value = '';
         if (isset($data[$field->id])) {
             $value = wp_unslash($data[$field->id]);
         }
         $customer_details[$field->id] = $value;
         $wpdb->insert(WPSC_TABLE_SUBMITTED_FORM_DATA, array('log_id' => $log_id, 'form_id' => $field->id, 'value' => $value), array('%d', '%d', '%s'));
     }
     wpsc_save_customer_details($customer_details);
 }
开发者ID:PhanHaHus,项目名称:wordpress,代码行数:31,代码来源:checkout-form-data.class.php


示例18: process_ipn

 /**
  * Process IPN messages from Amazon
  *
  * @access public
  * @since  4.0
  * @return void
  */
 public function process_ipn()
 {
     if (!isset($_GET['wpsc-listener']) || $_GET['wpsc-listener'] !== 'amazon') {
         return;
     }
     if (isset($_GET['state'])) {
         return;
     }
     // Get the IPN headers and Message body
     $headers = getallheaders();
     $body = file_get_contents('php://input');
     $this->doing_ipn = true;
     if (!class_exists('PayWithAmazon\\IpnHandler')) {
         require_once WPSC_MERCHANT_V3_SDKS_PATH . '/amazon-payments/sdk/IpnHandler.php';
     }
     try {
         $ipn = new PayWithAmazon\IpnHandler($headers, $body);
         $data = $ipn->toArray();
         $seller_id = $data['SellerId'];
         if ($seller_id != $this->gateway->seller_id) {
             wp_die(__('Invalid Amazon seller ID', 'wpsc'), __('IPN Error', 'wpsc'), array('response' => 401));
         }
         switch ($data['NotificationType']) {
             case 'OrderReferenceNotification':
                 break;
             case 'PaymentAuthorize':
                 break;
             case 'PaymentCapture':
                 $status = $data['CaptureDetails']['CaptureStatus']['State'];
                 if ('Declined' === $status) {
                     $value = $data['CaptureDetails']['CaptureReferenceId'];
                     $reason = $data['CaptureDetails']['CaptureStatus']['ReasonCode'];
                     // Get Order ID by reference
                     $order = WPSC_Purchase_Log::get_log_by_meta('amazon_capture_id', $value);
                     if (!$order) {
                         break;
                     }
                     // Update status to declined
                     $order->set('processed', WPSC_Purchase_Log::PAYMENT_DECLINED)->save();
                     // Update Amazon note
                     $order->set('amazon-status', __('Could not authorize Amazon payment.', 'wpsc'))->save();
                     // Email user
                     $hard = 'InvalidPaymentMethod' == $reason;
                     $this->send_decline_email($hard, $order);
                 }
                 break;
             case 'PaymentRefund':
                 $refund_id = $data['RefundDetails']['AmazonRefundId'];
                 $status = $data['RefundDetails']['RefundStatus']['State'];
                 $amount = $data['RefundDetails']['RefundAmount'];
                 if ('Completed' === $status) {
                     // get payment ID based on refund ID
                     $order = WPSC_Purchase_Log::get_log_by_meta('amazon_refund_id', $refund_id);
                     // Update status to refunded
                     $order->set('processed', WPSC_Purchase_Log::REFUNDED)->save();
                     // Add payment note for refund.
                     $order->set('amazon-status', sprintf(__('Refunded %s', 'wpsc'), wpsc_currency_display($amount)))->save();
                     // Update refund ID
                     wpsc_add_purchase_meta($order->get('id'), 'amazon_refund_id', $refund_id);
                 }
                 break;
         }
     } catch (Exception $e) {
         wp_die($e->getErrorMessage(), __('IPN Error', 'wpsc'), array('response' => 401));
     }
 }
开发者ID:RJHanson292,项目名称:WP-e-Commerce,代码行数:73,代码来源:amazon-payments.php


示例19: dibspayment_paywin_process

/**
 * Handle Response from DIBS server
 * 
 * 
 *  
 */
function dibspayment_paywin_process()
{
    global $wpdb;
    if (isset($_GET['dibspw_result']) && isset($_POST['s_pid'])) {
        array_walk($_POST, create_function('&$val', '$val = stripslashes($val);'));
        $hamc_key = get_option('dibspw_hmac');
        $order_id = $_POST['orderid'];
        switch ($_GET['dibspw_result']) {
            case 'callback':
                if ($hamc_key && !isset($_POST['MAC'])) {
                    die("HMAC error!");
                }
                if (isset($_POST['MAC']) && $_POST['MAC'] != dibspayment_paywin_calc_mac($_POST, $hamc_key, $bUrlDecode = FALSE)) {
                    die("Mac is incorrect, fraud attempt!!");
                }
                $dibsInvoiceFields = array("acquirerLastName", "acquirerFirstName", "acquirerDeliveryAddress", "acquirerDeliveryPostalCode", "acquirerDeliveryPostalPlace");
                $dibsInvoiceFieldsString = "";
                foreach ($_POST as $key => $value) {
                    if (in_array($key, $dibsInvoiceFields)) {
                        $dibsInvoiceFieldsString .= "{$key}={$value}\n";
                    }
                }
                // Email is not send automatically on a success transactio page
                // from version '3.8.9 so we send email on callback from this version
                if (version_compare(get_option('wpsc_version'), '3.8.9', '>=')) {
                    if ($_POST['status'] == "ACCEPTED") {
                        $purchaselog = new WPSC_Purchase_Log($order_id);
                        $purchaselog->set('processed', get_option('dibspw_status'));
                        $purchaselog->set('notes', $dibsInvoiceFieldsString);
                        $purchaselog->save();
                        $wpscmerch = new wpsc_merchant($order_id, false);
                        $wpscmerch->set_purchase_processed_by_purchid(get_option('dibspw_status'));
                    }
                } else {
                    if ($_POST['status'] == "ACCEPTED") {
                        $purchase_log = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid`= " . $_POST['s_pid'] . " LIMIT 1", ARRAY_A);
                        $wpdb->query("UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET `processed` = '" . get_option('dibspw_status') . "', `notes`='" . $dibsInvoiceFieldsString . "'  WHERE `id` = '" . $purchase_log[0]['id'] . "' LIMIT 1;");
                        // If it is the second callback with status ACCEPTED
                        // we want to send an email to customer.
                        if ($purchase_log[0]['authcode'] == "PENDING") {
                            transaction_results($_POST['s_pid'], false);
                        }
                    } else {
                        // we save not successed statuses it can be PENDING status..
                        $wpdb->query("UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET `processed` = '1' , `authcode` = '" . $_POST['status'] . "'  WHERE `id` = '" . $purchase_log[0]['id'] . "' LIMIT 1;");
                    }
                }
                break;
            case 'success':
                if (!isset($_GET['page_id']) || get_permalink($_GET['page_id']) != get_option('transact_url')) {
                    $location = add_query_arg('sessionid', $_POST['s_pid'], get_option('transact_url'));
                    if ($_POST['status'] == "ACCEPTED") {
                        if ($hamc_key && !isset($_POST['MAC'])) {
                            die("HMAC error!");
                        }
                        if (isset($_POST['MAC']) && $_POST['MAC'] != dibspayment_paywin_calc_mac($_POST, $hamc_key, $bUrlDecode = FALSE)) {
                            die("HMAC is incorrect, fraud attempt!");
                        }
                    } else {
                        // Declined or PENDING
                        $purchase_log = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `sessionid`= " . $_POST['s_pid'] . " LIMIT 1", ARRAY_A);
                        $wpdb->query("UPDATE `&q 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP WPSEO_Frontend类代码示例发布时间:2022-05-23
下一篇:
PHP WPSC_Country类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap