-my $oldAutoCommit = $FS::UID::AutoCommit;
-local $FS::UID::AutoCommit = 0;
-my $dbh = dbh;
-
-my $pay_batch = qsearchs('pay_batch', {'status'=>''} );
-die "No pending batch. \n" unless $pay_batch;
-
-my %batchhash = $pay_batch->hash;
-$batchhash{'status'} = 'I';
-my $new = new FS::pay_batch \%batchhash;
-my $error = $new->replace($pay_batch);
-die "error updating batch status: $error\n" if $error;
-
-my $batchtotal=0;
-my $batchcount=0;
-
-my (@date)=localtime();
-my $jdate = sprintf("%03d", $date[5] % 100).sprintf("%03d", $date[7]);
-
-if ($format eq "BoM") {
-
- my($origid,$datacenter,$typecode,$shortname,$longname,$mybank,$myacct) =
- $conf->config("batchconfig-$format");
- %><%= sprintf( "A%10s%04u%06u%05u%54s\n",$origid,$pay_batch->batchnum,$jdate,$datacenter,"").
- sprintf( "XD%03u%06u%-15s%-30s%09u%-12s \n",$typecode,$jdate,$shortname,$longname,$mybank,$myacct )
- %><%
-
-}elsif ($format eq "CSV file for TD Canada Trust Merchant PC Batch"){
-# 1;
-}else{
- die "Unknown format for batch in batchconfig. \n";
+my %opt;
+if ( $cgi->param('gatewaynum') =~ /^(\d+)$/ ) {
+ my $gateway = FS::payment_gateway->by_key($1);
+ die "gatewaynum $1 not found" unless $gateway;
+ $opt{'gateway'} = $gateway;