get_checkout_payment_url() public method

Generates a URL so that a customer can pay for their (unpaid - pending) order. Pass 'true' for the checkout version which doesn't offer gateway choices.
public get_checkout_payment_url ( boolean $on_checkout = false ) : string
$on_checkout boolean
return string
 /**
  * Process the payment field and redirect to checkout/pay page.
  *
  * @param $order_id
  * @return array
  */
 function process_payment($order_id)
 {
     $order = new WC_Order($order_id);
     // Persist the payment method, bank name and emi months as private custom fields.
     update_post_meta($order->id, '_pz_payment_method', mysql_real_escape_string($_POST['pz_payment_method']));
     //update_post_meta($order->id, '_pz_bank_name', mysql_real_escape_string($_POST['pz_bank_name']));
     //update_post_meta($order->id, '_pz_emi_months', mysql_real_escape_string($_POST['pz_emi_months']));
     // Redirect to checkout/pay page
     return array('result' => 'success', 'redirect' => add_query_arg('order', $order->id, add_query_arg('key', $order->order_key, $order->get_checkout_payment_url(true))));
 }
 /**
  * Process the payment and check if the currency is in PHP
  */
 function process_payment($order_id)
 {
     global $woocommerce;
     $order = new WC_Order($order_id);
     $woocommerce->cart->empty_cart();
     if (get_woocommerce_currency() == 'PHP' || get_woocommerce_currency() == 'php') {
         return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(true));
     } else {
         $woocommerce->add_error(__('Currency Error: ', 'woothemes') . "will only accept PHP currency.");
     }
 }
 /**
  * 
  * @global type $woocommerce
  * @param type $order_id
  * @return type
  * 
  * Esta funcion se ejecuta junto luego de seleccionar el metodo de pago. 
  * 
  */
 function process_payment($order_id)
 {
     global $woocommerce;
     $order = new \WC_Order($order_id);
     $installments = $this->checkInstallments($_POST["cuotasMP"]);
     /*
      * Se agrega el meta dato de cuotas.
      * Si ya existe se actualiza
      */
     if (!add_post_meta($order_id, "CUOTASMP", $installments, true)) {
         update_post_meta($order_id, "CUOTASMP", $installments);
     }
     return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(true));
 }
 public function process_payment($order_id)
 {
     if (!$this->is_currency_supported()) {
         throw new Exception(__('You cannot use this currency with LINE Pay.', 'wc-payment-gateway-line-pay'));
     }
     $order = new WC_Order($order_id);
     $items = $order->get_items();
     reset($items);
     $first_item = $items[key($items)];
     $item_name = $first_item['name'];
     $item_count = $order->get_item_count();
     $product_name = $item_name;
     if ($item_count > 1) {
         $product_name .= sprintf(__(' and %s others', 'wc-payment-gateway-line-pay'), $item_count - 1);
     }
     $response_data = $this->client->reserve($product_name, $this->product_image_url, $order->get_total(), get_woocommerce_currency(), add_query_arg('wc-api', 'linepay_confirm_url', home_url('/')), $order->get_checkout_payment_url(), $order_id, $this->get_option('langCd'));
     if ($response_data->returnCode != '0000') {
         throw new Exception(sprintf(__('Incorrect parameters were passed during checkout. Please contact site administrator. Return code: %s', 'wc-payment-gateway-line-pay'), $response_data->returnCode));
     }
     update_post_meta($order_id, '_hpd_linepay_transactionId', $response_data->info->transactionId);
     WC()->cart->empty_cart();
     return array('result' => 'success', 'redirect' => $response_data->info->paymentUrl->web);
 }
 /**
  * Process the payment and return the result
  **/
 function process_payment($order_id)
 {
     $order = new WC_Order($order_id);
     if (version_compare(WOOCOMMERCE_VERSION, '2.1.0', '>=')) {
         /* 2.1.0 */
         $checkout_payment_url = $order->get_checkout_payment_url(true);
     } else {
         /* 2.0.0 */
         $checkout_payment_url = get_permalink(get_option('woocommerce_pay_page_id'));
     }
     return array('result' => 'success', 'redirect' => add_query_arg('order_pay', $order->id, $checkout_payment_url));
 }
 function thankyou_page()
 {
     global $woocommerce;
     if (version_compare(WOOCOMMERCE_VERSION, '2.0.20', '>')) {
         /* WC 2.1 */
         global $wp;
         $order_id = (int) $wp->query_vars['order-received'];
     } else {
         $order_id = (int) $_GET['order'];
     }
     $order = new WC_Order($order_id);
     if ($order->status == 'processing' || $order->status == 'completed') {
         if (version_compare(WOOCOMMERCE_VERSION, '2.0.20', '>')) {
             /* WC 2.1 */
             $url_commande = $order->get_view_order_url();
             $montant_commande = wc_price($order->order_total);
         } else {
             $url_commande = add_query_arg('order', $order->id, get_permalink(get_option('woocommerce_view_order_page_id')));
             $montant_commande = woocommerce_price($order->order_total);
         }
         $compte_client = get_post_meta($order->id, '_customer_user', true);
         printf("<p>" . __("Votre règlement par carte bancaire de %s a bien été finalisé auprès de notre banque"), $montant_commande);
         if ($compte_client > 0) {
             printf(__(", <a href=\"%s\">cliquez ici</a> pour consulter votre commande.", "atos") . "</p>", $url_commande);
         } else {
             echo ".</p>";
         }
     } elseif ($order->status != 'failed') {
         if (version_compare(WOOCOMMERCE_VERSION, '2.0.14', '>=')) {
             /* WC 2.1 */
             $payer_url = $order->get_checkout_payment_url();
         } else {
             $payer_url = add_query_arg('order_id', $order->id, add_query_arg('order', $order->order_key, add_query_arg('pay_for_order', 'true', get_permalink(get_option('woocommerce_pay_page_id')))));
         }
         printf("<p>" . __("Échec du règlement par carte bancaire de votre commande, <a href=\"%s\">cliquez ici</a> pour effectuer une nouvelle tentative de paiement.", "atos") . "</p>", $payer_url);
         /* WC 2.1 */
     }
 }
 /**
  * Check for Veritrans Web Response
  * Method ini akan dipanggil untuk merespon notifikasi yang
  * diberikan oleh server Veritrans serta melakukan verifikasi
  * apakah notifikasi tersebut berasal dari Veritrans dan melakukan
  * konfirmasi transaksi pembayaran yang dilakukan customer
  *
  * update: sekaligus untuk menjadi finish/failed URL handler.
  * @access public
  * @return void
  */
 function veritrans_vtweb_response()
 {
     global $woocommerce;
     @ob_clean();
     global $woocommerce;
     $order = new WC_Order($order_id);
     Veritrans_Config::$isProduction = $this->environment == 'production' ? true : false;
     if ($this->environment == 'production') {
         Veritrans_Config::$serverKey = $this->server_key_v2_production;
     } else {
         Veritrans_Config::$serverKey = $this->server_key_v2_sandbox;
     }
     // check whether the request is GET or POST,
     // if request == GET, request is for finish OR failed URL, then redirect to WooCommerce's order complete/failed
     // else if request == POST, request is for payment notification, then update the payment status
     if (!isset($_GET['order_id'])) {
         // Check if POST, then create new notification
         $veritrans_notification = new Veritrans_Notification();
         if (in_array($veritrans_notification->status_code, array(200, 201, 202))) {
             header('HTTP/1.1 200 OK');
             if ($order->get_order($veritrans_notification->order_id) == true) {
                 $veritrans_confirmation = Veritrans_Transaction::status($veritrans_notification->order_id);
                 do_action("valid-veritrans-web-request", $veritrans_notification);
             }
         }
     } else {
         // else if GET, redirect to order complete/failed
         // error_log('status_code '. $_GET['status_code']); //debug
         // error_log('status_code '. $_GET['transaction_status']); //debug
         if (isset($_GET['order_id']) && isset($_GET['transaction_status']) && ($_GET['transaction_status'] == 'capture' || $_GET['transaction_status'] == 'pending' || $_GET['transaction_status'] == 'settlement')) {
             $order_id = $_GET['order_id'];
             // error_log($this->get_return_url( $order )); //debug
             $order = new WC_Order($order_id);
             wp_redirect($order->get_checkout_order_received_url());
         } else {
             if (isset($_GET['order_id']) && isset($_GET['transaction_status']) && $_GET['transaction_status'] == 'deny') {
                 $order_id = $_GET['order_id'];
                 $order = new WC_Order($order_id);
                 wp_redirect($order->get_checkout_payment_url(false));
             } else {
                 if (isset($_GET['order_id']) && !isset($_GET['transaction_status'])) {
                     // if customer click "back" button, redirect to checkout page again
                     $order_id = $_GET['order_id'];
                     $order = new WC_Order($order_id);
                     wp_redirect($order->get_checkout_payment_url(false));
                 }
             }
         }
     }
 }
 /**
  * Add a "Change Payment Method" button to the "My Subscriptions" table.
  *
  * @param array $all_actions The $subscription_key => $actions array with all actions that will be displayed for a subscription on the "My Subscriptions" table
  * @param array $subscriptions All of a given users subscriptions that will be displayed on the "My Subscriptions" table
  * @since 1.4
  */
 public static function change_payment_method_button($all_actions, $subscriptions)
 {
     foreach ($all_actions as $subscription_key => $actions) {
         $order = new WC_Order($subscriptions[$subscription_key]['order_id']);
         if (WC_Subscriptions_Manager::can_subscription_be_changed_to('new-payment-method', $subscription_key, get_current_user_id())) {
             if (!WC_Subscriptions::is_woocommerce_pre_2_1()) {
                 // WC 2.1+
                 $url = add_query_arg(array('change_payment_method' => $subscription_key, 'order_id' => $order->id), $order->get_checkout_payment_url());
                 $url = wp_nonce_url($url, __FILE__);
             } else {
                 $url = add_query_arg(array('change_payment_method' => $subscription_key, 'order_id' => $order->id, 'order' => $order->order_key), get_permalink(woocommerce_get_page_id('pay')));
                 $url = wp_nonce_url($url, __FILE__);
             }
             $all_actions[$subscription_key] = array('change_payment_method' => array('url' => $url, 'name' => __('Change Payment Method', 'woocommerce-subscriptions'))) + $all_actions[$subscription_key];
         }
     }
     return $all_actions;
 }
 /**
  * Process standard payments.
  *
  * @param WC_Order $order
  * @return array
  */
 protected function process_hosted_payments($order)
 {
     return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(true));
 }
