wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[ljcom] r9986: LJSUP-7428. Charity vgifts shouldn't be ...

Committer: gprochaev
LJSUP-7428. Charity vgifts shouldn't be paid with tokens

U   trunk/cgi-bin/LJ/Pay/Method/Wallet.pm
Modified: trunk/cgi-bin/LJ/Pay/Method/Wallet.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay/Method/Wallet.pm	2011-02-03 06:36:24 UTC (rev 9985)
+++ trunk/cgi-bin/LJ/Pay/Method/Wallet.pm	2011-02-03 09:12:35 UTC (rev 9986)
@@ -31,6 +31,19 @@
 
     my $token_price = $cart->calculate_price * LJ::Pay::Wallet::EXCHANGE_RATE;
 
+    my ($tan_plus, $tan_minus) = (0,0);
+    foreach my $it ($cart->get_items) {
+        if ($it->is_tangible) {
+            if ($it->get_amt >= 0) {
+                $tan_plus += $it->get_amt;
+            } else {
+                $tan_minus += abs($it->get_amt);
+            }
+        }
+    }
+
+    return 0 if $tan_plus > $tan_minus;
+
     return
         LJ::Pay::Wallet->is_user_eligible($remote) &&
         !LJ::Pay::Payment::PayItem::WalletTokens->present_in($cart) &&

Tags: ljcom, pm, wisest-owl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments