Committer: nnikulochkina
LJSUP-13074: Implement Paid Repost lifecycleU trunk/cgi-bin/LJ/Entry.pm U trunk/cgi-bin/ljprotocol.pl
Modified: trunk/cgi-bin/LJ/Entry.pm =================================================================== --- trunk/cgi-bin/LJ/Entry.pm 2012-07-26 15:42:21 UTC (rev 22509) +++ trunk/cgi-bin/LJ/Entry.pm 2012-07-27 07:06:08 UTC (rev 22510) @@ -10,6 +10,7 @@ use Carp qw/ croak /; use LJ::TimeUtil; use LJ::Entry::Repost; +use LJ::Pay::Repost::Offer; # internal fields: # @@ -1553,6 +1554,22 @@ return $class->{'original_post_obj'}; } +sub repost_offer { + my $self = shift; + return $self->prop('repost_offer'); +} + +sub repost_budget { + my $self = shift; + + return unless $self->repost_offer; + + return LJ::Pay::Repost::Offer->get_budget( + $self->posterid, + $self->repost_offer, + ); +} + package LJ; use Class::Autouse qw ( Modified: trunk/cgi-bin/ljprotocol.pl =================================================================== --- trunk/cgi-bin/ljprotocol.pl 2012-07-26 15:42:21 UTC (rev 22509) +++ trunk/cgi-bin/ljprotocol.pl 2012-07-27 07:06:08 UTC (rev 22510) @@ -3289,7 +3289,9 @@ ); } - if (LJ::is_enabled("paid_repost") && defined $req->{repost_budget} && !$req->{revoke_repost_offer}) { + if (LJ::is_enabled("paid_repost") + && defined $req->{repost_budget} + && !$req->{revoke_repost_offer}) { # cannot create or edit repost offer via api return fail($err,222) unless $flags->{noauth};