Beispiel #10
0
 public function processOrder($order_id)
 {
     $order = new WC_Order($order_id);
     $partsOforderNumber = $this->exploderOrderNumber($order->get_order_number());
     $response = $this->prepareResponse();
     $this->monetWebPay->log->write("Processing response, payId: " . $response->payId . " dttm: " . $response->dttm . " resultCode: " . $response->resultCode . " resultMessage: " . $response->resultMessage . " authCode: " . $response->authCode . " signature: " . $response->signature);
     if ($this->monetWebPay->verifyPaymentResponseSignature($response, $this->publicKey, "payment response verify") == false) {
         $this->monetWebPay->log->write('Response signature verification failed for payId ' . $response->payId);
         $redirect = $order->get_checkout_payment_url(true);
         $this->msg['message'] = 'Nepodařilo se ověřit podpis odpovědi';
         $this->msg['class'] = 'error';
         wc_add_notice(__($this->msg['message'], 'monet') . $error_message, 'error');
         return;
     }
     if ($response->resultCode != 0) {
         $this->monetWebPay->log->write('Response resultCode is ' . $response->resultCode . " [" . $response->resultMessage . "] for payId " . $response->payId);
     }
     if ($response->paymentStatus == PaymentStatus::$approved) {
         $this->monetWebPay->log->write('Received approved status for payId: ' . $response->payId);
         $this->monetWebPay->updateTransactionStatus($partsOforderNumber[0], $response);
         $this->msg['class'] = 'woocommerce_message';
         $this->msg['message'] = sprintf(__('Platba byla zpracována a čeká v bance na zařazení do zúčtovaní. Číslo objednávky: %s', 'monet'), $partsOforderNumber[0]);
         $order->add_order_note($this->msg['message']);
         WC()->cart->empty_cart();
         $order->payment_complete();
         $order->update_status('on-hold');
     } else {
         if ($response->paymentStatus == PaymentStatus::$canceled) {
             $this->monetWebPay->log->write('Received cancelled status for payId: ' . $response->payId);
             $this->monetWebPay->clearTransaction($partsOforderNumber[0], $response);
             $this->msg['message'] = sprintf(__('Platba byla na platební bráně zrušena zákazníkem. Číslo objednávky: %s', 'monet'), $partsOforderNumber[0]);
             $this->msg['class'] = 'woocommerce_message woocommerce_message_info';
             $order->add_order_note($this->msg['message']);
             $order->update_status('failed');
             wc_add_notice(__($this->msg['message'], 'monet') . $error_message, 'error');
         } else {
             if ($response->paymentStatus == PaymentStatus::$declined) {
                 $this->monetWebPay->log->write('Received declined status for payId: ' . $response->payId);
                 $this->monetWebPay->clearTransaction($partsOforderNumber[0], $response);
                 $this->msg['message'] = 'Platba byla na platební bráně zamítnuta. Číslo objednávky: ' . $partsOforderNumber[0];
                 $this->msg['class'] = 'woocommerce_message woocommerce_message_info';
                 $order->add_order_note(sprintf($this->msg['message']));
                 $order->update_status('failed');
                 wc_add_notice(__($this->msg['message'], 'monet') . $error_message, 'error');
             } else {
                 if ($response->paymentStatus == PaymentStatus::$toClearing) {
                     $this->monetWebPay->log->write('Received to_clearing status for payId: ' . $response->payId);
                     $this->monetWebPay->updateTransactionStatus($partsOforderNumber[0], $response);
                     $this->msg['class'] = 'woocommerce_message woocommerce_message_info';
                     $this->msg['message'] = sprintf(__('Platba byla zpracována a je v bance zařazena do zúčtovaní. Číslo objednavky: %s', 'monet'), $partsOforderNumber[0]);
                     $order->add_order_note($this->msg['message']);
                     WC()->cart->empty_cart();
                     $order->payment_complete();
                 }
             }
         }
     }
     $location = $this->get_return_url($order);
     wp_safe_redirect($location);
     exit;
 }
