From 52294139a082f00a739b4b889ead0ce072bb4f7c Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 19 May 2011 08:58:44 -0700 Subject: [PATCH] -0.00 ne 0.00. Handle both cases of ~0 when checking out to intercept and finish the transaction immediately. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Shop/Cart.pm | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 9b77c4210..28f4e994a 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,4 +1,5 @@ 7.10.17 + - fixed: Forced to use a PayDriver even with a balance of 0 in the cart. 7.10.16 - fixed #12121: typ-o Asset_Map.templateIdEditPoint diff --git a/lib/WebGUI/Shop/Cart.pm b/lib/WebGUI/Shop/Cart.pm index 9a16ae3ef..62cb80878 100644 --- a/lib/WebGUI/Shop/Cart.pm +++ b/lib/WebGUI/Shop/Cart.pm @@ -925,7 +925,7 @@ sub www_checkout { my $total = $self->calculateTotal; ##Handle rounding errors, and checkout immediately if the amount is 0 since ##at least the ITransact driver won't accept $0 checkout. - if (sprintf('%.2f', $total + $self->calculateShopCreditDeduction($total)) eq '0.00') { + if (sprintf('%.2f', abs($total + $self->calculateShopCreditDeduction($total))) eq '0.00') { my $transaction = WebGUI::Shop::Transaction->create($session, {cart => $self}); $transaction->completePurchase('zero', 'success', 'success'); $self->onCompletePurchase;