Committer: vtroitsky
LJSUP-12356: Remove not working subs from SelfPromo.pm [final refactoring stage cleaning old stuff]U trunk/cgi-bin/LJ/Pay/SelfPromo.pm
Modified: trunk/cgi-bin/LJ/Pay/SelfPromo.pm =================================================================== --- trunk/cgi-bin/LJ/Pay/SelfPromo.pm 2012-05-28 11:22:59 UTC (rev 12019) +++ trunk/cgi-bin/LJ/Pay/SelfPromo.pm 2012-05-28 13:22:21 UTC (rev 12020) @@ -625,76 +625,6 @@ return 1; } -sub old_owner_cancel_promo { # the name of the function has been changed from poster_cancel_promo - my ( $class, $object ) = @_; - - return unless $object; - - # TODO: Acquire lock to perform cancelling! - my $lock = $class->lock; - # TODO: Perform error processing when lock couldn't be acquired during default timeout, 10s - - my $promo = $class->current_promo_info( undef, 'require_db' => 1 ); - - unless ( $promo && $promo->is_promoting($object) ) -# && $promo->journalid == $entry->journalid -# && $promo->jitemid == $entry->jitemid ) - { - - # your princess is in another castle, sorry - # TODO: return error - return; - } - - my $owner = $promo->owner; - - my $cart; - my $refund = $class->calculate_refund($promo); - my $promoter = $promo->promoter; - - my $refund_remainder = - $refund % $LJ::SELF_PROMO_CONF->{$class->class()}{'refund_step'}; - - my $refund_rounded = $refund - $refund_remainder; - - my $remainder_to = - LJ::load_user( $LJ::SELF_PROMO_CONF->{$class->class()}{'remainder_receiver'} ); - my $remainder_userid = $remainder_to ? $remainder_to->userid : 0; - - $cart = $class->create_shop_cart( - { - 'cart_owner' => $owner, - 'object' => undef, - 'price' => 0, - 'profit' => 0, - 'rcptid' => $owner->userid, - 'refund' => $refund_rounded, - 'refund_userid' => $promoter->userid, - 'refund_promoid' => $promo->promoid, - 'remainder' => $refund_remainder, - 'remainder_userid' => $remainder_userid, - 'type' => 'owner_cancel', - } - ); - - $cart->set_method( LJ::Pay::Method::Free->code ); - $cart->update( 'used' => 'N', 'mailed' => 'N' ); - $cart->set_daterecv_epoch(time); - - my ($item) = $cart->get_items; - - $cart->update( 'used' => 'Y' ); - $item->update( 'status' => 'pend' ); - - $class->_deliver_item($item, $owner); - - $item->deliver( $item->get_cart, time, sub { } ); - - $cart->mark_complete; - - return 1; -} - # Remote / promoter itself cancel promotion without refunding sub withdraw_object { my ( $class, $slot, $promoted_object ) = @_;