X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpay_batch%2Ftd_eft1464.pm;h=93612f1ea794f5c6f7f7b2386506a26f621a0392;hb=389b6f1116c3309c2ee57a6c295ed1a793503095;hp=c3294d1612b4afb2a353d4a78f9f104d31920613;hpb=b638e75f063e231edaf3f3859d27f3981c12c999;p=freeside.git diff --git a/FS/FS/pay_batch/td_eft1464.pm b/FS/FS/pay_batch/td_eft1464.pm index c3294d161..93612f1ea 100644 --- a/FS/FS/pay_batch/td_eft1464.pm +++ b/FS/FS/pay_batch/td_eft1464.pm @@ -53,6 +53,7 @@ $name = 'td_eft1464'; # just to suppress warning; importing this format is a fatal error %export_info = ( + delimiter => '', init => sub { $conf = shift; @opt{ @@ -64,11 +65,11 @@ $name = 'td_eft1464'; 'retacct', 'cpacode', } = $conf->config("batchconfig-td_eft1464"); - $opt{'origid'} = sprintf('%-10s', $opt{'origid'}); - $opt{'shortname'} = sprintf('%-15s', $opt{'shortname'}); - $opt{'longname'} = sprintf('%-30s', $opt{'longname'}); - $opt{'retbranch'} = '0004'.sprintf('%5s',$opt{'retbranch'}); - $opt{'retacct'} = sprintf('%-11s', $opt{'retacct'}). ' '; + $opt{'origid'} = sprintf('%-10.10s', $opt{'origid'}); + $opt{'shortname'} = sprintf('%-15.15s', $opt{'shortname'}); + $opt{'longname'} = sprintf('%-30.30s', $opt{'longname'}); + $opt{'retbranch'} = '0004'.sprintf('%5.5s',$opt{'retbranch'}); + $opt{'retacct'} = sprintf('%-11.11s', $opt{'retacct'}). ' '; $i = 1; }, header => sub { @@ -76,13 +77,13 @@ $name = 'td_eft1464'; my @cust_pay_batch = @{(shift)}; my $time = $pay_batch->download || time; my $now = sprintf("%03u%03u", - (localtime(time))[5],#year since 1900 + (localtime(time))[5] % 100,#year since 1900 (localtime(time))[7]+1);#day of year # Request settlement the next day my $duedate = time+86400; $opt{'due'} = sprintf("%03u%03u", - (localtime($duedate))[5], + (localtime($duedate))[5] % 100, (localtime($duedate))[7]+1); $opt{'fcn'} = @@ -94,12 +95,15 @@ $name = 'td_eft1464'; $opt{'fcn'}, $now, $opt{'datacenter'}, - ' ' x 1429 #filler + ' ' x 1429, #filler ); }, row => sub { my ($cust_pay_batch, $pay_batch) = @_; my ($account, $aba) = split('@', $cust_pay_batch->payinfo); + if ( $aba =~ /^(\d+)\.(\d+)$/ ) { #branch.route + $aba = $2.$1; #routebranch + } $i++; # The 1464 byte format supports up to 5 payments per line, # but we're only going to send 1. @@ -114,24 +118,25 @@ $name = 'td_eft1464'; sprintf('%010.0f', $cust_pay_batch->amount*100), $opt{'due'}, #due date...? XXX sprintf('%09u', $aba), - sprintf('%-12s', $account), - ' ' x 22, - ' ' x 3, + sprintf('%-12.12s', $account), + '0' x 22, + '0' x 3, $opt{'shortname'}, - sprintf('%-30s', + sprintf('%-30.30s', join(' ', $cust_pay_batch->first, $cust_pay_batch->last) ), $opt{'longname'}, $opt{'origid'}, - sprintf('%-19s', $cust_pay_batch->paybatchnum), # originator reference num + sprintf('%-19.19s', $cust_pay_batch->paybatchnum), # originator reference num $opt{'retbranch'}, $opt{'retacct'}, + ' ' x 15, ' ' x 22, ' ' x 2, '0' x 11, ); - return $control . $payment . (' ' x 720); + return sprintf('%-1464s',$control . $payment) ; }, footer => sub { my ($pay_batch, $batchcount, $batchtotal) = @_; @@ -149,5 +154,14 @@ $name = 'td_eft1464'; }, ); +sub _upgrade_gateway { + my $conf = FS::Conf->new; + my @batchconfig = $conf->config('batchconfig-td_eft1464'); + my %options; + @options{ qw(originator datacentre short_name long_name return_branch + return_account cpa_code) } = @batchconfig; + ( 'TD_EFT', %options ); +} + 1;