changelog_bot (changelog_bot) wrote in changelog,
changelog_bot
changelog_bot
changelog

[ljcom] r7540: LJSUP-4585

Committer: gproschaev
LJSUP-4585


U   branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/VGift.pm
U   branches/shop/cgi-bin/LJ/Pay/Payment/PayItem.pm
U   branches/shop/cgi-bin/LJ/Pay/Payment.pm
U   branches/shop/cgi-bin/paylib.pl
U   branches/shop/cgi-bin/paylib_cart.pl
U   branches/shop/htdocs/admin/accounts/enternew.bml
U   branches/shop/htdocs/admin/accounts/paidsearch.bml
U   branches/shop/htdocs/manage/account/index.bml
Modified: branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/VGift.pm
===================================================================
--- branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/VGift.pm	2009-08-05 06:35:44 UTC (rev 7539)
+++ branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/VGift.pm	2009-08-05 07:01:46 UTC (rev 7540)
@@ -185,7 +185,7 @@
             $html_body = LJ::Lang::ml('esn.vgift.body.html', $vars);
         }
 
-        my $email = $self->{'rcptemail'};
+        my $email = '';
         $email = $rcpt_u->email_raw if $rcpt_u;
 
         # send email notification

Modified: branches/shop/cgi-bin/LJ/Pay/Payment/PayItem.pm
===================================================================
--- branches/shop/cgi-bin/LJ/Pay/Payment/PayItem.pm	2009-08-05 06:35:44 UTC (rev 7539)
+++ branches/shop/cgi-bin/LJ/Pay/Payment/PayItem.pm	2009-08-05 07:01:46 UTC (rev 7540)
@@ -82,7 +82,7 @@
     }
 
     foreach (qw(piid payid item subitem qty rcptid amt status
-                rcptemail anon giveafter token tokenid qty_res)) {
+                anon giveafter token tokenid qty_res)) {
         $self->{$_} = $args{$_};
     }
 
@@ -98,7 +98,7 @@
     return _err("invalid arguments") unless $self;
 
     my @cols = qw(payid status item subitem qty rcptid amt
-                  rcptemail anon giveafter token tokenid);
+                  anon giveafter token tokenid);
     my $cols = join(",", @cols);
     my $bind = join(",", map { "?" } @cols);
 
@@ -245,7 +245,6 @@
 sub get_rcptid     { _get($_[0], 'rcptid'    ) }
 sub get_amt        { _get($_[0], 'amt'       ) }
 sub get_status     { _get($_[0], 'status'    ) }
-sub get_rcptemail  { _get($_[0], 'rcptemail' ) }
 sub get_anon       { _get($_[0], 'anon'      ) }
 sub get_giveafter  { _get($_[0], 'giveafter' ) }
 sub get_token      { _get($_[0], 'token'     ) }
@@ -747,7 +746,7 @@
 
     my $buyer_u = LJ::load_userid($payment->{'userid'});
 
