There have been several posts about the payment processor being called even when the order total is zero (i.e. the order is fully covered by a gift voucher).
I have had the same problem, and managed finally to fix it tonight. I suspect that the error is different depending on how many payment modules you have installed - I have only one module installed (2checkout), and none of the aforementioned solutions worked for me at all.
The steps I eventually took were:
1. The line:
if ($credit_covers) $payment=''; //ICW added for CREDIT CLASS
in checkout_confirmation.php appeared to be in the wrong place?
In my experience, $credit_covers is always empty because this line appears before the line:
$order_total_modules->pre_confirmation_check();
in which $credit_covers is actually set.
I therefore re-ordered the relevant bits of code in checkout_confirmation.php, that section in my checkout_confirmation.php now looks like this:
require(DIR_WS_CLASSES . 'payment.php');
require(DIR_WS_CLASSES . 'order.php');
//ICW ADDED FOR CREDIT CLASS SYSTEM
require(DIR_WS_CLASSES . 'order_total.php');
$order = new order;
//ICW ADDED FOR CREDIT CLASS SYSTEM
$order_total_modules = new order_total;
//ICW ADDED FOR CREDIT CLASS SYSTEM
$order_total_modules->collect_posts();
//ICW ADDED FOR CREDIT CLASS SYSTEM
$order_total_modules->pre_confirmation_check();
if ($credit_covers) $payment=''; //ICW added for CREDIT CLASS
$payment_modules = new payment($payment);
$payment_modules->update_status();
2. In /includes/classes/payment.php, there is a section of code as follows:
// if there is only one payment method, select it as default because in
// checkout_confirmation.php the $payment variable is being assigned the
// $HTTP_POST_VARS['payment'] value which will be empty (no radio button selection possible)
if ( (tep_count_payment_modules() == 1) && (!isset($GLOBALS[$payment]) || (isset($GLOBALS[$payment]) && !is_object($GLOBALS[$payment]))) ) {
$payment = $include_modules[0]['class'];
}
What this does is if you only have one payment module, and the $payment variable has been set to '' in checkout_confirmation.php because your order is covered by credit, this line goes and sets it back again to your default payment module .... grrrr! So I changed it to this:
// if there is only one payment method, select it as default because in
// checkout_confirmation.php the $payment variable is being assigned the
// $HTTP_POST_VARS['payment'] value which will be empty (no radio button selection possible)
if ( (!$credit_covers) && (tep_count_payment_modules() == 1) && (!isset($GLOBALS[$payment]) || (isset($GLOBALS[$payment]) && !is_object($GLOBALS[$payment]))) ) {
$payment = $include_modules[0]['class'];
}
I hope this helps somebody in the same predicament :)