changelog_bot (changelog_bot) wrote in changelog,
changelog_bot
changelog_bot
changelog

[ljcom] r7576: LJSUP-4585

Committer: gproschaev
LJSUP-4585


U   branches/shop/cgi-bin/LJ/Hooks/Underage.pm
U   branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon.pm
U   branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/PaidAccount.pm
U   branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Permanent.pm
U   branches/shop/cgi-bin/LJ/Pay/Payment.pm
U   branches/shop/cgi-bin/paylib_cart.pl
U   branches/shop/htdocs/pay/checkout.bml
U   branches/shop/htdocs/pay/index.bml
U   branches/shop/htdocs/pay/modify.bml
U   branches/shop/htdocs/shop/index.bml
U   branches/shop/htdocs/shop/view.bml
U   branches/shop/ssldocs/pay/cc.bml
U   branches/shop/ssldocs/pay/ccpay.bml
Modified: branches/shop/cgi-bin/LJ/Hooks/Underage.pm
===================================================================
--- branches/shop/cgi-bin/LJ/Hooks/Underage.pm	2009-08-18 09:27:49 UTC (rev 7575)
+++ branches/shop/cgi-bin/LJ/Hooks/Underage.pm	2009-08-18 10:34:25 UTC (rev 7576)
@@ -32,7 +32,7 @@
         });
 
         $cartobj->save;
-        LJ::Pay::payvar_append($cartobj, "creator_ip", LJ::get_remote_ip());
+        $cartobj->payvar_append("creator_ip", LJ::get_remote_ip());
         my $c = $cartobj->{payid} . "-" . $cartobj->{anum};
         my $extra = $u->underage_status eq 'O' ? '&o=1' : '';
         $$redir = "$LJ::SITEROOT/agecheck/?c=$c$extra";

Modified: branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon.pm
===================================================================
--- branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon.pm	2009-08-18 09:27:49 UTC (rev 7575)
+++ branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon.pm	2009-08-18 10:34:25 UTC (rev 7576)
@@ -532,9 +532,8 @@
 
     # if an error, log to payvars (call above also logged to statushistory) and skip the email
     unless ($res) {
-        LJ::Pay::payvar_append($pp, "error",
-                               "[" . LJ::mysql_time() . "] unable to apply: item=$pi->{'item'},  size=" .
-                               (split("-", $pi->{'subitem'}))[0] . ", qty=$pi->{'qty'}. invalid cart?");
+        $payment->payvar_append("error", "[" . LJ::mysql_time() . "] unable to apply: item=$self->{'item'},  size=" .
+                               (split("-", $self->{'subitem'}))[0] . ", qty=$self->{'qty'}. invalid cart?");
 
         # if there was a failure, all bonus items of this type were marked
         # as failed, so we shouldn't try to process any more of them

Modified: branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/PaidAccount.pm
===================================================================
--- branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/PaidAccount.pm	2009-08-18 09:27:49 UTC (rev 7575)
+++ branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/PaidAccount.pm	2009-08-18 10:34:25 UTC (rev 7576)
@@ -297,8 +297,7 @@
 
     # some sort of error occurred, log to payvars and try again later
     unless ($res) {
-        LJ::Pay::payvar_append($payment, "error",
-                               "[" . LJ::mysql_time() . "] unable to apply: item=$self->{'item'}, qty=$self->{'qty'}.");
+        $payment->payvar_append("error", "[" . LJ::mysql_time() . "] unable to apply: item=$self->{'item'}, qty=$self->{'qty'}.");
         return (0, undef, undef);
     }
 

Modified: branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Permanent.pm
===================================================================
--- branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Permanent.pm	2009-08-18 09:27:49 UTC (rev 7575)
+++ branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Permanent.pm	2009-08-18 10:34:25 UTC (rev 7576)
@@ -136,8 +136,7 @@
 
     # some sort of error occurred, log to payvars and try again later
     unless ($res) {
-        LJ::Pay::payvar_append($payment, "error",
-                               "[" . LJ::mysql_time() . "] unable to apply: item=$self->{'item'}, qty=$self->{'qty'}.")
+        $payment->payvar_append("error", "[" . LJ::mysql_time() . "] unable to apply: item=$self->{'item'}, qty=$self->{'qty'}.")
             if $payment; # $payment may be undef
         return (0, undef, undef);
     }

Modified: branches/shop/cgi-bin/LJ/Pay/Payment.pm
===================================================================
--- branches/shop/cgi-bin/LJ/Pay/Payment.pm	2009-08-18 09:27:49 UTC (rev 7575)
+++ branches/shop/cgi-bin/LJ/Pay/Payment.pm	2009-08-18 10:34:25 UTC (rev 7576)
@@ -171,13 +171,6 @@
     return $self;
 }
 
