X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2Fbin%2Ffreeside-eftca-download;h=1b7653cb39a6e633dcfe7a2ebcc3b86f5c8c01f6;hp=702a80ca1c513b92a93a3cb5b77f3be70a30c031;hb=a36e0f8a0f69349dafaa16d1d2d57dfb6e5dbc85;hpb=76169025ea3f676adde2642e60d40e4d8c4e7e72 diff --git a/FS/bin/freeside-eftca-download b/FS/bin/freeside-eftca-download index 702a80ca1..1b7653cb3 100755 --- a/FS/bin/freeside-eftca-download +++ b/FS/bin/freeside-eftca-download @@ -52,7 +52,7 @@ my $conf = new FS::Conf; my @agents; if ( $conf->exists('batch-spoolagent') ) { - @agents = qsearchs('agent', { 'disabled' => '' }); + @agents = qsearch('agent', { 'disabled' => '' }); } else { @agents = (1); } @@ -62,11 +62,14 @@ foreach my $agent (@agents) { my @batchconf; if ( $conf->exists('batch-spoolagent') ) { @batchconf = $conf->config('batchconfig-eft_canada', $agent->agentnum, 1); - next unless $batchconf[0]; + if ( !length($batchconf[0]) ) { + warn "agent '".$agent->agent."' has no batchconfig-eft_canada setting; skipped.\n"; + next; + } } else { @batchconf = $conf->config('batchconfig-eft_canada'); } - # BIN, terminalID, merchantID, username, password + # user, password, transaction code, delay days my $user = $batchconf[0] or die "no EFT Canada batch username configured\n"; my $pass = $batchconf[1] or die "no EFT Canada batch password configured\n"; @@ -82,7 +85,7 @@ foreach my $agent (@agents) { $sftp->setcwd('/Returns'); - my $files = $sftp->ls('.', wanted => qr/^ReturnFile/, names_only => 1); + my $files = $sftp->ls('.', wanted => qr/\.txt$/, names_only => 1); die "no response files found\n" if !@$files; FILE: foreach my $filename (@$files) {