[freeside-commits] freeside/FS/FS/pay_batch td_eft1464.pm, 1.1.2.2, 1.1.2.3
Mark Wells
mark at wavetail.420.am
Thu Dec 23 16:41:27 PST 2010
Update of /home/cvs/cvsroot/freeside/FS/FS/pay_batch
In directory wavetail.420.am:/tmp/cvs-serv4921/FS/FS/pay_batch
Modified Files:
Tag: FREESIDE_2_1_BRANCH
td_eft1464.pm
Log Message:
manual batch approval and TD EFT fixes, RT#10545
Index: td_eft1464.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/pay_batch/td_eft1464.pm,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
--- td_eft1464.pm 12 Nov 2010 23:34:12 -0000 1.1.2.2
+++ td_eft1464.pm 24 Dec 2010 00:41:25 -0000 1.1.2.3
@@ -49,84 +49,8 @@
$name = 'td_eft1464';
# TD Bank EFT 1464 Byte format
-%import_info = (
- 'filetype' => 'variable',
- 'parse' => \&parse,
- 'fields' => [ qw(
- status
- paid
- paybatchnum
- ) ],
- 'hook' => sub {
- my $hash = shift;
- $hash->{'_date'} = time;
- $hash->{'paid'} = sprintf('%.2f', $hash->{'paid'});
- },
- 'approved' => sub {
- my $hash = shift;
- $hash->{'status'} eq 'A'
- },
- 'declined' => sub {
- my $hash = shift;
- $hash->{'status'} eq 'D';
- },
- 'begin_condition' => sub {
- my $hash = shift;
- $hash->{'status'} eq 'A' or $hash->{'status'} eq 'D';
- },
- 'end_condition' => sub {
- my $hash = shift;
- $hash->{'status'} eq 'END'
- },
- 'close_condition' => sub {
- my $batch = shift;
- my @cust_pay_batch = qsearch('cust_pay_batch',
- { batchnum => $batch->batchnum }
- );
- return ( (grep {! length($_->status) } @cust_pay_batch) == 0 );
- },
-);
-
-sub parse {
- my ($batch, $line) = @_;
- $batch->setfield('import_state','') if !$batch->import_state;
- return 'END' if $batch->import_state eq 'END';
- if( $batch->import_state eq '212' ) {
- # APX212 fields:
- # trace number, trans type, amount, due date, routing number,
- # account number, xref number, return routing number and account
- # The only ones we take are amount and xref number.
- if( $line =~ /CREDITS\s+DEBITS/ ) {
- $batch->setfield('import_state', 'END');
- return 'END';
- }
- $line =~ /^\d{22} D\d{3} (.{14}) \d{5} \d{4}-\d{5} .{12} (.{19}).*$/
- or die "can't parse: $line";
- # strip leading zeroes/spaces from paybatchnum at this point
- return ('A', $1, sprintf('%u',$2));
- }
- elsif( $batch->import_state eq '234' ) {
- # APX234 fields:
- # payor name, xref number, due date, routing number, account number,
- # amount, reason for return
- if( $line =~ /TOTAL NUMBER -/ ) {
- $batch->setfield('import_state', 'END');
- return 'END';
- }
- $line =~ /^.{22} (.{19}) \d\d\/\d\d\/\d\d \d{9} .{12} (.{14}).*$/
- or die "can't parse: $line";
- return ('D', $2, sprintf('%u',$1));
- }
- else {
- if ( $line =~ /ITEM TRACE NUMBER/ ) {
- $batch->setfield('import_state','212');
- }
- elsif ( $line =~ /REASON FOR RETURN/ ) {
- $batch->setfield('import_state','234');
- } # else leave it undefined
- return 'HEADER';
- }
-}
+%import_info = ( filetype => 'NONE' );
+# just to suppress warning; importing this format is a fatal error
%export_info = (
init => sub {
@@ -152,13 +76,13 @@
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'} =
@@ -192,7 +116,7 @@
sprintf('%09u', $aba),
sprintf('%-12s', $account),
' ' x 22,
- ' ' x 3,
+ '0' x 3,
$opt{'shortname'},
sprintf('%-30s',
join(' ',
@@ -203,11 +127,12 @@
sprintf('%-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) = @_;
More information about the freeside-commits
mailing list