vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[ljcom] r9894: LJSUP-7445: Try & buy

Committer: vsukhanov
LJSUP-7445: Try & buy
U   trunk/cgi-bin/LJ/Pay/Payment/PayItem/PaidAccount.pm
U   trunk/cgi-bin/ljcom.pl
U   trunk/htdocs/manage/account/index.bml
U   trunk/htdocs/manage/payments/index.bml.text.local
Modified: trunk/cgi-bin/LJ/Pay/Payment/PayItem/PaidAccount.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay/Payment/PayItem/PaidAccount.pm	2010-12-30 12:27:19 UTC (rev 9893)
+++ trunk/cgi-bin/LJ/Pay/Payment/PayItem/PaidAccount.pm	2011-01-12 11:08:57 UTC (rev 9894)
@@ -638,6 +638,10 @@
 sub _deliver_item {
     my ($self, $payment, $buyer_u, $rcpt_u, $note_rec_change) = @_;
 
+    ## Try'n'buy is shareware version of paid account
+    ## We wish user upgrade to real paid account after trying it.
+    my $was_trynbuy = $rcpt_u->get_cap('trynbuy');
+
     if ($rcpt_u->get_cap('perm')) {
         # we cannot deliver a paid account to a user who already has
         # a permantent one; let's deliver wallet tokens instead
@@ -673,6 +677,17 @@
         return (0, undef, undef);
     }
 
+    ## Log upgrading from Trynbuy to real paid acc
+    if ($bonus_ref and $was_trynbuy){ ## paid account delivered to user
+        ## user got a real Paid Acc and does not need a shareware version of it.
+        my $rcpt_u_up = LJ::modify_caps($rcpt_u->userid, [], ['trynbuy']);
+        if ($rcpt_u){
+            $rcpt_u = $rcpt_u_up;
+            $rcpt_u->log_event('upgraded_to_paid_from_trynbuy');
+        }
+
+    }
+
     # promo action 'Give more 2010' (LJSUP-7267)
     my $now = time;
     if ($self->{'qty'} == 12 and (not $buyer_u or $rcpt_u->userid != $buyer_u->userid) and 

Modified: trunk/cgi-bin/ljcom.pl
===================================================================
--- trunk/cgi-bin/ljcom.pl	2010-12-30 12:27:19 UTC (rev 9893)
+++ trunk/cgi-bin/ljcom.pl	2011-01-12 11:08:57 UTC (rev 9894)
@@ -194,6 +194,9 @@
                                  : $BML::ML{'ljcom.userinfo.types.sponsored'};
             }
         }
+    } elsif (LJ::caps_in_group($caps, "trynbuy")) {   
+        ## TRY'n'BUY
+        return "*trynbuy*";
     } elsif (LJ::caps_in_group($caps, "plus")) {
         if ($display_extrainfo) {
             return $is_early ? $BML::ML{'ljcom.userinfo.types.previously_early'} : "";

Modified: trunk/htdocs/manage/account/index.bml
===================================================================
--- trunk/htdocs/manage/account/index.bml	2010-12-30 12:27:19 UTC (rev 9893)
+++ trunk/htdocs/manage/account/index.bml	2011-01-12 11:08:57 UTC (rev 9894)
@@ -403,7 +403,16 @@
 
         $body .= "<tr><td colspan='3' valign='top'>";
         $body .= "<div class='account_level'>";
-        $body .= $u->in_class("plus") ? $ML{'.accountlevel.plus'} : $ML{'.accountlevel.basic'};
+        if ($u->get_cap('trynbuy')){
+            my $exptime = $u->prop('trynbuy_enabled_at') + 24*3600*7;
+            my (undef, undef, undef, $day, $month, $year) = localtime($exptime);
+            $month ++;
+            $year += 1900;
+            my $expdate = sprintf("%.4d-%.2d-%.2d", $year, $month, $day);
+            $body .= LJ::Lang::ml('.accountlevel.trynbuy', { expdate => $expdate }); 
+        } else {
+            $body .= $u->in_class("plus") ? $ML{'.accountlevel.plus'} : $ML{'.accountlevel.basic'};
+        }
         $body .= "<br /><span class='userpic_count'>" . BML::ml('.accountlevel.userpics', { used => $u->get_userpic_count, max => $u->userpic_quota }) . "</span>";
         $body .= "</div>";
         $body .= "</td></tr>";

Modified: trunk/htdocs/manage/payments/index.bml.text.local
===================================================================
--- trunk/htdocs/manage/payments/index.bml.text.local	2010-12-30 12:27:19 UTC (rev 9893)
+++ trunk/htdocs/manage/payments/index.bml.text.local	2011-01-12 11:08:57 UTC (rev 9894)
@@ -5,6 +5,9 @@
 .accountlevel.plus|staleness=1
 .accountlevel.plus=You currently have a <strong>Plus</strong> Account,
 
+.accountlevel.trynbuy|staleness=1
+.accountlevel.trynbuy=You currently have a <strong>Paid Account Trial</strong>, expiring [[expdate]],
+
 .accountlevel.userpics|staleness=1
 .accountlevel.userpics=and you're using [[used]] of [[max]] [[?max|userpic|userpics]].
 

Tags: bml, ljcom, local, pl, pm, vadvs
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