+=item batch_processor OPTIONS
+
+For BatchPayment gateways only. Returns a
+L<Business::BatchPayment::Processor> object to communicate with the
+gateway.
+
+OPTIONS will be passed to the constructor, along with any gateway
+options in the database for this L<FS::payment_gateway>. Useful things
+to include there may include 'input' and 'output' (to direct transport
+to files), 'debug', and 'test_mode'.
+
+If the global 'business-batchpayment-test_transaction' flag is set,
+'test_mode' will be forced on, and gateways that don't support test
+mode will be disabled.
+
+=cut
+
+sub batch_processor {
+ local $@;
+ my $self = shift;
+ my %opt = @_;
+ my $batch = $opt{batch};
+ my $output = $opt{output};
+ die 'gateway '.$self->gatewaynum.' is not a Business::BatchPayment gateway'
+ unless $self->gateway_namespace eq 'Business::BatchPayment';
+ eval "use Business::BatchPayment;";
+ die "couldn't load Business::BatchPayment: $@" if $@;
+
+ my $conf = new FS::Conf;
+ my $test_mode = $conf->exists('business-batchpayment-test_transaction');
+ $opt{'test_mode'} = 1 if $test_mode;
+
+ my $module = $self->gateway_module;
+ my $processor = eval {
+ Business::BatchPayment->create($module, $self->options, %opt)
+ };
+ die "failed to create Business::BatchPayment::$module object: $@"
+ if $@;
+
+ die "$module does not support test mode"
+ if $test_mode and not $processor->does('Business::BatchPayment::TestMode');
+
+ return $processor;
+}
+