You are here

function commerce_payment_redirect_pane_next_page in Commerce Core 7

Moves an order ahead to the next page via an order update and redirect.

Redirected payment methods are responsible for calling this method when receiving external notifications of successful payment.

Parameters

$order: An order object.

$log: Optional log message to use when updating the order status in conjunction with the redirect to the next checkout page.

2 calls to commerce_payment_redirect_pane_next_page()
commerce_payment_redirect_pane_checkout_form in modules/payment/includes/commerce_payment.checkout_pane.inc
Payment redirect pane: form callback.
commerce_payment_rules_redirect_pane_next_page in modules/payment/commerce_payment.rules.inc
Implements Rules action execution callback.

File

modules/payment/commerce_payment.module, line 332
Defines the payment system and checkout integration.

Code

function commerce_payment_redirect_pane_next_page($order, $log = '') {

  // Load the order status object for the current order.
  $order_status = commerce_order_status_load($order->status);
  if ($order_status['state'] == 'checkout' && $order_status['checkout_page'] == 'payment') {
    $payment_page = commerce_checkout_page_load($order_status['checkout_page']);
    $next_page = $payment_page['next_page'];
    $order = commerce_order_status_update($order, 'checkout_' . $next_page, FALSE, NULL, $log);

    // Inform modules of checkout completion if the next page is Completed.
    if ($next_page == 'complete') {
      commerce_checkout_complete($order);
    }
  }
}