changelog_bot (changelog_bot) wrote in changelog,
changelog_bot
changelog_bot
changelog

[ljcom] r7561: LJSUP-4585

Committer: gproschaev
LJSUP-4585


U   branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon/Boolean.pm
U   branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon/Sized.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/ssldocs/pay/cc.bml
U   branches/shop/ssldocs/pay/ccpay.bml
Modified: branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon/Boolean.pm
===================================================================
--- branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon/Boolean.pm	2009-08-11 07:58:38 UTC (rev 7560)
+++ branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon/Boolean.pm	2009-08-11 11:04:36 UTC (rev 7561)
@@ -10,6 +10,7 @@
 sub is_valid_bool_bonus {
     my $self = shift;
     my ($item, $qty) = ($self->{item}, $self->{qty});
+    my $is_rec = shift;
 
     # allow passing of an $it hash
     if (ref $item) {
@@ -21,7 +22,7 @@
     return 0 unless ref $itrec;
     return 0 unless $itrec->{type} eq 'bool';
     return 0 unless ref $itrec->{items}->{$qty};
-    return 0 unless defined $itrec->{items}->{$qty}->{'amount_rec'};
+    return 0 unless defined $itrec->{items}->{$qty}->{$is_rec ? 'amount_rec' : 'amount'};
     return 1;
 }
 
@@ -111,7 +112,7 @@
     my $self = shift;
     my %opts = @_;
     
-    return undef unless $self->is_valid_bool_bonus;
+    return undef unless $self->is_valid_bool_bonus(1);
     return $LJ::Pay::Payment::PayItem::Addon::bonus{$self->{item}}->{items}->{$self->{qty}}->{'amount_rec'};
 }
 

Modified: branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon/Sized.pm
===================================================================
--- branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon/Sized.pm	2009-08-11 07:58:38 UTC (rev 7560)
+++ branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon/Sized.pm	2009-08-11 11:04:36 UTC (rev 7561)
@@ -125,7 +125,7 @@
 sub is_valid_sized_bonus {
     my $self = shift;
     my ($size, $qty) = ($self->{subitem}, $self->{qty});
-    my $is_rec = shift || 1;
+    my $is_rec = shift;
 
     # allow passing of an $it hash
     if (ref $item) {

Modified: branches/shop/cgi-bin/LJ/Pay/Payment.pm
===================================================================
--- branches/shop/cgi-bin/LJ/Pay/Payment.pm	2009-08-11 07:58:38 UTC (rev 7560)
+++ branches/shop/cgi-bin/LJ/Pay/Payment.pm	2009-08-11 11:04:36 UTC (rev 7561)
@@ -171,6 +171,13 @@
     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)
@@ -810,6 +817,12 @@
     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-11 07:58:38 UTC (rev 7560)
+++ branches/shop/cgi-bin/paylib_cart.pl	2009-08-11 11:04:36 UTC (rev 7561)
@@ -140,18 +140,6 @@
     return $cartobj->can_checkout;
 }
 
