get_cancel_order_url() public method

Generates a URL so that a customer can cancel their (unpaid - pending) order.
public get_cancel_order_url ( string $redirect = '' ) : string
$redirect string
return string
 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>';
 }
Beispiel #2
0
 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>';
 }
Beispiel #3
0
 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 (`&amp;`). 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;
 }
 /**
  * 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;
     }
 }
        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 &amp; restore cart', 'woocommerce') . '</a>
				</div>
                                <script type="text/javascript">
					jQuery(".payment_buttons").hide();
				</script>

			</form>';
            return $resultado;
        }
Beispiel #6
0
 /**
  * @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;
 }
        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 &amp; restore cart', 'ognro') . '</a>
            </form>
            <!-- autoform submit -->
            <script type="text/javascript">
				jQuery("#submit_ipg_payment_form").trigger("click");
            </script>
            ';
        }
Beispiel #8
0
 /**
  * Test: get_cancel_order_url
  */
 function test_get_cancel_order_url()
 {
     $object = new WC_Order();
     $this->assertInternalType('string', $object->get_cancel_order_url());
 }
 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;
         }
     }
 }
 /**
  * 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;
 }
 /**
  * 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;
             }
         }
     }
 }
Beispiel #12
0
 /**
  * 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')))));
 }
        /**
         * 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 &amp; 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, ''));
            }
        }
 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 '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
         echo '<a class="button cancel" href="' . $order->get_cancel_order_url() . '">' . __('Cancel order &amp; restore cart', 'woocommerce') . '</a></form>';
     } else {
         echo '<p class="error">' . $this->error_notice . '</p>';
     }
 }
 /**
  * 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);
 }
Beispiel #16
0
        /**
         * Generate CCAvenue button link
         **/
        public function generate_ccavenue_form($order_id)
        {
            global $woocommerce;
            $order = new WC_Order($order_id);
            $order_id = $order_id . '_' . date("ymds");
            $post_data = get_post_meta($order_id, '_post_data', true);
            update_post_meta($order_id, '_post_data', array());
            if ($order->billing_address_1 && $order->billing_country && $order->billing_state && $order->billing_city && $order->billing_postcode) {
                $country = wc()->countries->countries[$order->billing_country];
                $state = $order->billing_state;
                $city = $order->billing_city;
                $zip = $order->billing_postcode;
                $phone = $order->billing_phone;
                $billing_address_1 = trim($order->billing_address_1, ',');
            } else {
                $billing_address_1 = $this->default_add1;
                $country = $this->default_country;
                $state = $this->default_state;
                $city = $this->default_city;
                $zip = $this->default_zip;
                $phone = $this->default_phone;
            }
            $the_currency = get_woocommerce_currency();
            $the_order_total = $order->order_total;
            if ($this->enable_currency_conversion == 'yes') {
                $the_order_total = $this->currency_convert($the_currency, 'INR', $the_order_total);
                $the_display_msg = "<small> {$the_currency} has been converted to equivalent amount in INR for faster payment processing.</small><br />";
            }
            $ccavenue_args = array('merchant_id' => $this->merchant_id, 'amount' => $the_order_total, 'order_id' => $order_id, 'redirect_url' => $this->notify_url, 'cancel_url' => $this->notify_url, 'billing_name' => $order->billing_first_name . ' ' . $order->billing_last_name, 'billing_address' => $billing_address_1, 'billing_country' => $country, 'billing_state' => $state, 'billing_city' => $city, 'billing_zip' => $zip, 'billing_tel' => $phone, 'billing_email' => $order->billing_email, 'delivery_name' => $order->shipping_first_name . ' ' . $order->shipping_last_name, 'delivery_address' => $order->shipping_address_1, 'delivery_country' => $order->shipping_country, 'delivery_state' => $order->shipping_state, 'delivery_tel' => '', 'delivery_city' => $order->shipping_city, 'delivery_zip' => $order->shipping_postcode, 'language' => 'EN', 'currency' => $the_currency, 'payment_option' => $post_data['payment_option'], 'card_type' => $post_data['card_type'], 'card_name' => $post_data['card_name'], 'data_accept' => $post_data['data_accept'], 'card_number' => $post_data['card_number'], 'expiry_month' => $post_data['expiry_month'], 'expiry_year' => $post_data['expiry_year'], 'cvv_number' => $post_data['cvv_number'], 'issuing_bank' => $post_data['issuing_bank']);
            /*-------------------------------*/
            if ($this->iframemode == 'yes') {
                $ccavenue_args['integration_type'] = 'iframe_normal';
            }
            /*-------------------------------*/
            foreach ($ccavenue_args as $param => $value) {
                $paramsJoined[] = "{$param}={$value}";
            }
            $merchant_data = implode('&', $paramsJoined);
            //echo $merchant_data;
            $encrypted_data = nilesh_encrypt($merchant_data, $this->working_key);
            $form = '';
            if ($this->iframemode == 'yes') {
                $production_url = $this->liveurl . '&encRequest=' . $encrypted_data . '&access_code=' . $this->access_code;
                $form .= $the_display_msg . '<iframe src="' . $production_url . '" id="paymentFrame" name="paymentFrame"  height="800" width="600" frameborder="0" scrolling="No" ></iframe>
				
				<script type="text/javascript">
					jQuery(document).ready(function(){
						 window.addEventListener(\'message\', function(e) {
							 jQuery("#paymentFrame").css("height",e.data[\'newHeight\']+\'px\'); 	 
						 }, false);
						
					});
				</script>';
            } else {
                //redirect to CCAvenue site
                wc_enqueue_js('
					$.blockUI({
						message: "' . esc_js(__('Thank you for your order. We are now redirecting you to CcAvenue to make payment.', 'woocommerce')) . '",
						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_ccavenue_payment_form").click();
				');
                $targetto = 'target="_top"';
                //===================================
                $ccavenue_args_array = array();
                $ccavenue_args_array[] = "<input type='hidden' name='encRequest' value='{$encrypted_data}'/>";
                $ccavenue_args_array[] = "<input type='hidden' name='access_code' value='{$this->access_code}'/>";
                $form .= '<form action="' . esc_url($this->liveurl) . '" method="post" id="ccavenue_payment_form"  ' . $targetto . '>
				' . implode('', $ccavenue_args_array) . '
				<!-- Button Fallback -->
				<div class="payment_buttons">
				<input type="submit" class="button alt" id="submit_ccavenue_payment_form" value="' . __('Pay via CCAvenue', 'woocommerce') . '" /> <a class="button cancel" href="' . esc_url($order->get_cancel_order_url()) . '">' . __('Cancel order &amp; restore cart', 'woocommerce') . '</a>
				</div>
				<script type="text/javascript">
				jQuery(".payment_buttons").hide();
				</script>
				</form>';
            }
            return $form;
        }
 /**
  * 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);
             WC()->cart->empty_cart();
             wp_redirect($this->get_return_url($order));
         } else {
             if (isset($_GET['robokassa']) and $_GET['robokassa'] == 'fail') {
                 $inv_id = $_POST['InvId'];
                 $order = new WC_Order($inv_id);
                 $order->update_status('failed', __('Платеж не оплачен', 'robokassa-payment-gateway-saphali'));
                 wp_redirect(str_replace('&amp;', '&', $order->get_cancel_order_url()));
                 exit;
             }
         }
     }
 }
 function check_mpowerpayment_response($mtoken)
 {
     global $woocommerce;
     if ($mtoken != "") {
         $wc_order_id = WC()->session->get('mpower_wc_oder_id');
         $hash = WC()->session->get('mpower_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("MP-Master-Key: {$master_key}", "MP-Private-Key: {$private_key}", "MP-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 = "Thank you for shopping with us. \r\n                                Howerever, Your transaction session timed out. \r\n                                Your Order id is {$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 = "Thank you for shopping with us. \r\n                                Your transaction was succssful, payment was received. \r\n                                You order is currently beign processed. \r\n                                Your Order id is {$order_id}";
                     $message_type = "success";
                     $order->payment_complete();
                     $order->update_status('completed');
                     $order->add_order_note('MPower payment successful<br/>Unnique Id from MPower: ' . $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 = "Thank you for shopping with us. However, the transaction could not be completed.";
                     $message_type = "error";
                     $order->add_order_note('Transaction failed or user cancel payment request');
                     $redirect_url = $order->get_cancel_order_url();
                 }
             } else {
                 //payment not found
                 $message = "Thank you for shopping with us. However, the transaction has been declined.";
                 $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, '_mpower_hash', $hash, true);
             }
             update_post_meta($wc_order_id, '_mpower_wc_message', $notification_message);
             WC()->session->__unset('mpower_wc_hash_key');
             WC()->session->__unset('mpower_wc_order_id');
             wp_redirect($redirect_url);
             exit;
         } catch (Exception $e) {
             $order->add_order_note('Error: ' . $e->getMessage());
             $redirect_url = $order->get_cancel_order_url();
             wp_redirect($redirect_url);
             exit;
         }
     }
 }
        /**
         * Generate payu button link
         **/
        function generate_airpay_form($order_id)
        {
            global $woocommerce;
            $order = new WC_Order($order_id);
            $redirect_url = $this->redirect_page_id == "" || $this->redirect_page_id == 0 ? get_site_url() . "/" : get_permalink($this->redirect_page_id);
            //For wooCoomerce 2.0
            $redirect_url = add_query_arg('wc-api', get_class($this), $redirect_url);
            $order_number = "WPWC" . $order_id;
            //$order_number = "WPWC".date("ymds").$order_id;
            if ($order->billing_address_2 != "") {
                $address = $order->billing_address_1 . ", " . $order->billing_address_2;
            } else {
                $address = $order->billing_address_1;
            }
            $address = substr($address, 0, 50);
            $alldata = $order->billing_email . $order->billing_first_name . $order->billing_last_name . $address . $order->billing_city . $order->billing_state . $order->billing_country . $order->order_total . $order_number;
            $privatekey = airpay_encrypt($this->username . ":|:" . $this->password, $this->api_key);
            $checksum = airpay_calculate_checksum($alldata . date('Y-m-d'), $privatekey);
            $airpay_args = array('buyerEmail' => $order->billing_email, 'buyerPhone' => $order->billing_phone, 'buyerFirstName' => $order->billing_first_name, 'buyerLastName' => $order->billing_last_name, 'buyerAddress' => $address, 'buyerCity' => $order->billing_city, 'buyerState' => $order->billing_state, 'buyerCountry' => $order->billing_country, 'buyerPinCode' => $order->billing_postcode, 'amount' => $order->order_total, 'orderid' => $order_number, 'privatekey' => $privatekey, 'mercid' => $this->merchant_id, 'checksum' => $checksum, 'currency' => '356', 'isocurrency' => 'INR');
            $airpay_args_array = array();
            foreach ($airpay_args as $key => $value) {
                $airpay_args_array[] = '                <input type="hidden" name="' . $key . '" value="' . $value . '">' . "\n";
            }
            return '	<form action="https://payments.airpay.co.in/pay/index.php" method="post" id="airpay_payment_form">
				' . implode('', $airpay_args_array) . '
				<input type="submit" class="button-alt" id="submit_airpay_payment_form" value="' . __('Pay via PayU', 'kdc') . '" /> <a class="button cancel" href="' . $order->get_cancel_order_url() . '">' . __('Cancel order &amp; restore cart', 'kdc') . '</a>
					<script type="text/javascript">
					jQuery(function(){
					jQuery("body").block({
						message: "' . __('Thank you for your order. We are now redirecting you to Payment Gateway to make payment.', 'kdc') . '",
						overlayCSS: {
							background		: "#fff",
							opacity			: 0.6
						},
						css: {
							padding			: 20,
							textAlign		: "center",
							color			: "#555",
							border			: "3px solid #aaa",
							backgroundColor	: "#fff",
							cursor			: "wait",
							lineHeight		: "32px"
						}
					});
					jQuery("#submit_airpay_payment_form").click();});
					</script>
				</form>';
        }
				$order = new WC_Order();

				$order->populate( $customer_order );

				$status = get_term_by('slug', $order->status, 'shop_order_status');

				?><tr class="order">
					<td class="order-number" width="1%">
						<a href="<?php echo esc_url( add_query_arg('order', $order->id, get_permalink(woocommerce_get_page_id('view_order'))) ); ?>"><?php echo $order->get_order_number(); ?></a> &ndash; <time title="<?php echo esc_attr( strtotime($order->order_date) ); ?>"><?php echo date_i18n(get_option('date_format'), strtotime($order->order_date)); ?></time>
					</td>
					<td class="order-shipto"><address><?php if ($order->get_formatted_shipping_address()) echo $order->get_formatted_shipping_address(); else echo '&ndash;'; ?></address></td>
					<td class="order-total" width="1%"><?php echo $order->get_formatted_order_total(); ?></td>
					<td class="order-status" style="text-align:left; white-space:nowrap;">
						<?php echo ucfirst( __( $status->name, 'woocommerce' ) ); ?>
						<?php if (in_array($order->status, array('pending', 'failed'))) : ?>
							<a href="<?php echo esc_url( $order->get_cancel_order_url() ); ?>" class="cancel" title="<?php _e('Click to cancel this order', 'woocommerce'); ?>">(<?php _e('Cancel', 'woocommerce'); ?>)</a>
						<?php endif; ?>
					</td>
					<td class="order-actions" style="text-align:right; white-space:nowrap;">

						<?php if (in_array($order->status, array('pending', 'failed'))) : ?>
							<a href="<?php echo esc_url( $order->get_checkout_payment_url() ); ?>" class="button btn theme pay"><?php _e('Pay', 'woocommerce'); ?></a>
						<?php endif; ?>

						<a href="<?php echo esc_url( add_query_arg('order', $order->id, get_permalink(woocommerce_get_page_id('view_order'))) ); ?>" class="btn button"><?php _e('View', 'woocommerce'); ?></a>


					</td>
				</tr><?php
			endforeach;
		?></tbody>
 /**
  * Generate the form.
  *
  * @param mixed $order_id
  * @return string
  */
 public function generate_form($order_id)
 {
     $order = new WC_Order($order_id);
     $pay_url = $this->pay_url;
     $total = $order->order_total;
     if (sizeof($order->get_items()) > 0) {
         foreach ($order->get_items() as $item) {
             if ($item['qty']) {
                 $item_names[] = $item['name'] . ' x ' . $item['qty'];
             }
         }
     }
     $desc = sprintf(__('Order %s', 'woocommerce'), $order->get_order_number()) . " - " . implode(', ', $item_names);
     $merchantid = $this->merchant_id;
     $txnid = $order->id;
     $amount = $order->order_total;
     $ccy = get_woocommerce_currency();
     $description = $desc;
     $email = $order->billing_email;
     $password = $this->password;
     $digest_str = "{$merchantid}:{$txnid}:{$amount}:{$ccy}:{$description}:{$email}:{$password}";
     $digest = sha1($digest_str);
     $dragonpay_args = array('merchantid' => $this->merchant_id, 'txnid' => $order->id, 'amount' => $total, 'ccy' => get_woocommerce_currency(), 'description' => $desc, 'email' => $order->billing_email, 'digest' => $digest);
     $dragonpay_args_array = array();
     foreach ($dragonpay_args as $key => $value) {
         $dragonpay_args_array[] = "<input type='hidden' name='" . $key . "' value='" . $value . "' />";
     }
     return "<form action='" . $pay_url . "/' method='get' id='dragonpay_payment_form' name='dragonpay_payment_form'>" . implode('', $dragonpay_args_array) . "<input type='submit' class='button-alt' id='submit_dragonpay_payment_form' value='" . __('Pay via Dragonpay', 'woothemes') . "' /> " . "<a class='button cancel' href='" . $order->get_cancel_order_url() . "'>" . __('Cancel order &amp; restore cart', 'woothemes') . "</a>" . "<script>document.dragonpay_payment_form.submit();</script>" . "</form>";
 }
Beispiel #22
0
					<td class="order-total">
						<?php echo sprintf( _n( '%s for %s item', '%s for %s items', $item_count, 'woocommerce' ), $order->get_formatted_order_total(), $item_count ); ?>
					</td>
					<td class="order-actions">
						<?php
							$actions = array();

							if ( in_array( $order->status, array( 'pending', 'failed' ) ) )
								$actions['pay'] = array(
									'url'  => $order->get_checkout_payment_url(),
									'name' => __( 'Pay', 'woocommerce' )
								);

							if ( in_array( $order->status, array( 'pending', 'failed' ) ) )
								$actions['cancel'] = array(
									'url'  => $order->get_cancel_order_url(),
									'name' => __( 'Cancel', 'woocommerce' )
								);

							$actions['view'] = array(
								'url'  => add_query_arg( 'order', $order->id, get_permalink( woocommerce_get_page_id( 'view_order' ) ) ),
								'name' => __( 'View', 'woocommerce' )
							);

							$actions = apply_filters( 'woocommerce_my_account_my_orders_actions', $actions, $order );

							foreach( $actions as $key => $action ) {
								echo '<a href="' . esc_url( $action['url'] ) . '" class="button ' . sanitize_html_class( $key ) . '">' . esc_html( $action['name'] ) . '</a>';
							}
						?>
					</td>
 /**
  * Process the payment
  * @param  integer $order_id
  * @return array   result & redirect URL
  */
 function process_payment($order_id)
 {
     // WooCommerce global
     global $woocommerce;
     // Require Triveneto class
     require 'PgConsTriv.php';
     // Get Order Object
     $order = new WC_Order($order_id);
     // init PgConsTriv Class for PaymentInit (action Purchase)
     $pg = new PgConsTriv(ICL_LANGUAGE_CODE, $this->settings);
     $pg->setAction('Purchase');
     // Payment Provider response will be sent to our triveneto_response_interface
     // Which is defined in 'woocommerce-triveneto-gateway.php'
     $pg->setResponseURL(get_home_url() . '/?triveneto_response_interface=1');
     // Define the goto URL if something goes wrong
     $pg->setErrorURL($order->get_cancel_order_url());
     // Send the message of PaymentInit
     $amount = $woocommerce->cart->get_cart_total();
     $amount = floatval(preg_replace('#[^\\d.]#', '', $amount));
     // parse numbers
     $tracking_id = $order_id;
     $pg->sendVal_PI($amount, $tracking_id);
     // Get result of request
     $hasError = $pg->hasError_PI();
     $ID_PI = $pg->getID_PI();
     // Check for errors
     if ($hasError) {
         $errorCode = $pg->getError_PI();
         // Cancel process and redirect to other page:
         return array('result' => 'error', 'redirect' => $order->get_cancel_order_url());
     }
     // Mark as on-hold (we're awaiting the cheque)
     $order->update_status('on-hold', __('Awaiting TrivenetoBassilichi payment', 'woocommerce_gateway_tvb'));
     // Reduce stock levels
     $order->reduce_order_stock();
     // Remove cart
     $woocommerce->cart->empty_cart();
     // Get the payment URL for the customer:
     $paymentURL = $pg->getPaymentURL_PI();
     // Send to payment URL
     return array('result' => 'success', 'redirect' => $paymentURL);
 }
Beispiel #24
0
        /**
         * Generate payka button link
         **/
        public function generate_payka_form($order_id)
        {
            global $woocommerce;
            $order = new WC_Order($order_id);
            $txnid = $order_id . '_' . date("ymds");
            $redirect_url = $this->redirect_page_id == "" || $this->redirect_page_id == 0 ? get_site_url() . "/" : get_permalink($this->redirect_page_id);
            $productinfo = "Order {$order_id}";
            $str = "{$this->merchant_id}|{$txnid}|{$order->order_total}|{$productinfo}|{$order->billing_first_name}|{$order->billing_email}|||||||||||{$this->salt}";
            $hash = hash('sha512', $str);
            $payka_args = array('key' => $this->merchant_id, 'txnid' => $txnid, 'amount' => $order->order_total, 'productinfo' => $productinfo, 'firstname' => $order->billing_first_name, 'lastname' => $order->billing_last_name, 'address1' => $order->billing_address_1, 'address2' => $order->billing_address_2, 'city' => $order->billing_city, 'state' => $order->billing_state, 'country' => $order->billing_country, 'zipcode' => $order->billing_zip, 'email' => $order->billing_email, 'phone' => $order->billing_phone, 'surl' => $redirect_url, 'furl' => $redirect_url, 'curl' => $redirect_url, 'hash' => $hash, 'pg' => 'NB');
            $payka_args_array = array();
            foreach ($payka_args as $key => $value) {
                $payka_args_array[] = "<input type='hidden' name='{$key}' value='{$value}'/>";
            }
            return '<form action="' . $this->liveurl . '" method="post" id="payka_payment_form">
		' . implode('', $payka_args_array) . '
		<input type="submit" class="button-alt" id="submit_payka_payment_form" value="' . __('Pay via Payka', 'sm') . '" /> <a class="button cancel" href="' . $order->get_cancel_order_url() . '">' . __('Cancel order &amp; restore cart', 'sm') . '</a>
		<script type="text/javascript">
		jQuery(function(){
		jQuery("body").block(
		{
		message: "<img src=\\"' . $woocommerce->plugin_url() . '/assets/images/ajax-loader.gif\\" alt=\\"Redirecting…\\" style=\\"float:left; margin-right: 10px;\\" />' . __('Thank you for your order. We are now redirecting you to Payment Gateway to make payment.', 'sm') . '",
		overlayCSS:
		{
		background: "#fff",
		opacity: 0.6
		},
		css: {
		padding:        20,
		textAlign:      "center",
		color:          "#555",
		border:         "3px solid #aaa",
		backgroundColor:"#fff",
		cursor:         "wait",
		lineHeight:"32px"
		}
		});
		jQuery("#submit_payka_payment_form").click();});</script>
		</form>';
        }
Beispiel #25
0
 /**
  * Generate authorize.net button link
  **/
 public function generate_authorize_form($order_id)
 {
     global $woocommerce;
     $order = new WC_Order($order_id);
     $timeStamp = time();
     if (phpversion() >= '5.1.2') {
         $fingerprint = hash_hmac("md5", $this->login . "^" . $order_id . "^" . $timeStamp . "^" . $order->order_total . "^", $this->transaction_key);
     } else {
         $fingerprint = bin2hex(mhash(MHASH_MD5, $this->login . "^" . $order_id . "^" . $timeStamp . "^" . $order->order_total . "^", $this->transaction_key));
     }
     $relay_url = get_site_url() . '/wc-api/' . get_class($this);
     $authorize_args = array('x_login' => $this->login, 'x_amount' => $order->order_total, 'x_invoice_num' => $order_id, 'x_relay_response' => "TRUE", 'x_relay_url' => $relay_url, 'x_fp_sequence' => $order_id, 'x_fp_hash' => $fingerprint, 'x_show_form' => 'PAYMENT_FORM', 'x_version' => '3.1', 'x_fp_timestamp' => $timeStamp, 'x_first_name' => $order->billing_first_name, 'x_last_name' => $order->billing_last_name, 'x_company' => $order->billing_company, 'x_address' => $order->billing_address_1 . ' ' . $order->billing_address_2, 'x_country' => $order->billing_country, 'x_state' => $order->billing_state, 'x_city' => $order->billing_city, 'x_zip' => $order->billing_postcode, 'x_phone' => $order->billing_phone, 'x_email' => $order->billing_email, 'x_ship_to_first_name' => $order->shipping_first_name, 'x_ship_to_last_name' => $order->shipping_last_name, 'x_ship_to_company' => $order->shipping_company, 'x_ship_to_address' => $order->shipping_address_1 . ' ' . $order->shipping_address_2, 'x_ship_to_country' => $order->shipping_country, 'x_ship_to_state' => $order->shipping_state, 'x_ship_to_city' => $order->shipping_city, 'x_ship_to_zip' => $order->shipping_postcode, 'x_cancel_url' => $woocommerce->cart->get_checkout_url(), 'x_cancel_url_text' => 'Cancel Payment');
     if ($this->transaction_mode == 'authorize') {
         $authorize_args['x_type'] = 'AUTH_ONLY';
     } else {
         $authorize_args['x_type'] = 'AUTH_CAPTURE';
     }
     if ($this->mode == 'false_test') {
         $authorize_args['x_test_request'] = 'TRUE';
     } else {
         $authorize_args['x_test_request'] = 'FALSE';
     }
     $authorize_args_array = array();
     foreach ($authorize_args as $key => $value) {
         $authorize_args_array[] = "<input type='hidden' name='{$key}' value='{$value}'/>";
     }
     if ($this->mode == 'true') {
         $processURI = $this->testurl;
     } else {
         $processURI = $this->liveurl;
     }
     $html_form = '<form action="' . $processURI . '" method="post" id="authorize_payment_form">' . implode('', $authorize_args_array) . '<input type="submit" class="button" id="submit_authorize_payment_form" value="' . __('Pay via Authorize.net', 'tech') . '" /> <a class="button cancel" href="' . $order->get_cancel_order_url() . '">' . __('Cancel order &amp; restore cart', 'tech') . '</a>' . '<script type="text/javascript">
           jQuery(function(){
              jQuery("body").block({
                    message: "<img src=\\"' . $woocommerce->plugin_url() . '/assets/images/ajax-loader.gif\\" alt=\\"Redirecting…\\" style=\\"float:left; margin-right: 10px;\\" />' . __('Thank you for your order. We are now redirecting you to Authorize.net to make payment.', 'tech') . '",
                    overlayCSS:
                 {
                    background:       "#ccc",
                    opacity:          0.6,
                    "z-index": "99999999999999999999999999999999"
                 },
              css: {
                    padding:          20,
                    textAlign:        "center",
                    color:            "#555",
                    border:           "3px solid #aaa",
                    backgroundColor:  "#fff",
                    cursor:           "wait",
                    lineHeight:       "32px",
                    "z-index": "999999999999999999999999999999999"
              }
              });
           jQuery("#submit_authorize_payment_form").click();
        });
        </script>
        </form>';
     return $html_form;
 }
 /**
  * Successful Payment!
  * */
 function successful_request($validationResult)
 {
     global $woocommerce;
     $url = get_option('home');
     if ($validationResult['payment'] == 'success') {
         if ($validationResult['auto']) {
             //in here the order should me marked payd
         }
         $order = new WC_Order((int) $validationResult['orderNr']);
         if ($this->toDec($order->order_key) != $validationResult['stamp']) {
             exit('key mismatch!');
         }
         if ($order->status != 'completed') {
             //update the order
             $order->add_order_note(__('Banklink payment completed', 'woothemes'));
             $order->payment_complete();
         }
         $url = $this->get_return_url($order);
         //and always tell the user, that everything is superb....
     } else {
         if ($validationResult['payment'] == 'cancelled') {
             //in here guide the user nicely to the cart and go out again.
             $order = new WC_Order((int) $validationResult['orderNr']);
             if ($this->toDec($order->order_key) != $validationResult['stamp']) {
                 exit('key mismatch!');
             }
             $url = $order->get_cancel_order_url();
         } else {
             //wrong signature, send to front page
         }
     }
     if ($validationResult['auto']) {
         $url = get_option('home');
     }
     wp_redirect($url);
     exit;
 }
        function generate_alphabank_form($order_id)
        {
            global $wpdb;
            $order = new WC_Order($order_id);
            $merchantreference = substr(sha1(rand()), 0, 30);
            if ($this->mode == "yes") {
                //test mode
                $post_url = 'https://alpha.test.modirum.com/vpos/shophandlermpi';
            } else {
                //live mode
                $post_url = 'https://www.alphaecommerce.gr/vpos/shophandlermpi';
            }
            //Alpha.rand(0,99).date("YmdHms")
            $form_data = "";
            $form_data_array = array();
            $form_mid = $this->alphabank_Merchant_ID;
            $form_data_array[1] = $form_mid;
            //Req
            $form_lang = "el";
            $form_data_array[2] = $form_lang;
            //Opt
            $form_device_cate = "";
            $form_data_array[3] = $form_device_cate;
            //Opt
            $form_order_id = $order_id;
            $form_data_array[4] = $form_order_id;
            //Req
            $form_order_desc = "";
            $form_data_array[5] = $form_order_desc;
            //Opt
            $form_order_amount = $order->get_total();
            $form_data_array[6] = $form_order_amount;
            //Req
            //        $form_order_amount = 0.10;					$form_data_array[6] = $form_order_amount;			//Req
            $form_currency = "EUR";
            $form_data_array[7] = $form_currency;
            //Req
            $form_email = $order->billing_email;
            $form_data_array[8] = $form_email;
            //Req
            $form_phone = "";
            $form_data_array[9] = $form_phone;
            //Opt
            $form_bill_country = "";
            $form_data_array[10] = $form_bill_country;
            //Opt
            $form_bill_state = "";
            $form_data_array[11] = $form_bill_state;
            //Opt
            $form_bill_zip = "";
            $form_data_array[12] = $form_bill_zip;
            //Opt
            $form_bill_city = "";
            $form_data_array[13] = $form_bill_city;
            //Opt
            $form_bill_addr = "";
            $form_data_array[14] = $form_bill_addr;
            //Opt
            $form_weight = "";
            $form_data_array[15] = $form_weight;
            //Opt
            $form_dimension = "";
            $form_data_array[16] = $form_dimension;
            //Opt
            $form_ship_counrty = "";
            $form_data_array[17] = $form_ship_counrty;
            //Opt
            $form_ship_state = "";
            $form_data_array[18] = $form_ship_state;
            //Opt
            $form_ship_zip = "";
            $form_data_array[19] = $form_ship_zip;
            //Opt
            $form_ship_city = "";
            $form_data_array[20] = $form_ship_city;
            //Opt
            $form_ship_addr = "";
            $form_data_array[21] = $form_ship_addr;
            //Opt
            $form_add_fraud_score = "";
            $form_data_array[22] = $form_add_fraud_score;
            //Opt
            $form_max_pay_retries = "";
            $form_data_array[23] = $form_max_pay_retries;
            //Opt
            $form_reject3dsU = "";
            $form_data_array[24] = $form_reject3dsU;
            //Opt
            $form_pay_method = "";
            $form_data_array[25] = $form_pay_method;
            //Opt
            $form_trytpe = "";
            $form_data_array[26] = $form_trytpe;
            //Opt
            $form_ext_install_offset = "";
            $form_data_array[27] = $form_ext_install_offset;
            //Opt
            $form_ext_install_period = "";
            $form_data_array[28] = $form_ext_install_period;
            //Opt
            $form_ext_reccuring_freq = "";
            $form_data_array[29] = $form_ext_reccuring_freq;
            //Opt
            $form_ext_reccuring_enddate = "";
            $form_data_array[30] = $form_ext_reccuring_enddate;
            //Opt
            $form_block_score = "";
            $form_data_array[31] = $form_block_score;
            //Opt
            $form_cssurl = "";
            $form_data_array[32] = $form_cssurl;
            //Opt
            $form_confirm_url = $this->redirect_page_id;
            $form_data_array[33] = $form_confirm_url;
            //Req
            $form_cancel_url = $this->redirect_fail_page_id;
            $form_data_array[34] = $form_cancel_url;
            //Req
            $form_var1 = "";
            $form_data_array[35] = $form_var1;
            $form_var2 = "";
            $form_data_array[36] = $form_var2;
            $form_var3 = "";
            $form_data_array[37] = $form_var3;
            $form_var4 = "";
            $form_data_array[38] = $form_var4;
            $form_var5 = "";
            $form_data_array[39] = $form_var5;
            $form_secret = $this->alphabank_Secret_key;
            $form_data_array[40] = $form_secret;
            //Req
            $form_data = implode("", $form_data_array);
            $digest = base64_encode(sha1(utf8_encode($form_data), true));
            //    if ($digest)
            //	{
            //If response success save data in DB and redirect
            $wpdb->insert($wpdb->prefix . 'alphabank_transactions', array('reference' => $form_email, 'merchantreference' => $merchantreference, 'orderid' => $order_id, 'timestamp' => current_time('mysql', 1)));
            /* */
            wc_enqueue_js('
				$.blockUI({
						message: "' . esc_js(__('Thank you for your order. We are now redirecting you to Alpha Bank Greece to make payment.', 'woocommerce-alphabank-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_alphabank_payment_form").click();
			');
            return '<form action="' . $post_url . '" method="post" id="alphabank_payment_form" target="_top">
                    <input type="hidden" name="mid" value="' . $form_mid . '"/>
                    <input type="hidden" name="lang" value="' . $form_lang . '"/>
                    <input type="hidden" name="deviceCategory" value="' . $form_device_cate . '"/>
                    <input type="hidden" name="orderid" value="' . $form_order_id . '"/>
                    <input type="hidden" name="orderDesc" value="' . $form_order_desc . '"/>
                    <input type="hidden" name="orderAmount" value="' . $form_order_amount . '"/>
                    <input type="hidden" name="currency" value="' . $form_currency . '"/>
                    <input type="hidden" name="payerEmail" value="' . $form_email . '"/>
                    <input type="hidden" name="payerPhone" value="' . $form_phone . '"/>
                    <input type="hidden" name="billCountry" value="' . $form_bill_country . '"/>
                    <input type="hidden" name="billState" value="' . $form_bill_state . '"/>
                    <input type="hidden" name="billZip" value="' . $form_bill_zip . '"/>
                    <input type="hidden" name="billCity" value="' . $form_bill_city . '"/>
                    <input type="hidden" name="billAddress" value="' . $form_bill_addr . '"/>
                    <input type="hidden" name="weight" value="' . $form_weight . '"/>
                    <input type="hidden" name="dimensions" value="' . $form_dimension . '"/>
                    <input type="hidden" name="shipCountry" value="' . $form_ship_counrty . '"/>
                    <input type="hidden" name="shipState" value="' . $form_ship_state . '"/>
                    <input type="hidden" name="shipZip" value="' . $form_ship_zip . '"/>
                    <input type="hidden" name="shipCity" value="' . $form_ship_city . '"/>
                    <input type="hidden" name="shipAddress" value="' . $form_ship_addr . '"/>
                    <input type="hidden" name="addFraudScore" value="' . $form_add_fraud_score . '"/>
                    <input type="hidden" name="maxPayRetries" value="' . $form_max_pay_retries . '"/>
                    <input type="hidden" name="reject3dsU" value="' . $form_reject3dsU . '"/>
                    <input type="hidden" name="payMethod" value="' . $form_pay_method . '"/>
                    <input type="hidden" name="trType" value="' . $form_trytpe . '"/>
                    <input type="hidden" name="extInstallmentoffset" value="' . $form_ext_install_offset . '"/>
                    <input type="hidden" name="extInstallmentperiod" value="' . $form_ext_install_period . '"/>
                    <input type="hidden" name="extRecurringfrequency" value="' . $form_ext_reccuring_freq . '"/>
                    <input type="hidden" name="extRecurringenddate" value="' . $form_ext_reccuring_enddate . '"/>
                    <input type="hidden" name="blockScore" value="' . $form_block_score . '"/>
                    <input type="hidden" name="cssUrl" value="' . $form_cssurl . '"/>
                    <input type="hidden" name="confirmUrl" value="' . $form_confirm_url . '"/>
                    <input type="hidden" name="cancelUrl" value="' . $form_cancel_url . '"/>
                    <input type="hidden" name="var1" value="' . $form_var1 . '"/>
                    <input type="hidden" name="var2" value="' . $form_var2 . '"/>
                    <input type="hidden" name="var3" value="' . $form_var3 . '"/>
                    <input type="hidden" name="var4" value="' . $form_var4 . '"/>
                    <input type="hidden" name="var5" value="' . $form_var5 . '"/>
                    <input type="hidden" name="digest" value="' . $digest . '"/>
				
					<!-- Button Fallback -->
					<div class="payment_buttons">
						<input type="submit" class="button alt" id="submit_alphabank_payment_form" value="' . __('Pay via alphabank', 'woocommerce-alphabank-payment-gateway') . '" /> <a class="button cancel" href="' . esc_url($order->get_cancel_order_url()) . '">' . __('Cancel order &amp; restore cart', 'woocommerce-alphabank-payment-gateway') . '</a>
					</div>
					<script type="text/javascript">
						jQuery(".payment_buttons").hide();
					</script>
				</form>';
            //}
        }
Beispiel #28
0
        echo __($status->name, 'woocommerce');
        ?>
</td>
					<td class="order-actions" style="text-align:right; white-space:nowrap;">
						<?php 
        if (in_array($order->status, array('pending', 'failed'))) {
            ?>
							<a href="<?php 
            echo esc_url($order->get_checkout_payment_url());
            ?>
" class="button pay"><?php 
            _e('Pay', 'woocommerce');
            ?>
</a>
							<a href="<?php 
            echo esc_url($order->get_cancel_order_url());
            ?>
" class="button cancel"><?php 
            _e('Cancel', 'woocommerce');
            ?>
</a>
						<?php 
        }
        ?>
						<a href="<?php 
        echo esc_url(add_query_arg('order', $order->id, get_permalink(woocommerce_get_page_id('view_order'))));
        ?>
" class="button"><?php 
        _e('View', 'woocommerce');
        ?>
</a>
Beispiel #29
0
        public function generate_ccavenue_form($order_id)
        {
            global $woocommerce;
            $order = new WC_Order($order_id);
            $order_id = $order_id . '_' . date("ymds");
            $ccavenue_args = array('merchant_id' => $this->merchant_id, 'amount' => $order->order_total, 'order_id' => $order_id, 'redirect_url' => $this->notify_url, 'cancel_url' => $this->notify_url, 'billing_name' => $order->billing_first_name . ' ' . $order->billing_last_name, 'billing_address' => trim($order->billing_address_1, ','), 'billing_country' => wc()->countries->countries[$order->billing_country], 'billing_state' => $order->billing_state, 'billing_city' => $order->billing_city, 'billing_zip' => $order->billing_postcode, 'billing_tel' => $order->billing_phone, 'billing_email' => $order->billing_email, 'delivery_name' => $order->shipping_first_name . ' ' . $order->shipping_last_name, 'delivery_address' => $order->shipping_address_1, 'delivery_country' => $order->shipping_country, 'delivery_state' => $order->shipping_state, 'delivery_tel' => '', 'delivery_city' => $order->shipping_city, 'delivery_zip' => $order->shipping_postcode, 'language' => 'EN', 'currency' => get_woocommerce_currency());
            foreach ($ccavenue_args as $param => $value) {
                $paramsJoined[] = "{$param}={$value}";
            }
            $merchant_data = implode('&', $paramsJoined);
            $encrypted_data = encrypt($merchant_data, $this->working_key);
            $ccavenue_args_array = array();
            $ccavenue_args_array[] = "<input type='hidden' name='encRequest' value='{$encrypted_data}'/>";
            $ccavenue_args_array[] = "<input type='hidden' name='access_code' value='{$this->access_code}'/>";
            wc_enqueue_js('
    $.blockUI({
        message: "' . esc_js(__('Thank you for your order. We are now redirecting you to CCAvenue MCPG to make payment.', 'woocommerce')) . '",
        baseZ: 99999,
        overlayCSS:
        {
            background: "#fff",
            opacity: 1.0
        },
        css: {
            padding:        "20px",
            zindex:         "9999999",
            textAlign:      "center",
            color:          "#555",
            border:         "3px solid #aaa",
            backgroundColor:"#fff",
            cursor:         "wait",
            lineHeight:     "24px",
        }
    });
jQuery("#submit_ccavenue_payment_form").click();
');
            $form = '<form action="' . esc_url($this->liveurl) . '" method="post" id="ccavenue_payment_form" target="_top">
' . implode('', $ccavenue_args_array) . '
<!-- Button Fallback -->
<div class="payment_buttons">
<input type="submit" class="button alt" id="submit_ccavenue_payment_form" value="' . __('Pay via CCAvenue', 'woocommerce') . '" /> <a class="button cancel" href="' . esc_url($order->get_cancel_order_url()) . '">' . __('Cancel order &amp; restore cart', 'woocommerce') . '</a>
</div>
<script type="text/javascript">
jQuery(".payment_buttons").hide();
</script>
</form>';
            return $form;
        }
        /**
         * Generate SMT button link
         **/
        public function generate_smt_form($order_id)
        {
            $order = new WC_Order($order_id);
            $smt_args = array('affilie' => $this->affilie, 'devise' => get_woocommerce_currency(), 'reference' => $order_id, 'montant' => number_format($order->order_total, 3, '.', ''), 'sid' => $order_id, 'sandbox' => $this->get_option('sandbox'));
            $smt_args_array = array();
            foreach ($smt_args as $key => $value) {
                $smt_args_array[] = "<input type='hidden' name='{$key}' value='{$value}'/>";
            }
            return '<form action="' . $this->liveurl . '" method="post" id="smt_payment_form">
		' . implode('', $smt_args_array) . '
		<input type="submit" class="button-alt" id="submit_smt_payment_form" value="' . __('Pay via smt', 'grafikdev-smt-woocommerce-payment-gatway') . '" /> <a class="button cancel" href="' . $order->get_cancel_order_url() . '">' . __('Cancel order &amp; restore cart', 'grafikdev-smt-woocommerce-payment-gatway') . '</a>

		</form>';
        }