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


PHP WC_Order::get_transaction_id方法代码示例

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


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

示例1: iamport_order_detail

 /**
  * @action woocommerce_order_details_after_order_table
  *
  * @param WC_Order $order
  */
 public static function iamport_order_detail(\WC_Order $order)
 {
     $checkout_methods = WSKL_Payment_Gates::get_checkout_methods('iamport');
     $pay_method = $order->iamport_paymethod;
     $receipt_url = $order->iamport_receipt_url;
     $vbank_name = $order->iamport_vbank_name;
     $vbank_num = $order->iamport_vbank_num;
     $vbank_date = $order->iamport_vbank_date;
     $transction_id = $order->get_transaction_id();
     ob_start();
     switch ($pay_method) {
         case 'card':
             $pay_method_text = $checkout_methods['credit'];
             include_once WSKL_PATH . '/includes/lib/iamport/template-simple.php';
             break;
         case 'trans':
             $pay_method_text = $checkout_methods['remit'];
             include_once WSKL_PATH . '/includes/lib/iamport/template-simple.php';
             break;
         case 'phone':
             $pay_method_text = $checkout_methods['mobile'];
             include_once WSKL_PATH . '/includes/lib/iamport/template-simple.php';
             break;
         case 'vbank':
             $pay_method_text = $checkout_methods['virtual'];
             include_once WSKL_PATH . '/includes/lib/iamport/template-vbank.php';
             break;
         case 'kakao':
             $pay_method_text = $checkout_methods['kakao_pay'];
             include_once WSKL_PATH . '/includes/lib/iamport/template-simple.php';
             break;
     }
     ob_end_flush();
 }
开发者ID:EricKim65,项目名称:woosym-korean-localization,代码行数:39,代码来源:class-pg-iamport-main.php

示例2: get_transaction_url

 /**
  * Get a link to the transaction on the 3rd party gateway size (if applicable)
  *
  * @param  WC_Order $order the order object
  * @return string transaction URL, or empty string
  */
 public function get_transaction_url($order)
 {
     $return_url = '';
     $transaction_id = $order->get_transaction_id();
     if (!empty($this->view_transaction_url) && !empty($transaction_id)) {
         $return_url = sprintf($this->view_transaction_url, $transaction_id);
     }
     return apply_filters('woocommerce_get_transaction_url', $return_url, $order, $this);
 }
开发者ID:anagio,项目名称:woocommerce,代码行数:15,代码来源:abstract-wc-payment-gateway.php

示例3: get_request

 /**
  * Get refund request args
  * @param  WC_Order $order
  * @param  float $amount
  * @param  string $reason
  * @return array
  */
 public static function get_request($order, $amount = null, $reason = '')
 {
     $request = array('VERSION' => '84.0', 'SIGNATURE' => self::$api_signature, 'USER' => self::$api_username, 'PWD' => self::$api_password, 'METHOD' => 'RefundTransaction', 'TRANSACTIONID' => $order->get_transaction_id(), 'NOTE' => html_entity_decode(wc_trim_string($reason, 255), ENT_NOQUOTES, 'UTF-8'), 'REFUNDTYPE' => 'Full');
     if (!is_null($amount)) {
         $request['AMT'] = number_format($amount, 2, '.', '');
         $request['CURRENCYCODE'] = $order->get_order_currency();
         $request['REFUNDTYPE'] = 'Partial';
     }
     return apply_filters('woocommerce_paypal_refund_request', $request, $order, $amount, $reason);
 }
开发者ID:flasomm,项目名称:Montkailash,代码行数:17,代码来源:class-wc-gateway-paypal-refund.php

示例4: refund_order

 /**
  * Refund an order.
  *
  * @throws \PayPal_API_Exception
  *
  * @param WC_Order $order      Order to refund
  * @param float    $amount     Amount to refund
  * @param string   $refundType Type of refund (Partial or Full)
  * @param string   $reason     Reason to refund
  * @param string   $current    Currency of refund
  *
  * @return null|string If exception is thrown, null is returned. Otherwise
  *                     ID of refund transaction is returned.
  */
 public static function refund_order($order, $amount, $refundType, $reason, $currency)
 {
     // add refund params
     $params['TRANSACTIONID'] = $order->get_transaction_id();
     $params['REFUNDTYPE'] = $refundType;
     $params['AMT'] = $amount;
     $params['CURRENCYCODE'] = $currency;
     $params['NOTE'] = $reason;
     // do API call
     $response = wc_gateway_ppec()->client->refund_transaction($params);
     // look at ACK to see if success or failure
     // if success return the transaction ID of the refund
     // if failure then do 'throw new PayPal_API_Exception( $response );'
     if ('Success' == $response['ACK'] || 'SuccessWithWarning' == $response['ACK']) {
         return $response['REFUNDTRANSACTIONID'];
     } else {
         throw new PayPal_API_Exception($response);
     }
 }
