当前位置: 首页>>代码示例>>PHP>>正文


PHP WPSC_Purchase_Log::is_transaction_completed方法代码示例

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


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

示例1: _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

示例2: 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

示例3: wpsc_maybe_empty_cart

/**
 * Conditionally empties the cart based on the status of `processed`.
 * Removed from being hardcoded in transaction_results().
 *
 * @since  3.9.0
 *
 * @param  WPSC_Purchase_Log $log Purchase Log.
 * @return void
 */
function wpsc_maybe_empty_cart($log)
{
    if ($log->is_transaction_completed() || $log->is_order_received()) {
        global $wpsc_cart;
        $wpsc_cart->empty_cart();
    }
}
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:16,代码来源:checkout-results.php

示例4: _wpsc_buy_now_transaction_results

function _wpsc_buy_now_transaction_results()
{
    if (!isset($_REQUEST['sessionid'])) {
        return;
    }
    $purchase_log = new WPSC_Purchase_Log($_REQUEST['sessionid'], 'sessionid');
    if (!$purchase_log->exists() || $purchase_log->is_transaction_completed()) {
        return;
    }
    $purchase_log->set('processed', WPSC_Purchase_Log::ORDER_RECEIVED);
    $purchase_log->save();
}
开发者ID:ashik968,项目名称:digiplot,代码行数:12,代码来源:paypal-standard.merchant.php

示例5: wpsc_send_customer_email

function wpsc_send_customer_email($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;
    }
    $email = new WPSC_Purchase_Log_Customer_Notification($purchase_log);
    $email_sent = $email->send();
    do_action('wpsc_transaction_send_email_to_customer', $email, $email_sent);
    return $email_sent;
}
开发者ID:ashik968,项目名称:digiplot,代码行数:13,代码来源:purchase-log.helpers.php

示例6: 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

示例7: push_sales_data

 /**
  * Pushes sales data back to Baikonur
  *
  * Only pushes once.  Accounts for annoying potential edge case of status-switching admins
  *
  * @param  WPSC_Purchase_Log object $purchase_log Purchase Log object
  * @return void
  */
 public static function push_sales_data($purchase_log_id, $current_status, $old_status, $purchase_log)
 {
     $purchase_log = new WPSC_Purchase_Log($purchase_log_id);
     $id = absint($purchase_log->get('id'));
     //Also checking is_order_received, as that's what Manual Payments do.
     if ($purchase_log->is_transaction_completed() || $purchase_log->is_order_received()) {
         $pushed_to_sass = wpsc_get_meta($id, '_pushed_to_wpeconomy', 'purchase_log');
         if (empty($pushed_to_saas)) {
             $data = $purchase_log->get_data();
             $cart_contents = $purchase_log->get_cart_contents();
             //We want to push sales data - but naturally, IDs will differ, even names could potentially.
             //So we add the slug to the object we POST
             foreach ($cart_contents as $key => $cart_item) {
                 $slug = get_post_field('post_name', $cart_item->prodid);
                 $cart_contents[$key]->slug = $slug;
             }
             $args = array('body' => array('data' => json_encode($data), 'cart_contents' => json_encode($cart_contents)));
             $request = wp_remote_post('http://www.wpeconomy.org/?sales_data=true', $args);
             $response = wp_remote_retrieve_response_code($request);
             //For some reason, if the site is down, we want the ability to ensure we can grab the sale later.
             $success = 200 === $response;
             wpsc_update_meta($id, '_pushed_to_wpeconomy', $success, 'purchase_log');
         }
     }
 }
开发者ID:VanessaGarcia-Freelance,项目名称:ButtonHut,代码行数:33,代码来源:Sputnik.php

示例8: _wpsc_oklink_return

function _wpsc_oklink_return()
{
    if (!isset($_REQUEST['wpsc_oklink_return'])) {
        return;
    }
    // oklink order param interferes with wordpress
    unset($_REQUEST['order']);
    unset($_GET['order']);
    if (!isset($_REQUEST['sessionid'])) {
        return;
    }
    global $sessionid;
    $purchase_log = new WPSC_Purchase_Log($_REQUEST['sessionid'], 'sessionid');
    if (!$purchase_log->exists() || $purchase_log->is_transaction_completed()) {
        return;
    }
    $status = 1;
    if (isset($_REQUEST['cancelled'])) {
        # Unsetting sessionid to show error
        do_action('wpsc_payment_failed');
        $sessionid = false;
        unset($_REQUEST['sessionid']);
        unset($_GET['sessionid']);
    } else {
        $status = WPSC_Purchase_Log::ORDER_RECEIVED;
        $purchase_log->set('processed', $status);
        $purchase_log->save();
        wpsc_empty_cart();
    }
}
开发者ID:ritthisakdi,项目名称:oklink-e-commerce,代码行数:30,代码来源:oklink.merchant.php

示例9: completed_order

 /**
  * Adds product properties to analytics.track() when the order is completed successfully.
  *
  * @since  1.0.0
  * @access public
  *
  * @uses  func_get_args() Because our abstract class doesn't know how many parameters are passed to each hook
  *                        for each different platform, we use func_get_args().
  *
  * @return array Filtered array of name and properties for analytics.track().
  */
 public function completed_order()
 {
     $args = func_get_args();
     $track = $args[0];
     if (did_action('wpsc_transaction_results_shutdown') && isset($_GET['sessionid'])) {
         $log = new WPSC_Purchase_Log($_GET['sessionid'], 'sessionid');
         /* We like checking is_order_received(), as that's what the manual payment gateway uses. */
         if ($log->is_transaction_completed() || $log->is_order_received()) {
             $gateway_data = $log->get_gateway_data();
             $items = $log->get_cart_contents();
             $products = array();
             foreach ($items as $item) {
                 $product = array('id' => $item->prodid, 'sku' => wpsc_product_sku($item->prodid), 'name' => $item->name, 'price' => $item->price, 'quantity' => $item->quantity, 'category' => implode(', ', wp_list_pluck(wpsc_get_product_terms($item->prodid, 'wpsc_product_category'), 'name')));
                 $products[] = $product;
             }
             $track = array('event' => __('Completed Order', 'segment'), 'properties' => array('id' => $log->get('id'), 'total' => $log->get('totalprice'), 'revenue' => $gateway_data['subtotal'], 'shipping' => $gateway_data['shipping'], 'tax' => $gateway_data['tax'], 'products' => $products));
         }
     }
     return $track;
 }
开发者ID:qfrery,项目名称:analytics-wordpress,代码行数:31,代码来源:wp-e-commerce.php

示例10: shipwire_on_checkout

 /**
  * Hooks into to checkout process. Sends order to shipwire on successful checkout
  *
  * @param integer $log_id Purchase Log ID
  *
  * @since 3.8.9
  * @return type
  */
 public function shipwire_on_checkout($log_id)
 {
     $log = new WPSC_Purchase_Log($log_id);
     if (!$log->is_transaction_completed()) {
         return false;
     }
     self::process_order_request($log_id);
 }
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:16,代码来源:shipwire_functions.php


注:本文中的WPSC_Purchase_Log::is_transaction_completed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。