function commerce_paypal_ec_commerce_checkout_router in Commerce PayPal 7.2
Implements hook_commerce_checkout_router().
File
- modules/
ec/ commerce_paypal_ec.module, line 173 - Implements PayPal Express Checkout in Drupal Commerce checkout.
Code
function commerce_paypal_ec_commerce_checkout_router($order, $checkout_page) {
// If the current page is the Express Checkout page but the current order did
// not use the Express Checkout flow...
if ($checkout_page['page_id'] == 'paypal_ec' && (empty($order->data['commerce_paypal_ec']['flow']) || $order->data['commerce_paypal_ec']['flow'] != 'ec')) {
// Update the order status to the next checkout page.
$next_page = $checkout_page['next_page'];
$order = commerce_order_status_update($order, 'checkout_' . $next_page, FALSE, FALSE);
// Inform modules of checkout completion if the next page is Completed.
if ($next_page == 'complete') {
commerce_checkout_complete($order);
}
// Redirect to the URL for the new checkout page.
$target_uri = commerce_checkout_order_uri($order);
return drupal_goto($target_uri);
}
}