本文整理汇总了PHP中WC_Order::get_cancel_order_url方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Order::get_cancel_order_url方法的具体用法?PHP WC_Order::get_cancel_order_url怎么用?PHP WC_Order::get_cancel_order_url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WC_Order
的用法示例。
在下文中一共展示了WC_Order::get_cancel_order_url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate_form
public function generate_form($order_id)
{
$order = new WC_Order($order_id);
$order_name = __('Order No. ') . $order_id;
$args = array('receiver' => $this->wallet_number, 'formcomment' => $this->formcomment, 'short-dest' => $order_name, 'quickpay-form' => 'shop', 'targets' => $order_name, 'sum' => $order->order_total, 'paymentType' => 'AC', 'label' => $order_id);
$paypal_args = apply_filters('woocommerce_robokassa_args', $args);
$args_array = array();
foreach ($args as $key => $value) {
$args_array[] = '<input type="hidden" name="' . esc_attr($key) . '" value="' . esc_attr($value) . '" />';
}
return '<form action="' . esc_url($this->url) . '" method="POST" class="order_actions">' . "\n" . implode("\n", $args_array) . '<input type="submit" class="button alt" value="' . __('Pay') . '" /> <a class="button cancel" href="' . $order->get_cancel_order_url() . '">' . __('Cancel Order') . '</a>' . "\n" . '</form>';
}
示例2: generate_form
public function generate_form($order_id)
{
$order = new WC_Order($order_id);
$action_adr = $this->liveurl;
$result_url = str_replace('https:', 'http:', add_query_arg('wc-api', 'wc_privat24', get_permalink(woocommerce_get_page_id('thanks'))));
$args = array('amt' => $order->order_total, 'ccy' => get_woocommerce_currency(), 'merchant' => $this->merchant_id, 'order' => $order_id, 'details' => "Оплата за заказ - {$order_id}", 'ext_details' => "Оплата за заказ - {$order_id}", 'pay_way' => 'privat24', 'return_url' => $result_url, 'server_url' => '');
$args_array = array();
foreach ($args as $key => $value) {
$args_array[] = '<input type="hidden" name="' . esc_attr($key) . '" value="' . esc_attr($value) . '" />';
}
return '<form action="' . esc_url($action_adr) . '" method="POST" id="privat24_payment_form">' . '<input type="submit" class="button alt" id="submit_privat24_button" value="' . __('Оплатить', 'woocommerce') . '" /> <a class="button cancel" href="' . $order->get_cancel_order_url() . '">' . __('Отказаться от оплаты & вернуться в корзину', 'woocommerce') . '</a>' . "\n" . implode("\n", $args_array) . '</form>';
}
示例3: get_cancel_url
public function get_cancel_url()
{
$url = $this->order->get_cancel_order_url();
/*
* The WooCommerce developers changed the `get_cancel_order_url` function in version 2.1.0.
* In version 2.1.0 the WooCommerce plugin uses the `wp_nonce_url` function. This WordPress
* function uses the WordPress `esc_html` function. The `esc_html` function converts specials
* characters like `&` to HTML entities (`&`). This is causing redirecting issues, so we
* decode these back with the `wp_specialchars_decode` function.
*
* @see https://github.com/WordPress/WordPress/blob/4.1/wp-includes/functions.php#L1325-L1338
* @see https://github.com/WordPress/WordPress/blob/4.1/wp-includes/formatting.php#L3144-L3167
* @see https://github.com/WordPress/WordPress/blob/4.1/wp-includes/formatting.php#L568-L647
* @see https://github.com/woothemes/woocommerce/blob/v2.1.0/includes/class-wc-order.php#L1112
*
* @see https://github.com/woothemes/woocommerce/blob/v2.0.20/classes/class-wc-order.php#L1115
* @see https://github.com/woothemes/woocommerce/blob/v2.0.0/woocommerce.php#L1693-L1703
*
* @see https://github.com/woothemes/woocommerce/blob/v1.6.6/classes/class-wc-order.php#L1013
* @see https://github.com/woothemes/woocommerce/blob/v1.6.6/woocommerce.php#L1630
*/
$url = wp_specialchars_decode($url);
return $url;
}
示例4: do_transaction_cancelled
/**
* Handle a cancelled transaction response.
*
* @since 4.3.0
* @param \WC_Order $order the order object
* @param \SV_WC_Payment_Gateway_API_Payment_Notification_Response $response the response object
*/
protected function do_transaction_cancelled(WC_Order $order, $response)
{
if ($response->is_ipn()) {
status_header(200);
die;
} else {
wp_redirect($order->get_cancel_order_url());
exit;
}
}
示例5: round
function generate_webpayplus_form($order_id)
{
global $webpay_comun_folder;
$SUFIJO = "[WEBPAY - FORM]";
$order = new WC_Order($order_id);
$redirect_url = $this->notify_url;
$order_key = $order->order_key;
if (strpos($redirect_url, "?")) {
$failureLink = $redirect_url . "&status=failure&order={$order_id}&key={$order_key}";
$successLink = $redirect_url . "&status=success&order={$order_id}&key={$order_key}";
} else {
$failureLink = $redirect_url . "?status=failure&order={$order_id}&key={$order_key}";
$successLink = $redirect_url . "?status=success&order={$order_id}&key={$order_key}";
}
log_me("REDIRECT_URL " . $redirect_url, $SUFIJO);
$TBK_MONTO = round($order->order_total);
$TBK_ORDEN_COMPRA = $order_id;
$TBK_ID_SESION = date("Ymdhis");
$filename = __FILE__;
$myPath = $webpay_comun_folder . DIRECTORY_SEPARATOR . "dato{$TBK_ID_SESION}.log";
log_me("Se utilizará {$myPath} para guardar los datos", $SUFIJO);
/* * **************** FIN CONFIGURACION **************** */
//formato Moneda
$partesMonto = explode(",", $TBK_MONTO);
$TBK_MONTO = $partesMonto[0] . "00";
//Grabado de datos en archivo de transaccion
$fic = fopen($myPath, "w+");
$linea = "{$TBK_MONTO};{$TBK_ORDEN_COMPRA}";
log_me("Preparando para escribir {$linea} en {$myPath}", $SUFIJO);
fwrite($fic, $linea);
fclose($fic);
log_me("ARCHIVO CERRADO", $SUFIJO);
log_me("Argumentos", $SUFIJO);
$webpayplus_args = array('TBK_TIPO_TRANSACCION' => "TR_NORMAL", 'TBK_MONTO' => $TBK_MONTO, 'TBK_ORDEN_COMPRA' => $TBK_ORDEN_COMPRA, 'TBK_ID_SESION' => $TBK_ID_SESION, 'TBK_URL_EXITO' => $successLink, 'TBK_URL_FRACASO' => $failureLink);
log_me($webpayplus_args);
foreach ($webpayplus_args as $key => $value) {
$webpayplus_args_array[] = '<input type="hidden" name="' . esc_attr($key) . '" value="' . esc_attr($value) . '" />';
}
/*
* Esto hace que sea enviada automáticamente el formulario.
*/
wc_enqueue_js('
$.blockUI({
message: "' . esc_js(__('Gracias por tu orden. Estamos redireccionando a Transbank')) . '",
baseZ: 99999,
overlayCSS:
{
background: "#fff",
opacity: 0.6
},
css: {
padding: "20px",
zindex: "9999999",
textAlign: "center",
color: "#555",
border: "3px solid #aaa",
backgroundColor:"#fff",
cursor: "wait",
lineHeight: "24px",
}
});
jQuery("#submit_webpayplus_payment_form").click();
');
/*
* La variable resultado tiene el formulario que es enviado a transbank. ( Todo el <FORM> )
*/
$resultado = '<form action="' . esc_url($this->liveurl) . '" method="post" id="webpayplus_payment_form" target="_top">';
$resultado .= implode('', $webpayplus_args_array);
$resultado .= '<!-- Button Fallback -->
<div class="payment_buttons">
<input type="submit" class="button alt" id="submit_webpayplus_payment_form" value="' . __('Pago via WebpayPlus') . '" /> <a class="button cancel" href="' . esc_url($order->get_cancel_order_url()) . '">' . __('Cancel order & restore cart', 'woocommerce') . '</a>
</div>
<script type="text/javascript">
jQuery(".payment_buttons").hide();
</script>
</form>';
return $resultado;
}
示例6: get_checkout
/**
* @param WC_Order $order
* @param string $checkout_url
* @param int $redirect_id
* @param WP_User $user
*
* @return array
*/
public static function get_checkout($order, $checkout_url, $redirect_id, $user)
{
$serializer = array('toc' => true, 'merchant' => array('confirmation_url' => add_query_arg('action', 'confirm', get_permalink($redirect_id)), 'cancel_url' => html_entity_decode($order->get_cancel_order_url()), 'checkout_url' => html_entity_decode($checkout_url), 'success_url' => html_entity_decode($order->get_checkout_order_received_url())), 'customer' => $user->ID ? self::get_user($user) : self::get_customer($order->billing_email), 'order' => self::get_order($order), 'billing' => self::get_address($order, 'billing'), 'meta' => static::get_meta());
$shipping_method = $order->get_shipping_method();
if (!empty($shipping_method)) {
$serializer['shipping'] = self::get_shipping_info($order);
}
return $serializer;
}
示例7: generate_ipg_form
public function generate_ipg_form($order_id)
{
global $wpdb;
global $woocommerce;
$order = new WC_Order($order_id);
$productinfo = "Order {$order_id}";
$curr_symbole = get_woocommerce_currency();
$table_name = $wpdb->prefix . 'tpayway_ipg';
$check_oder = $wpdb->get_var("SELECT COUNT(*) FROM {$table_name} WHERE transaction_id = '" . $order_id . "'");
if ($check_oder > 0) {
$wpdb->update($table_name, array('response_code' => '', 'response_code_desc' => '', 'reason_code' => '', 'amount' => $order->order_total, 'or_date' => date('Y-m-d'), 'status' => ''), array('transaction_id' => $order_id));
} else {
$wpdb->insert($table_name, array('transaction_id' => $order_id, 'response_code' => '', 'response_code_desc' => '', 'reason_code' => '', 'amount' => $order->order_total, 'or_date' => date('Y-m-d'), 'status' => ''), array('%s', '%d'));
}
if ((bool) stristr($_SERVER["REQUEST_URI"], "en_US")) {
if (is_null($this->CurrencyEn)) {
$order->order_total = $order->order_total;
} else {
$order->order_total = $order->order_total * $this->CurrencyEn;
}
}
$order_format_value = str_pad($order->order_total * 100, 12, '0', STR_PAD_LEFT);
//$enc = base64_encode(pack('H*', sha1($pass)));
$totalAmount = number_format($order->order_total, 2, '', '');
// http://docs.woothemes.com/wc-apidocs/class-WC_Customer.html
$method = 'authorize-form';
// method type
$pgwInstallments = '1';
// broj rata
$pgw_card_type_id = '1';
// tip kartice
$secret_key = $this->AcqID;
// Secret key
$pgw_authorization_type = '0';
$pgw_language = '';
$pgw_shop_id = $this->ShopID;
$pgw_order_id = $order_id;
$pgw_amount = $totalAmount;
$pgw_success_url = $this->responce_url_sucess;
$pgw_failure_url = $this->responce_url_fail;
$order = new WC_Order($order_id);
// Customs data
$pgw_first_name = $order->billing_first_name;
$pgw_last_name = $order->billing_last_name;
$pgw_street = $woocommerce->customer->address;
$pgw_city = $woocommerce->customer->city;
$pgw_post_code = $woocommerce->customer->postcode;
$pgw_country = $woocommerce->customer->country;
$pgw_telephone = $order->billing_phone;
$pgw_email = $order->billing_email;
$pgw_signature = hash('sha512', $method . $secret_key . $pgw_shop_id . $secret_key . $pgw_order_id . $secret_key . $pgw_amount . $secret_key . $pgw_authorization_type . $secret_key . $pgw_language . $secret_key . $pgw_success_url . $secret_key . $pgw_failure_url . $secret_key . $pgw_first_name . $secret_key . $pgw_last_name . $secret_key . $pgw_street . $secret_key . $pgw_city . $secret_key . $pgw_post_code . $secret_key . $pgw_country . $secret_key . $pgw_telephone . $secret_key . $pgw_email . $secret_key);
$form_args = array('Version' => $this->Version, 'pgw_shop_id' => $pgw_shop_id, 'pgw_order_id' => $pgw_order_id, 'pgw_amount' => $pgw_amount, 'pgw_authorization_type' => $pgw_authorization_type, 'pgw_success_url' => $this->responce_url_sucess, 'pgw_failure_url' => $this->responce_url_fail, 'pgw_language' => $pgw_language, 'pgw_signature' => $pgw_signature, 'pgw_first_name' => $pgw_first_name, 'pgw_last_name' => $pgw_last_name, 'pgw_street' => $pgw_street, 'pgw_city' => $pgw_city, 'pgw_post_code' => $pgw_post_code, 'pgw_country' => $pgw_country, 'pgw_telephone' => $pgw_telephone, 'pgw_email' => $pgw_email, 'AcqID' => $this > AcqID, 'PurchaseAmt' => $order_format_value);
$form_args_array = array();
$form_args_joins = null;
foreach ($form_args as $key => $value) {
$form_args_array[] = "<input type='hidden' name='{$key}' value='{$value}'/>";
$form_args_joins = $key . '=' . $value . '&';
}
return '<p>' . $percentage_msg . '</p>
<p>Total amount will be <b>' . number_format($order->order_total) . ' ' . $curr_symbole . '</b></p>
<form action="' . $this->pg_domain . '" method="post" name="payway-authorize-form" id="payway-authorize-form" type="application/x-www-form-urlencoded">
' . implode('', $form_args_array) . '
<input type="submit" class="button-alt" id="submit_ipg_payment_form" value="' . __('Pay via PayWay', 'ognro') . '" />
<a class="button cancel" href="' . $order->get_cancel_order_url() . '">' . __('Cancel order & restore cart', 'ognro') . '</a>
</form>
<!-- autoform submit -->
<script type="text/javascript">
jQuery("#submit_ipg_payment_form").trigger("click");
</script>
';
}
示例8:
/**
* Test: get_cancel_order_url
*/
function test_get_cancel_order_url()
{
$object = new WC_Order();
$this->assertInternalType('string', $object->get_cancel_order_url());
}
示例9: WC
function check_paydunya_response($mtoken)
{
global $woocommerce;
if ($mtoken != "") {
$wc_order_id = WC()->session->get('paydunya_wc_oder_id');
$hash = WC()->session->get('paydunya_wc_hash_key');
$order = new WC_Order($wc_order_id);
try {
$ch = curl_init();
$master_key = $this->live_master_key;
$private_key = "";
$url = $this->geturl . $mtoken;
$token = "";
if ($this->settings['sandbox'] == "yes") {
$private_key = $this->test_private_key;
$token = $this->test_token;
} else {
$private_key = $this->live_private_key;
$token = $this->live_token;
}
curl_setopt_array($ch, array(CURLOPT_URL => $url, CURLOPT_NOBODY => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_HTTPHEADER => array("PAYDUNYA-MASTER-KEY: {$master_key}", "PAYDUNYA-PRIVATE-KEY: {$private_key}", "PAYDUNYA-TOKEN: {$token}")));
$response = curl_exec($ch);
$response_decoded = json_decode($response);
$respond_code = $response_decoded->response_code;
if ($respond_code == "00") {
//payment found
$status = $response_decoded->status;
$custom_data = $response_decoded->custom_data;
$order_id = $custom_data->order_id;
if ($wc_order_id != $order_id) {
$message = "Votre session de transaction a expiré. Votre numéro de commande est: {$order_id}";
$message_type = "notice";
$order->add_order_note($message);
$redirect_url = $order->get_cancel_order_url();
}
if ($status == "completed") {
//payment was completely processed
$total_amount = strip_tags($woocommerce->cart->get_cart_total());
$message = "Merci pour votre achat. La transaction a été un succès, le paiement a été reçu. Votre commande est en cours de traitement. Votre numéro de commande est {$order_id}";
$message_type = "success";
$order->payment_complete();
$order->update_status('completed');
$order->add_order_note('Paiement PAYDUNYA effectué avec succès<br/>ID unique reçu de PAYDUNYA: ' . $mtoken);
$order->add_order_note($this->msg['message']);
$woocommerce->cart->empty_cart();
$redirect_url = $this->get_return_url($order);
$customer = trim($order->billing_last_name . " " . $order->billing_first_name);
if ($this->sms == "yes") {
$phone_no = get_user_meta(get_current_user_id(), 'billing_phone', true);
$sms = $this->sms_message;
$sms = str_replace("{ORDER-ID}", $order_id, $sms);
$sms = str_replace("{AMOUNT}", $total_amount, $sms);
$sms = str_replace("{CUSTOMER}", $customer, $sms);
$this->sendsms($phone_no, $sms);
}
} else {
//payment is still pending, or user cancelled request
$message = "La transaction n'a pu être complétée.";
$message_type = "error";
$order->add_order_note("La transaction a échoué ou l'utilisateur a eu à faire demande d'annulation de paiement");
$redirect_url = $order->get_cancel_order_url();
}
} else {
//payment not found
$message = "Merci de nous avoir choisi. Malheureusement, la transaction a été refusée.";
$message_type = "error";
$redirect_url = $order->get_cancel_order_url();
}
$notification_message = array('message' => $message, 'message_type' => $message_type);
if (version_compare(WOOCOMMERCE_VERSION, "2.2") >= 0) {
add_post_meta($wc_order_id, '_paydunya_hash', $hash, true);
}
update_post_meta($wc_order_id, '_paydunya_wc_message', $notification_message);
WC()->session->__unset('paydunya_wc_hash_key');
WC()->session->__unset('paydunya_wc_order_id');
wp_redirect($redirect_url);
exit;
} catch (Exception $e) {
$order->add_order_note('Erreur: ' . $e->getMessage());
$redirect_url = $order->get_cancel_order_url();
wp_redirect($redirect_url);
exit;
}
}
}
示例10: get_skrill_args
/**
* Get arguments to pass to Skrill.
*
* @param WC_Order order An order object.
* @return array
*/
protected function get_skrill_args(WC_Order $order)
{
$this->log(sprintf(__('Skrill - Generating payment form for order #%s.'), $order->id), true);
$currency = get_woocommerce_currency();
$order_cancel_url = $order->get_cancel_order_url();
$order_total = number_format($order->order_total, 2, '.', '');
$skrill_args = array('pay_to_email' => $this->email, 'language' => $this->get_gateway_language(), 'currency' => $currency, 'return_url' => $this->get_return_url($order), 'cancel_url' => $order_cancel_url, 'status_url' => $this->status_url, 'merchant_fields' => 'order_key', 'order_key' => $order->order_key, 'transaction_id' => $order->id, 'amount' => $order_total, 'amount2' => $order_total, 'amount2_description' => sprintf(__('Order #%s', $this->text_domain), $order->id), 'comments' => $order->customer_note);
// Add billing details
$skrill_args = array_merge($skrill_args, $this->get_billing_fields($order));
$skrill_args = apply_filters('wc_gateway_skrill_form_fields', $skrill_args);
$this->log(sprintf(__('Skrill arguments (JSON): ', $this->text_domain), json_encode($skrill_args)), true);
return $skrill_args;
}
示例11:
/**
* Check Response
**/
function check_ipn_response()
{
global $woocommerce;
if (isset($_GET['robokassa']) and $_GET['robokassa'] == 'result') {
@ob_clean();
$_POST = stripslashes_deep($_POST);
if ($this->check_ipn_request_is_valid($_POST)) {
do_action('valid-robokassa-standard-ipn-reques', $_POST);
} else {
wp_die('IPN Request Failure');
}
} else {
if (isset($_GET['robokassa']) and $_GET['robokassa'] == 'success') {
$inv_id = $_POST['InvId'];
$order = new WC_Order($inv_id);
$order->update_status('on-hold', __('Платеж успешно оплачен', 'woocommerce'));
$woocommerce->cart->empty_cart();
wp_redirect(add_query_arg('key', $order->order_key, add_query_arg('order', $inv_id, get_permalink(get_option('woocommerce_thanks_page_id')))));
exit;
} else {
if (isset($_GET['robokassa']) and $_GET['robokassa'] == 'fail') {
$inv_id = $_POST['InvId'];
$order = new WC_Order($inv_id);
$order->update_status('failed', __('Платеж не оплачен', 'woocommerce'));
wp_redirect($order->get_cancel_order_url());
exit;
}
}
}
}
示例12: array
/**
* Check Response
**/
function check_ipn_response($post)
{
global $woocommerce;
//var_dump($post);
if (isset($post['respcode']) && $post['respcode'] == '00' && isset($post['orderID']) && ctype_digit($post['orderID'])) {
//echo 11 . ' ';
$post = stripslashes_deep($post);
$orderId = $post['orderID'];
$order = new WC_Order($orderId);
if ($order && $order->status == 'pending') {
//echo 12 . ' ';
$postdata = array();
$postdata['hostID'] = $this->arca_hostid;
$postdata['orderID'] = $orderId;
$amount = number_format($order->order_total, 2, '.', '');
$postdata['amount'] = $amount;
$postdata['currency'] = $this->arca_currency;
$postdata['mid'] = $this->arca_mid;
$postdata['tid'] = $this->arca_tid;
$postdata['mtpass'] = $this->arca_mtpass;
$postdata['trxnDetails'] = "Order placed";
$res = $this->call_arca_rpc("merchant_check", $postdata);
if ('yes' == $this->debug) {
$this->log->add('arca', "ARCA :: MERCHANTCHECK REQUEST = " . serialize($postdata));
$this->log->add('arca', "ARCA :: MERCHANTCHECK RESPONCE = " . serialize($res));
}
//var_dump($res);
//var_dump($postdata);
if (isset($res['respcode']) && $res['respcode'] == "00") {
if ($res['orderID'] == $orderId && $res['amount'] == $amount) {
$this->data = $res;
$res['mid'] = $this->arca_mid;
$res['tid'] = $this->arca_tid;
//echo 13 . ' ';
$comment = "=== ARCA Transaction Details ===\r\n";
$comment .= "Date/Time: " . $res['datetime'] . "\r\n";
$comment .= "STAN: " . $res['stan'] . "\r\n";
$comment .= "Auth Code: " . $res['authcode'] . "\r\n";
$comment .= "RRN:\t" . $res['rrn'] . "\r\n";
$postdata['trxnDetails'] = "Order confirmed";
$res = $this->call_arca_rpc("confirmation", $postdata);
//$order->update_status('on-hold', __('Order successfuly payed', 'arca'));
$woocommerce->cart->empty_cart();
// Payment completed
$order->add_order_note(__('Order successfuly payed via Arca IPN', 'arca'));
$order->payment_complete();
wp_redirect(add_query_arg('key', $order->order_key, add_query_arg('order', $orderId, get_permalink(get_option('woocommerce_thanks_page_id')))));
return;
} else {
$postdata['trxnDetails'] = "Order refused";
$res = $this->call_arca_rpc("refuse", $postdata);
$order->update_status('failed', __('Payment via Arca has been refused', 'arca'));
wp_redirect($order->get_cancel_order_url());
return;
}
} elseif (isset($res['error'])) {
echo $res['error'];
return;
}
}
} elseif (isset($post['cancel']) && $post['cancel'] == 'CANCEL') {
wp_redirect(home_url());
return;
}
//wp_redirect(home_url());
//wp_redirect(add_query_arg('key', 123, add_query_arg('order', 123, get_permalink(get_option('woocommerce_thanks_page_id')))));
}
示例13: intval
/**
* Generate the Piraeus Payment button link
* */
function generate_piraeusbank_form($order_id)
{
global $woocommerce;
global $wpdb;
$order = new WC_Order($order_id);
//echo $this->pb_authorize;
if ($this->pb_authorize == "yes") {
$requestType = '00';
$ExpirePreauth = '30';
} else {
$requestType = '02';
$ExpirePreauth = '0';
}
$installments = 1;
if ($this->pb_installments > 1) {
$installments = intval($order->get_total() / 30);
$installments = min($installments, $this->pb_installments);
}
try {
$soap = new SoapClient("https://paycenter.piraeusbank.gr/services/tickets/issuer.asmx?WSDL");
$ticketRequest = array('Username' => $this->pb_Username, 'Password' => hash('md5', $this->pb_Password), 'MerchantId' => $this->pb_PayMerchantId, 'PosId' => $this->pb_PosId, 'AcquirerId' => $this->pb_AcquirerId, 'MerchantReference' => $order_id, 'RequestType' => $requestType, 'ExpirePreauth' => $ExpirePreauth, 'Amount' => $order->get_total(), 'CurrencyCode' => '978', 'Installments' => $installments, 'Bnpl' => '0', 'Parameters' => '');
$xml = array('Request' => $ticketRequest);
$oResult = $soap->IssueNewTicket($xml);
if ($oResult->IssueNewTicketResult->ResultCode == 0) {
// store TranTicket in table
$wpdb->insert($wpdb->prefix . 'piraeusbank_transactions', array('trans_ticket' => $oResult->IssueNewTicketResult->TranTicket, 'merch_ref' => $order_id, 'timestamp' => current_time('mysql', 1)));
//redirect to payment
wc_enqueue_js('
$.blockUI({
message: "' . esc_js(__('Thank you for your order. We are now redirecting you to Piraeus Bank to make payment.', 'woocommerce-piraeusbank-payment-gateway')) . '",
baseZ: 99999,
overlayCSS:
{
background: "#fff",
opacity: 0.6
},
css: {
padding: "20px",
zindex: "9999999",
textAlign: "center",
color: "#555",
border: "3px solid #aaa",
backgroundColor:"#fff",
cursor: "wait",
lineHeight: "24px",
}
});
jQuery("#submit_pb_payment_form").click();
');
$LanCode = "el-GR";
/*
Other available Language codes
en-US: English
ru-RU: Russian
de-DE: German
*/
return '<form action="' . esc_url("https://paycenter.piraeusbank.gr/redirection/pay.aspx") . '" method="post" id="pb_payment_form" target="_top">
<input type="hidden" id="AcquirerId" name="AcquirerId" value="' . esc_attr($this->pb_AcquirerId) . '"/>
<input type="hidden" id="MerchantId" name="MerchantId" value="' . esc_attr($this->pb_PayMerchantId) . '"/>
<input type="hidden" id="PosID" name="PosID" value="' . esc_attr($this->pb_PosId) . '"/>
<input type="hidden" id="User" name="User" value="' . esc_attr($this->pb_Username) . '"/>
<input type="hidden" id="LanguageCode" name="LanguageCode" value="' . $LanCode . '"/>
<input type="hidden" id="MerchantReference" name="MerchantReference" value="' . esc_attr($order_id) . '"/>
<!-- Button Fallback -->
<div class="payment_buttons">
<input type="submit" class="button alt" id="submit_pb_payment_form" value="' . __('Pay via Pireaus Bank', 'woocommerce-piraeusbank-payment-gateway') . '" /> <a class="button cancel" href="' . esc_url($order->get_cancel_order_url()) . '">' . __('Cancel order & restore cart', 'woocommerce-piraeusbank-payment-gateway') . '</a>
</div>
<script type="text/javascript">
jQuery(".payment_buttons").hide();
</script>
</form>';
} else {
echo __('An error occured, please contact the Administrator', 'woocommerce-piraeusbank-payment-gateway');
}
} catch (SoapFault $fault) {
$order->add_order_note(__('Error' . $fault, ''));
}
}
开发者ID:fovoc,项目名称:Woocommerce-Payment-Gateways-Greek-Banks,代码行数:83,代码来源:woocommerce-piraeusbank-payment-gateway.php
示例14: array
function receipt_page($order_id)
{
global $woocommerce;
$order = new WC_Order($order_id);
$order_received_url = add_query_arg('wc-api', 'WC_Nom_EPDQ', $order->get_checkout_order_received_url());
$fields = array('PSPID' => $this->access_key, 'ORDERID' => $order_id, 'AMOUNT' => $order->order_total * 100, 'CURRENCY' => get_woocommerce_currency(), 'LANGUAGE' => get_bloginfo('language'), 'CN' => $order->billing_first_name . ' ' . $order->billing_last_name, 'EMAIL' => $order->billing_email, 'OWNERZIP' => $order->billing_postcode, 'OWNERADDRESS' => $order->billing_address_1, 'OWNERADDRESS2' => $order->billing_address_2, 'OWNERCTY' => $woocommerce->countries->countries[$order->billing_country], 'OWNERTOWN' => $order->billing_city, 'OWNERTELNO' => $order->billing_phone, 'ACCEPTURL' => $order_received_url, 'DECLINEURL' => $order_received_url, 'EXCEPTIONURL' => $order_received_url, 'CANCELURL' => $order_received_url, 'BACKURL' => get_permalink($this->back_url), 'HOMEURL' => get_permalink($this->home_url), 'CATALOGURL' => get_permalink($this->cat_url));
if ($this->pp_format == 'yes') {
$fields['TITLE'] = $this->TITLE;
$fields['BGCOLOR'] = $this->BGCOLOR;
$fields['TXTCOLOR'] = $this->TXTCOLOR;
$fields['TBLBGCOLOR'] = $this->TBLBGCOLOR;
$fields['TBLTXTCOLOR'] = $this->TBLTXTCOLOR;
$fields['BUTTONBGCOLOR'] = $this->BUTTONBGCOLOR;
$fields['BUTTONTXTCOLOR'] = $this->BUTTONTXTCOLOR;
$fields['FONTTYPE'] = $this->FONTTYPE;
$fields['LOGO'] = $this->LOGO;
}
$shasign = '';
$shasign_arg = array();
ksort($fields);
foreach ($fields as $key => $value) {
if ($value == '') {
continue;
}
$shasign_arg[] = $key . '=' . $value;
}
if ($this->sha_method == 0) {
$shasign = sha1(implode($this->sha_in, $shasign_arg) . $this->sha_in);
} elseif ($this->sha_method == 1) {
$shasign = hash('sha256', implode($this->sha_in, $shasign_arg) . $this->sha_in);
} elseif ($this->sha_method == 2) {
$shasign = hash('sha512', implode($this->sha_in, $shasign_arg) . $this->sha_in);
} else {
}
$epdq_args = array();
foreach ($fields as $key => $value) {
if ($value == '') {
continue;
}
$epdq_args[] = "<input type='hidden' name='{$key}' value='{$value}'/>";
}
if (isset($this->status) and ($this->status == 'test' or $this->status == 'live')) {
if ($this->status == 'test') {
$url = $this->test_url;
}
if ($this->status == 'live') {
$url = $this->live_url;
}
echo '<p>' . __('Thank you for your order, please click the button below to pay securely', 'woocommerce') . '</p>';
echo '<form action="' . $url . '" method="post" id="epdq_payment_form">';
echo implode('', $epdq_args);
echo '<input type="hidden" name="SHASIGN" value="' . $shasign . '"/>';
echo '<input type="submit" class="button alt" id="submit_epdq_payment_form" value="' . __('Pay securely', 'woocommerce') . '" />';
echo ' ';
echo '<a class="button cancel" href="' . $order->get_cancel_order_url() . '">' . __('Cancel order & restore cart', 'woocommerce') . '</a></form>';
} else {
echo '<p class="error">' . $this->error_notice . '</p>';
}
}
示例15: explode
/**
* PayU Error response
*
* @access public
* @param $_GET
* @return void
*/
function payu_error()
{
$posted = stripslashes_deep($_GET);
$order_ref = explode("-", $posted['order_ref']);
$order_id = $order_ref[0];
$order = new WC_Order($order_id);
$order->cancel_order(__('Cancelled payment.', 'wc-payu'));
wc_add_notice(__('You rejected the payment or the transaction has expired.', 'wc-payu'), 'error');
if ($this->debug == 'yes') {
$this->log->add('payu', sprintf(__('Cancelled payment. ID: %s', 'wc-payu'), $order_id));
}
$url = $order->get_cancel_order_url();
wp_redirect($url);
}