You are here

function commerce_worldpay_bg_redirect_form_validate in Commerce Worldpay 7

Implements hook_redirect_form_validate

This fires when the user is sent back to our site. E.g. 'checkout/' . $order->order_id . '/payment/return/'

File

./commerce_worldpay_bg.module, line 830
Provides a Worldpay Business Gateway payment method for Drupal Commerce.

Code

function commerce_worldpay_bg_redirect_form_validate($order, $payment_method) {
  if (!empty($payment_method['settings']['payment_response_logging']) && $payment_method['settings']['payment_response_logging'] == 'full_wppr') {
    watchdog('commerce_worldpay_bg', 'Customer returned from WorldPay with the following POST data:<pre>' . check_plain(print_r($_POST, TRUE)) . '</pre>', array(), 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['transStatus']) && $_POST['transStatus'] == 'C') {
    return FALSE;
  }
}