=item submit BATCH
Send a batch of requests to the gateway. BATCH must be a
-L<Business::BatchPayment::Batch>.
+L<Business::BatchPayment::Batch>. No defined return value,
+but processors may optionally set the 'processor_id' field
+on the input batch, which should then be stored and passed
+to receive.
=item receive
Download/otherwise acquire the available confirmed transactions from the
gateway, parse them, and return a list of L<Business::BatchPayment::Batch>
objects. The items in these batches will have, at minimum, the 'approved'
-field and either the 'tid' or 'amount' field set.
+field and either the 'tid' or 'amount' field set. Accepts an optional
+list of processor_id strings, if required by your processor.
=item format_request BATCH
warn $request if $self->debug >= 2;
$self->transport->upload($request);
}
-;
+
sub receive {
my $self = shift;
my @responses = $self->transport->download;
my $self = shift;
my $batch = shift;
my $output = $self->format_header($batch);
+ $batch->num(0);
foreach my $item ($batch->elements) {
try {
$output .= $self->format_item($item, $batch);
+ $batch->num( $batch->num + 1 );
} catch {
$self->format_error($item, $_);
};
my $input = shift;
my $batch = Business::BatchPayment->create(Batch =>
incoming => $self->incoming,
- batch_id => $self->parse_batch_id($input)
+ batch_id => $self->parse_batch_id($input),
+ num => 0,
);
while ( $input =~ s/(.*)\n//m ) {
my $row = $1;
try {
$batch->push( $self->parse_item($row) );
+ $batch->num( $batch->num + 1 );
} catch {
$self->parse_error($row, $_);
};