1 package FS::pay_batch::td_canada_trust;
3 # Formerly known as csv-td_canada_trust-merchant_pc_batch,
4 # which I'm sure we can all agree is both a terrible name
5 # and an illegal Perl identifier.
8 use vars qw(@ISA %import_info %export_info $name);
9 use Time::Local 'timelocal';
13 my ($origid, $datacenter, $typecode, $shortname, $longname, $mybank, $myacct);
15 $name = 'csv-td_canada_trust-merchant_pc_batch';
28 'type', # transaction type
29 'result', # processing result
34 my $date = $hash->{'_date'};
35 my $time = $hash->{'time'};
36 $hash->{'paid'} = sprintf("%.2f", $hash->{'paid'} / 100);
37 $hash->{'_date'} = timelocal( substr($time, 4, 2),
41 substr($date, 4, 2)-1,
42 substr($date, 0, 4)-1900 );
46 $hash->{'type'} eq '0' && $hash->{'result'} == 3
50 $hash->{'type'} eq '0' && ( $hash->{'result'} == 4
51 || $hash->{'result'} == 5 )
53 'end_condition' => sub {
55 $hash->{'type'} eq '0BC';
58 my ($hash, $total) = @_;
59 $total = sprintf("%.2f", $total);
60 my $batch_total = sprintf("%.2f", $hash->{'paybatchnum'} / 100);
61 return "Our total $total does not match bank total $batch_total!"
62 if $total != $batch_total;
72 my ($cust_pay_batch, $pay_batch) = @_;
79 $cust_pay_batch->payinfo,
80 $cust_pay_batch->expmmyy,
81 $cust_pay_batch->amount,
82 $cust_pay_batch->paybatchnum