-sub LJ::Pay::cart_contains_coppa {
-    my $cartobj = shift;
-    return 0 unless $cartobj;
-    return $cartobj->contains_coppa;
-}
-
-sub LJ::Pay::cart_needs_shipping {
-    my $cartobj = shift;
-    return 0 unless $cartobj;
-    return $cartobj->needs_shipping;
-}
-
 sub LJ::Pay::reserve_items {
     my $cartobj = shift;
     my $out_list = shift;  # listref to push out of stock product names onto
@@ -251,7 +239,7 @@
     my $ret = shift;
     my $opts = shift;
     my $remote = LJ::get_remote();
-    my $has_coppa = LJ::Pay::cart_contains_coppa($cartobj);
+    my $has_coppa = $cartobj->cart_contains_coppa;
 
     $$ret .= <<HDR;
 <table width='95%' cellpadding='2' style='border-collapse: collapse'>
@@ -454,7 +442,7 @@
 
         $$ret .= "<td colspan='2' align='right'>";
         if ($opts->{'checkout'} && LJ::Pay::can_checkout_cart($cartobj)) {
-            if ($amts->{'adj_amt_tot'} > 0 || $has_coppa || LJ::Pay::cart_needs_shipping($cartobj)) {
+            if ($amts->{'adj_amt_tot'} > 0 || $has_coppa || $cartobj->cart_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-11 07:58:38 UTC (rev 7560)
+++ branches/shop/htdocs/pay/checkout.bml	2009-08-11 11:04:36 UTC (rev 7561)
@@ -43,7 +43,7 @@
         $ret .= "</ul>";
 
         $ret .= "<p>";
-        if (LJ::Pay::cart_needs_shipping($cartobj)) {
+        if ($cartobj->cart_needs_shipping) {
             $ret .= "$ML{'.haveaddress'} ";
         }
 

Modified: branches/shop/htdocs/pay/index.bml
===================================================================
--- branches/shop/htdocs/pay/index.bml	2009-08-11 07:58:38 UTC (rev 7560)
+++ branches/shop/htdocs/pay/index.bml	2009-08-11 11:04:36 UTC (rev 7561)
@@ -106,7 +106,7 @@
         return $ret;
     }
 
-    if (LJ::Pay::cart_needs_shipping($cartobj)) {
+    if ($cartobj->cart_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-11 07:58:38 UTC (rev 7560)
+++ branches/shop/htdocs/pay/modify.bml	2009-08-11 11:04:36 UTC (rev 7561)
@@ -218,8 +218,8 @@
         }
 
         return $err->($ML{'.error.invalidpaymentmethodforage'}) if
-            $POST{'paymeth'} ne 'cc' && LJ::Pay::cart_contains_coppa($cartobj);
-        $POST{'paymeth'} = "free" if $cartobj->{'amount'} == 0 && ! LJ::Pay::cart_needs_shipping($cartobj) && ! LJ::Pay::cart_contains_coppa($cartobj);
+            $POST{'paymeth'} ne 'cc' && $cartobj->cart_contains_coppa;
+        $POST{'paymeth'} = "free" if $cartobj->{'amount'} == 0 && ! $cartobj->cart_needs_shipping && ! $cartobj->cart_contains_coppa;
 
         if ($cartobj->{userid} && $remote && $remote->underage &&
             ! scalar grep { $_->{item} eq 'coppa' } @{$cartobj->{items}}) {
@@ -257,7 +257,7 @@
             return;
         }
 
-        my $needs_shipping = LJ::Pay::cart_needs_shipping($cartobj);
+        my $needs_shipping = $cartobj->cart_needs_shipping;
 
         # some payment methods are invalid for shipping
         if ($needs_shipping) {

Modified: branches/shop/ssldocs/pay/cc.bml
===================================================================
--- branches/shop/ssldocs/pay/cc.bml	2009-08-11 07:58:38 UTC (rev 7560)
+++ branches/shop/ssldocs/pay/cc.bml	2009-08-11 11:04:36 UTC (rev 7561)
@@ -18,8 +18,8 @@
     my $cartobj = LJ::Pay::load_cart($cart);
     return BML::redirect("$LJ::SITEROOT/pay/") unless $cartobj;
 
-    my $needs_shipping = LJ::Pay::cart_needs_shipping($cartobj);
-    my $has_coppa      = LJ::Pay::cart_contains_coppa($cartobj);
+    my $needs_shipping = $cartobj->cart_needs_shipping;
+    my $has_coppa      = $cartobj->cart_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      = LJ::Pay::cart_contains_coppa($cartobj);
-        my $needs_shipping = LJ::Pay::cart_needs_shipping($cartobj);
+        my $has_coppa      = $cartobj->cart_contains_coppa;
+        my $needs_shipping = $cartobj->cart_needs_shipping;
         
         # coppa requires remote
         if ($has_coppa && ! $remote) {

Modified: branches/shop/ssldocs/pay/ccpay.bml
===================================================================
--- branches/shop/ssldocs/pay/ccpay.bml	2009-08-11 07:58:38 UTC (rev 7560)
+++ branches/shop/ssldocs/pay/ccpay.bml	2009-08-11 11:04:36 UTC (rev 7561)
@@ -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      = LJ::Pay::cart_contains_coppa($cartobj);
-    my $needs_shipping = LJ::Pay::cart_needs_shipping($cartobj);
+    my $has_coppa      = $cartobj->cart_contains_coppa;
+    my $needs_shipping = $cartobj->cart_needs_shipping;
 
     # coppa requires remote
     if ($has_coppa && ! $remote) {

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