开发者ID:ksan5835,项目名称:maadithottam,代码行数:33,代码来源:class-wc-gateway-ppec-refund.php

示例5: can_refund_order

 /**
  * Can the order be refunded via PayPal?
  * @param  WC_Order $order
  * @return bool
  */
 public function can_refund_order($order)
 {
     return $order && $order->get_transaction_id();
 }
开发者ID:venturepact,项目名称:blog,代码行数:9,代码来源:class-wc-gateway-paypal.php

示例6:

 /**
  * Test: get_transaction_id
  */
 function test_get_transaction_id()
 {
     $object = new WC_Order();
     $set_to = '12345';
     $object->set_transaction_id($set_to);
     $this->assertEquals($set_to, $object->get_transaction_id());
 }
开发者ID:woocommerce,项目名称:woocommerce,代码行数:10,代码来源:crud.php

示例7: orderpost

function orderpost($orderId)
{
    global $wpdb;
    $testMode = get_option('linksync_test');
    $LAIDKey = get_option('linksync_laid');
    $apicall = new linksync_class($LAIDKey, $testMode);
    //Checking for already sent Order
    $sentOrderIds = get_option('linksync_sent_order_id');
    if (isset($sentOrderIds)) {
        if (!empty($sentOrderIds)) {
            $order_id_array = unserialize($sentOrderIds);
        } else {
            $order_id_array = array();
        }
        if (!in_array($orderId, $order_id_array)) {
            $order = new WC_Order($orderId);
            if ($order->post_status == get_option('order_status_wc_to_vend')) {
                update_option('linksync_sent_order_id', serialize(array_merge($order_id_array, array($orderId))));
                $order_no = $order->get_order_number();
                if (strpos($order_no, '#') !== false) {
                    $order_no = str_replace('#', '', $order_no);
                }
                $get_total = $order->get_total();
                $get_user = $order->get_user();
                $comments = $order->post->post_excerpt;
                $primary_email_address = $get_user->data->user_email;
                $currency = $order->get_order_currency();
                $shipping_method = $order->get_shipping_method();
                $order_total = $order->get_order_item_totals();
                $transaction_id = $order->get_transaction_id();
                $taxes_included = false;
                $total_discount = $order->get_total_discount();
                $total_quantity = 0;
                $registerDb = get_option('wc_to_vend_register');
                $vend_uid = get_option('wc_to_vend_user');
                $total_tax = $order->get_total_tax();
                // Geting Payment object details
                if (isset($order_total['payment_method']['value']) && !empty($order_total['payment_method']['value'])) {
                    $wc_payment = get_option('wc_to_vend_payment');
                    if (isset($wc_payment) && !empty($wc_payment)) {
                        $total_payments = explode(",", $wc_payment);
                        foreach ($total_payments as $mapped_payment) {
                            $exploded_mapped_payment = explode("|", $mapped_payment);
                            if (isset($exploded_mapped_payment[1]) && !empty($exploded_mapped_payment[1]) && isset($exploded_mapped_payment[0]) && !empty($exploded_mapped_payment[0])) {
                                if ($exploded_mapped_payment[1] == $order_total['payment_method']['value']) {
                                    $vend_payment_data = explode("%%", $exploded_mapped_payment[0]);
                                    if (isset($vend_payment_data[0])) {
                                        $payment_method = $vend_payment_data[0];
                                    }
                                    if (isset($vend_payment_data[1])) {
                                        $payment_method_id = $vend_payment_data[1];
                                    }
                                    break;
                                }
                            }
                        }
                    }
                    $payment = array("retailer_payment_type_id" => isset($payment_method_id) ? $payment_method_id : null, "amount" => isset($get_total) ? $get_total : 0, "method" => isset($payment_method) ? $payment_method : null, "transactionNumber" => isset($transaction_id) ? $transaction_id : null);
                }
                $export_user_details = get_option('wc_to_vend_export');
                if (isset($export_user_details) && !empty($export_user_details)) {
                    if ($export_user_details == 'customer') {
                        //woocommerce filter
                        $billingAddress_filter = apply_filters('woocommerce_order_formatted_billing_address', array('firstName' => $order->billing_first_name, 'lastName' => $order->billing_last_name, 'phone' => $order->billing_phone, 'street1' => $order->billing_address_1, 'street2' => $order->billing_address_2, 'city' => $order->billing_city, 'state' => $order->billing_state, 'postalCode' => $order->billing_postcode, 'country' => $order->billing_country, 'company' => $order->billing_company, 'email_address' => $order->billing_email), $order);
                        $billingAddress = array('firstName' => $billingAddress_filter['firstName'], 'lastName' => $billingAddress_filter['lastName'], 'phone' => $billingAddress_filter['phone'], 'street1' => $billingAddress_filter['street1'], 'street2' => $billingAddress_filter['street2'], 'city' => $billingAddress_filter['city'], 'state' => $billingAddress_filter['state'], 'postalCode' => $billingAddress_filter['postalCode'], 'country' => $billingAddress_filter['country'], 'company' => $billingAddress_filter['company'], 'email_address' => $billingAddress_filter['email_address']);
                        $deliveryAddress_filter = apply_filters('woocommerce_order_formatted_shipping_address', array('firstName' => $order->shipping_first_name, 'lastName' => $order->shipping_last_name, 'phone' => $order->shipping_phone, 'street1' => $order->shipping_address_1, 'street2' => $order->shipping_address_2, 'city' => $order->shipping_city, 'state' => $order->shipping_state, 'postalCode' => $order->shipping_postcode, 'country' => $order->shipping_country, 'company' => $order->shipping_company), $order);
                        $deliveryAddress = array('firstName' => $deliveryAddress_filter['firstName'], 'lastName' => $deliveryAddress_filter['lastName'], 'phone' => $deliveryAddress_filter['phone'], 'street1' => $deliveryAddress_filter['street1'], 'street2' => $deliveryAddress_filter['street2'], 'city' => $deliveryAddress_filter['city'], 'state' => $deliveryAddress_filter['state'], 'postalCode' => $deliveryAddress_filter['postalCode'], 'country' => $deliveryAddress_filter['country'], 'company' => $deliveryAddress_filter['company']);
                        $primary_email = isset($primary_email_address) ? $primary_email_address : $billingAddress['email_address'];
                        unset($billingAddress['email_address']);
                    }
                }
                $vend_user_detail = get_option('wc_to_vend_user');
                if (isset($vend_user_detail) && !empty($vend_user_detail)) {
                    $user = explode('|', $vend_user_detail);
                    $vend_uid = isset($user[0]) ? $user[0] : null;
                    $vend_username = isset($user[1]) ? $user[1] : null;
                }
                //Ordered product(s)
                $items = $order->get_items();
                $taxes = $order->get_taxes();
                foreach ($items as $item) {
                    foreach ($taxes as $tax_label) {
                        $sql = mysql_query("SELECT  tax_rate_id FROM  `" . $wpdb->prefix . "woocommerce_tax_rates` WHERE  tax_rate_name='" . $tax_label['label'] . "' AND tax_rate_class='" . $item['item_meta']['_tax_class'][0] . "'");
                        if (mysql_num_rows($sql) != 0) {
                            $tax_classes = linksync_tax_classes($tax_label['label'], $item['item_meta']['_tax_class'][0]);
                            if ($tax_classes['result'] == 'success') {
                                $vend_taxes = explode('/', $tax_classes['tax_classes']);
                            }
                        }
                    }
                    $taxId = isset($vend_taxes[0]) ? $vend_taxes[0] : null;
                    $taxName = isset($vend_taxes[1]) ? $vend_taxes[1] : null;
                    $taxRate = isset($vend_taxes[2]) ? $vend_taxes[2] : null;
                    if (isset($item['variation_id']) && !empty($item['variation_id'])) {
                        $product_id = $item['variation_id'];
                    } else {
                        $product_id = $item['product_id'];
                    }
                    $pro_object = new WC_Product($product_id);
                    $itemtotal = (double) $item['item_meta']['_line_subtotal'][0];
//.........这里部分代码省略.........
开发者ID:amanpreet8333,项目名称:linksync,代码行数:101,代码来源:linksync_add_action_order.php

示例8: can_refund_order

 /**
  * Can the order be refunded via PayTPV?
  * @param  WC_Order $order
  * @return bool
  */
 public function can_refund_order($order)
 {
     return $order && $order->get_transaction_id() && get_post_meta((int) $order->id, 'PayTPV_IdUser', true);
 }
开发者ID:PayTpv,项目名称:paytpv-for-woocommerce,代码行数:9,代码来源:woocommerce-paytpv.php

示例9: can_refund_order

 /**
  * Can the order be refunded?
  *
  * @param WC_Order $order
  *
  * @return bool
  */
 public function can_refund_order($order)
 {
     return $order && $order->payment_method == 'fac' && $order->get_transaction_id();
 }
开发者ID:strikewood,项目名称:woocommerce-first-atlantic-commerce,代码行数:11,代码来源:class-wc-gateway-fac.php

示例10: process_refund

 /**
  * Process a refund in WooCommerce 2.2 or later.
  *
  * @param  int    $order_id
  * @param  float  $amount
  * @param  string $reason
  *
  * @return bool|WP_Error True or false based on success, or a WP_Error object.
  */
 public function process_refund($order_id, $amount = null, $reason = '')
 {
     $order = new WC_Order($order_id);
     if (!$order || !$order->get_transaction_id()) {
         return false;
     }
     $diff = strtotime($order->order_date) - strtotime(current_time('mysql'));
     $days = absint($diff / (60 * 60 * 24));
     $limit = 120;
     if ($limit > $days) {
         $tid = $order->get_transaction_id();
         $amount = wc_format_decimal($amount);
         $response = $this->api->do_transaction_cancellation($order, $tid, $order->id . '-' . time(), $amount);
         // Already canceled.
         if (isset($response->mensagem) && !empty($response->mensagem)) {
             $order->add_order_note(__('Cielo', 'cielo-woocommerce') . ': ' . sanitize_text_field($response->mensagem));
             return new WP_Error('cielo_refund_error', sanitize_text_field($response->mensagem));
         } else {
             if (isset($response->cancelamentos->cancelamento)) {
                 $order->add_order_note(sprintf(__('Cielo: %s - Refunded amount: %s.', 'cielo-woocommerce'), sanitize_text_field($response->cancelamentos->cancelamento->mensagem), wc_price($response->cancelamentos->cancelamento->valor / 100)));
             }
             return true;
         }
     } else {
         return new WP_Error('cielo_refund_error', sprintf(__('This transaction has been made ​​more than %s days and therefore it can not be canceled', 'cielo-woocommerce'), $limit));
     }
     return false;
 }
开发者ID:ronal2do,项目名称:cielo-woocommerce,代码行数:37,代码来源:class-wc-cielo-helper.php

示例11: get_transaction_url

 /**
  * Get a link to the transaction on the 3rd party gateway size (if applicable)
  *
  * @param  WC_Order $order the order object
  *
  * @return string transaction URL, or empty string
  */
 public function get_transaction_url($order)
 {
     $return_url = '';
     $transaction_id = $order->get_transaction_id();
     if (!$transaction_id) {
         $transaction_id = get_post_meta($order->id, 'oplatamd_transaction_id', true);
     }
     if (!empty($this->view_transaction_url) && !empty($transaction_id)) {
         $return_url = sprintf($this->view_transaction_url, $transaction_id);
     }
     return apply_filters('woocommerce_get_transaction_url', $return_url, $order, $this);
 }
开发者ID:slavic18,项目名称:fruitware-woocommerce-oplatamd,代码行数:19,代码来源:wc-oplatamd.php

示例12: process_creditcapture

 /**
  * Process a Credit Capture transaction.
  *
  * @access public
  * @param  WC_Order $order
  * @return bool|WP_Error
  */
 public function process_creditcapture($order)
 {
     // Bail if no GUID.
     if (!$order || !$order->get_transaction_id()) {
         $this->log('TrxServices failed to capture an authorized credit transaction: No GUID');
         return false;
     }
     $guid = $order->get_transaction_id();
     $data = array('Detail' => array('TranType' => 'Credit', 'TranAction' => 'Capture', 'CurrencyCode' => 840, 'Amount' => $order->order_total), 'Reference' => array('Guid' => $guid));
     $data = apply_filters('woocommerce_trxservices_creditcapture_data', $data, $order, $amount, $reason);
     $result = $this->do_request($data);
     // Bail if capture failed.
     if (!$result) {
         return false;
     }
     // Extract guid, responseCode and responseText.
     extract($result);
     if ($responseCode != '00') {
         $message = sprintf(__('Unable to capture payment for order %s via TrxServices (GUID: %s ResponseCode: %s ResponseText: %s)', 'woocommerce-trxservices'), $order_id, $guid, $responseCode, $responseText);
         $order->add_order_note($message);
         $this->log($message);
         return false;
     }
     // Change order status.
     $order->update_status('processing', __('Payment captured via TrxServices.', 'woocommerce-trxservices'));
     $order->add_order_note(sprintf(__('TrxServices Credit Capture %s (GUID: %s)', 'woocommerce-trxservices'), $amount, $guid));
     // Store transaction type.
     update_post_meta($order->id, '_trxservices_transaction_type', 'Credit Capture');
     $message = 'TrxServices captured payment for an authorized credit transaction for order #' . $order->id;
     $this->log($message);
     return true;
 }
开发者ID:hitfactory,项目名称:woocommerce-trxservices,代码行数:39,代码来源:class-wc-gateway-trxservices.php


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