Committer: ssafronova
LJSUP-7375: Make beta-version of shop delivery scriptU trunk/bin/maint/pay.pl U trunk/cgi-bin/LJ/Pay/Payment.pm
Modified: trunk/bin/maint/pay.pl =================================================================== --- trunk/bin/maint/pay.pl 2010-11-17 09:13:29 UTC (rev 9725) +++ trunk/bin/maint/pay.pl 2010-11-17 09:39:32 UTC (rev 9726) @@ -200,6 +200,8 @@ LJ::end_request(); + my %is_beta; # payid => 'beta' payvar + my @used = (); foreach my $p (@$res) { @@ -221,6 +223,19 @@ } } + # simplified copy of LJ::Payment->payvar_get + # loading of unneeded payments is hard + my $is_beta = $dbh->selectrow_array("SELECT pval FROM payvars WHERE payid=? AND pkey=?", + undef, $p->{'payid'}, 'beta'); + die $dbh->errstr if $dbh->err; + if ($LJ::SHOP_DELIVERY_SPECIAL) { # process only specially marked payments + next unless $is_beta eq $LJ::SHOP_DELIVERY_SPECIAL; + } else { # process only non-marked payments + next if $is_beta; + } + + $is_beta{ $p->{'payid'} } = $is_beta; # will be used later, on payitems phase + if (%userids) { # call into LJ::load_userids_multi() to get clusterids for these users # -- cheap because we load all payment userids later during processing @@ -367,6 +382,17 @@ if ($@) { warn "cannot load cart: $@"; } else { + + my $is_beta = $is_beta{ $pi->{'payid'} }; + $is_beta = $pp->payvar_get('beta') unless exists $is_beta{ $pi->{'payid'} }; + $is_beta{ $pi->{'payid'} } = $is_beta; # store (found) value + + if ($LJ::SHOP_DELIVERY_SPECIAL) { # process only specially marked payments + next unless $is_beta eq $LJ::SHOP_DELIVERY_SPECIAL; + } else { # process only non-marked payments + next if $is_beta; + } + $pi->deliver($pp, $now, $note_rec_change); } Modified: trunk/cgi-bin/LJ/Pay/Payment.pm =================================================================== --- trunk/cgi-bin/LJ/Pay/Payment.pm 2010-11-17 09:13:29 UTC (rev 9725) +++ trunk/cgi-bin/LJ/Pay/Payment.pm 2010-11-17 09:39:32 UTC (rev 9726) @@ -142,6 +142,9 @@ $self->set_payid($dbh->{mysql_insertid}+0) or return _err("no mysql_insertid"); + # mark cart release version, to be delivered by right server + $self->payvar_append('beta', $LJ::SHOP_DELIVERY_SPECIAL) if $LJ::SHOP_DELIVERY_SPECIAL; + foreach my $it ($self->get_items) { $it->set_payid($self->get_payid); $it->save