[freeside-commits] freeside/FS/bin freeside-eftca-download, 1.1.2.2, 1.1.2.3
Ivan,,,
ivan at wavetail.420.am
Fri Oct 21 16:41:27 PDT 2011
Update of /home/cvs/cvsroot/freeside/FS/bin
In directory wavetail.420.am:/tmp/cvs-serv1497/FS/bin
Modified Files:
Tag: FREESIDE_2_3_BRANCH
freeside-eftca-download
Log Message:
agent-virt batches and batchconfig-eftcanada config (argh!), RT#14859
Index: freeside-eftca-download
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-eftca-download,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -w -d -r1.1.2.2 -r1.1.2.3
--- freeside-eftca-download 22 Jul 2011 19:19:56 -0000 1.1.2.2
+++ freeside-eftca-download 21 Oct 2011 23:41:25 -0000 1.1.2.3
@@ -49,20 +49,36 @@
my $tmpdir = tempdir( CLEANUP => 1 ); #DIR=>somewhere?
my $conf = new FS::Conf;
-my @batchconf = $conf->config('batchconfig-eft_canada');
+
+my @agents;
+if ( $conf->exists('batch-spoolagent') ) {
+ @agents = qsearchs('agent', { 'disabled' => '' });
+} else {
+ @agents = (1);
+}
+
+foreach my $agent (@agents) {
+
+ my @batchconf;
+ if ( $conf->exists('batch-spoolagent') ) {
+ @batchconf = $conf->config('batchconfig-eft_canada', $agent->agentnum, 1);
+ next unless $batchconf[0];
+ } else {
+ @batchconf = $conf->config('batchconfig-eft_canada');
+ }
# BIN, terminalID, merchantID, username, password
-my $username = $batchconf[0] or die "no EFT Canada batch username configured\n";
-my $password = $batchconf[1] or die "no EFT Canada batch password configured\n";
+ 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";
my $host = 'ftp.eftcanada.com';
-print STDERR "Connecting to $username\@$host...\n" if $opt_v;
+ print STDERR "Connecting to $user\@$host...\n" if $opt_v;
my $sftp = Net::SFTP::Foreign->new( host => $host,
- user => $username,
- password => $password,
+ user => $user,
+ password => $pass,
timeout => 30,
);
-die "failed to connect to '$username\@$host'\n(".$sftp->error.")\n" if $sftp->error;
+ die "failed to connect to '$user\@$host'\n(".$sftp->error.")\n" if $sftp->error;
$sftp->setcwd('/Returns');
@@ -118,6 +134,8 @@
close $fh;
}
+}
+
print STDERR "Finished!\n" if $opt_v;
=head1 NAME
More information about the freeside-commits
mailing list