本文整理汇总了PHP中wc_get_order_id_by_order_key函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_get_order_id_by_order_key函数的具体用法?PHP wc_get_order_id_by_order_key怎么用?PHP wc_get_order_id_by_order_key使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wc_get_order_id_by_order_key函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_paypal_order
/**
* Get the order from the PayPal 'Custom' variable
*
* @param string $raw_custom JSON Data passed back by PayPal
* @return bool|WC_Order object
*/
protected function get_paypal_order($raw_custom)
{
// We have the data in the correct format, so get the order
if (($custom = json_decode($raw_custom)) && is_object($custom)) {
$order_id = $custom->order_id;
$order_key = $custom->order_key;
// Fallback to serialized data if safe. This is @deprecated in 2.3.11
} elseif (preg_match('/^a:2:{/', $raw_custom) && !preg_match('/[CO]:\\+?[0-9]+:"/', $raw_custom) && ($custom = maybe_unserialize($raw_custom))) {
$order_id = $custom[0];
$order_key = $custom[1];
// Nothing was found
} else {
WC_Gateway_Paypal::log('Error: Order ID and key were not found in "custom".');
return false;
}
if (!($order = wc_get_order($order_id))) {
// We have an invalid $order_id, probably because invoice_prefix has changed
$order_id = wc_get_order_id_by_order_key($order_key);
$order = wc_get_order($order_id);
}
if (!$order || $order->order_key !== $order_key) {
WC_Gateway_Paypal::log('Error: Order Keys do not match.');
return false;
}
return $order;
}
开发者ID:slavic18,项目名称:cats,代码行数:32,代码来源:class-wc-gateway-paypal-response.php
示例2: get_paypal_order
/**
* Get the order from the PayPal 'Custom' variable
*
* @param string $custom
* @return bool|WC_Order object
*/
protected function get_paypal_order($custom)
{
$custom = maybe_unserialize($custom);
if (is_array($custom)) {
list($order_id, $order_key) = $custom;
if (!($order = wc_get_order($order_id))) {
// We have an invalid $order_id, probably because invoice_prefix has changed
$order_id = wc_get_order_id_by_order_key($order_key);
$order = wc_get_order($order_id);
}
if (!$order || $order->order_key !== $order_key) {
$this->log('Error: Order Keys do not match.');
return false;
}
} elseif (!($order = apply_filters('woocommerce_get_paypal_order', false, $custom))) {
$this->log('Error: Order ID and key were not found in "custom".');
return false;
}
return $order;
}
开发者ID:amusiiko,项目名称:armo,代码行数:26,代码来源:class-wc-gateway-paypal-response.php
示例3: get_paypal_order
/**
* Get the order from the PayPal 'Custom' variable.
*
* @param string $raw_custom JSON Data passed back by PayPal
* @return bool|WC_Order Order object or false
*/
protected function get_paypal_order($raw_custom)
{
// We have the data in the correct format, so get the order.
if (($custom = json_decode($raw_custom)) && is_object($custom)) {
$order_id = $custom->order_id;
$order_key = $custom->order_key;
} else {
wc_gateway_ppec_log(sprintf('%s: %s', __FUNCTION__, 'Error: Order ID and key were not found in "custom".'));
return false;
}
if (!($order = wc_get_order($order_id))) {
// We have an invalid $order_id, probably because invoice_prefix has changed.
$order_id = wc_get_order_id_by_order_key($order_key);
$order = wc_get_order($order_id);
}
if (!$order || $order->order_key !== $order_key) {
wc_gateway_ppec_log(sprintf('%s: %s', __FUNCTION__, 'Error: Order Keys do not match.'));
return false;
}
return $order;
}
开发者ID:ksan5835,项目名称:maadithottam,代码行数:27,代码来源:abstract-wc-gateway-ppec-paypal-request-handler.php
示例4: coinsimple_callback
/**
* Notification callback.
*
* @param void
* @return void
*/
public function coinsimple_callback()
{
// obtain body
@ob_clean();
$body = file_get_contents('php://input');
$data = json_decode($body);
$business = new \CoinSimple\Business($this->get_option("business_id"), $this->get_option('api_key'));
if (!$business->validateHash($data->hash, $data->timestamp)) {
$this->debug(__METHOD__, 'invalid callback hash');
return;
}
$order = new WC_Order($data->custom->order_id);
if (!isset($order->id)) {
// orderId invalid, try alternate find
$orderId = wc_get_order_id_by_order_key($data->custom->order_key);
$order = new WC_Order($orderId);
}
if ($order->order_key !== $data->custom->order_key) {
$this->debug(__METHOD__, 'invalid order key');
return;
}
$order->payment_complete();
}
开发者ID:kedamaian,项目名称:coinsimple-woocommerce,代码行数:29,代码来源:wc_coinsimple.php
示例5: woocommerce_get_order_id_by_order_key
/**
* @deprecated
*/
function woocommerce_get_order_id_by_order_key($order_key)
{
return wc_get_order_id_by_order_key($order_key);
}
开发者ID:nayemDevs,项目名称:woocommerce,代码行数:7,代码来源:wc-deprecated-functions.php
示例6: check_payment_response
public static function check_payment_response()
{
if (!empty($_REQUEST['imp_uid'])) {
//결제승인 결과조회
require_once WSKL_PATH . '/includes/lib/iamport/iamport.php';
$imp_uid = $_REQUEST['imp_uid'];
$rest_key = wskl_get_option('iamport_rest_key');
$rest_secret = wskl_get_option('iamport_rest_secret');
$iamport = new Iamport($rest_key, $rest_secret);
$result = $iamport->findByImpUID($imp_uid);
if ($result->success) {
$payment_data = $result->data;
if (empty($_REQUEST['order_id'])) {
//call by iamport notification
$order_id = wc_get_order_id_by_order_key($payment_data->merchant_uid);
} else {
$order_id = $_REQUEST['order_id'];
}
$order = wc_get_order($order_id);
update_post_meta($order_id, '_iamport_provider', $payment_data->pg_provider);
update_post_meta($order_id, '_iamport_paymethod', $payment_data->pay_method);
update_post_meta($order_id, '_iamport_receipt_url', $payment_data->receipt_url);
if ($payment_data->status == 'paid') {
if ($order->order_total == $payment_data->amount) {
if (!$order->has_status(array('processing', 'completed'))) {
$order->payment_complete($payment_data->imp_uid);
//imp_uid
wp_redirect($order->get_checkout_order_received_url());
return;
}
} else {
$order->add_order_note('요청하신 결제금액이 다릅니다.');
wc_add_notice('요청하신 결제금액이 다릅니다.', 'error');
}
} else {
if ($payment_data->status == 'ready') {
if ($payment_data->pay_method == 'vbank') {
$vbank_name = $payment_data->vbank_name;
$vbank_num = $payment_data->vbank_num;
$vbank_date = $payment_data->vbank_date;
//가상계좌 입금할 계좌정보 기록
update_post_meta($order_id, '_iamport_vbank_name', $vbank_name);
update_post_meta($order_id, '_iamport_vbank_num', $vbank_num);
update_post_meta($order_id, '_iamport_vbank_date', $vbank_date);
//가상계좌 입금대기 중
$order->update_status('awaiting-vbank', __('가상계좌 입금대기 중', 'iamport'));
wp_redirect($order->get_checkout_order_received_url());
return;
} else {
$order->add_order_note('실제 결제가 이루어지지 않았습니다.');
wc_add_notice('실제 결제가 이루어지지 않았습니다.', 'error');
}
} else {
if ($payment_data->status == 'failed') {
$order->add_order_note('결제요청 승인에 실패하였습니다.');
wc_add_notice('결제요청 승인에 실패하였습니다.', 'error');
}
}
}
} else {
$payment_data =& $result->data;
if (!empty($_REQUEST['order_id'])) {
$order = new WC_Order($_REQUEST['order_id']);
$order->update_status('failed');
$order->add_order_note('결제승인정보를 받아오지 못했습니다. 관리자에게 문의해주세요' . $payment_data->error['message']);
wc_add_notice($payment_data->error['message'], 'error');
$redirect_url = $order->get_checkout_payment_url(TRUE);
wp_redirect($redirect_url);
}
}
}
}
开发者ID:EricKim65,项目名称:woosym-korean-localization,代码行数:72,代码来源:class-pg-iamport-main.php
示例7: woocommerce_pay_order_button_html
function woocommerce_pay_order_button_html($html)
{
$orderid = wc_get_order_id_by_order_key($_REQUEST['key']);
if ($_available_gateways = WC()->payment_gateways->get_available_payment_gateways()) {
if (isset($_available_gateways['inicis_card']) || isset($_available_gateways['inicis_bank']) || isset($_available_gateways['inicis_vbank']) || isset($_available_gateways['inicis_hpp']) || isset($_available_gateways['inicis_kpay']) || isset($_available_gateways['inicis_stdcard']) || isset($_available_gateways['inicis_escrow_bank'])) {
if (wp_is_mobile()) {
wp_register_script('ifw-pay-for-order', $this->plugin_url() . '/assets/js/ifw_pay_for_order.mobile.js', array(), $this->version);
} else {
wp_register_script('ifw-pay-for-order', $this->plugin_url() . '/assets/js/ifw_pay_for_order.js', array(), $this->version);
}
wp_enqueue_script('ifw-pay-for-order');
wp_localize_script('ifw-pay-for-order', '_ifw_pay_for_order', array('ajax_loader_url' => $this->plugin_url() . '/assets/images/ajax_loader.gif', 'order_id' => $orderid, 'order_key' => $_REQUEST['key']));
}
}
return $html;
}
开发者ID:ksw2342,项目名称:kau_webstudio_12,代码行数:16,代码来源:inicis-for-woocommerce.php
示例8: get_paypal_order
/**
* get_paypal_order function.
*
* @param string $custom
* @param string $invoice
* @return WC_Order object
*/
private function get_paypal_order($custom, $invoice = '')
{
$custom = maybe_unserialize($custom);
// Backwards comp for IPN requests
if (is_numeric($custom)) {
$order_id = (int) $custom;
$order_key = $invoice;
} elseif (is_string($custom)) {
$order_id = (int) str_replace($this->invoice_prefix, '', $custom);
$order_key = $custom;
} else {
list($order_id, $order_key) = $custom;
}
$order = new WC_Order($order_id);
if (!isset($order->id)) {
// We have an invalid $order_id, probably because invoice_prefix has changed
$order_id = wc_get_order_id_by_order_key($order_key);
$order = new WC_Order($order_id);
}
// Validate key
if ($order->order_key !== $order_key) {
if ('yes' == $this->debug) {
$this->log->add('paypal', 'Error: Order Key does not match invoice.');
}
exit;
}
return $order;
}
开发者ID:prosenjit-itobuz,项目名称:nutraperfect,代码行数:35,代码来源:class-wc-gateway-paypal.php
示例9: generate_form
private function generate_form($order, $URL_Request)
{
$order_key = $_GET['key'];
$order_id = wc_get_order_id_by_order_key($order_key);
return '<a class="button" href="' . get_site_url() . '/?TodoPago_redirect=true&form=ext&order=' . $order_id . '" id="submit_todopago_payment_form"> Pagar con TodoPago </a>
<a class="button cancel" href="' . $order->get_cancel_order_url() . '">' . ' Cancelar orden ' . '</a>';
}
开发者ID:TodoPago,项目名称:Plugin-WooCommerce,代码行数:7,代码来源:index.php
示例10: thankyou_page
/**
* Return page of Alipay, show Alipay Trade No.
*
* @access public
* @param mixed Sync Notification
* @return void
*/
function thankyou_page($order_id)
{
$_GET = stripslashes_deep($_GET);
if (isset($_GET['trade_status']) && !empty($_GET['trade_status'])) {
require_once "lib/alipay_notify.class.php";
$aliapy_config = $this->get_alipay_config();
$alipayNotify = new AlipayNotify($aliapy_config);
$order_key = $_GET['key'];
// Delete parameters added by WC from $_GET
if (isset($_GET['page_id'])) {
unset($_GET['page_id']);
}
// When using default permlaink format
if (isset($_GET['order-received'])) {
unset($_GET['order-received']);
}
// When using default permlaink format
unset($_GET['order']);
unset($_GET['key']);
if ($this->debug == 'yes') {
$log = true;
}
$verify_result = $alipayNotify->verifyReturn($log);
if ($verify_result) {
$trade_no = $_GET['trade_no'];
// Alipay Order Number
$out_trade_no = $_GET['out_trade_no'];
// Merchant Order Number
// Check order ID
if (is_numeric($out_trade_no)) {
if (!empty($this->order_prefix)) {
$check = (int) str_replace($this->order_prefix, '', $out_trade_no);
} else {
$check = (int) $out_trade_no;
}
} else {
$check = (int) str_replace($this->order_prefix, '', $out_trade_no);
}
if ($order_id != $check) {
// We have an invalid $order_id, probably because order_prefix has changed
$check = wc_get_order_id_by_order_key($order_key);
if ($order_id != $check) {
_e("<p><strong>ERROR:</strong>The order ID doesn't match!</p>", 'alipay');
return;
}
}
// Order ID is correct.
$order = new WC_Order($order_id);
echo '<ul class="order_details">
<li class="alipayNo">' . __('Your Alipay Trade No.: ', 'alipay') . '<strong>' . $trade_no . '</strong></li>
</ul>';
// Update the order according to data carried with the return_url
$trade_status = $_GET['trade_status'];
switch ($trade_status) {
case 'WAIT_SELLER_SEND_GOODS':
$order_needs_updating = in_array($order->status, array('processing', 'completed')) ? false : true;
$status = apply_filters('woocommerce_alipay_payment_successful_status', 'processing', $order);
if ($order_needs_updating) {
// Update order status if IPN has not process the order
update_post_meta($order_id, 'Alipay Trade No.', wc_clean($trade_no));
$order->update_status($status, __("Payment received, awaiting fulfilment. ", 'alipay'));
// Send deliver notification to alipay if the order is vitural and downloadable.
$success = $this->send_goods_confirm(wc_clean($trade_no), $order);
if (strpos($success, 'error') !== false) {
// Failed to update status
if ('yes' == $this->debug) {
$message = sprintf(__('ERROR: Failed to send goods automatically for order %d, ', 'alipay'), $order_id);
$message .= $success;
$this->log->add('alipay', $message);
}
} else {
if ($success === true) {
$order->add_order_note(__('Your order has been shipped, awaiting buyer\'s confirmation', 'alipay'));
}
}
// Reduce stock level
$order->reduce_order_stock();
}
break;
case 'TRADE_FINISHED':
case 'TRADE_SUCCESS':
if ($order->status != 'completed' && $order->status != 'processing') {
$order->payment_complete();
}
update_post_meta($order_id, 'Alipay Trade No.', wc_clean($trade_no));
break;
default:
break;
}
}
}
}
开发者ID:wenqingyu,项目名称:enterprise-management-system,代码行数:99,代码来源:class-wc-alipay.php
示例11: wp_head
//.........这里部分代码省略.........
;
var woocs_default_currency = <?php
echo json_encode($currencies[$this->default_currency]);
?>
;
var woocs_array_of_get = '{}';
<?php
if (!empty($_GET)) {
?>
<?php
//sanitization of $_GET array
$sanitized_get_array = array();
foreach ($_GET as $key => $value) {
$sanitized_get_array[$this->escape($key)] = $this->escape($value);
}
?>
woocs_array_of_get = '<?php
echo str_replace("'", "", json_encode($sanitized_get_array));
?>
';
<?php
}
?>
woocs_array_no_cents = '<?php
echo json_encode($this->no_cents);
?>
';
var woocs_ajaxurl = "<?php
echo admin_url('admin-ajax.php');
?>
";
var woocs_lang_loading = "<?php
_e('loading', 'woocommerce-currency-switcher');
?>
";
var woocs_shop_is_cached =<?php
echo (int) $this->shop_is_cached;
?>
;
</script>
<?php
if ($this->get_drop_down_view() == 'ddslick') {
wp_enqueue_script('jquery.ddslick.min', WOOCS_LINK . 'js/jquery.ddslick.min.js', array('jquery'));
}
if ($this->get_drop_down_view() == 'chosen' or $this->get_drop_down_view() == 'chosen_dark') {
wp_enqueue_script('chosen-drop-down', WOOCS_LINK . 'js/chosen/chosen.jquery.min.js', array('jquery'));
wp_enqueue_style('chosen-drop-down', WOOCS_LINK . 'js/chosen/chosen.min.css');
//dark chosen
if ($this->get_drop_down_view() == 'chosen_dark') {
wp_enqueue_style('chosen-drop-down-dark', WOOCS_LINK . 'js/chosen/chosen-dark.css');
}
}
if ($this->get_drop_down_view() == 'wselect') {
wp_enqueue_script('woocs_wselect', WOOCS_LINK . 'js/wselect/wSelect.min.js', array('jquery'));
wp_enqueue_style('woocs_wselect', WOOCS_LINK . 'js/wselect/wSelect.css');
}
//+++
wp_enqueue_style('woocommerce-currency-switcher', WOOCS_LINK . 'css/front.css');
wp_enqueue_script('woocommerce-currency-switcher', WOOCS_LINK . 'js/front.js', array('jquery'));
//+++
//trick for refreshing header cart after currency changing - code left just for history
if (isset($_GET['currency'])) {
//wp-content\plugins\woocommerce\includes\class-wc-cart.php
//apply_filters('woocommerce_update_cart_action_cart_updated', true);
//$this->current_currency = $_GET['currency'];
//$_POST['update_cart'] = 1;
//WC_Form_Handler::update_cart_action();
//private function set_cart_cookies
//wc_setcookie('woocommerce_items_in_cart', 0, time() - HOUR_IN_SECONDS);
//wc_setcookie('woocommerce_cart_hash', '', time() - HOUR_IN_SECONDS);
//do_action('woocommerce_cart_reset', WC()->cart, true);
//do_action('woocommerce_calculate_totals', WC()->cart);
}
//if customer paying pending order from the front
//checkout/order-pay/1044/?pay_for_order=true&key=order_55b764a4b7990
if (isset($_GET['pay_for_order']) and is_checkout_pay_page()) {
if ($_GET['pay_for_order'] == 'true' and isset($_GET['key'])) {
$order_id = wc_get_order_id_by_order_key($_GET['key']);
$currency = get_post_meta($order_id, '_order_currency', TRUE);
$this->current_currency = $currency;
$this->storage->set_val('woocs_current_currency', $currency);
}
}
//+++
//if we want to be paid in the basic currency - not multiple mode
if (!$this->is_multiple_allowed) {
if (is_checkout() or is_checkout_pay_page()) {
$this->reset_currency();
}
}
//logic hack for some cases when shipping for example is wrong in
//non multiple mode but customer doesn work allow pay in user selected currency
if ($this->is_multiple_allowed) {
if ((is_checkout() or is_checkout_pay_page()) and $this->bones['reset_in_multiple']) {
$this->reset_currency();
}
}
}
开发者ID:websideas,项目名称:Mondova,代码行数:101,代码来源:index.php
示例12: callback_payapp_status
/**
* AJAX 콜백. order key 에 대응해서 해당 order 의 주문 상태를 반환한다.
*
* 요구하는 파라미터: $_GET['order_key']
* JSON 응답:
* success: bool
* message: string success or 에러 메시지
* redirect: string 리다이렉트 주소
* order_id: int success=true 이면 order id
* order_status: string success=true 이면 order status 문자열.
* (pending|processing|completed)
*
* @action wc_ajax_{wskl-payapp-status}
*/
public static function callback_payapp_status()
{
if (!defined('DOING_AJAX') || !defined('WC_DOING_AJAX')) {
die(-1);
}
$order_key = isset($_GET['order_key']) ? sanitize_text_field($_GET['order_key']) : 0;
$order = wc_get_order(wc_get_order_id_by_order_key($order_key));
if (!$order) {
wc_add_notice(__('주문 과정에 문제가 발생했습니다. 다시 시도해 주세요.', 'wskl'), 'error');
wp_send_json(array('success' => FALSE, 'message' => 'An invalid order key received.', 'redirect' => wc_get_checkout_url()));
die;
}
if ($order->has_status(array('processing', 'completed'))) {
$redirect = $order->get_checkout_order_received_url();
} else {
$redirect = '';
}
wp_send_json(array('success' => TRUE, 'message' => 'success', 'order_id' => $order->id, 'order_status' => $order->get_status(), 'redirect' => $redirect));
die;
}
开发者ID:EricKim65,项目名称:woosym-korean-localization,代码行数:34,代码来源:class-pg-payapp-main.php
示例13: WC
dynx_pagetype: 'conversionintent',
dynx_totalvalue: <?php
echo WC()->cart->total;
?>
};
</script>
<?php
} elseif (is_order_received_page()) {
?>
<script type="text/javascript">
var google_tag_params = {
dynx_itemid: <?php
echo "[";
$order = new WC_Order(wc_get_order_id_by_order_key($_GET['key']));
$order_total = $order->get_total();
$items = $order->get_items();
$order_items = array();
foreach ((array) $items as $item) {
array_push($order_items, "'" . $item['product_id'] . "'");
}
echo implode(', ', $order_items);
echo "]";
?>
,
dynx_pagetype: 'conversion',
dynx_totalvalue: <?php
echo $order_total;
?>
开发者ID:sinapsmarketing,项目名称:Remarketing-Dinamic,代码行数:29,代码来源:remarketing-dinamic.php
示例14: wp_head
<!-- * WordPress wp_head() ********************************************** -->
<!-- ******************************************************************** -->
<?php
wp_head();
?>
</head>
<body <?php
body_class();
?>
>
<?php
if (is_wc_endpoint_url('order-received')) {
$order_id = wc_get_order_id_by_order_key($_GET['key']);
$order1 = new WC_order($order_id);
$order_items = array_values($order1->get_items());
$net_amount = $order_items[0]['line_subtotal'];
$tax_amount = $order_items[0]['line_subtotal_tax'];
$product_name = $order_items[0]['name'];
$product_id = $order_items[0]['product_id'];
$belboon = $_SESSION['belboon'];
$url_home = home_url();
?>
<img src="https://www1.belboon.de/adtracking/sale/000021772.gif/oc=<?php
echo $order_id;
?>
&sale=<?php
echo $net_amount;
?>
开发者ID:shwetadubey,项目名称:upfit,代码行数:31,代码来源:header.php
示例15: wp_head
public function wp_head()
{
wp_enqueue_script('jquery');
$currencies = $this->get_currencies();
?>
<script type="text/javascript">
var woocs_drop_down_view = "<?php
echo $this->get_drop_down_view();
?>
";
var woocs_current_currency = <?php
echo json_encode(isset($currencies[$this->current_currency]) ? $currencies[$this->current_currency] : $currencies[$this->default_currency]);
?>
;
var woocs_default_currency = <?php
echo json_encode($currencies[$this->default_currency]);
?>
;
var woocs_array_of_get = '{}';
<?php
if (!empty($_GET)) {
?>
woocs_array_of_get = '<?php
echo json_encode($_GET);
?>
';
<?php
}
?>
woocs_array_no_cents = '<?php
echo json_encode($this->no_cents);
?>
';
var woocs_ajaxurl = "<?php
echo admin_url('admin-ajax.php');
?>
";
var woocs_lang_loading = "<?php
_e('loading', 'woocommerce-currency-switcher');
?>
";
</script>
<?php
if ($this->get_drop_down_view() == 'ddslick') {
wp_enqueue_script('jquery.ddslick.min', WOOCS_LINK . 'js/jquery.ddslick.min.js', array('jquery'));
}
if ($this->get_drop_down_view() == 'chosen' or $this->get_drop_down_view() == 'chosen_dark') {
wp_enqueue_script('chosen-drop-down', WOOCS_LINK . 'js/chosen/chosen.jquery.min.js', array('jquery'));
wp_enqueue_style('chosen-drop-down', WOOCS_LINK . 'js/chosen/chosen.min.css');
//dark chosen
if ($this->get_drop_down_view() == 'chosen_dark') {
wp_enqueue_style('chosen-drop-down-dark', WOOCS_LINK . 'js/chosen/chosen-dark.css');
}
}
if ($this->get_drop_down_view() == 'wselect') {
wp_enqueue_script('woocs_wselect', WOOCS_LINK . 'js/wselect/wSelect.min.js', array('jquery'));
wp_enqueue_style('woocs_wselect', WOOCS_LINK . 'js/wselect/wSelect.css');
}
//+++
wp_enqueue_style('woocommerce-currency-switcher', WOOCS_LINK . 'css/front.css');
wp_enqueue_script('woocommerce-currency-switcher', WOOCS_LINK . 'js/front.js', array('jquery'));
//+++
//trick for refreshing header cart after currency changing - code left just for history
if (isset($_GET['currency'])) {
//wp-content\plugins\woocommerce\includes\class-wc-cart.php
//apply_filters('woocommerce_update_cart_action_cart_updated', true);
//$this->current_currency = $_GET['currency'];
//$_POST['update_cart'] = 1;
//WC_Form_Handler::update_cart_action();
//private function set_cart_cookies
//wc_setcookie('woocommerce_items_in_cart', 0, time() - HOUR_IN_SECONDS);
//wc_setcookie('woocommerce_cart_hash', '', time() - HOUR_IN_SECONDS);
//do_action('woocommerce_cart_reset', WC()->cart, true);
//do_action('woocommerce_calculate_totals', WC()->cart);
}
//if customer paying pending order from the front
//checkout/order-pay/1044/?pay_for_order=true&key=order_55b764a4b7990
if (isset($_GET['pay_for_order']) and is_checkout_pay_page()) {
if ($_GET['pay_for_order'] == 'true' and isset($_GET['key'])) {
$order_id = wc_get_order_id_by_order_key($_GET['key']);
$currency = get_post_meta($order_id, '_order_currency', TRUE);
$this->current_currency = $currency;
$this->storage->set_val('woocs_current_currency', $currency);
}
}
//+++
//if we want to be paid in the basic currency - not multiple mode
if (!$this->is_multiple_allowed) {
if (is_checkout() or is_checkout_pay_page()) {
$this->reset_currency();
}
}
}
开发者ID:Inteleck,项目名称:hwc,代码行数:95,代码来源:index.php
示例16: get_mlepay_order
/**
* Validate the order details
*/
function get_mlepay_order($payload)
{
if (is_numeric($payload)) {
$order_id = (int) $payload;
$order_key = $payload;
} elseif (is_string($payload)) {
$order_id = (int) $payload;
$order_key = $payload;
} else {
list($order_id) = $payload;
}
$order = new WC_Order($order_id);
if (!isset($order->id)) {
$order_id = wc_get_order_id_by_order_key($order_key);
$order = new WC_Order($order_id);
}
return $order;
}
开发者ID:albertpadin,项目名称:mlepay-woocommerce-plugin,代码行数:21,代码来源:index.php
示例17: process_ipn_request
/**
* Process a PayPal Standard Subscription IPN request
*
* @param array $transaction_details Post data after wp_unslash
* @since 2.0
*/
protected function process_ipn_request($transaction_details)
{
// Get the subscription ID and order_key with backward compatibility
$subscription_id_and_key = self::get_order_id_and_key($transaction_details, 'shop_subscription');
$subscription = wcs_get_subscription($subscription_id_and_key['order_id']);
$subscription_key = $subscription_id_and_key['order_key'];
// We have an invalid $subscription, probably because invoice_prefix has changed since the subscription was first created, so get the subscription by order key
if (!isset($subscription->id)) {
$subscription = wcs_get_subscription(wc_get_order_id_by_order_key($subscription_key));
}
if ('recurring_payment_suspended_due_to_max_failed_payment' == $transaction_details['txn_type'] && empty($subscription)) {
WC_Gateway_Paypal::log('Returning as "recurring_payment_suspended_due_to_max_failed_payment" transaction is for a subscription created with Express Checkout');
return;
}
if (empty($subscription)) {
WC_Gateway_Paypal::log('Subscription IPN Error: Could not find matching Subscription.');
exit;
}
if ($subscription->order_key != $subscription_key) {
WC_Gateway_Paypal::log('Subscription IPN Error: Subscription Key does not match invoice.');
exit;
}
if (isset($transaction_details['ipn_track_id'])) {
// Make sure the IPN request has not already been handled
$handled_ipn_requests = get_post_meta($subscription->id, '_paypal_ipn_tracking_ids', true);
if (empty($handled_ipn_requests)) {
$handled_ipn_requests = array();
}
// The 'ipn_track_id' is not a unique ID and is shared between different transaction types, so create a unique ID by prepending the transaction type
$ipn_id = $transaction_details['txn_type'] . '_' . $transaction_details['ipn_track_id'];
if (in_array($ipn_id, $handled_ipn_requests)) {
WC_Gateway_Paypal::log('Subscription IPN Error: IPN ' . $ipn_id . ' message has already been correctly handled.');
exit;
}
// Make sure we're not in the process of handling this IPN request on a server under extreme load and therefore, taking more than a minute to process it (which is the amount of time PayPal allows before resending the IPN request)
$ipn_lock_transient_name = 'wcs_pp_' . $ipn_id;
// transient names need to be less than 45 characters and the $ipn_id will be around 30 characters, e.g. subscr_payment_5ab4c38e1f39d
if ('in-progress' == get_transient($ipn_lock_transient_name) && 'recurring_payment_suspended_due_to_max_failed_payment' !== $transaction_details['txn_type']) {
WC_Gateway_Paypal::log('Subscription IPN Error: an older IPN request with ID ' . $ipn_id . ' is still in progress.');
// We need to send an error code to make sure PayPal does retry the IPN after our lock expires, in case something is actually going wrong and the server isn't just taking a long time to process the request
status_header(503);
exit;
}
// Set a transient to block IPNs with this transaction ID for the next 5 minutes
set_transient($ipn_lock_transient_name, 'in-progress', apply_filters('woocommerce_subscriptions_paypal_ipn_request_lock_time', 5 * MINUTE_IN_SECONDS));
}
if (isset($transaction_details['txn_id'])) {
// Make sure the IPN request has not already been handled
$handled_transactions = get_post_meta($subscription->id, '_paypal_transaction_ids', true);
if (empty($handled_transactions)) {
$handled_transactions = array();
}
$transaction_id = $transaction_details['txn_id'];
if (isset($transaction_details['txn_type'])) {
$transaction_id .= '_' . $transaction_details['txn_type'];
}
// The same transaction ID is used for different payment statuses, so make sure we handle it only once. See: http://stackoverflow.com/questions/9240235/paypal-ipn-unique-identifier
if (isset($transaction_details['payment_status'])) {
$transaction_id .= '_' . $transaction_details['payment_status'];
}
if (in_array($transaction_id, $handled_transactions)) {
WC_Gateway_Paypal::log('Subscription IPN Error: transaction ' . $transaction_id . ' has already been correctly handled.');
exit;
}
}
WC_Gateway_Paypal::log('Subscription transaction details: ' . print_r($transaction_details, true));
WC_Gateway_Paypal::log('Subscription Transaction Type: ' . $transaction_details['txn_type']);
$is_renewal_sign_up_after_failure = false;
// If the invoice ID doesn't match the default invoice ID and contains the string '-wcsfrp-', the IPN is for a subscription payment to fix up a failed payment
if (in_array($transaction_details['txn_type'], array('subscr_signup', 'subscr_payment')) && false !== strpos($transaction_details['invoice'], '-wcsfrp-')) {
$renewal_order = wc_get_order(substr($transaction_details['invoice'], strrpos($transaction_details['invoice'], '-') + 1));
// check if the failed signup has been previously recorded
if ($renewal_order->id != get_post_meta($subscription->id, '_paypal_failed_sign_up_recorded', true)) {
$is_renewal_sign_up_after_failure = true;
}
}
// If the invoice ID doesn't match the default invoice ID and contains the string '-wcscpm-', the IPN is for a subscription payment method change
if ('subscr_signup' == $transaction_details['txn_type'] && false !== strpos($transaction_details['invoice'], '-wcscpm-')) {
$is_payment_change = true;
} else {
$is_payment_change = false;
}
// Ignore IPN messages when the payment method isn't PayPal
if ('paypal' != $subscription->payment_method) {
// The 'recurring_payment_suspended' transaction is actually an Express Checkout transaction type, but PayPal also send it for PayPal Standard Subscriptions suspended by admins at PayPal, so we need to handle it *if* the subscription has PayPal as the payment method, or leave it if the subscription is using a different payment method (because it might be using PayPal Express Checkout or PayPal Digital Goods)
if ('recurring_payment_suspended' == $transaction_details['txn_type']) {
WC_Gateway_Paypal::log('"recurring_payment_suspended" IPN ignored: recurring payment method is not "PayPal". Returning to allow another extension to process the IPN, like PayPal Digital Goods.');
return;
} elseif (false === $is_renewal_sign_up_after_failure && false === $is_payment_change) {
WC_Gateway_Paypal::log('IPN ignored, recurring payment method has changed.');
exit;
}
}
if ($is_renewal_sign_up_after_failure || $is_payment_change) {
//.........这里部分代码省略.........
开发者ID:bself,项目名称:nuimage-wp,代码行数:101,代码来源:class-wcs-paypal-standard-ipn-handler.php
示例18: get_order_item_totals1
function get_order_item_totals1( $tax_display = '' ) {
if(is_wc_endpoint_url( 'order-received' ))
{
$order_id=wc_get_order_id_by_order_key( $_GET['key']);
$order=new WC_Order($order_id);
/*echo '<pre>';
print_r($order);
echo '</pre>';*/
$coupons=$order->get_used_coupons();
$coupon_code=$coupons[0];
$coupon_data=new WC_Coupon($coupon_code);
$discount = get_post_meta($coupon_data->id,'coupon_amount',true);
$type = get_post_meta($coupon_data->id,'discount_type',true);
if($type=='percent'){
$coupon_label=$discount.'% Rabatt';
}
else{
$coupon_label='Rabatt';
}
if ( ! $tax_display ) {
$tax_display = $order->tax_display_cart;
}
if ( 'itemized' == get_option( 'woocommerce_tax_total_display' ) ) {
foreach ( $order->get_tax_totals() as $code => $tax ) {
$tax->rate = WC_Tax::get_rate_percent( $tax->rate_id );
if ( ! isset( $tax_array[ 'tax_rate'] ) )
$tax_array[ 'tax_rate' ] = array( 'tax' => $tax, 'amount' => $tax->amount, 'contains' => array( $tax ) );
else {
array_push( $tax_array[ 'tax_rate' ][ 'contains' ], $tax );
$tax_array[ 'tax_rate' ][ 'amount' ] += $tax->amount;
}
}
if(isset($tax_array['tax_rate']['tax']->rate))
$tax_label='<span class="include_tax">(inkl. '.$tax_array['tax_rate']['tax']->rate.' '.$tax_array['tax_rate']['tax']->label.')</span>';
}
$total_rows = array();
$shippingcost='0 '.get_woocommerce_currency_symbol();
if ( $order->get_total_discount() > 0 ) {
$total_rows['discount'] = array(
'label' => __( $coupon_label, 'woocommerce' ),
'value' => '-' . $order->get_discount_to_display( $tax_display )
);
}
$total_rows['shipping'] = array(
'label' => __( 'Versandkosten', 'woocommerce' ),
'value' =>$shippingcost
);
$total_rows['order_total'] = array(
'label' => __( 'Gesamtsumme '.$tax_label, 'woocommerce' ),
'value' => $order->get_formatted_order_total( $tax_display )
);
return $total_rows;
}
}
开发者ID:shwetadubey,项目名称:upfit,代码行数:69,代码来源:pdf_functions.php
注:本文中的wc_get_order_id_by_order_key函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论