You are here

function commerce_payment_redirect_pane_previous_page in Commerce Core 7

Moves an order back to the previous page via an order update and redirect.

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

Parameters

$order: An order object.

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

2 calls to commerce_payment_redirect_pane_previous_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_previous_page in modules/payment/commerce_payment.rules.inc
Implements Rules action execution callback.

File

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

Code

function commerce_payment_redirect_pane_previous_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']);
    $prev_page = $payment_page['prev_page'];
    $order = commerce_order_status_update($order, 'checkout_' . $prev_page, FALSE, NULL, $log);
  }
}