Beispiel #11
0
 /**
  * Process the payment and return the result
  **/
 function process_payment($order_id)
 {
     $order = new WC_Order($order_id);
     return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(true));
 }
 /** Process Payment
  * @param int $order_id
  * @return array
  */
 function process_payment($order_id)
 {
     global $woocommerce;
     $order = new WC_Order($order_id);
     $this->log->add('pagantis', 'Acceso a la opción de pago con Paga+Tarde ');
     // Return receipt_page redirect
     return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(true));
 }
Beispiel #13
0
 /**
  * Process the payment and return the result
  **/
 function process_payment($order_id)
 {
     $order = new WC_Order($order_id);
     update_post_meta($order_id, '_post_data', $_POST);
     return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(true));
 }
 /**
  * This function is called when user places order with paddle chosen as the payment method
  * Redirect to payment page (handled by receipt_page() method)
  * @param int $order_id
  * @return mixed
  */
 public function process_payment($order_id)
 {
     $order = new WC_Order($order_id);
     if (version_compare(WOOCOMMERCE_VERSION, '2.1', '>=')) {
         return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(true));
     } else {
         return array('result' => 'success', 'redirect' => add_query_arg('order', $order->id, add_query_arg('key', $order->order_key, get_permalink(woocommerce_get_page_id('pay')))));
     }
 }
 public function process_payment($order_id)
 {
     global $woocommerce;
     $order = new WC_Order($order_id);
     return array('result' => 'success', 'redirect' => add_query_arg('key', $order->order_key, add_query_arg('order-pay', $order_id, $order->get_checkout_payment_url(true))));
 }
 function process_payment($orderid)
 {
     global $woocommerce;
     $order = new WC_Order($orderid);
     //WooCommerce Version Check
     if (version_compare(WOOCOMMERCE_VERSION, '2.1.0', '>=')) {
         return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(true), 'order_id' => $order->id, 'order_key' => $order->order_key);
     } else {
         return array('result' => 'success', 'redirect' => add_query_arg('order', $order->id, add_query_arg('key', $order->order_key, get_permalink(get_option('woocommerce_pay_page_id')))), 'order_id' => $order->id, 'order_key' => $order->order_key);
     }
 }
 function process_payment($order_id)
 {
     //global $woocommerce;
     global $woocommerce_ver21_less;
     $order = new WC_Order($order_id);
     if ($woocommerce_ver21_less) {
         $return_array = array('result' => 'success', 'redirect' => add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink(woocommerce_get_page_id('pay')))));
     } else {
         $return_array = array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(TRUE));
     }
     return $return_array;
 }
 /**
  * Handle a failed 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_failed(WC_Order $order, $response)
 {
     if ($response->is_ipn()) {
         status_header(200);
         die;
     } else {
         wp_redirect($order->get_checkout_payment_url($this->use_form_post() && !$this->use_auto_form_post()));
         exit;
     }
 }
Beispiel #19
0
</address></td>
					<td class="order-total"><?php 
        echo woocommerce_price($order->order_total);
        ?>
</td>
					<td class="order-status"><?php 
        $status = get_term_by('slug', $order->status, 'shop_order_status');
        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 
        }
        ?>
 /**
  * Checks if the current request is by a user to change the status of their subscription, and if it is
  * validate the subscription cancellation request and maybe processes the cancellation. 
  * 
  * @since 1.2
  */
 public static function maybe_create_renewal_order_for_user()
 {
     global $woocommerce;
     if (isset($_GET['renew_subscription']) && isset($_GET['_wpnonce'])) {
         $user_id = get_current_user_id();
         $subscription = WC_Subscriptions_Manager::get_users_subscription($user_id, $_GET['renew_subscription']);
         $redirect_to = get_permalink(woocommerce_get_page_id('myaccount'));
         if (wp_verify_nonce($_GET['_wpnonce'], __FILE__) === false) {
             $woocommerce->add_error(__('There was an error with the renewal request. Please try again.', WC_Subscriptions::$text_domain));
         } elseif (empty($subscription)) {
             $woocommerce->add_error(__('That doesn\'t appear to be one of your subscriptions.', WC_Subscriptions::$text_domain));
         } elseif (!self::can_subscription_be_renewed($_GET['renew_subscription'], $user_id)) {
             $woocommerce->add_error(__('That subscription can not be renewed. Please contact us if you need assistance.', WC_Subscriptions::$text_domain));
         } else {
             $order = new WC_Order($subscription['order_id']);
             // Don't email requesting payment when the customer requested the renewal
             remove_action('woocommerce_subscriptions_renewal_order_created', __CLASS__ . '::maybe_send_customer_renewal_order_email', 10, 1);
             $renewal_order_id = self::generate_renewal_order($order, $subscription['product_id']);
             $renewal_order = new WC_Order($renewal_order_id);
             $order->add_order_note(sprintf(__('Subscriber generated renewal order %s', WC_Subscriptions::$text_domain), $renewal_order->get_order_number()));
             $woocommerce->add_message(__('Renew your subscription.', WC_Subscriptions::$text_domain));
             $redirect_to = $renewal_order->get_checkout_payment_url();
         }
         wp_safe_redirect($redirect_to);
         exit;
     }
 }
 /**
  * Process the payment and return the result
  **/
 function process_payment($order_id)
 {
     $order = new WC_Order($order_id);
     /* return array('result' => 'success', 'redirect' => add_query_arg('order',
            $order->id, add_query_arg('key', $order->order_key, get_permalink(get_option('woocommerce_pay_page_id'))))
        );*/
     return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(true));
 }
 public static function check_payment_response()
 {
     if (!empty($_REQUEST['imp_uid'])) {
         //결제승인 결과조회
         require_once WSKL_PATH . '/includes/lib/iamport/iamport.php';
         $imp_uid = $_REQUEST['imp_uid'];
         $rest_key = wskl_get_option('iamport_rest_key');
         $rest_secret = wskl_get_option('iamport_rest_secret');
         $iamport = new Iamport($rest_key, $rest_secret);
         $result = $iamport->findByImpUID($imp_uid);
         if ($result->success) {
             $payment_data = $result->data;
             if (empty($_REQUEST['order_id'])) {
                 //call by iamport notification
                 $order_id = wc_get_order_id_by_order_key($payment_data->merchant_uid);
             } else {
                 $order_id = $_REQUEST['order_id'];
             }
             $order = wc_get_order($order_id);
             update_post_meta($order_id, '_iamport_provider', $payment_data->pg_provider);
             update_post_meta($order_id, '_iamport_paymethod', $payment_data->pay_method);
             update_post_meta($order_id, '_iamport_receipt_url', $payment_data->receipt_url);
             if ($payment_data->status == 'paid') {
                 if ($order->order_total == $payment_data->amount) {
                     if (!$order->has_status(array('processing', 'completed'))) {
                         $order->payment_complete($payment_data->imp_uid);
                         //imp_uid
                         wp_redirect($order->get_checkout_order_received_url());
                         return;
                     }
                 } else {
                     $order->add_order_note('요청하신 결제금액이 다릅니다.');
                     wc_add_notice('요청하신 결제금액이 다릅니다.', 'error');
                 }
             } else {
                 if ($payment_data->status == 'ready') {
                     if ($payment_data->pay_method == 'vbank') {
                         $vbank_name = $payment_data->vbank_name;
                         $vbank_num = $payment_data->vbank_num;
                         $vbank_date = $payment_data->vbank_date;
                         //가상계좌 입금할 계좌정보 기록
                         update_post_meta($order_id, '_iamport_vbank_name', $vbank_name);
                         update_post_meta($order_id, '_iamport_vbank_num', $vbank_num);
                         update_post_meta($order_id, '_iamport_vbank_date', $vbank_date);
                         //가상계좌 입금대기 중
                         $order->update_status('awaiting-vbank', __('가상계좌 입금대기 중', 'iamport'));
                         wp_redirect($order->get_checkout_order_received_url());
                         return;
                     } else {
                         $order->add_order_note('실제 결제가 이루어지지 않았습니다.');
                         wc_add_notice('실제 결제가 이루어지지 않았습니다.', 'error');
                     }
                 } else {
                     if ($payment_data->status == 'failed') {
                         $order->add_order_note('결제요청 승인에 실패하였습니다.');
                         wc_add_notice('결제요청 승인에 실패하였습니다.', 'error');
                     }
                 }
             }
         } else {
             $payment_data =& $result->data;
             if (!empty($_REQUEST['order_id'])) {
                 $order = new WC_Order($_REQUEST['order_id']);
                 $order->update_status('failed');
                 $order->add_order_note('결제승인정보를 받아오지 못했습니다. 관리자에게 문의해주세요' . $payment_data->error['message']);
                 wc_add_notice($payment_data->error['message'], 'error');
                 $redirect_url = $order->get_checkout_payment_url(TRUE);
                 wp_redirect($redirect_url);
             }
         }
     }
 }
 /**
  * Process the payment and return the result
  * */
 function process_payment($order_id)
 {
     $order = new WC_Order($order_id);
     return array('result' => 'success', 'redirect' => add_query_arg('order', $order->id, add_query_arg('key', $order->order_key, $order->get_checkout_payment_url(true))));
 }
