diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2015-12-22 00:28:53 -0600 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2016-01-05 21:06:41 -0600 |
commit | 1667ab631f9fbd0f4ceeb6ec000b0f4ff3ddb51a (patch) | |
tree | f1fae9a3e8f6a01782a45528c04e6e9d9ded749a /FS/bin | |
parent | 9088495eea6c836c7086dec1e76839ed8e93e0be (diff) |
RT#34295: Error when attempting to create batch payments [better handling of empty batches]
Diffstat (limited to 'FS/bin')
-rwxr-xr-x | FS/bin/freeside-eftca-upload | 4 | ||||
-rwxr-xr-x | FS/bin/freeside-paymentech-upload | 5 | ||||
-rwxr-xr-x | FS/bin/freeside-rbc-upload | 4 |
3 files changed, 13 insertions, 0 deletions
diff --git a/FS/bin/freeside-eftca-upload b/FS/bin/freeside-eftca-upload index b66765af3..107aa19ce 100755 --- a/FS/bin/freeside-eftca-upload +++ b/FS/bin/freeside-eftca-upload @@ -47,6 +47,10 @@ foreach my $pay_batch (@batches) { my $filename = time2str('%Y%m%d', time) . '-' . sprintf('%06d.csv',$batchnum); print STDERR "Exporting batch $batchnum to $filename...\n" if $opt_v; my $text = $pay_batch->export_batch(format => 'eft_canada'); + unless ($text) { + print STDERR "Batch is empty, resolving..." if $opt_v; + next; + } open OUT, ">$tmpdir/$filename"; print OUT $text; close OUT; diff --git a/FS/bin/freeside-paymentech-upload b/FS/bin/freeside-paymentech-upload index 5ae147d07..799e6c42c 100755 --- a/FS/bin/freeside-paymentech-upload +++ b/FS/bin/freeside-paymentech-upload @@ -68,6 +68,10 @@ foreach my $pay_batch (@batches) { my $filename = sprintf('%06d',$batchnum) . '-' .time2str('%Y%m%d%H%M%S', time); print STDERR "Exporting batch $batchnum to $filename...\n" if $opt_v; my $text = $pay_batch->export_batch(format => 'paymentech'); + unless ($text) { + print STDERR "Batch is empty, resolving..." if $opt_v; + next; + } $text =~ s!<fileID>FILEID</fileID>!<fileID>$filename</fileID>! or log_and_die("couldn't find FILEID tag\n"); open OUT, ">$tmpdir/$filename.xml"; @@ -80,6 +84,7 @@ foreach my $pay_batch (@batches) { log_and_die("failed to create zip file\n") if (! -f "$tmpdir/$filename.zip" ); push @filenames, $filename; } +log_and_die("All batches empty\n") if !@filenames; my $host = ($opt_t ? 'orbitalbatchvar.paymentech.net' : 'orbitalbatch.paymentech.net'); diff --git a/FS/bin/freeside-rbc-upload b/FS/bin/freeside-rbc-upload index 52501028c..3fff32a67 100755 --- a/FS/bin/freeside-rbc-upload +++ b/FS/bin/freeside-rbc-upload @@ -70,6 +70,10 @@ foreach my $pay_batch (@batches) { debug "Exporting batch $batchnum to $filename\n"; my $text = $pay_batch->export_batch(format => 'RBC'); + unless ($text) { + print STDERR "Batch is empty, resolving..." if $opt_v; + next; + } write_file("$tmpdir/$filename", $text); debug "Uploading $filename..."; |