sunnyman's (sunnyman) wrote in changelog,
sunnyman's
sunnyman
changelog

[ljcom] r12247: LJSUP-12436: Create special is_sandbox f...

Committer: vtroitsky
LJSUP-12436: Create special is_sandbox flag for promotions (to simulale all logic except payments)
U   trunk/bin/maint/selfpromo.pl
Modified: trunk/bin/maint/selfpromo.pl
===================================================================
--- trunk/bin/maint/selfpromo.pl	2012-07-09 18:13:19 UTC (rev 12246)
+++ trunk/bin/maint/selfpromo.pl	2012-07-09 18:15:29 UTC (rev 12247)
@@ -29,16 +29,33 @@
 
 # run 1 time a day
 $maint{'commercial_create'} = sub {
+    my @args = @_;
+    my $arg = shift @args;
+    
+    my $opts = {};
+    if ( $arg && $arg =~ /^sandbox|production$/ ) {
+        $opts->{is_sandbox} = ($arg =~ /^sandbox$/ ? 1 : 0 );
+        warn "Add options flag: $arg";
+    }
+
     # Create additional slots for sell in commercial promo
     my $slot = LJ::Pay::PromotionSlot->find_slot(class => PROMO_COMMERCIAL());
-    LJ::Pay::CommercialPromo->create_promotions($slot) if $slot;
+    LJ::Pay::CommercialPromo->create_promotions($slot, $opts ) if $slot;
 };
 
 # run as often as we did it for selfpromo_check (every minute)
 $maint{'commercial_check'} = sub {
+    my $arg = shift;
+
+    my $opts = {};
+    if ( $arg && $arg =~ /^sandbox|production$/ ) {
+        $opts->{is_sandbox} = ($arg =~ /^sandbox$/ ? 1 : 0 );
+        warn "Add options flag: $arg";
+    }
+    
     # check some promotions before active one
     my $slot = LJ::Pay::PromotionSlot->find_slot(class => PROMO_COMMERCIAL());
-    $slot->check_current_promotion() if $slot;
+    $slot->check_current_promotion($opts) if $slot;
 
     # notify promoter about start/stop/ not ready items
     LJ::Pay::CommercialPromo->notify_promoters($slot) if $slot;

Tags: ljcom, pl, sunnyman, vtroitsky
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