Beispiel #24
0
 /**
  * Procesa el pago 
  *
  * @access public
  * @return void
  */
 function process_payment($order_id)
 {
     global $woocommerce;
     $order = new WC_Order($order_id);
     $woocommerce->cart->empty_cart();
     if (version_compare(WOOCOMMERCE_VERSION, '2.0.19', '<=')) {
         return array('result' => 'success', 'redirect' => add_query_arg('order', $order->id, add_query_arg('key', $order->order_key, get_permalink(get_option('woocommerce_pay_page_id')))));
     } else {
         $parameters_args = $this->get_params_post($order_id);
         $payu_args_array = array();
         foreach ($parameters_args as $key => $value) {
             $payu_args_array[] = $key . '=' . $value;
         }
         $params_post = implode('&', $payu_args_array);
         return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(true));
     }
 }
Beispiel #25
0
					<td class="order-date">
						<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-status" style="text-align:left; white-space:nowrap;">
						<?php echo ucfirst( __( $status->name, 'woocommerce' ) ); ?>
					</td>
					<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 );
				?><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>

	</table>
<?php
else :
?>
	<p><?php _e('You have no recent orders.', 'woocommerce'); ?></p>
 /**
  * Process the payment
  *
  * @access public
  * @return void
  * */
 public function process_payment($order_id)
 {
     //create the order object
     $order = new WC_Order($order_id);
     if (isset(WC()->session->token)) {
         unset(WC()->session->paymentId);
         unset(WC()->session->PayerID);
     }
     //redirect to pay
     return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(true));
 }
