You are here

function commerce_paypal_ec_redirect_form_back in Commerce PayPal 7.2

Payment method callback: redirect form back callback.

File

modules/ec/commerce_paypal_ec.module, line 728
Implements PayPal Express Checkout in Drupal Commerce checkout.

Code

function commerce_paypal_ec_redirect_form_back($order, $payment_method) {

  // Display a message indicating the customer initiatied cancellation.
  drupal_set_message(t('You have canceled checkout at PayPal but may resume the checkout process here when you are ready.'));

  // Remove the payment information from the order data array.
  $flow = $order->data['commerce_paypal_ec']['flow'];
  unset($order->data['commerce_paypal_ec']);
  unset($order->data['payment_method']);

  // If the customer initially redirected to PayPal from the cart form...
  if ($flow == 'ec') {

    // Send them back to the shopping cart page instead of the previous page in
    // the checkout process.
    commerce_order_status_update($order, 'cart', FALSE, NULL, t('Customer canceled Express Checkout at PayPal.'));
    drupal_goto('cart');
  }
}