#33286: Direct Debit by BillBuddy for Bank Accounts
authorJonathan Prykop <jonathan@freeside.biz>
Tue, 31 Mar 2015 18:55:54 +0000 (13:55 -0500)
committerJonathan Prykop <jonathan@freeside.biz>
Tue, 31 Mar 2015 18:55:54 +0000 (13:55 -0500)
FS/FS/Schema.pm
FS/FS/pay_batch.pm
httemplate/edit/payment_gateway.html

index a048d3e..a21e97c 100644 (file)
@@ -2616,6 +2616,7 @@ sub tables_hashref {
         'download',       @date_type,     '', '', 
         'upload',         @date_type,     '', '', 
         'title',   'varchar', 'NULL',255, '', '',
+        'processor_id',   'varchar', 'NULL',255, '', '',
       ],
       'primary_key'  => 'batchnum',
       'unique'       => [],
index 449ea22..a7628f6 100644 (file)
@@ -558,7 +558,14 @@ sub import_from_gateway {
 
   my $processor = $gateway->batch_processor(%proc_opt);
 
-  my @batches = $processor->receive;
+  my @processor_ids = map { $_->processor_id } 
+                        qsearch({
+                          'table' => 'pay_batch',
+                          'hashref' => { 'status' => 'I' },
+                          'extra_sql' => q( AND processor_id != '' AND processor_id IS NOT NULL)
+                        });
+
+  my @batches = $processor->receive(@processor_ids);
 
   my $num = 0;
 
@@ -1044,6 +1051,11 @@ sub export_to_gateway {
   );
   $processor->submit($batch);
 
+  if ($batch->processor_id) {
+    $self->set('processor_id',$batch->processor_id);
+    $self->replace;
+  }
+
   $dbh->commit or die $dbh->errstr if $oldAutoCommit;
   '';
 }
index 97976df..156910f 100644 (file)
@@ -103,6 +103,7 @@ my %modules = (
     'KeyBank',
     'Paymentech',
     'TD_EFT',
+    'BillBuddy',
   ],
 );