-sub cart_contains_coppa {
-    my $self = shift;
-    return 0 unless $self;
-    return $self->contains_coppa;
-}
-
-
 # attempt to find a duplicate payment based on state of payments and payitems rows
 # returns a payment object if a dup is found, otherwise returns 0 on success with no
 # dup found, and undef on error (with $@ set)
@@ -817,12 +810,6 @@
     return 1;
 }
 
-sub cart_needs_shipping {
-    my $self = shift;
-    return 0 unless $self;
-    return $self->needs_shipping;
-}
-
 sub contains_coppa {
     my LJ::Pay::Payment $self = shift
         or return _err("invalid arguments");

Modified: branches/shop/cgi-bin/paylib_cart.pl
===================================================================
--- branches/shop/cgi-bin/paylib_cart.pl	2009-08-18 09:27:49 UTC (rev 7575)
+++ branches/shop/cgi-bin/paylib_cart.pl	2009-08-18 10:34:25 UTC (rev 7576)
@@ -28,32 +28,11 @@
           )
         or return undef;
 
-    LJ::Pay::payvar_append($cartobj, "creator_ip", LJ::get_remote_ip());
+    $cartobj->payvar_append("creator_ip", LJ::get_remote_ip());
 
     return $cartobj;
 }
 
-sub LJ::Pay::payvar_add {
-    my $cartobj = shift;
-    return undef unless $cartobj;
-
-    return $cartobj->payvar_add(@_);
-}
-
-sub LJ::Pay::payvar_append {
-    my $cartobj = shift;
-    return undef unless $cartobj;
-
-    return $cartobj->payvar_append(@_);
-}
-
-sub LJ::Pay::payvar_set {
-    my $cartobj = shift;
-    return undef unless $cartobj;
-
-    return $cartobj->payvar_append(@_);
-}
-
 sub LJ::Pay::user_has_used_method {
     my ($u, $method) = @_;
     croak "invalid user: $u" unless LJ::isu($u);
@@ -97,49 +76,6 @@
     return $it;
 }
 
-sub LJ::Pay::remove_cart_items {
-    my $cartobj = shift;
-    my @items = @_;
-    return 0 unless $cartobj;
-    return 1 unless @items;
-
-    return $cartobj->remove_items(@items);
-}
-
-sub LJ::Pay::update_shipping_cost {
-    my ($cartobj, $country) = @_;
-    return 0 unless $cartobj;
-
-    return $cartobj->update_shipping_cost;
-}
-
-# see LJ::Pay::Payment::coupon_reduce for notes
-# on what is returned from this function
-sub LJ::Pay::coupon_reduce {
-    my $cartobj = shift;
-    return undef unless $cartobj;
-
-    return $cartobj->coupon_reduce;
-}
-
-sub LJ::Pay::update_cart_total {
-    my $cartobj = shift;
-    return 0 unless $cartobj;
-    return $cartobj->update_total;
-}
-
-sub LJ::Pay::can_mod_cart {
-    my $cartobj = shift;
-    return 0 unless $cartobj;
-    return $cartobj->can_modify;
-}
-
-sub LJ::Pay::can_checkout_cart {
-    my $cartobj = shift;
-    return 0 unless $cartobj;
-    return $cartobj->can_checkout;
-}
-
 sub LJ::Pay::reserve_items {
     my $cartobj = shift;
     my $out_list = shift;  # listref to push out of stock product names onto
@@ -239,7 +175,7 @@
     my $ret = shift;
     my $opts = shift;
     my $remote = LJ::get_remote();
-    my $has_coppa = $cartobj->cart_contains_coppa;
+    my $has_coppa = $cartobj->contains_coppa;
 
     $$ret .= <<HDR;
 <table width='95%' cellpadding='2' style='border-collapse: collapse'>
@@ -342,7 +278,7 @@
     $$ret .= " </td>";
 
     # analyze various amounts in this cart
-    my $amts = LJ::Pay::coupon_reduce($cartobj);
+    my $amts = $cartobj->coupon_reduce;
 
     my $tot = 0;
     $tot += $_->{amt} foreach @{$cartobj ? $cartobj->{items} : []};
@@ -372,7 +308,7 @@
         $$ret .= "<td align='right'>" . $damt->($amts->{'adj_amt_tot'}) . "</td></tr>";
     }
 
