diff options
author | Mark Wells <mark@freeside.biz> | 2012-10-19 12:51:06 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2012-10-19 12:51:06 -0700 |
commit | 744b17e5c9a5de68ad8a24b7a35449b535f02731 (patch) | |
tree | 341a92bd2b7b20aaaa4328391c8ea8bda78beff8 /FS/FS/pay_batch | |
parent | a056cbfc08fa8491aa3c995d7053ed4574b18c50 (diff) |
recurring indicator for Paymentech batches, #19571
Diffstat (limited to 'FS/FS/pay_batch')
-rw-r--r-- | FS/FS/pay_batch/paymentech.pm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/FS/FS/pay_batch/paymentech.pm b/FS/FS/pay_batch/paymentech.pm index 2ac5a66..133f8f1 100644 --- a/FS/FS/pay_batch/paymentech.pm +++ b/FS/FS/pay_batch/paymentech.pm @@ -10,7 +10,7 @@ use Tie::IxHash; use FS::Conf; my $conf; -my ($bin, $merchantID, $terminalID, $username); +my ($bin, $merchantID, $terminalID, $username, $password, $with_recurringInd); $name = 'paymentech'; my $gateway; @@ -80,7 +80,7 @@ my %paytype = ( eval "use XML::Writer"; die $@ if $@; my $conf = shift; - ($bin, $terminalID, $merchantID, $username) = + ($bin, $terminalID, $merchantID, $username, $password, $with_recurringInd) = $conf->config('batchconfig-paymentech'); }, # Here we do all the work in the header function. @@ -99,6 +99,7 @@ my %paytype = ( foreach (@cust_pay_batch) { $xml->startTag('newOrder', BatchRequestNo => $count++); + my $status = $_->cust_main->status; tie my %order, 'Tie::IxHash', ( industryType => 'EC', transType => 'AC', @@ -124,6 +125,13 @@ my %paytype = ( orderID => $_->paybatchnum, amount => $_->amount * 100, ); + # only do this if recurringInd is enabled in config, + # and the customer has at least one non-canceled recurring package + if ( $with_recurringInd and $status =~ /^active|suspended|ordered$/ ) { + # then send RF if this is the first payment on this payinfo, + # RS otherwise. + $order{'recurringInd'} = $_->payinfo_used ? 'RS' : 'RF'; + } foreach my $key (keys %order) { $xml->dataElement($key, $order{$key}) } |