From d7c1839c14f0d37a352388b8df4086c47bedc6e5 Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Tue, 31 Mar 2015 13:55:54 -0500 Subject: [PATCH] #33286: Direct Debit by BillBuddy for Bank Accounts --- FS/FS/Schema.pm | 1 + FS/FS/pay_batch.pm | 14 +++++++++++++- httemplate/edit/payment_gateway.html | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 9f4670cd7..cd74a3854 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -1850,6 +1850,7 @@ sub tables_hashref { 'download', @date_type, '', '', 'upload', @date_type, '', '', 'title', 'varchar', 'NULL',255, '', '', + 'processor_id', 'varchar', 'NULL',255, '', '', ], 'primary_key' => 'batchnum', 'unique' => [], diff --git a/FS/FS/pay_batch.pm b/FS/FS/pay_batch.pm index 3ce71b0f2..364e7f63e 100644 --- a/FS/FS/pay_batch.pm +++ b/FS/FS/pay_batch.pm @@ -574,7 +574,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; @@ -1059,6 +1066,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; ''; } diff --git a/httemplate/edit/payment_gateway.html b/httemplate/edit/payment_gateway.html index 97976dfef..156910f51 100644 --- a/httemplate/edit/payment_gateway.html +++ b/httemplate/edit/payment_gateway.html @@ -103,6 +103,7 @@ my %modules = ( 'KeyBank', 'Paymentech', 'TD_EFT', + 'BillBuddy', ], ); -- 2.11.0