You are here

function commerce_paypal_wps_redirect_form_validate in Commerce PayPal 7.2

Same name and namespace in other branches
  1. 7 modules/wps/commerce_paypal_wps.module \commerce_paypal_wps_redirect_form_validate()

Payment method callback: redirect form return validation.

File

modules/wps/commerce_paypal_wps.module, line 210
Implements PayPal Website Payments Standard in Drupal Commerce checkout.

Code

function commerce_paypal_wps_redirect_form_validate($order, $payment_method) {
  if (!empty($payment_method['settings']['ipn_logging']) && $payment_method['settings']['ipn_logging'] == 'full_ipn') {
    watchdog('commerce_paypal_wps', 'Customer returned from PayPal with the following POST data:!ipn_data', array(
      '!ipn_data' => '<pre>' . check_plain(print_r($_POST, TRUE)) . '</pre>',
    ), WATCHDOG_NOTICE);
  }

  // This may be an unnecessary step, but if for some reason the user does end
  // up returning at the success URL with a Failed payment, go back.
  if (!empty($_POST['payment_status']) && $_POST['payment_status'] == 'Failed') {
    return FALSE;
  }
}