[freeside-commits] freeside/FS/FS/pay_batch paymentech.pm,1.6,1.7
Mark Wells
mark at wavetail.420.am
Mon Sep 20 22:54:26 PDT 2010
Update of /home/cvs/cvsroot/freeside/FS/FS/pay_batch
In directory wavetail.420.am:/tmp/cvs-serv26331/pay_batch
Modified Files:
paymentech.pm
Log Message:
store TxRefNum for Paymentech batch payments, RT#9962
Index: paymentech.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/pay_batch/paymentech.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -d -r1.6 -r1.7
--- paymentech.pm 19 Jan 2010 04:54:49 -0000 1.6
+++ paymentech.pm 21 Sep 2010 05:54:24 -0000 1.7
@@ -2,6 +2,7 @@
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';
@@ -12,6 +13,8 @@
my ($bin, $merchantID, $terminalID, $username);
$name = 'paymentech';
+my $gateway;
+
%import_info = (
filetype => 'XML',
xmlrow => [ qw(transResponse newOrderResp) ],
@@ -19,18 +22,42 @@
'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'}
More information about the freeside-commits
mailing list