Fix small number handling in the Shop. Fixes bug #11195

Format the number to be checked against 0.00 in Shop/Pay.pm, since sometimes perl
will leave small remainders when subtracting numbers.
This commit is contained in:
Colin Kuskie 2009-11-03 09:24:48 -08:00
parent 1eeb76e96f
commit d8526028ab
2 changed files with 2 additions and 1 deletions

View file

@ -409,7 +409,7 @@ sub www_selectPaymentGateway {
# Complete Transaction if it's a $0 transaction.
my $total = $cart->calculateTotal;
if (($total + $cart->calculateShopCreditDeduction($total)) == 0) {
if (sprintf('%.2f', $total + $cart->calculateShopCreditDeduction($total)) eq '0.00') {
my $transaction = WebGUI::Shop::Transaction->create($session, {cart => $cart});
$transaction->completePurchase('zero', 'success', 'success');
$cart->onCompletePurchase;