-    if ($opts->{'remove'} || ($opts->{'checkout'} && LJ::Pay::can_checkout_cart($cartobj))) {
+    if ($opts->{'remove'} || ($opts->{'checkout'} && $cartobj->can_checkout)) {
 
         # warning if the current amount is under the minimal threshold for mail payments
         if ($LJ::PAY_MIN_MAIL_PAYMENT > 0 &&
@@ -441,8 +377,8 @@
         $$ret .= "</td>";
 
         $$ret .= "<td colspan='2' align='right'>";
-        if ($opts->{'checkout'} && LJ::Pay::can_checkout_cart($cartobj)) {
-            if ($amts->{'adj_amt_tot'} > 0 || $has_coppa || $cartobj->cart_needs_shipping) {
+        if ($opts->{'checkout'} && $cartobj->can_checkout) {
+            if ($amts->{'adj_amt_tot'} > 0 || $has_coppa || $cartobj->needs_shipping) {
                 $$ret .= LJ::Lang::ml('pay.cart.paymentmethod') . " ";
 
                 my @pay_list_fast = (cc => LJ::Lang::ml('pay.cart.paymentmethod.cc'));

Modified: branches/shop/htdocs/pay/checkout.bml
===================================================================
--- branches/shop/htdocs/pay/checkout.bml	2009-08-18 09:27:49 UTC (rev 7575)
+++ branches/shop/htdocs/pay/checkout.bml	2009-08-18 10:34:25 UTC (rev 7576)
@@ -43,7 +43,7 @@
         $ret .= "</ul>";
 
         $ret .= "<p>";
-        if ($cartobj->cart_needs_shipping) {
+        if ($cartobj->needs_shipping) {
             $ret .= "$ML{'.haveaddress'} ";
         }
 

Modified: branches/shop/htdocs/pay/index.bml
===================================================================
--- branches/shop/htdocs/pay/index.bml	2009-08-18 09:27:49 UTC (rev 7575)
+++ branches/shop/htdocs/pay/index.bml	2009-08-18 10:34:25 UTC (rev 7576)
@@ -59,7 +59,7 @@
 
     # don't let them modify the cart if they've already started
     # any sort of checkout process
-    my $can_mod = ! $cartobj || LJ::Pay::can_mod_cart($cartobj);
+    my $can_mod = ! $cartobj || $cartobj->can_modify;
 
     # see if cart's dead, c=new requested, or already checked out
     if (! $cartobj && $cart || $GET{'c'} eq "new") {
@@ -106,7 +106,7 @@
         return $ret;
     }
 
-    if ($cartobj->cart_needs_shipping) {
+    if ($cartobj->needs_shipping) {
         $ret .= "<?h1 $ML{'.returnpolicy.header'} h1?><?p " . BML::ml('.returnpolicy.text', {'aopts' => "href='$LJ::SITEROOT/shop/sizechart.bml'"}) . " p?>";
     }
 

Modified: branches/shop/htdocs/pay/modify.bml
===================================================================
--- branches/shop/htdocs/pay/modify.bml	2009-08-18 09:27:49 UTC (rev 7575)
+++ branches/shop/htdocs/pay/modify.bml	2009-08-18 10:34:25 UTC (rev 7576)
@@ -185,7 +185,7 @@
             }
         }
 
-        LJ::Pay::remove_cart_items($cartobj, @remove);
+        $cartobj->remove_items(@remove);
 
         if (%extra_remove) {
             # body was filled in above
@@ -218,8 +218,8 @@
         }
 
         return $err->($ML{'.error.invalidpaymentmethodforage'}) if
-            $POST{'paymeth'} ne 'cc' && $cartobj->cart_contains_coppa;
-        $POST{'paymeth'} = "free" if $cartobj->{'amount'} == 0 && ! $cartobj->cart_needs_shipping && ! $cartobj->cart_contains_coppa;
+            $POST{'paymeth'} ne 'cc' && $cartobj->contains_coppa;
+        $POST{'paymeth'} = "free" if $cartobj->{'amount'} == 0 && ! $cartobj->needs_shipping && ! $cartobj->contains_coppa;
 
         if ($cartobj->{userid} && $remote && $remote->underage &&
             ! scalar grep { $_->{item} eq 'coppa' } @{$cartobj->{items}}) {
@@ -257,7 +257,7 @@
             return;
         }
 
-        my $needs_shipping = $cartobj->cart_needs_shipping;
+        my $needs_shipping = $cartobj->needs_shipping;
 
         # some payment methods are invalid for shipping
         if ($needs_shipping) {
@@ -385,7 +385,7 @@
                 foreach my $v (qw(name addr1 addr2 city state zip country)) {
                     my $k = "ship_$v";
                     if ($POST{$k} ne $payvar{$k}) {
-                        LJ::Pay::payvar_set($cartobj, $k, $POST{$k});
+                        $cartobj->payvar_set($k, $POST{$k});
                     }
                 }
 
@@ -424,7 +424,7 @@
                     return $err->($ML{'.error.nointernationalshipping'});
                 }
 
-                LJ::Pay::update_shipping_cost($cartobj, $POST{'ship_country'});
+                $cartobj->update_shipping_cost($POST{'ship_country'});
 
             } else {
 
@@ -491,11 +491,11 @@
 
         # for debugging, log the browser
         my $ua = BML::get_client_header("User-Agent");
-        LJ::Pay::payvar_add($cartobj, "browser", $ua) if $ua;
+        $cartobj->payvar_add("browser", $ua) if $ua;
 
         # log uniq
         my $uniq = $r->notes('uniq');
-        LJ::Pay::payvar_add($cartobj, "uniq", LJ::mysql_time() . " - $uniq") if $uniq;
+        $cartobj->payvar_add("uniq", LJ::mysql_time() . " - $uniq") if $uniq;
 
         if ($POST{'paymeth'} eq "cash") {
             $title = $ML{'.cashwarning.title'};

Modified: branches/shop/htdocs/shop/index.bml
===================================================================
--- branches/shop/htdocs/shop/index.bml	2009-08-18 09:27:49 UTC (rev 7575)
+++ branches/shop/htdocs/shop/index.bml	2009-08-18 10:34:25 UTC (rev 7576)
@@ -34,7 +34,7 @@
     # now load remote and $cartobj
     $remote = LJ::get_remote();
     $cartobj = LJ::Pay::load_cart($cart);
-    $can_mod = ! $cartobj || LJ::Pay::can_mod_cart($cartobj);
+    $can_mod = ! $cartobj || $cartobj->can_modify;
 
     # see if cart's dead, c=new requested, or already checked out
     if (! $cartobj && $cart || $GET{'c'} eq "new" || !$can_mod) {

Modified: branches/shop/htdocs/shop/view.bml
===================================================================
--- branches/shop/htdocs/shop/view.bml	2009-08-18 09:27:49 UTC (rev 7575)
+++ branches/shop/htdocs/shop/view.bml	2009-08-18 10:34:25 UTC (rev 7576)
@@ -19,7 +19,7 @@
     # now load $remote and $cartobj
     $remote = LJ::get_remote();
     $cartobj = LJ::Pay::load_cart($cart);
-    $can_mod = ! $cartobj || LJ::Pay::can_mod_cart($cartobj);
+    $can_mod = ! $cartobj || $cartobj->can_modify;
 
     # see if cart's dead, c=new requested, or already checked out
     if (! $cartobj && $cart || $GET{'c'} eq "new" || !$can_mod) {

Modified: branches/shop/ssldocs/pay/cc.bml
===================================================================
--- branches/shop/ssldocs/pay/cc.bml	2009-08-18 09:27:49 UTC (rev 7575)
+++ branches/shop/ssldocs/pay/cc.bml	2009-08-18 10:34:25 UTC (rev 7576)
@@ -18,8 +18,8 @@
     my $cartobj = LJ::Pay::load_cart($cart);
     return BML::redirect("$LJ::SITEROOT/pay/") unless $cartobj;
 
-    my $needs_shipping = $cartobj->cart_needs_shipping;
-    my $has_coppa      = $cartobj->cart_contains_coppa;
+    my $needs_shipping = $cartobj->needs_shipping;
+    my $has_coppa      = $cartobj->contains_coppa;
 
     $title = $has_coppa ? $ML{'.coppa.title'} : $ML{'.title'};
 
@@ -296,8 +296,8 @@
         # if there is no userid, then we know it's clean because we checked
         # each individual item for email blocks when they were added to the cart
         
-        my $has_coppa      = $cartobj->cart_contains_coppa;
-        my $needs_shipping = $cartobj->cart_needs_shipping;
+        my $has_coppa      = $cartobj->contains_coppa;
+        my $needs_shipping = $cartobj->needs_shipping;
         
         # coppa requires remote
         if ($has_coppa && ! $remote) {
@@ -322,7 +322,7 @@
         
         my $country = LJ::LJcom::country_of_ip($remote_ip);
         my $now = LJ::mysql_time(time());
-        LJ::Pay::payvar_add($cartobj, "geoip-country", "$now: country=$country ($remote_ip)");
+        $cartobj->payvar_add("geoip-country", "$now: country=$country ($remote_ip)");
         
         # attempt to gather and store user's country/state
         if ($POST{country}) {
@@ -363,8 +363,7 @@
             }
             
             # otherwise we've decided to allow this user, log
-            LJ::Pay::payvar_add($cartobj, "allow_pay", 
-                                "$now: cc=$POST{'country'}, actual=$country, user=$u->{'user'} (allowed)");
+            $cartobj->payvar_add("allow_pay", "$now: cc=$POST{'country'}, actual=$country, user=$u->{'user'} (allowed)");
         }
         
         # throw an error if they didn't provide a parent's email
@@ -492,7 +491,7 @@
 
         # blocked credit card?
         $cardnum =~ /^(\d\d\d\d).*(\d\d\d\d)$/;
-        LJ::Pay::payvar_add($cartobj, "cc_sig", "$1-$2");
+        $cartobj->payvar_add("cc_sig", "$1-$2");
         if (LJ::sysban_check('pay_cc', "$1-$2")) {
 
             my $vars = { 'cart' => $cart };
@@ -669,7 +668,7 @@
 
         foreach (keys %payvars) {
             next unless $payvars{$_};
-            LJ::Pay::payvar_add($cartobj, $_, $payvars{$_});
+            $cartobj->payvar_add($_, $payvars{$_});
         }
 
         if ($err) {

Modified: branches/shop/ssldocs/pay/ccpay.bml
===================================================================
--- branches/shop/ssldocs/pay/ccpay.bml	2009-08-18 09:27:49 UTC (rev 7575)
+++ branches/shop/ssldocs/pay/ccpay.bml	2009-08-18 10:34:25 UTC (rev 7576)
@@ -191,8 +191,8 @@
     # if there is no userid, then we know it's clean because we checked
     # each individual item for email blocks when they were added to the cart
 
-    my $has_coppa      = $cartobj->cart_contains_coppa;
-    my $needs_shipping = $cartobj->cart_needs_shipping;
+    my $has_coppa      = $cartobj->contains_coppa;
+    my $needs_shipping = $cartobj->needs_shipping;
 
     # coppa requires remote
     if ($has_coppa && ! $remote) {
@@ -217,7 +217,7 @@
 
     my $country = LJ::LJcom::country_of_ip($remote_ip);
     my $now = LJ::mysql_time(time());
-    LJ::Pay::payvar_add($cartobj->{'payid'}, "geoip-country", "$now: country=$country ($remote_ip)");
+    $cartobj->payvar_add("geoip-country", "$now: country=$country ($remote_ip)");
 
     # attempt to gather and store user's country/state
     if ($POST{bill_country}) {
@@ -249,8 +249,7 @@
         }
 
         # otherwise we've decided to allow this user, log
-        LJ::Pay::payvar_add($cartobj->{'payid'}, "allow_pay", 
-                            "$now: cc=$POST{'bill_country'}, actual=$country, user=$u->{'user'} (allowed)");
+        $cartobj->payvar_add("allow_pay", "$now: cc=$POST{'bill_country'}, actual=$country, user=$u->{'user'} (allowed)");
     }
 
     # throw an error if they didn't provide a parent's email
@@ -556,7 +555,7 @@
     # save payvars in db now
     foreach (keys %payvars) {
         next unless $payvars{$_};
-        LJ::Pay::payvar_add($cartobj->{'payid'}, $_, $payvars{$_});
+        $cartobj->payvar_add($_, $payvars{$_});
     }
 
     # if a failure, note in ccfail table and possibly notify admins

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