X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpay_batch.pm;h=a7628f6e06666dea971930f96738a18672e7b4dc;hb=892ffefd1fda5aea9c6a3fe980613a3ab2e976b9;hp=3079db10fa865ce47a9ac0666a7f4085b839a95e;hpb=2e4fa975e054554beac71883436b143267d7aa12;p=freeside.git diff --git a/FS/FS/pay_batch.pm b/FS/FS/pay_batch.pm index 3079db10f..a7628f6e0 100644 --- a/FS/FS/pay_batch.pm +++ b/FS/FS/pay_batch.pm @@ -220,6 +220,36 @@ I<format> - an L<FS::pay_batch> module I<gateway> - an L<FS::payment_gateway> object for a batch gateway. This takes precedence over I<format>. +Supported format keys (defined in the specified FS::pay_batch module) are: + +I<filetype> - required, can be CSV, fixed, variable, XML + +I<fields> - required list of field names for each row/line + +I<formatre> - regular expression for fixed filetype + +I<parse> - required for variable filetype + +I<xmlkeys> - required for XML filetype + +I<xmlrow> - required for XML filetype + +I<begin_condition> - sub, ignore all lines before this returns true + +I<end_condition> - sub, stop processing lines when this returns true + +I<end_hook> - sub, runs immediately after end_condition returns true + +I<skip_condition> - sub, skip lines when this returns true + +I<hook> - required, sub, runs before approved/declined conditions are checked + +I<approved> - required, sub, returns true when approved + +I<declined> - required, sub, returns true when declined + +I<close_condition> - sub, decide whether or not to close the batch + =cut sub import_results { @@ -528,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; @@ -749,10 +786,7 @@ sub import_from_gateway { my $body = "Import from gateway ".$gateway->label."\n".$error_text; send_email( to => $mail_on_error, - from => $conf->config('invoice_from_name') ? - $conf->config('invoice_from_name') . ' <' . - $conf->config('invoice_from') . '>' : - $conf->config('invoice_from'), + from => $conf->invoice_from_full(), subject => $subject, body => $body, ); @@ -1017,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; ''; }