1 package FS::pay_batch::PAP;
4 use vars qw(@ISA %import_info %export_info $name);
5 use Time::Local 'timelocal';
9 my ($origid, $datacenter, $typecode, $shortname, $longname, $mybank, $myacct);
14 'filetype' => 'fixed',
15 'formatre' => '^(.).{19}(.{4})(.{3})(.{10})(.{6})(.{9})(.{12}).{110}(.{19}).{71}$',
28 $hash->{'paid'} = sprintf("%.2f", $hash->{'paid'} / 100 );
29 my $tmpdate = timelocal( 0,0,1,1,0,substr($hash->{'_date'}, 0, 3)+2000);
30 $tmpdate += 86400*(substr($hash->{'_date'}, 3, 3)-1) ;
31 $hash->{'_date'} = $tmpdate;
32 $hash->{'payinfo'} = $hash->{'payinfo'} . '@' . $hash->{'bank'};
34 'approved' => sub { 1 },
35 'declined' => sub { 0 },
36 # Why does pay_batch.pm have approved_condition and declined_condition?
37 # It doesn't even try to handle the case of neither condition being met.
39 my( $hash, $total) = @_;
40 $total = sprintf("%.2f", $total);
41 my $batch_total = $hash->{'datacenter'}.$hash->{'paid'}.
42 substr($hash->{'_date'},0,1); # YUCK!
43 $batch_total = sprintf("%.2f", $batch_total / 100 );
44 return "Our total $total does not match bank total $batch_total!"
45 if $total != $batch_total;
48 'end_condition' => sub {
50 $hash->{recordtype} eq 'W';
63 $myacct) = $conf->config("batchconfig-PAP");
66 my $pay_batch = shift;
67 sprintf( "H%10sD%3s%06u%-15s%09u%-12s%04u%19s\n",
70 cdate($pay_batch->download),
78 my ($cust_pay_batch, $pay_batch) = @_;
79 my ($account, $aba) = split('@', $cust_pay_batch->payinfo);
80 sprintf( "D%-23s%06u%-19s%09u%-12s%010.0f\n",
81 $cust_pay_batch->payname,
82 cdate($pay_batch->download),
83 $cust_pay_batch->paybatchnum,
86 $cust_pay_batch->amount*100 );
89 my ($pay_batch, $batchcount, $batchtotal) = @_;
90 sprintf( "T%08u%014.0f%57s\n",
98 my (@date) = localtime(shift);
99 sprintf("%02d%02d%02d", $date[3], $date[4] + 1, $date[5] % 100);