changes for cardfortress
[Business-BatchPayment.git] / BatchPayment / Processor.pm
index e02259a..a148c16 100644 (file)
@@ -219,7 +219,7 @@ sub submit {
   warn $request if $self->debug >= 2;
   $self->transport->upload($request);
 }
-;
+
 sub receive {
   my $self = shift;
   my @responses = $self->transport->download;
@@ -237,9 +237,11 @@ sub format_request {
   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, $_);
     };
@@ -253,12 +255,14 @@ sub parse_response {
   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, $_);
     };