[freeside-commits] freeside/FS/FS/pay_batch td_eftack264.pm, NONE, 1.1 td_eft1464.pm, 1.1, 1.2 td_eftret80.pm, NONE, 1.1
Mark Wells
mark at wavetail.420.am
Tue Nov 30 15:44:30 PST 2010
- Previous message: [freeside-commits] freeside/bin merge-referrals,1.1,1.1.2.1
- Next message: [freeside-commits] freeside/FS/FS Schema.pm, 1.249, 1.250 dsl_note.pm, 1.1, 1.2 geocode_Mixin.pm, 1.2, 1.3 qual.pm, 1.3, 1.4 svc_Common.pm, 1.59, 1.60 svc_dsl.pm, 1.6, 1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/FS/FS/pay_batch
In directory wavetail.420.am:/tmp/cvs-serv27155
Modified Files:
td_eft1464.pm
Added Files:
td_eftack264.pm td_eftret80.pm
Log Message:
TD EFT batch import formats, RT#10545
--- NEW FILE: td_eftack264.pm ---
package FS::pay_batch::td_eftack264;
use strict;
use vars qw(@ISA %import_info %export_info $name);
use Date::Format 'time2str';
use FS::Conf;
use FS::Record qw(qsearch);
=head1 NAME
td_eftack264 - TD Commercial Banking EFT 264 byte acknowledgement file
=cut
$name = 'td_eftack264';
%import_info = (
'filetype' => 'fixed',
'formatre' =>
'^(.)(.{9})(.{10})(.{4})(.{3})(.{10})(.{6})(.{9})(.{12}).{25}(.{15})(.{30})(.{30})(.{10})(.{19})(.{9})(.{12}).{15}.{22}(..)(.{11})$',
'fields' => [ qw(
recordtype
count
origid
fcn
cpacode
paid
duedate
bank
payinfo
shortname
custname
longname
origid2
paybatchnum
retbranch
retacct
usdcode
invfield
) ],
'hook' => sub {
my $hash = shift;
$hash->{'_date'} = time;
$hash->{'paid'} = sprintf('%.2f', $hash->{'paid'} / 100);
$hash->{'payinfo'} =~ s/^(\S+).*/$1/; # remove trailing spaces
$hash->{'payinfo'} = $hash->{'payinfo'} . '@' . $hash->{'bank'};
},
'approved' => sub { 0 },
'declined' => sub { 1 },
'skip_condition' => sub {
my $hash = shift;
$hash->{'recordtype'} ne 'D'; # Debit Detail record
},
'close_condition' => sub { 0 },
);
%export_info = ( filetype => 'NONE' );
1;
Index: td_eft1464.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/pay_batch/td_eft1464.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- td_eft1464.pm 12 Nov 2010 23:33:53 -0000 1.1
+++ td_eft1464.pm 30 Nov 2010 23:44:28 -0000 1.2
@@ -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 {
--- NEW FILE: td_eftret80.pm ---
package FS::pay_batch::td_eftret80;
use strict;
use vars qw(@ISA %import_info %export_info $name);
=head1 NAME
td_eftret80 - TD Commercial Banking EFT 80 byte returned item file
=cut
$name = 'td_eftret80';
%import_info = (
'filetype' => 'fixed',
'formatre' => '^(.)(.{20})(..)(.)(.{6})(.{19})(.{9})(.{12})(.{10})$',
'fields' => [ qw(
recordtype
custname
reason
verified
duedate
paybatchnum
bank
payinfo
amount
) ],
'hook' => sub {
my $hash = shift;
$hash->{'_date'} = time;
$hash->{'paid'} = sprintf('%.2f', $hash->{'paid'} / 100);
$hash->{'payinfo'} =~ s/^(\S+).*/$1/; # these often have trailing spaces
$hash->{'payinfo'} = $hash->{'payinfo'} . '@' . $hash->{'bank'};
},
'approved' => sub { 0 },
'declined' => sub { 1 },
'skip_condition' => sub {
my $hash = shift;
$hash->{'recordtype'} ne 'D'; #Detail record
},
'close_condition' => sub { 0 }, # never close just from this
);
%export_info = ( filetype => 'NONE' );
1;
- Previous message: [freeside-commits] freeside/bin merge-referrals,1.1,1.1.2.1
- Next message: [freeside-commits] freeside/FS/FS Schema.pm, 1.249, 1.250 dsl_note.pm, 1.1, 1.2 geocode_Mixin.pm, 1.2, 1.3 qual.pm, 1.3, 1.4 svc_Common.pm, 1.59, 1.60 svc_dsl.pm, 1.6, 1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list