[freeside-commits] freeside/FS/FS pay_batch.pm, 1.26.2.1, 1.26.2.2 Conf.pm, 1.397.2.1, 1.397.2.2

Mark Wells mark at wavetail.420.am
Fri Nov 12 15:34:14 PST 2010


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv13766/FS/FS

Modified Files:
      Tag: FREESIDE_2_1_BRANCH
	pay_batch.pm Conf.pm 
Log Message:
TD EFT batch format, RT#10545

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.397.2.1
retrieving revision 1.397.2.2
diff -u -w -d -r1.397.2.1 -r1.397.2.2
--- Conf.pm	12 Nov 2010 01:17:25 -0000	1.397.2.1
+++ Conf.pm	12 Nov 2010 23:34:12 -0000	1.397.2.2
@@ -2898,6 +2898,13 @@
   },
 
   {
+    'key'         => 'batchconfig-td_eft1464',
+    'section'     => 'billing',
+    'description' => 'Configuration for TD Bank EFT1464 batching, five lines: 1. Originator ID, 2. Datacenter Code, 3. Short name, 4. Long name, 5. Returned payment branch number, 6. Returned payment account, 7. Transaction code.',
+    'type'        => 'textarea',
+  },
+
+  {
     'key'         => 'payment_history-years',
     'section'     => 'UI',
     'description' => 'Number of years of payment history to show by default.  Currently defaults to 2.',

Index: pay_batch.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/pay_batch.pm,v
retrieving revision 1.26.2.1
retrieving revision 1.26.2.2
diff -u -w -d -r1.26.2.1 -r1.26.2.2
--- pay_batch.pm	12 Nov 2010 03:22:34 -0000	1.26.2.1
+++ pay_batch.pm	12 Nov 2010 23:34:12 -0000	1.26.2.2
@@ -202,9 +202,10 @@
 
   my $conf = new FS::Conf;
 
-  my $filetype            = $info->{'filetype'};      # CSV or fixed
+  my $filetype            = $info->{'filetype'};      # CSV, fixed, variable
   my @fields              = @{ $info->{'fields'}};
   my $formatre            = $info->{'formatre'};      # for fixed
+  my $parse               = $info->{'parse'};         # for variable
   my @all_values;
   my $begin_condition     = $info->{'begin_condition'};
   my $end_condition       = $info->{'end_condition'};
@@ -213,6 +214,7 @@
   my $hook                = $info->{'hook'};
   my $approved_condition  = $info->{'approved'};
   my $declined_condition  = $info->{'declined'};
+  my $close_condition     = $info->{'close_condition'};
 
   my $csv = new Text::CSV_XS;
 
@@ -286,7 +288,17 @@
         };
         push @values, $line;
         push @all_values, \@values;
-      }else{
+      }
+      elsif ($filetype eq 'variable') {
+        my @values = ( eval { $parse->($self, $line) } );
+        if( $@ ) {
+          $dbh->rollback if $oldAutoCommit;
+          return $@;
+        };
+        push @values, $line;
+        push @all_values, \@values;
+      }
+      else {
         $dbh->rollback if $oldAutoCommit;
         return "Unknown file type $filetype";
       }
@@ -421,6 +433,19 @@
 
   }
   
+  if ( defined($close_condition) ) {
+    # Allow the module to decide whether to close the batch.
+    # This is used for TD EFT, which requires two imports before 
+    # closing.
+    # $close_condition can also die() to abort the whole import.
+    my $close = eval { $close_condition->($self) };
+    if ( $@ ) {
+      $dbh->rollback;
+      die $@;
+    }
+    $self->set_status('I') if !$close;
+  }
+
   $dbh->commit or die $dbh->errstr if $oldAutoCommit;
   '';
 



More information about the freeside-commits mailing list