-    my $email = $self->{'rcptemail'};
+    my $email = '';
     my $rcpt_u;
     if ($self->{'rcptid'}) {
         $rcpt_u = LJ::load_userid($self->{'rcptid'}, "force");

Modified: branches/shop/cgi-bin/LJ/Pay/Payment.pm
===================================================================
--- branches/shop/cgi-bin/LJ/Pay/Payment.pm	2009-08-05 06:35:44 UTC (rev 7539)
+++ branches/shop/cgi-bin/LJ/Pay/Payment.pm	2009-08-05 07:01:46 UTC (rev 7540)
@@ -219,7 +219,6 @@
     my $sorter = sub {
         return
             $a->{rcptid}    <=> $b->{rcptid}    ||
-            $a->{rcptemail} cmp $b->{rcptemail} ||
             $a->{item}      cmp $b->{item}      ||
             $a->{subitem}   cmp $b->{subitem}   ||
             $a->{qty}       <=> $b->{qty}       ||
@@ -242,7 +241,7 @@
             return 0
         }
 
-        foreach (qw(rcptemail item subitem status)) {
+        foreach (qw(item subitem status)) {
             next if $eit->{$_}.'' eq $nit->{$_}.'';
             _debug("string value mismatch: $_ => ($eit->{$_} ne $nit->{$_})");
             return 0;
@@ -1531,7 +1530,7 @@
     my $it;
     my @common_args =
         ( status => $args{status} || 'cart',
-          map { $_ => $args{$_} } qw(item subitem qty rcptid amt rcptemail
+          map { $_ => $args{$_} } qw(item subitem qty rcptid amt 
                                      anon giveafter token tokenid) );
 
     # if $self->{payid} is defined, this object is saved

Modified: branches/shop/cgi-bin/paylib.pl
===================================================================
--- branches/shop/cgi-bin/paylib.pl	2009-08-05 06:35:44 UTC (rev 7539)
+++ branches/shop/cgi-bin/paylib.pl	2009-08-05 07:01:46 UTC (rev 7540)
@@ -76,8 +76,6 @@
 sub get_bonus_exp      { return LJ::Pay::Payment::PayItem::Addon::get_bonus_exp(@_); }
 sub remove_paid_time   { return LJ::Pay::Payment::PayItem::PaidAccount::remove_paid_time(@_); }
 sub new_rename_token   { return LJ::Pay::Payment::PayItem::Rename::new_rename_token(@_); }
-sub send_coupon_email  { return LJ::Pay::Payment::PayItem::Coupon::send_coupon_email(@_); }
-sub product_name       { return LJ::Pay::Payment::PayItem::product_name(@_); }
 sub clothing_availability { return LJ::Pay::Payment::PayItem::Clothes::clothing_availability(@_); }
 sub can_apply_sized_bonus { return LJ::Pay::Payment::PayItem::Addon::Sized::can_apply_sized_bonus(@_); }
 sub get_bonus_dim      { return LJ::Pay::Payment::PayItem::Addon::Sized::get_bonus_dim(@_); }
@@ -350,7 +348,7 @@
 
                       "Cart owner information:\n\n" .
 
-                      "        User: " . ($u ? $u->{user} : $cartobj->{rcptemail}) . "\n" .
+                      "        User: " . ($u ? $u->{user} : '') . "\n" .
                       "       Watch: " . ($u_watch ? "yes" : "no") . "\n" .
                       "       Payid: $cartobj->{'payid'}\n" .
                       "        Time: " . LJ::mysql_time() . "\n\n" .
@@ -576,34 +574,6 @@
     return 1;
 };
 
-sub LJ::Pay::get_item_base_price {
-    my ($item, $qty, $size, $is_rec, %opts) = @_;
-
-    if ($item eq 'paidacct') {
-        return undef
-            unless ref $LJ::Pay::account{$qty};
-
-        return LJ::Pay::paid_account_price( interval => $qty, rec => $is_rec, %opts );
-
-    } elsif (LJ::Pay::is_bonus($item, 'bool')) {
-
-        return undef unless LJ::Pay::is_valid_bool_bonus
-            ($item, $qty, $is_rec);
-
-        return $LJ::Pay::bonus{$item}->{items}->{$qty}->{$is_rec ? 'amount_rec' : 'amount'};
-
-    } elsif (LJ::Pay::is_bonus($item, 'sized')) {
-        return undef unless LJ::Pay::is_valid_sized_bonus
-            ($item, $size, $qty, $is_rec);
-
-        return $LJ::Pay::bonus{$item}->{'items'}->{$size}->{'qty'}->{$qty}->{$is_rec ? 'amount_rec' : 'amount'};
-
-    }
-
-    # this shouldn't happen, we'll error loudly
-    return undef;
-}
-
 sub LJ::Pay::postal_address_text {
     return join("\n", @LJ::PAY_POSTAL_ADDRESS, @_);
 }

Modified: branches/shop/cgi-bin/paylib_cart.pl
===================================================================
--- branches/shop/cgi-bin/paylib_cart.pl	2009-08-05 06:35:44 UTC (rev 7539)
+++ branches/shop/cgi-bin/paylib_cart.pl	2009-08-05 07:01:46 UTC (rev 7540)
@@ -89,7 +89,7 @@
     my $it = $cartobj->add_item
         ( status   => $args->{$_} || 'cart',
           map { $_ => $args->{$_} }
-          qw(item subitem qty rcptid amt rcptemail
+          qw(item subitem qty rcptid amt 
              anon giveafter token tokenid),
           )
         or return LJ::error($@);
@@ -335,7 +335,7 @@
             $$ret .= "<p><i>" . $note . "</i></p>" if $note;
 
         } else {
-            $$ret .= "<nobr>" . LJ::ehtml($it->{'rcptemail'}) . "</nobr>";
+            die "RcptId is not set!";
         }
         $$ret .= "</td><td align='right'>";
         $$ret .= sprintf("\$%0.02f", $it->{'amt'});

Modified: branches/shop/htdocs/admin/accounts/enternew.bml
===================================================================
--- branches/shop/htdocs/admin/accounts/enternew.bml	2009-08-05 06:35:44 UTC (rev 7539)
+++ branches/shop/htdocs/admin/accounts/enternew.bml	2009-08-05 07:01:46 UTC (rev 7540)
@@ -28,20 +28,17 @@
         # determine purchase user and recipient user/email
         my $user = LJ::canonical_username($POST{'user'});
         my $giftfrom = LJ::canonical_username($POST{'giftfrom'});
-        my $rcptemail = $POST{'email'};
         my $userid = 0;
         my $rcptuser = $user;
         my $rcptuserid = 0;
 
-        # user, no email
-        unless ($rcptemail) {
-            return LJ::bad_input("Invalid user specified.")
-                unless $user;
+        # user
+        return LJ::bad_input("Invalid user specified.")
+            unless $user;
 
-            $userid = LJ::get_userid($user)
-                or return LJ::bad_input("User <b>$user</b> doesn't exist.");
-            $rcptuserid = $userid;
-        }
+        $userid = LJ::get_userid($user)
+            or return LJ::bad_input("User <b>$user</b> doesn't exist.");
+        $rcptuserid = $userid;
 
         if ($giftfrom) {
             $rcptuser = $user;
@@ -55,7 +52,7 @@
         }
 
         return LJ::bad_input("Invalid recipient specified")
-            unless $rcptuserid || $rcptemail;
+            unless $rcptuserid;
 
         my %pay;   # payments row
         my %payit; # payitems row
@@ -153,12 +150,11 @@
             return LJ::bad_input("Must select the item the user is paying for.");
         }
         $payit{'item'} = $POST{'item'};
-        $payit{'rcptemail'} = $rcptemail || undef;
         $payit{'rcptid'} = $rcptuserid || 0;
 
         # at this point, the following should be properly set and validated:
         #    - %pay:   (datesent, amount)
-        #    - %payit: (rcptid, rcptemail, amt, item, subitem, qty)
+        #    - %payit: (rcptid, amt, item, subitem, qty)
 
         ### now, insert a payment
 
@@ -182,7 +178,7 @@
             my $cptype = $POST{'coupon_type'} =~ /^(tan|int)$/ ? $POST{'coupon_type'} : '';
             $type .= $cptype;
 
-            my $cpemail = $rcptemail;
+            my $cpemail = '';
             if ($rcptuserid) {
                 my $u = LJ::load_userid($rcptuserid);
                 $cpemail = $u->email_raw if $u;
@@ -202,7 +198,7 @@
         # log a statushistory row if there's a userid to associate it with
         if ($userid) {
             my $mo = $POST{'months'}+0;
-            my $rcpt = "rcptemail=$rcptemail";
+            my $rcpt = "";
             if ($rcptuserid) {
                 my $u = LJ::load_userid($rcptuserid);
                 $rcpt = "rcptuser=$u->{'user'}" if $u;
@@ -212,7 +208,7 @@
         }
 
         # send email notification of this action
-        my $rcpt = $rcptuser || $rcptemail;
+        my $rcpt = $rcptuser;
         my $msgbody = "Entered by $remote->{'user'}: payment \#$payid for $rcpt\n\n";
         foreach my $k (sort keys %POST) {
             $msgbody .= "$k:\n===============\n$POST{$k}\n\n";
@@ -223,13 +219,13 @@
                         'body' => $msgbody,
                     });
 
-        $dbh->do("INSERT INTO paymentsearch (payid, ikey, ival) VALUES (?,?,?)",
-                 undef, $payid, "handemail", $rcptemail)
+        $dbh->do("INSERT INTO paymentsearch (payid, ikey) VALUES (?,?)",
+                 undef, $payid, "handemail")
             unless $userid;
 
         return "<?h1 Success h1?><?p Payment \#$payid entered for <b>$rcpt</b> for \$$pay{'amount'} for: p?><ul>" .
             join("", map { "<li>$_->[0]=$_->[1]</li>" } 
-                 (['user' => $user], ['rcptuser' => $rcptuser], ['rcptemail' => $rcptemail],
+                 (['user' => $user], ['rcptuser' => $rcptuser],
                   ['method' => lc($POST{'method'})], ['item' => $payit{'item'}], 
                   ['subitem' => $payit{'subitem'}], ['qty' => $payit{'qty'}], ['token' => $payit{'token'} ])
                  ) .
@@ -252,13 +248,7 @@
                                      '', '(select)', map { $_ => $methods{$_} } keys %methods) . "</td></tr>";
 
     $ret .= "<tr>";
-    $ret .= $GET{'newacct'} ?
-        ("<td align='right'>Rcpt Email:</td>" .
-         "<td>" . LJ::html_text({ 'name' => 'email', 'size' => '40', 'maxlength' => 50 }) .
-         "(<a href='enternew.bml'>back</a>)</td>") :
-        ("<td align='right'>Rcpt Username:</td>" .
-         "<td>" . LJ::html_text({ 'name' => 'user', 'size' => 15, 'maxlength' => 15, 'value' => $GET{'user'} }) .
-         "(<a href='enternew.bml?newacct=1'>new account?</a>)</td>");
+    $ret .= "<td align='right'>Rcpt Username:</td><td>" . LJ::html_text({ 'name' => 'user', 'size' => 15, 'maxlength' => 15, 'value' => $GET{'user'} }) . "</td>";
     $ret .= "</tr>";
 
     $ret .= "<tr valign='top'><td align='right'>Gift From <sup>(Opt)</sup>:</td><td>";

Modified: branches/shop/htdocs/admin/accounts/paidsearch.bml
===================================================================
--- branches/shop/htdocs/admin/accounts/paidsearch.bml	2009-08-05 06:35:44 UTC (rev 7539)
+++ branches/shop/htdocs/admin/accounts/paidsearch.bml	2009-08-05 07:01:46 UTC (rev 7540)
@@ -24,7 +24,6 @@
     $ret .= "Search method: ";
     $ret .= LJ::html_select({ 'name' => 'method', 'selected' => $GET{'method'} },
                             'user' => "Username",
-                            'email' => "Email",
                             'lastname' => "Last Name",
                             'pptxnid' => "PayPal - transaction ID",
                             'cpid' => "Coupon",
@@ -88,21 +87,6 @@
         }
     }
     
-    # by-email search
-    if ($GET{'method'} eq "email") {
-        my $email = $GET{'value'};
-
-        # payment search vars:  ppemail (from a paypal payment notification)
-        # and 'handemail' (manually entered (before cart system))
-        push @ps_vars, qw(ppemail handemail);
-            
-        # from rcptemail
-        $sth = $dbh->prepare("SELECT payid FROM payitems WHERE ".
-                             "rcptemail=?");
-        $sth->execute($email);
-        $matched{$_} = 1 while $_ = $sth->fetchrow_array;
-    }
-
     # coupon search
     if ($GET{'method'} eq "cpid") {
         my $cpid = $GET{'value'};

Modified: branches/shop/htdocs/manage/account/index.bml
===================================================================
--- branches/shop/htdocs/manage/account/index.bml	2009-08-05 06:35:44 UTC (rev 7539)
+++ branches/shop/htdocs/manage/account/index.bml	2009-08-05 07:01:46 UTC (rev 7540)
@@ -151,7 +151,8 @@
 
             my $paid = $rec->get_item('paidacct');
             my $paid_price =
-                $price_format->( LJ::Pay::get_item_base_price( 'paidacct', $rec->{bill_interval}, undef, 1 ) );
+                my $item = LJ::Pay::Payment::PayItem->new_memonly ( item => 'paidacct' );
+                $price_format->( $item->get_item_base_price( $rec->{bill_interval}, undef ) );
 
             my @next_payment = $rec->predict_next_bill_price();
             my $next_price = sprintf '$%0.2f', $next_payment[1];
@@ -194,7 +195,8 @@
                 $body .= LJ::Pay::product_name( $_->get_name(), $_->get_size, undef, 1 );
                 $body .= "</td><td class='price'>\$";
                 $item_price =
-                    $price_format->( LJ::Pay::get_item_base_price( $_->get_name(), $rec->{bill_interval}, $_->get_size(), 1 ) );
+                    my $item = LJ::Pay::Payment::PayItem->new_memonly ( item => $_->get_name() );
+                    $price_format->( $item->get_item_base_price( $rec->{bill_interval}, $_->get_size() ) );
                 $total += $item_price;
                 $body .= "$item_price</td></tr>";
             }

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