diff options
Diffstat (limited to 'FS/FS/pay_batch')
-rw-r--r-- | FS/FS/pay_batch/BoM.pm | 73 | ||||
-rw-r--r-- | FS/FS/pay_batch/PAP.pm | 103 | ||||
-rw-r--r-- | FS/FS/pay_batch/RBC.pm | 143 | ||||
-rw-r--r-- | FS/FS/pay_batch/ach_spiritone.pm | 65 | ||||
-rw-r--r-- | FS/FS/pay_batch/chase_canada.pm | 89 | ||||
-rw-r--r-- | FS/FS/pay_batch/paymentech.pm | 144 | ||||
-rw-r--r-- | FS/FS/pay_batch/td_canada_trust.pm | 90 | ||||
-rw-r--r-- | FS/FS/pay_batch/td_eft1464.pm | 156 | ||||
-rw-r--r-- | FS/FS/pay_batch/td_eftack264.pm | 59 | ||||
-rw-r--r-- | FS/FS/pay_batch/td_eftret80.pm | 46 |
10 files changed, 0 insertions, 968 deletions
diff --git a/FS/FS/pay_batch/BoM.pm b/FS/FS/pay_batch/BoM.pm deleted file mode 100644 index 7bfc22a64..000000000 --- a/FS/FS/pay_batch/BoM.pm +++ /dev/null @@ -1,73 +0,0 @@ -package FS::pay_batch::BoM; - -use strict; -use vars qw(@ISA %import_info %export_info $name); -use Time::Local 'timelocal'; -use FS::Conf; - -my $conf; -my ($origid, $datacenter, $typecode, $shortname, $longname, $mybank, $myacct); - -$name = 'BoM'; - -%import_info = ( - 'filetype' => 'CSV', - 'fields' => [], - 'hook' => sub { die "Can't import BoM" }, - 'approved' => sub { 1 }, - 'declined' => sub { 0 }, -); - -%export_info = ( - init => sub { - $conf = shift; - ($origid, - $datacenter, - $typecode, - $shortname, - $longname, - $mybank, - $myacct) = $conf->config("batchconfig-BoM"); - }, - header => sub { - my $pay_batch = shift; - sprintf( "A%10s%04u%06u%05u%54s\n", - $origid, - $pay_batch->batchnum, - jdate($pay_batch->download), - $datacenter, - "") . - sprintf( "XD%03u%06u%-15s%-30s%09u%-12s \n", - $typecode, - jdate($pay_batch->download), - $shortname, - $longname, - $mybank, - $myacct); - }, - row => sub { - my ($cust_pay_batch, $pay_batch) = @_; - my ($account, $aba) = split('@', $cust_pay_batch->payinfo); - sprintf( "D%010.0f%09u%-12s%-29s%-19s\n", - $cust_pay_batch->amount * 100, - $aba, - $account, - $cust_pay_batch->payname, - $cust_pay_batch->paybatchnum - ); - }, - footer => sub { - my ($pay_batch, $batchcount, $batchtotal) = @_; - sprintf( "YD%08u%014.0f%56s\n", $batchcount, $batchtotal*100, ""). - sprintf( "Z%014u%04u%014u%05u%41s\n", - $batchtotal*100, $batchcount, "0", "0", ""); - }, -); - -sub jdate { - my (@date) = localtime(shift); - sprintf("%03d%03d", $date[5] % 100, $date[7] + 1); -} - -1; - diff --git a/FS/FS/pay_batch/PAP.pm b/FS/FS/pay_batch/PAP.pm deleted file mode 100644 index 432ef07ed..000000000 --- a/FS/FS/pay_batch/PAP.pm +++ /dev/null @@ -1,103 +0,0 @@ -package FS::pay_batch::PAP; - -use strict; -use vars qw(@ISA %import_info %export_info $name); -use Time::Local 'timelocal'; -use FS::Conf; - -my $conf; -my ($origid, $datacenter, $typecode, $shortname, $longname, $mybank, $myacct); - -$name = 'PAP'; - -%import_info = ( - 'filetype' => 'fixed', - 'formatre' => '^(.).{19}(.{4})(.{3})(.{10})(.{6})(.{9})(.{12}).{110}(.{19}).{71}$', - 'fields' => [ - 'recordtype', - 'batchnum', - 'datacenter', - 'paid', - '_date', - 'bank', - 'payinfo', - 'paybatchnum', - ], - 'hook' => sub { - my $hash = shift; - $hash->{'paid'} = sprintf("%.2f", $hash->{'paid'} / 100 ); - my $tmpdate = timelocal( 0,0,1,1,0,substr($hash->{'_date'}, 0, 3)+2000); - $tmpdate += 86400*(substr($hash->{'_date'}, 3, 3)-1) ; - $hash->{'_date'} = $tmpdate; - $hash->{'payinfo'} = $hash->{'payinfo'} . '@' . $hash->{'bank'}; - }, - 'approved' => sub { 1 }, - 'declined' => sub { 0 }, -# Why does pay_batch.pm have approved_condition and declined_condition? -# It doesn't even try to handle the case of neither condition being met. - 'end_hook' => sub { - my( $hash, $total) = @_; - $total = sprintf("%.2f", $total); - my $batch_total = $hash->{'datacenter'}.$hash->{'paid'}. - substr($hash->{'_date'},0,1); # YUCK! - $batch_total = sprintf("%.2f", $batch_total / 100 ); - return "Our total $total does not match bank total $batch_total!" - if $total != $batch_total; - ''; - }, - 'end_condition' => sub { - my $hash = shift; - $hash->{recordtype} eq 'W'; - }, -); - -%export_info = ( - init => sub { - $conf = shift; - ($origid, - $datacenter, - $typecode, - $shortname, - $longname, - $mybank, - $myacct) = $conf->config("batchconfig-PAP"); - }, - header => sub { - my $pay_batch = shift; - sprintf( "H%10sD%3s%06u%-15s%09u%-12s%04u%19s\n", - $origid, - $typecode, - cdate($pay_batch->download), - $shortname, - $mybank, - $myacct, - $pay_batch->batchnum, - "" ) - }, - row => sub { - my ($cust_pay_batch, $pay_batch) = @_; - my ($account, $aba) = split('@', $cust_pay_batch->payinfo); - sprintf( "D%-23s%06u%-19s%09u%-12s%010.0f\n", - $cust_pay_batch->payname, - cdate($pay_batch->download), - $cust_pay_batch->paybatchnum, - $aba, - $account, - $cust_pay_batch->amount*100 ); - }, - footer => sub { - my ($pay_batch, $batchcount, $batchtotal) = @_; - sprintf( "T%08u%014.0f%57s\n", - $batchcount, - $batchtotal*100, - "" ); - }, -); - -sub cdate { - my (@date) = localtime(shift); - sprintf("%02d%02d%02d", $date[3], $date[4] + 1, $date[5] % 100); -} - -1; - diff --git a/FS/FS/pay_batch/RBC.pm b/FS/FS/pay_batch/RBC.pm deleted file mode 100644 index 6ee5771fe..000000000 --- a/FS/FS/pay_batch/RBC.pm +++ /dev/null @@ -1,143 +0,0 @@ -package FS::pay_batch::RBC; - -use strict; -use vars qw(@ISA %import_info %export_info $name); -use Date::Format 'time2str'; -use FS::Conf; - -my $conf; -my ($client_num, $shortname, $longname, $trans_code, $i); - -$name = 'RBC'; -# Royal Bank of Canada ACH Direct Payments Service - -%import_info = ( - 'filetype' => 'fixed', - 'formatre' => - '^(.).{18}(.{4}).{3}(.).{11}(.{19}).{6}(.{30}).{17}(.{9})(.{18}).{6}(.{14}).{23}(.).{9}\r?$', - 'fields' => [ qw( - recordtype - batchnum - subtype - paybatchnum - custname - bank - payinfo - paid - status - ) ], - 'hook' => sub { - my $hash = shift; - $hash->{'paid'} = sprintf("%.2f", $hash->{'paid'} / 100 ); - $hash->{'_date'} = time; - $hash->{'payinfo'} =~ s/^(\S+).*/$1/; # these often have trailing spaces - $hash->{'payinfo'} = $hash->{'payinfo'} . '@' . $hash->{'bank'}; - }, - 'approved' => sub { - my $hash = shift; - $hash->{'status'} eq ' ' - }, - 'declined' => sub { - my $hash = shift; - grep { $hash->{'status'} eq $_ } ('E', 'R', 'U', 'T'); - }, - 'begin_condition' => sub { - my $hash = shift; - $hash->{recordtype} eq '1'; # Detail Record - }, - 'end_hook' => sub { - my( $hash, $total, $line ) = @_; - $total = sprintf("%.2f", $total); - # We assume here that this is an 'All Records' or 'Input Records' - # report. - my $batch_total = sprintf("%.2f", substr($line, 59, 18) / 100); - return "Our total $total does not match bank total $batch_total!" - if $total != $batch_total; - ''; - }, - 'end_condition' => sub { - my $hash = shift; - $hash->{recordtype} eq '4'; # Client Trailer Record - }, - 'skip_condition' => sub { - my $hash = shift; - $hash->{'subtype'} ne '0'; - }, -); - -%export_info = ( - init => sub { - $conf = shift; - ($client_num, - $shortname, - $longname, - $trans_code, - ) = $conf->config("batchconfig-RBC"); - $i = 1; - }, - header => sub { - my $pay_batch = shift; - '$$AAPASTD0152[PROD[NL$$'."\n". - '000001'. - 'A'. - 'HDR'. - sprintf("%10s", $client_num). - sprintf("%-30s", $longname). - sprintf("%04u", $pay_batch->batchnum). - time2str("%Y%j", $pay_batch->download). - 'CAD'. - '1'. - ' ' x 87 # filler/reserved fields - ; - }, - row => sub { - my ($cust_pay_batch, $pay_batch) = @_; - my ($account, $aba) = split('@', $cust_pay_batch->payinfo); - $i++; - sprintf("%06u", $i). - 'D'. - sprintf("%3s",$trans_code). - sprintf("%10s",$client_num). - ' '. - sprintf("%-19s", $cust_pay_batch->paybatchnum). - '00'. - sprintf("%09u", $aba). - sprintf("%-18s", $account). - ' '. - sprintf("%010.0f",$cust_pay_batch->amount*100). - ' '. - time2str("%Y%j", $pay_batch->download). - sprintf("%-30s", $cust_pay_batch->cust_main->first . ' ' . - $cust_pay_batch->cust_main->last). - 'E'. # English - ' '. - sprintf("%-15s", $shortname). - 'CAD'. - ' '. - 'CAN'. - ' '. - 'N' # no customer optional information follows - ; -# Note: IAT Address Information and Remittance records are not -# supported. This means you probably can't process payments -# destined to U.S. bank accounts. If you need this feature, contact -# Freeside Internet Services. - }, - footer => sub { - my ($pay_batch, $batchcount, $batchtotal) = @_; - sprintf("%06u", $i + 1). - 'Z'. - 'TRL'. - sprintf("%10s", $client_num). - ' ' x 20 . - sprintf("%06u", $batchcount). - sprintf("%014.0f", $batchtotal*100). - '00' . - '000000' . # total number of customer information records - ' ' x 84 - ; - }, -); - -1; - diff --git a/FS/FS/pay_batch/ach_spiritone.pm b/FS/FS/pay_batch/ach_spiritone.pm deleted file mode 100644 index bd3bb14c3..000000000 --- a/FS/FS/pay_batch/ach_spiritone.pm +++ /dev/null @@ -1,65 +0,0 @@ -package FS::pay_batch::ach_spiritone; - -use strict; -use vars qw(@ISA %import_info %export_info $name); -use Time::Local 'timelocal'; -use FS::Conf; -use File::Temp; - -my $conf; -my ($origid, $datacenter, $typecode, $shortname, $longname, $mybank, $myacct); - -$name = 'ach-spiritone'; # note spelling - -%import_info = ( - 'filetype' => 'CSV', - 'fields' => [ - '', #name - 'paybatchnum', - 'aba', - 'payinfo', - '', #transaction type - 'paid', - '', #default transaction type - '', #default amount - ], - 'hook' => sub { - my $hash = shift; - $hash->{'_date'} = time; - $hash->{'payinfo'} = $hash->{'payinfo'} . '@' . $hash->{'aba'}; - }, - 'approved' => sub { 1 }, - 'declined' => sub { 0 }, -); - -%export_info = ( -# This is the simplest case. - row => sub { - my ($cust_pay_batch, $pay_batch) = @_; - my ($account, $aba) = split('@', $cust_pay_batch->payinfo); - my $payname = $cust_pay_batch->first . ' ' . $cust_pay_batch->last; - $payname =~ tr/",/ /; - qq!"$payname","!.$cust_pay_batch->paybatchnum. - qq!","$aba","$account","27","!.$cust_pay_batch->amount. - qq!","27","0.00"!; #" - }, - autopost => sub { - my ($pay_batch, $batch) = @_; - my $dir = $FS::UID::conf_dir. "/cache.". $FS::UID::datasrc; - my $fh = new File::Temp( - TEMPLATE => 'paybatch.'. $pay_batch->batchnum .'.XXXXXXXX', - DIR => $dir, - ) or return "can't open temp file: $!\n"; - - print $fh $batch; - seek $fh, 0, 0; - - my $error = $pay_batch->import_results( 'filehandle' => $fh, - 'format' => $name, - ); - return $error if $error; - }, -); - -1; - diff --git a/FS/FS/pay_batch/chase_canada.pm b/FS/FS/pay_batch/chase_canada.pm deleted file mode 100644 index 5d8437dba..000000000 --- a/FS/FS/pay_batch/chase_canada.pm +++ /dev/null @@ -1,89 +0,0 @@ -package FS::pay_batch::chase_canada; - -use strict; -use vars qw(@ISA %import_info %export_info $name); -use Time::Local 'timelocal'; -use FS::Conf; - -my $conf; -my $origid; - -$name = 'csv-chase_canada-E-xactBatch'; - -%import_info = ( - 'filetype' => 'CSV', - 'fields' => [ - '', - '', - '', - 'paid', - 'auth', - 'payinfo', - '', - '', - 'bankcode', - 'bankmess', - 'etgcode', - 'etgmess', - '', - 'paybatchnum', - '', - 'result', - ], - 'hook' => sub { - my $hash = shift; - my $cpb = shift; - $hash->{'paid'} = sprintf("%.2f", $hash->{'paid'} ); - $hash->{'_date'} = time; - $hash->{'payinfo'} = $cpb->{'payinfo'} - if( substr($hash->{'payinfo'}, -4) eq substr($cpb->{'payinfo'}, -4) ); - }, - 'approved' => sub { - my $hash = shift; - $hash->{'etgcode'} eq '00' && $hash->{'result'} eq 'Approved'; - }, - 'declined' => sub { - my $hash = shift; - $hash->{'etgcode'} ne '00' || $hash->{'result'} eq 'Declined'; - }, -); - -%export_info = ( - init => sub { - $conf = shift; - ($origid) = $conf->config("batchconfig-$name"); - }, - header => sub { - my $pay_batch = shift; - sprintf( '$$E-xactBatchFileV1.0$$%s:%03u$$%s', - sdate($pay_batch->download), - $pay_batch->batchnum, - $origid ); - }, - row => sub { - my ($cust_pay_batch, $pay_batch) = @_; - my $payname = $cust_pay_batch->payname; - $payname =~ tr/",/ /; - - join(',', - $cust_pay_batch->paybatchnum, - $cust_pay_batch->custnum, - $cust_pay_batch->invnum, - qq!"$payname"!, - '00', - $cust_pay_batch->payinfo, - $cust_pay_batch->amount, - $cust_pay_batch->expmmyy, - '', - '' - ); - }, - # no footer -); - -sub sdate { - my (@date) = localtime(shift); - sprintf('%02d/%02d/%02d', $date[5] % 100, $date[4] + 1, $date[3]); -} - -1; diff --git a/FS/FS/pay_batch/paymentech.pm b/FS/FS/pay_batch/paymentech.pm deleted file mode 100644 index f22a80f89..000000000 --- a/FS/FS/pay_batch/paymentech.pm +++ /dev/null @@ -1,144 +0,0 @@ -package FS::pay_batch::paymentech; - -use strict; -use vars qw(@ISA %import_info %export_info $name); -use FS::Record 'qsearchs'; -use Time::Local; -use Date::Format 'time2str'; -use Date::Parse 'str2time'; -use Tie::IxHash; -use FS::Conf; - -my $conf; -my ($bin, $merchantID, $terminalID, $username); -$name = 'paymentech'; - -my $gateway; - -%import_info = ( - filetype => 'XML', - xmlrow => [ qw(transResponse newOrderResp) ], - fields => [ - 'paybatchnum', - '_date', - 'approvalStatus', - 'order_number', - 'authorization', - ], - xmlkeys => [ - 'orderID', - 'respDateTime', - 'approvalStatus', - 'txRefNum', - 'authorizationCode', - ], - 'hook' => sub { - if ( !$gateway ) { - # find a gateway configuration that has the same merchantID - # as the batch config, if there is one. If not, leave - # gateway out entirely. - my $merchant = (FS::Conf->new->config('batchconfig-paymentech'))[2]; - my $g = qsearchs({ - 'table' => 'payment_gateway', - 'addl_from' => ' JOIN payment_gateway_option USING (gatewaynum) ', - 'hashref' => { disabled => '', - optionname => 'merchant_id', - optionvalue => $merchant, - }, - }); - $gateway = ($g ? $g->gatewaynum . '-' : '') . 'PaymenTech'; - } - my ($hash, $oldhash) = @_; - my ($mon, $day, $year, $hour, $min, $sec) = - $hash->{'_date'} =~ /^(..)(..)(....)(..)(..)(..)$/; - $hash->{'_date'} = timelocal($sec, $min, $hour, $day, $mon-1, $year); - $hash->{'paid'} = $oldhash->{'amount'}; - $hash->{'paybatch'} = join(':', - $gateway, - $hash->{'authorization'}, - $hash->{'order_number'}, - ); - }, - 'approved' => sub { my $hash = shift; - $hash->{'approvalStatus'} - }, - 'declined' => sub { my $hash = shift; - ! $hash->{'approvalStatus'} - }, -); - -my %paytype = ( - 'personal checking' => 'C', - 'personal savings' => 'S', - 'business checking' => 'X', - 'business savings' => 'X', - ); - -%export_info = ( - init => sub { -# Load this at run time - eval "use XML::Writer"; - die $@ if $@; - my $conf = shift; - ($bin, $terminalID, $merchantID, $username) = - $conf->config('batchconfig-paymentech'); - }, -# Here we do all the work in the header function. - header => sub { - my $pay_batch = shift; - my @cust_pay_batch = @{(shift)}; - my $count = 1; - my $output; - my $xml = new XML::Writer(OUTPUT => \$output, DATA_MODE => 1, DATA_INDENT => 2); - $xml->startTag('transRequest', RequestCount => scalar(@cust_pay_batch) + 1); - $xml->startTag('batchFileID'); - $xml->dataElement(userID => $username); - $xml->dataElement(fileDateTime => time2str('%Y%m%d%H%M%S', time)); - $xml->dataElement(fileID => 'FILEID'); - $xml->endTag('batchFileID'); - - foreach (@cust_pay_batch) { - $xml->startTag('newOrder', BatchRequestNo => $count++); - tie my %order, 'Tie::IxHash', ( - industryType => 'EC', - transType => 'AC', - bin => $bin, - merchantID => $merchantID, - terminalID => $terminalID, - ($_->payby eq 'CARD') ? ( - ccAccountNum => $_->payinfo, - ccExp => $_->expmmyy, - ) : ( - ecpCheckRT => ($_->payinfo =~ /@(\d+)/), - ecpCheckDDA => ($_->payinfo =~ /(\d+)@/), - ecpBankAcctType => $paytype{lc($_->cust_main->paytype)}, - ecpDelvMethod => 'A', - ), - avsZip => substr($_->zip, 0, 10), - avsAddress1 => substr($_->address1, 0, 30), - avsAddress2 => substr($_->address2, 0, 30), - avsCity => substr($_->city, 0, 20), - avsState => $_->state, - avsName => substr($_->first . ' ' . $_->last, 0, 30), - avsCountryCode => $_->country, - orderID => $_->paybatchnum, - amount => $_->amount * 100, - ); - foreach my $key (keys %order) { - $xml->dataElement($key, $order{$key}) - } - $xml->endTag('newOrder'); - } - $xml->startTag('endOfDay', BatchRequestNo => $count); - $xml->dataElement(bin => $bin); - $xml->dataElement(merchantID => $merchantID); - $xml->dataElement(terminalID => $terminalID); - $xml->endTag('endOfDay'); - $xml->endTag('transRequest'); - return $output; - }, - row => sub {}, -); - -1; - diff --git a/FS/FS/pay_batch/td_canada_trust.pm b/FS/FS/pay_batch/td_canada_trust.pm deleted file mode 100644 index e80441ef8..000000000 --- a/FS/FS/pay_batch/td_canada_trust.pm +++ /dev/null @@ -1,90 +0,0 @@ -package FS::pay_batch::td_canada_trust; - -# Formerly known as csv-td_canada_trust-merchant_pc_batch, -# which I'm sure we can all agree is both a terrible name -# and an illegal Perl identifier. - -use strict; -use vars qw(@ISA %import_info %export_info $name); -use Time::Local 'timelocal'; -use FS::Conf; - -my $conf; -my ($origid, $datacenter, $typecode, $shortname, $longname, $mybank, $myacct); - -$name = 'csv-td_canada_trust-merchant_pc_batch'; - -%import_info = ( - 'filetype' => 'CSV', - 'fields' => [ - 'paybatchnum', - 'paid', - '', # card type - '_date', - 'time', - 'payinfo', - '', # expiry date - '', # auth number - 'type', # transaction type - 'result', # processing result - '', # terminal ID - ], - 'hook' => sub { - my $hash = shift; - my $date = $hash->{'_date'}; - my $time = $hash->{'time'}; - $hash->{'paid'} = sprintf("%.2f", $hash->{'paid'} / 100); - $hash->{'_date'} = timelocal( substr($time, 4, 2), - substr($time, 2, 2), - substr($time, 0, 2), - substr($date, 6, 2), - substr($date, 4, 2)-1, - substr($date, 0, 4)-1900 ); - }, - 'approved' => sub { - my $hash = shift; - $hash->{'type'} eq '0' && $hash->{'result'} == 3 - }, - 'declined' => sub { - my $hash = shift; - $hash->{'type'} eq '0' && ( $hash->{'result'} == 4 - || $hash->{'result'} == 5 ) - }, - 'end_condition' => sub { - my $hash = shift; - $hash->{'type'} eq '0BC'; - }, - 'end_hook' => sub { - my ($hash, $total) = @_; - $total = sprintf("%.2f", $total); - my $batch_total = sprintf("%.2f", $hash->{'paybatchnum'} / 100); - return "Our total $total does not match bank total $batch_total!" - if $total != $batch_total; - }, -); - -%export_info = ( - init => sub { - $conf = shift; - }, - # no header - row => sub { - my ($cust_pay_batch, $pay_batch) = @_; - - return join(',', - '', - '', - '', - '', - $cust_pay_batch->payinfo, - $cust_pay_batch->expmmyy, - $cust_pay_batch->amount, - $cust_pay_batch->paybatchnum - ); - }, -# no footer -); - - -1; - diff --git a/FS/FS/pay_batch/td_eft1464.pm b/FS/FS/pay_batch/td_eft1464.pm deleted file mode 100644 index 7f58ab5f7..000000000 --- a/FS/FS/pay_batch/td_eft1464.pm +++ /dev/null @@ -1,156 +0,0 @@ -package FS::pay_batch::td_eft1464; - -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_eft1464 - TD Commercial Banking EFT1464 format - -=head1 CONFIGURATION - -The Freeside option 'batchconfig-td_eft1464' must be set -with the following values on separate lines: - -=over 4 - -=item Originator ID - -=item TD Datacenter Location - -00400 - Vancouver -00410 - Montreal -00420 - Toronto -00430 - Halifax -00470 - Winnipeg -00490 - Calgary - -=item Short Name - -=item Long Name - -=item Returned Payment Branch (5 digits) - -=item Returned Payment Account - -=item Transaction Type Code - defaults to "437" (Internet access) - -=back - -=cut - -my $conf; -my %opt; -my $i; - -$name = 'td_eft1464'; -# TD Bank EFT 1464 Byte format - -%import_info = ( filetype => 'NONE' ); -# just to suppress warning; importing this format is a fatal error - -%export_info = ( - init => sub { - $conf = shift; - @opt{ - 'origid', - 'datacenter', - 'shortname', - 'longname', - 'retbranch', - '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'}). ' '; - $i = 1; - }, - header => sub { - my $pay_batch = shift; - my @cust_pay_batch = @{(shift)}; - my $time = $pay_batch->download || time; - my $now = sprintf("%03u%03u", - (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] % 100, - (localtime($duedate))[7]+1); - - $opt{'fcn'} = - sprintf('%04u', ($pay_batch->batchnum % 9999)+1), # file creation number - join('', - 'A', #record type - sprintf('%09u', 1), #record number - $opt{'origid'}, - $opt{'fcn'}, - $now, - $opt{'datacenter'}, - ' ' x 1429, #filler - "\r" - ); - }, - row => sub { - my ($cust_pay_batch, $pay_batch) = @_; - my ($account, $aba) = split('@', $cust_pay_batch->payinfo); - $i++; - # The 1464 byte format supports up to 5 payments per line, - # but we're only going to send 1. - my $control = join('', - 'D', # for 'debit' - sprintf("%09u", $i), #record number - $opt{'origid'}, - $opt{'fcn'}, - ); - my $payment = join('', - $opt{'cpacode'} || 437, # CPA code, defaults to "Internet access" - sprintf('%010.0f', $cust_pay_batch->amount*100), - $opt{'due'}, #due date...? XXX - sprintf('%09u', $aba), - sprintf('%-12s', $account), - ' ' x 22, - '0' x 3, - $opt{'shortname'}, - sprintf('%-30s', - join(' ', - $cust_pay_batch->first, $cust_pay_batch->last) - ), - $opt{'longname'}, - $opt{'origid'}, - sprintf('%-19s', $cust_pay_batch->paybatchnum), # originator reference num - $opt{'retbranch'}, - $opt{'retacct'}, - ' ' x 15, - ' ' x 22, - ' ' x 2, - '0' x 11, - ); - return sprintf('%-1464s',$control . $payment) . "\r"; - }, - footer => sub { - my ($pay_batch, $batchcount, $batchtotal) = @_; - join('', - 'Z', - sprintf('%09u', $batchcount + 2), - $opt{'origid'}, - $opt{'fcn'}, - sprintf('%014.0f', $batchtotal*100), # total of debit txns - sprintf('%08u', $batchcount), # number of debit txns - '0' x 14, # total of credit txns - '0' x 8, # total of credit txns - ' ' x 1396, - "\r" - ) - }, -); - -1; - diff --git a/FS/FS/pay_batch/td_eftack264.pm b/FS/FS/pay_batch/td_eftack264.pm deleted file mode 100644 index 9ab16ef2d..000000000 --- a/FS/FS/pay_batch/td_eftack264.pm +++ /dev/null @@ -1,59 +0,0 @@ -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 deleted file mode 100644 index b8c5e27dc..000000000 --- a/FS/FS/pay_batch/td_eftret80.pm +++ /dev/null @@ -1,46 +0,0 @@ -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; - |