JBAS-1544 Payflow xact balance comparison repair
authorBill Erickson <berickxx@gmail.com>
Wed, 21 Sep 2016 20:04:05 +0000 (16:04 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm

index 24a8294..b756974 100644 (file)
@@ -2038,8 +2038,14 @@ sub payflow_create_payment {
     my $cur_total = $U->fpsum(@xact_balances); # current balance of selected.
     my $paid_total = $tokens->{AMT}; # original paypal payment amount
 
-    if ($paid_total != $cur_total) {
-        my @xacts = $tokens->{xacts};
+    # Using != resulted in some numbers that (according to the logs) were
+    # the same number behaving as if they weren't.  More decimal weirdness?
+    # Treat the values as strings instead.
+    $cur_total = sprintf("%.2f", $cur_total);
+    $paid_total = sprintf("%.2f", $paid_total);
+
+    if ($paid_total ne $cur_total) {
+        my @xacts = @{$tokens->{xacts}};
 
         $logger->error("PayflowHosted requested payment amount of ".
             "$paid_total does not match total balance owed ($cur_total) of ".