From 7b512e03e15ee791db801f59cdddb76052224126 Mon Sep 17 00:00:00 2001 From: mark Date: Thu, 20 Jan 2011 00:31:34 +0000 Subject: [PATCH] TD EFT batch import formats, RT#10545 --- FS/FS/pay_batch/td_eftack264.pm | 59 +++++++++++++++++++++++++++++++++++++++++ FS/FS/pay_batch/td_eftret80.pm | 46 ++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 FS/FS/pay_batch/td_eftack264.pm create mode 100644 FS/FS/pay_batch/td_eftret80.pm diff --git a/FS/FS/pay_batch/td_eftack264.pm b/FS/FS/pay_batch/td_eftack264.pm new file mode 100644 index 000000000..9ab16ef2d --- /dev/null +++ b/FS/FS/pay_batch/td_eftack264.pm @@ -0,0 +1,59 @@ +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; + diff --git a/FS/FS/pay_batch/td_eftret80.pm b/FS/FS/pay_batch/td_eftret80.pm new file mode 100644 index 000000000..b8c5e27dc --- /dev/null +++ b/FS/FS/pay_batch/td_eftret80.pm @@ -0,0 +1,46 @@ +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; + -- 2.11.0