Beispiel #28
0
 /**
  * Test: get_checkout_payment_url
  */
 function test_get_checkout_payment_url()
 {
     $object = new WC_Order();
     $id = $object->save();
     $this->assertEquals('http://example.org?order-pay=' . $id . '&pay_for_order=true&key=' . $object->get_order_key(), $object->get_checkout_payment_url());
 }
 /**
  * Loads the my-subscriptions.php template on the My Account page.
  *
  * @since 1.0
  */
 public static function get_my_subscriptions_template()
 {
     $subscriptions = WC_Subscriptions_Manager::get_users_subscriptions();
     $user_id = get_current_user_id();
     $all_actions = array();
     foreach ($subscriptions as $subscription_key => $subscription_details) {
         $actions = array();
         if ($subscription_details['status'] == 'trash') {
             unset($subscriptions[$subscription_key]);
             continue;
         }
         $admin_with_suspension_disallowed = current_user_can('manage_woocommerce') && 0 == get_option(WC_Subscriptions_Admin::$option_prefix . '_max_customer_suspensions', 0) ? true : false;
         if (WC_Subscriptions_Manager::can_subscription_be_changed_to('on-hold', $subscription_key, $user_id) && WC_Subscriptions_Manager::current_user_can_suspend_subscription($subscription_key) && !$admin_with_suspension_disallowed) {
             $actions['suspend'] = array('url' => WC_Subscriptions_Manager::get_users_change_status_link($subscription_key, 'on-hold'), 'name' => __('Suspend', 'woocommerce-subscriptions'));
         } elseif (WC_Subscriptions_Manager::can_subscription_be_changed_to('active', $subscription_key, $user_id) && !WC_Subscriptions_Manager::subscription_requires_payment($subscription_key, $user_id)) {
             $actions['reactivate'] = array('url' => WC_Subscriptions_Manager::get_users_change_status_link($subscription_key, 'active'), 'name' => __('Reactivate', 'woocommerce-subscriptions'));
         }
         if (WC_Subscriptions_Renewal_Order::can_subscription_be_renewed($subscription_key, $user_id)) {
             $actions['renew'] = array('url' => WC_Subscriptions_Renewal_Order::get_users_renewal_link($subscription_key), 'name' => __('Renew', 'woocommerce-subscriptions'));
         }
         $renewal_orders = WC_Subscriptions_Renewal_Order::get_renewal_orders($subscription_details['order_id'], 'ID');
         $last_order_id = end($renewal_orders);
         if ($last_order_id) {
             $renewal_order = new WC_Order($last_order_id);
             if (WC_Subscriptions_Manager::can_subscription_be_changed_to('active', $subscription_key, $user_id) && in_array($renewal_order->status, array('pending', 'failed')) && !is_numeric(get_post_meta($renewal_order->id, '_failed_order_replaced_by', true))) {
                 $actions['pay'] = array('url' => $renewal_order->get_checkout_payment_url(), 'name' => __('Pay', 'woocommerce-subscriptions'));
             }
         } else {
             // Check if the master order still needs to be paid
             $order = new WC_Order($subscription_details['order_id']);
             if ('pending' == $order->status && WC_Subscriptions_Manager::can_subscription_be_changed_to('active', $subscription_key, $user_id)) {
                 $actions['pay'] = array('url' => $order->get_checkout_payment_url(), 'name' => __('Pay', 'woocommerce-subscriptions'));
             }
         }
         if (WC_Subscriptions_Manager::can_subscription_be_changed_to('cancelled', $subscription_key, $user_id) && $subscription_details['interval'] != $subscription_details['length']) {
             $actions['cancel'] = array('url' => WC_Subscriptions_Manager::get_users_change_status_link($subscription_key, 'cancelled'), 'name' => __('Cancel', 'woocommerce-subscriptions'));
         }
         $all_actions[$subscription_key] = $actions;
     }
     $all_actions = apply_filters('woocommerce_my_account_my_subscriptions_actions', $all_actions, $subscriptions);
     woocommerce_get_template('myaccount/my-subscriptions.php', array('subscriptions' => $subscriptions, 'actions' => $all_actions, 'user_id' => $user_id), '', plugin_dir_path(__FILE__) . 'templates/');
 }
 function process_payment($order_id)
 {
     $sufijo = "[WEBPAY - PROCESS - PAYMENT]";
     log_me("Iniciando el proceso de pago para {$order_id}", $sufijo);
     $order = new WC_Order($order_id);
     return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url(true));
 }