本文整理汇总了PHP中WC_Order类的典型用法代码示例。如果您正苦于以下问题:PHP WC_Order类的具体用法?PHP WC_Order怎么用?PHP WC_Order使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WC_Order类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: add_edit_address_subscription_action
/**
* Add a "Change Shipping Address" button to the "My Subscriptions" table for those subscriptions
* which require shipping.
*
* @param array $all_actions The $subscription_key => $actions array with all actions that will be displayed for a subscription on the "My Subscriptions" table
* @param array $subscriptions All of a given users subscriptions that will be displayed on the "My Subscriptions" table
* @since 1.3
*/
public static function add_edit_address_subscription_action($all_actions, $subscriptions)
{
foreach ($all_actions as $subscription_key => $actions) {
$order = new WC_Order($subscriptions[$subscription_key]['order_id']);
$needs_shipping = false;
foreach ($order->get_items() as $item) {
if ($item['product_id'] !== $subscriptions[$subscription_key]['product_id']) {
continue;
}
$product = $order->get_product_from_item($item);
if (!is_object($product)) {
// In case a product has been deleted
continue;
}
if ($product->needs_shipping()) {
$needs_shipping = true;
}
}
if ($needs_shipping && in_array($subscriptions[$subscription_key]['status'], array('active', 'on-hold'))) {
// WC 2.1+
if (function_exists('wc_get_endpoint_url')) {
$all_actions[$subscription_key] = array('change_address' => array('url' => add_query_arg(array('subscription' => $subscription_key), wc_get_endpoint_url('edit-address', 'shipping')), 'name' => __('Change Address', 'woocommerce-subscriptions'))) + $all_actions[$subscription_key];
} else {
$all_actions[$subscription_key] = array('change_address' => array('url' => add_query_arg(array('address' => 'shipping', 'subscription' => $subscription_key), get_permalink(woocommerce_get_page_id('edit_address'))), 'name' => __('Change Address', 'woocommerce-subscriptions'))) + $all_actions[$subscription_key];
}
}
}
return $all_actions;
}
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:37,代码来源:class-wc-subscriptions-addresses.php
示例2: admin_sms_alert
function admin_sms_alert($order_id)
{
global $woocommerce;
$order = new WC_Order($order_id);
$billing_firstname = get_post_meta($order_id, '_billing_first_name', true);
$billing_lastname = get_post_meta($order_id, '_billing_last_name', true);
$billing_phone = get_post_meta($order_id, '_billing_phone', true);
$shipping_address1 = get_post_meta($order_id, '_billing_address_1', true);
$shipping_address2 = get_post_meta($order_id, '_billing_address_2', true);
$medallion = strtoupper(get_user_meta($order->user_id, 'loyalty_status', true));
$order_amount = get_post_meta($order_id, '_order_total', true);
$pay_type = get_post_meta($order_id, '_payment_method', true);
if ($pay_type == 'cod') {
$pay_method = 'Cash on delivery';
} else {
$pay_method = 'Credit card on delivery';
}
$order_item = $order->get_items();
foreach ($order_item as $product) {
$product_meta[] = $product['name'] . ' (' . strtok($product['item_meta']['size'][0], ' ') . ')';
}
$product_list = implode("\n", $product_meta);
$admin_sms = "New Order #{$order_id}\n" . "{$product_list}\n" . "{$medallion}\n" . "Total \${$order_amount}\n" . "{$pay_method}\n" . "{$billing_firstname} {$billing_lastname}\n" . "{$shipping_address1}" . ($shipping_address2 ? " {$shipping_address2}" : '') . "\n" . "{$billing_phone}";
require 'twilio-php/Services/Twilio.php';
$account_sid = 'AC48732db704fe33f0601c8b61bd1519b8';
$auth_token = 'b881c619f25d20143bbbf6ac4d0d3429';
$admin_phone = array('+13109253443', '+18185102424', '+18183392676');
foreach ($admin_phone as $number) {
$client = new Services_Twilio($account_sid, $auth_token);
$client->account->messages->create(array('To' => $number, 'From' => "+13232104996", 'Body' => $admin_sms));
}
}
开发者ID:keyshames,项目名称:tcm2016,代码行数:32,代码来源:twillio.php
示例3: custom_order_actions
/**
* Add custom order actions in order list view
*
* @since 1.0.0
* @param array $actions
* @param \WC_Order $order
* @return array
*/
public function custom_order_actions($actions, WC_Order $order)
{
$status = new WC_Order_Status_Manager_Order_Status($order->get_status());
// Sanity check: bail if no status was found.
// This can happen if some statuses are registered late
if (!$status || !$status->get_id()) {
return $actions;
}
$next_statuses = $status->get_next_statuses();
$order_statuses = wc_get_order_statuses();
$custom_actions = array();
// TODO: Change action to `woocommerce_mark_order_status` for 2.3.x compatibility
// TODO: Change nonce_action to `woocommerce-mark-order-status` for 2.3.x compatibility
$action = 'wc_order_status_manager_mark_order_status';
$nonce_action = 'wc-order-status-manager-mark-order-status';
// Add next statuses as actions
if (!empty($next_statuses)) {
foreach ($next_statuses as $next_status) {
$custom_actions[$next_status] = array('url' => wp_nonce_url(admin_url('admin-ajax.php?action=' . $action . '&status=' . $next_status . '&order_id=' . $order->id), $nonce_action), 'name' => $order_statuses['wc-' . $next_status], 'action' => $next_status);
// Remove duplicate built-in complete action
if ('completed' === $next_status) {
unset($actions['complete']);
}
}
}
// Next status actions are prepended to any existing actions
return $custom_actions + $actions;
}
开发者ID:seoduda,项目名称:Patua,代码行数:36,代码来源:class-wc-order-status-manager-admin-orders.php
示例4: order_paid
/**
* Triggered when an order is paid
* @param int $order_id
*/
public function order_paid($order_id)
{
// Get the order
$order = new WC_Order($order_id);
if (get_post_meta($order_id, 'wc_paid_listings_packages_processed', true)) {
return;
}
foreach ($order->get_items() as $item) {
$product = wc_get_product($item['product_id']);
if ($product->is_type(array('job_package', 'resume_package', 'job_package_subscription', 'resume_package_subscription')) && $order->customer_user) {
// Give packages to user
for ($i = 0; $i < $item['qty']; $i++) {
$user_package_id = wc_paid_listings_give_user_package($order->customer_user, $product->id, $order_id);
}
// Approve job or resume with new package
if (isset($item['job_id'])) {
$job = get_post($item['job_id']);
if (in_array($job->post_status, array('pending_payment', 'expired'))) {
wc_paid_listings_approve_job_listing_with_package($job->ID, $order->customer_user, $user_package_id);
}
} elseif (isset($item['resume_id'])) {
$resume = get_post($item['resume_id']);
if (in_array($resume->post_status, array('pending_payment', 'expired'))) {
wc_paid_listings_approve_resume_with_package($resume->ID, $order->customer_user, $user_package_id);
}
}
}
}
update_post_meta($order_id, 'wc_paid_listings_packages_processed', true);
}
开发者ID:sabdev1,项目名称:sabstaff,代码行数:34,代码来源:class-wc-paid-listings-orders.php
示例5: add_meta_boxes
public function add_meta_boxes()
{
global $post;
if (isset($_GET['post'])) {
if (get_post_meta($_GET['post'], '_payment_method', true) == 'inicis_escrow_bank') {
$payment_method = get_post_meta($_GET['post'], '_payment_method', true);
$tmp_settings = get_option('woocommerce_' . $payment_method . '_settings', true);
$refund_mypage_status = $tmp_settings['possible_register_delivery_info_status_for_admin'];
//관리자 배송정보 등록/환불 가능 주문상태 지정
$order = new WC_Order($post->ID);
$paid_order = get_post_meta($post->ID, "_paid_date", true);
if (in_array($order->get_status(), $refund_mypage_status) && !empty($paid_order)) {
add_meta_box('ifw-order-escrow-register-delivery-request', __('이니시스 에스크로', 'codem_inicis'), 'IFW_Meta_Box_Escrow_Register_Delivery::output', 'shop_order', 'side', 'default');
}
} else {
if (get_post_meta($_GET['post'], '_payment_method', true) == 'inicis_vbank') {
add_meta_box('ifw-order-vbank-refund-request', __('가상계좌 무통장입금 환불 처리', 'codem_inicis'), 'IFW_Meta_Box_Vbank_Refund::output', 'shop_order', 'side', 'default');
} else {
if (in_array(get_post_meta($_GET['post'], '_payment_method', true), array('inicis_card', 'inicis_bank', 'inicis_hpp', 'inicis_kpay', 'inicis_stdcard'))) {
$order = new WC_Order($_GET['post']);
if (!in_array($order->get_status(), array('pending', 'on-hold'))) {
add_meta_box('ifw-order-refund-request', __('결제내역', 'codem_inicis'), 'IFW_Meta_Box_Refund::output', 'shop_order', 'side', 'default');
}
}
}
}
}
}
开发者ID:ksw2342,项目名称:kau_webstudio_12,代码行数:28,代码来源:class-ifw-admin-meta-boxes.php
示例6: email_instructions
/**
* Add content to the WC emails.
*
* @access public
* @param WC_Order $order
* @param bool $sent_to_admin
* @param bool $plain_text
*
* @return void
*/
public function email_instructions($order, $sent_to_admin, $plain_text = false)
{
if (!$sent_to_admin && 'bKash' === $order->payment_method && $order->has_status('on-hold')) {
if ($this->instructions) {
echo wpautop(wptexturize($this->instructions)) . PHP_EOL;
}
}
}
开发者ID:TanvirAmi,项目名称:woocommerce-bkash,代码行数:18,代码来源:class-wc-gateway-bkash.php
示例7: get_product_name
/**
* @since 1.0
* @return string Product Name
*/
private function get_product_name($order_id)
{
$order = new WC_Order($order_id);
$items = $order->get_items();
// Get the first ordered item
$item = array_shift($items);
return $item['name'];
}
开发者ID:KevinFairbanks,项目名称:woocommerce-software-activations,代码行数:12,代码来源:class-wc-software-activations.php
示例8: array
/**
* Track custom user properties via the Mixpanel API
*
* This example illustrates how to add/update the "Last Subscription Billing Amount"
* user property when a subscription is renewed.
*
* @param \WC_Order $renewal_order
* @param \WC_Order $original_order
* @param int $product_id the
* @param \WC_Order $new_order_role
*/
function sv_wc_mixpanel_renewed_subscription($renewal_order, $original_order, $product_id, $new_order_role)
{
if (!function_exists('wc_mixpanel')) {
return;
}
$properties = array('Last Subscription Billing Amount' => $renewal_order->get_total());
wc_mixpanel()->get_integration()->custom_user_properties_api($properties, $renewal_order->user_id);
}
开发者ID:skyverge,项目名称:wc-plugins-snippets,代码行数:19,代码来源:track-custom-user-properties.php
示例9: output_order_tracking_code
/**
* Output the order tracking code for enabled networks
*
* @param int $order_id
*
* @return string
*/
public function output_order_tracking_code($order_id)
{
$order = new WC_Order($order_id);
$code = "<script>fbq('track', 'Purchase', {value: '" . esc_js($order->get_total()) . "', currency: '" . esc_js($order->get_order_currency()) . "'});</script>";
$code .= '<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=' . esc_js($this->facebook_id) . '&ev=Purchase&cd[value]=' . urlencode($order->get_total()) . '&cd[currency]=' . urlencode($order->get_order_currency()) . '&noscript=1"
/></noscript>';
echo $code;
}
开发者ID:bitpiston,项目名称:woocommerce-facebook-remarketing,代码行数:16,代码来源:class-wc-facebook-remarketing-integration.php
示例10: email_instructions
/**
* Add content to the WC emails.
*
* Note: The difference from WC_Gateway_BACS is that we use __() before
* passing the string through wptexturize() and wpautop().
*
* @param WC_Order $order
* @param bool $sent_to_admin
* @param bool $plain_text
*/
public function email_instructions($order, $sent_to_admin, $plain_text = false)
{
if (!$sent_to_admin && 'bacs' === $order->payment_method && $order->has_status('on-hold')) {
if ($this->instructions) {
echo wpautop(wptexturize(function_exists('pll__') ? pll__($this->instructions) : __($this->instructions, 'woocommerce'))) . PHP_EOL;
}
$this->bank_details($order->id);
}
}
开发者ID:hyyan,项目名称:woo-poly-integration,代码行数:19,代码来源:GatewayBACS.php
示例11: output
/**
* Output the shortcode.
*
* @access public
* @param array $atts
* @return void
*/
public static function output($atts)
{
global $woocommerce;
$woocommerce->nocache();
if (!is_user_logged_in()) {
return;
}
extract(shortcode_atts(array('order_count' => 10), $atts));
$user_id = get_current_user_id();
$order_id = isset($_GET['order']) ? $_GET['order'] : 0;
$order = new WC_Order($order_id);
if ($order_id == 0) {
woocommerce_get_template('myaccount/my-orders.php', array('order_count' => 'all' == $order_count ? -1 : $order_count));
return;
}
if ($order->user_id != $user_id) {
echo '<div class="woocommerce-error">' . __('Invalid order.', 'woocommerce') . ' <a href="' . get_permalink(woocommerce_get_page_id('myaccount')) . '">' . __('My Account →', 'woocommerce') . '</a>' . '</div>';
return;
}
$status = get_term_by('slug', $order->status, 'shop_order_status');
echo '<p class="order-info">' . sprintf(__('Order <mark class="order-number">%s</mark> made on <mark class="order-date">%s</mark>', 'woocommerce'), $order->get_order_number(), date_i18n(get_option('date_format'), strtotime($order->order_date))) . '. ' . sprintf(__('Order status: <mark class="order-status">%s</mark>', 'woocommerce'), __($status->name, 'woocommerce')) . '.</p>';
$notes = $order->get_customer_order_notes();
if ($notes) {
?>
<h2><?php
_e('Order Updates', 'woocommerce');
?>
</h2>
<ol class="commentlist notes">
<?php
foreach ($notes as $note) {
?>
<li class="comment note">
<div class="comment_container">
<div class="comment-text">
<p class="meta"><?php
echo date_i18n(__('l jS \\of F Y, h:ia', 'woocommerce'), strtotime($note->comment_date));
?>
</p>
<div class="description">
<?php
echo wpautop(wptexturize($note->comment_content));
?>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
</li>
<?php
}
?>
</ol>
<?php
}
do_action('woocommerce_view_order', $order_id);
}
开发者ID:googlecode-mirror,项目名称:wpmu-demo,代码行数:64,代码来源:class-wc-shortcode-view-order.php
示例12: 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
示例13: order_status_changed
public static function order_status_changed($id, $status = '', $new_status = '')
{
$rules = get_option('woorule_rules', array());
foreach ($rules as $k => $rule) {
$enabled = get_option($rule['enabled']['id']) === 'yes' ? true : false;
if ($enabled) {
$which_event = get_option($rule['occurs']['id']);
$is_opt_in_rule = false;
$want_in = true;
if (isset($rule['show_opt_in'])) {
$is_opt_in_rule = get_option($rule['show_opt_in']['id']) === 'yes' ? true : false;
}
if ($is_opt_in_rule) {
$want_in = get_post_meta($id, 'woorule_opt_in_' . $k, false);
if (!empty($want_in)) {
$want_in = $want_in[0] === 'yes' ? true : false;
}
}
if ($want_in && $new_status === $which_event) {
$integration = new WC_Integration_RuleMailer();
$order = new WC_Order($id);
$user = $order->get_user();
$currency = $order->get_order_currency();
$order_subtotal = $order->order_total - ($order->order_shipping_tax + $order->order_shipping) - $order->cart_discount;
$items = $order->get_items();
$brands = array();
$categories = array();
$tags = array();
foreach ($items as $item) {
$p = new WC_Product_Simple($item['product_id']);
$brands[] = $p->get_attribute('brand');
// this is bullshit
$cat = strip_tags($p->get_categories(''));
$tag = strip_tags($p->get_tags(''));
if (!empty($cat)) {
$categories[] = $cat;
}
if (!empty($tag)) {
$tags[] = $tag;
}
}
$subscription = array('apikey' => $integration->api_key, 'update_on_duplicate' => get_option($rule['update_on_duplicate']['id']) === 'yes' ? true : false, 'auto_create_tags' => get_option($rule['auto_create_tags']['id']) === 'yes' ? true : false, 'auto_create_fields' => get_option($rule['auto_create_fields']['id']) === 'yes' ? true : false, 'tags' => explode(',', get_option($rule['tags']['id'])), 'subscribers' => array('email' => $order->billing_email, 'phone_number' => $order->billing_phone, 'fields' => array(array('key' => 'Order.Number', 'value' => $order->get_order_number()), array('key' => 'Order.Date', 'value' => $order->order_date), array('key' => 'Order.FirstName', 'value' => $order->billing_first_name), array('key' => 'Order.LastName', 'value' => $order->billing_last_name), array('key' => 'Order.Street1', 'value' => $order->billing_address_1), array('key' => 'Order.Street2', 'value' => $order->billing_address_2), array('key' => 'Order.City', 'value' => $order->billing_city), array('key' => 'Order.Country', 'value' => $order->billing_country), array('key' => 'Order.State', 'value' => $order->billing_state), array('key' => 'Order.Subtotal', 'value' => $order_subtotal), array('key' => 'Order.Discount', 'value' => $order->cart_discount), array('key' => 'Order.Shipping', 'value' => $order->order_shipping + $order->order_shipping_tax), array('key' => 'Order.Total', 'value' => $order->order_total), array('key' => 'Order.Vat', 'value' => $order->order_tax))));
if (!empty($categories)) {
$subscription['subscribers']['fields'][] = array('key' => 'Order.Categories', 'value' => $categories, 'type' => 'multiple');
}
if (!empty($tags)) {
$subscription['subscribers']['fields'][] = array('key' => 'Order.Tags', 'value' => array($tags), 'type' => 'multiple');
}
if (!empty($brands)) {
$subscription['subscribers']['fields'][] = array('key' => 'Order.Brands', 'value' => $brands, 'type' => 'multiple');
}
$api = WP_RuleMailer_API::get_instance();
$api::subscribe($integration->api_url, $subscription);
}
}
}
}
开发者ID:rulecom,项目名称:woorule,代码行数:57,代码来源:class-wc-admin-settings-woorule.php
示例14: get_order
/**
* Retrieve an order.
*
* @param int $order_id
* @return WC_Order or null
*/
public static function get_order($order_id = '')
{
$result = null;
$order = new WC_Order($order_id);
if ($order->get_order($order_id)) {
$result = $order;
}
return $result;
}
开发者ID:arobbins,项目名称:spellestate,代码行数:15,代码来源:class-groups-ws-helper.php
示例15: thankyou_page
/**
* Output for the order received page.
*/
public function thankyou_page($order_id)
{
$order = new WC_Order($order_id);
if ('completed' == $order->get_status()) {
echo '<p>' . __('Your booking has been confirmed. Thank you.', 'woocommerce-bookings') . '</p>';
} else {
echo '<p>' . __('Your booking is awaiting confirmation. You will be notified by email as soon as we\'ve confirmed availability.', 'woocommerce-bookings') . '</p>';
}
}
开发者ID:tonyvu1985,项目名称:appletutorings,代码行数:12,代码来源:class-wc-bookings-gateway.php
示例16: wpcomm_renewal_meta_update
function wpcomm_renewal_meta_update($order_meta, $order_id)
{
global $wpdb, $woocommerce;
// Send me an email if this hook works
error_log("woocommerce_subscriptions_renewal_order_created hook fired", 1, "[email protected]", "Subject: woocommerce_subscriptions_renewal_order_created");
if (!is_object($order)) {
$order = new WC_Order($order);
}
// Get the values we need from the WC_Order object
$order_id = $order->id;
$item = $order->get_items();
$product_id = WC_Subscriptions_Order::get_items_product_id($item[0]);
// These arrays contain the details for each possible product, in order. They
// are used to change the order to the correct values
$quarterly_product_ids = array(2949, 2945, 2767, 2793, 2795, 2796, 2798, 2799, 2800, 2805, 2806, 2815, 2816, 2817);
$quarterly_product_names = array("One Day Renewal for Testing No Virtual Downloadable", "One Day Renewal for Testing", "0-3 MONTHS ELEPHANT (QUARTERLY)", "3-6 MONTHS HIPPO (QUARTERLY)", "6-9 MONTHS GIRAFFE (QUARTERLY)", "9-12 MONTHS PANDA (QUARTERLY)", "12-15 MONTHS ZEBRA (QUARTERLY)", "15-18 MONTHS RABBIT (QUARTERLY)", "18-21 MONTHS MONKEY (QUARTERLY)", "21-24 MONTHS FROG (QUARTERLY)", "24-27 MONTHS KANGAROO (QUARTERLY)", "27-30 MONTHS BEAR (QUARTERLY)", "30-33 MONTHS TIGER (QUARTERLY)", "33-36 MONTHS CROCODILE (QUARTERLY)");
// Not sure yet if SKUs are needed
$quarterly_product_skus = array("test sku one", "test sku two", "0-3-elephant-q", "3-6-hippo-q", "6-9-giraffe-q", "9-12-panda-q", "12-15-zebra-q", "15-18-rabbit-q", "18-21-monkey-q", "21-24-frog-q", "24-24-kangaroo-q", "27-30-bear-q", "30-33-tiger-q", "33-36-crocodile-q");
$yearly_product_names = array();
$yearly_product_ids = array();
// Get the position of the current id, and then assign the next product
// to $incremented_item_id and $incremented_item_name
$product_id_index = array_search($product_id, $quarterly_product_ids);
if ($product_id_index === False) {
$product_id_index = array_search($product_id, $yearly_product_ids);
}
$incremented_item_id = $quarterly_product_ids[$product_id_index + 1];
$incremented_item_name = $quarterly_product_names[$product_id_index + 1];
$incremented_item_sku = $quarterly_product_skus[$product_id_index + 1];
// Apply the updates to the order
$order_meta["_product_id"] = $incremented_item_id;
$order_meta["_product_name"] = $incremented_item_name;
$order_meta["_sku"] = $incremented_item_sku;
return $order_meta;
}
开发者ID:wpcom-pac,项目名称:pac-renewal,代码行数:35,代码来源:WPCom_Renewal_Meta_Test.php
示例17: save_attendee_meta_to_order
/**
* Sets attendee data on order posts
*
* @since 4.1
*
* @param int $order_id WooCommerce Order ID
* @param array $post_data Data submitted via POST during checkout
*/
public function save_attendee_meta_to_order($order_id, $post_data)
{
$order = new WC_Order($order_id);
$order_items = $order->get_items();
// Bail if the order is empty
if (empty($order_items)) {
return;
}
$product_ids = array();
// gather product ids
foreach ((array) $order_items as $item) {
$product_ids[] = isset($item['product_id']) ? $item['product_id'] : $item['id'];
}
$meta_object = Tribe__Tickets_Plus__Main::instance()->meta();
// build the custom meta data that will be stored in the order meta
if (!($order_meta = $meta_object->build_order_meta($product_ids))) {
return;
}
// store the custom meta on the order
update_post_meta($order_id, Tribe__Tickets_Plus__Meta::META_KEY, $order_meta, true);
// clear out product custom meta data cookies
foreach ($product_ids as $product_id) {
$meta_object->clear_meta_cookie_data($product_id);
}
}
开发者ID:TakenCdosG,项目名称:chefs,代码行数:33,代码来源:Meta.php
示例18: process_payment
public function process_payment($order_id)
{
try {
global $woocommerce;
$customer_order = new WC_Order($order_id);
PayU_Middleware::$api_key = $this->api_key;
PayU_Middleware::$api_login = $this->api_login;
PayU_Middleware::$merchant_id = $this->merchant_id;
PayU_Middleware::$account_id = $this->account_id;
PayU_Middleware::$test_mode = $this->environment == 'yes';
$cardNumber = str_replace(array(' ', ''), '', $_POST['GP_PayU_online_Gateway-card-number']);
$expirationArray = explode('/', $_POST['GP_PayU_online_Gateway-card-expiry']);
$expirationDate = '20' . $expirationArray[1] . '/' . $expirationArray[0];
$expirationDate = str_replace(' ', '', $expirationDate);
$payerName = $customer_order->billing_first_name . ' ' . $customer_order->billing_last_name;
$cvv = $_POST['GP_PayU_online_Gateway-card-cvc'];
$res = PayU_Middleware::do_payment($order_id, $this->payment_description . $order_id, $customer_order->order_total, $customer_order->billing_email, $payerName, '111', $cardNumber, $cvv, $expirationDate, '', false);
if (isset($res['code']) == true && isset($res['state']) == true && $res['code'] == 'SUCCESS' && $res['state'] == "APPROVED") {
do_action('gp_order_online_completed_successfully', $res);
if ($this->mark_order == 'yes') {
$woocommerce->cart->empty_cart();
$customer_order->payment_complete();
$customer_order->update_status('completed');
}
return array('result' => 'success', 'redirect' => $this->thankyou_page_url . '?order_id=' . $order_id);
} else {
do_action('gp_order_online_completed_failed', $res);
}
} catch (PayUException $e) {
do_action('gp_error_occurred', $e);
} catch (Exception $e) {
do_action('gp_error_occurred', $e);
}
}
开发者ID:GammaPartners,项目名称:WooCommerce-Payment-Gateways,代码行数:34,代码来源:payu-online.php
示例19: show_course_message_woocommerce_order_details_after_order_table
function show_course_message_woocommerce_order_details_after_order_table($order)
{
global $coursepress;
$order_details = new WC_Order($order->id);
$order_items = $order_details->get_items();
$purchased_course = false;
foreach ($order_items as $order_item) {
$course_id = wp_get_post_parent_id($order_item['product_id']);
if ($course_id && get_post_type($course_id) == 'course') {
$purchased_course = true;
}
}
if ($purchased_course) {
?>
<h2 class="cp_woo_header"><?php
_e('Course', 'cp');
?>
</h2>
<p class="cp_woo_thanks"><?php
_e('Thank you for signing up for the course. We hope you enjoy your experience.');
?>
</p>
<?php
if (is_user_logged_in() && $order->post_status == 'wc-completed') {
?>
<p class="cp_woo_dashboard_link">
<?php
printf(__('You can find the course in your <a href="%s">Dashboard</a>', 'cp'), $coursepress->get_student_dashboard_slug(true));
?>
</p>
<hr />
<?php
}
}
}
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:35,代码来源:class.woocommerce-integration.php
示例20: gocoin_callback
/**
* Main callback function
*
*/
function gocoin_callback()
{
if (isset($_GET['gocoin_callback'])) {
global $woocommerce;
require plugin_dir_path(__FILE__) . 'gocoin-lib.php';
$gateways = $woocommerce->payment_gateways->payment_gateways();
if (!isset($gateways['gocoin'])) {
return;
}
$gocoin = $gateways['gocoin'];
$response = getNotifyData();
if (isset($response->error)) {
var_dump($response);
} else {
$orderId = (int) $response->payload->order_id;
$order = new WC_Order($orderId);
switch ($response->event) {
case 'invoice_created':
case 'invoice_payment_received':
break;
case 'invoice_ready_to_ship':
if (in_array($order->status, array('on-hold', 'pending', 'failed'))) {
$order->payment_complete();
}
break;
}
}
}
}
开发者ID:radoantal9,项目名称:wordpress_gocoin_php,代码行数:33,代码来源:gocoin-callback.php
注:本文中的WC_Order类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论