1 package FS::pay_batch::paymentech;
4 use vars qw(@ISA %import_info %export_info $name);
6 use Date::Format 'time2str';
7 use Date::Parse 'str2time';
9 use XML::Simple qw(XMLin XMLout);
12 my ($bin, $merchantID, $terminalID, $username);
17 xmlrow => [ qw(transResponse newOrderResp) ],
29 my ($hash, $oldhash) = @_;
30 my ($mon, $day, $year, $hour, $min, $sec) =
31 $hash->{'_date'} =~ /^(..)(..)(....)(..)(..)(..)$/;
32 $hash->{'_date'} = timelocal($sec, $min, $hour, $day, $mon-1, $year);
33 $hash->{'paid'} = $oldhash->{'amount'};
35 'approved' => sub { my $hash = shift;
36 $hash->{'approvalStatus'}
38 'declined' => sub { my $hash = shift;
39 ! $hash->{'approvalStatus'}
44 'personal checking' => 'C',
45 'personal savings' => 'S',
46 'business checking' => 'X',
47 'business savings' => 'X',
53 ($bin, $terminalID, $merchantID, $username) =
54 $conf->config('batchconfig-paymentech');
56 # Here we do all the work in the header function.
58 my $pay_batch = shift;
59 my @cust_pay_batch = @{(shift)};
63 RequestCount => scalar(@cust_pay_batch),
66 fileDateTime => time2str('%Y%m%d%H%M%s',time),
67 fileID => 'batch'.time2str('%Y%m%d',time),
70 # $_ here refers to a cust_pay_batch record.
71 BatchRequestNo => $count++,
75 merchantID => $merchantID,
76 terminalID => $terminalID,
77 ($_->payby eq 'CARD') ? (
79 ccAccountNum => $_->payinfo,
80 ccExp => time2str('%y%m',str2time($_->exp)),
82 # ECP (electronic check) stuff
83 ecpCheckRT => ($_->payinfo =~ /@(\d+)/),
84 ecpCheckDDA => ($_->payinfo =~ /(\d+)@/),
85 ecpBankAcctType => $paytype{lc($_->cust_main->paytype)},
89 avsAddress1 => $_->address1,
90 avsAddress2 => $_->address2,
92 avsState => $_->state,
93 avsName => $_->first . ' ' . $_->last,
94 avsCountryCode => $_->country,
95 orderID => $_->paybatchnum,
96 amount => $_->amount * 100,
100 BatchRequestNo => $count++,
102 merchantID => $merchantID,
103 terminalID => $terminalID
106 }, KeepRoot => 1, NoAttr => 1);