holyandrew (holyandrew) wrote in changelog,
holyandrew
holyandrew
changelog

[ljcom] r11982: LJSUP-12263: Bug in statistic

Committer: akanashin
LJSUP-12263: Bug in statistic
U   trunk/cgi-bin/LJ/Console/Command/DomainRU.pm
Modified: trunk/cgi-bin/LJ/Console/Command/DomainRU.pm
===================================================================
--- trunk/cgi-bin/LJ/Console/Command/DomainRU.pm	2012-05-21 13:44:14 UTC (rev 11981)
+++ trunk/cgi-bin/LJ/Console/Command/DomainRU.pm	2012-05-22 09:03:40 UTC (rev 11982)
@@ -68,9 +68,32 @@
         return $self->print("Domain added");
     } elsif ($action eq 'remove') {
         $reason ||= 'removed by support';
-        LJ::Pay::Payment::PayItem::DomainRU->delete_domains($account, $domain, $reason);
-        LJ::Pay::Wallet->try_add(LJ::load_user($account), $LJ::Pay::Payment::PayItem::DomainRU::shop_price * LJ::Pay::Wallet::EXCHANGE_RATE);
-        return $self->print("Domain removed");
+ 
+        my @subitem_params = (
+            $domain, LJ::load_user($account)->userid,
+        );
+ 
+        my $it = LJ::Pay::Payment::PayItem::DomainRU->new_memonly(
+            'item'    => 'domainru',
+            'subitem' => join(':', @subitem_params),
+            'anon'    => 0,
+            'rcptid'  => LJ::load_user($account)->userid,
+            'status'  => 'refund',
+            'amt'     => $LJ::Pay::Payment::PayItem::DomainRU::shop_price,
+        );
+
+        my $cart = LJ::Pay::Payment::new_cart(LJ::load_user($account));
+        $cart->payvar_append('do_not_notify_recepient',1);
+        $cart->add_item(%$it);
+        $cart->set_method( LJ::Pay::Method::Wallet->code );
+
+        my $status = LJ::Pay::Payment::PayItem::DomainRU->delete_domains($account, $domain, $reason);
+        if ($status) {
+            LJ::Pay::Wallet->try_add(LJ::load_user($account), $LJ::Pay::Payment::PayItem::DomainRU::shop_price * LJ::Pay::Wallet::EXCHANGE_RATE);
+            return $self->print("Domain removed");
+        } else {
+            return $self->error("Domain not find");
+        }
     } elsif ($action eq 'show') {
         my $domains = LJ::Pay::Payment::PayItem::DomainRU->get_domains($u);
         for (@$domains) {

Tags: akanashin, holyandrew, ljcom, pm
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