don't send countries other than US/CA/GB/UK to paymentech, RT#20222
authorIvan Kohler <ivan@freeside.biz>
Tue, 13 Nov 2012 07:54:48 +0000 (23:54 -0800)
committerIvan Kohler <ivan@freeside.biz>
Tue, 13 Nov 2012 07:54:48 +0000 (23:54 -0800)
Changes
Paymentech.pm

diff --git a/Changes b/Changes
index a91e799..0ea0bd8 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,4 +1,7 @@
 Revision history for Business-BatchPayment-Paymentech
 
+0.02    unreleased
+        - fix avsCountryCode to not pass non-Paymentech countries
+
 0.01    unreleased
 
index 7fa2e44..09b5672 100644 (file)
@@ -3,7 +3,7 @@ package Business::BatchPayment::Paymentech;
 use 5.006;
 use strict;
 use warnings;
-our $VERSION = '0.01';
+our $VERSION = '0.02';
 
 =head1 NAME
 
@@ -91,6 +91,8 @@ my %BankAcctType = (
   'business savings'  => 'X',
 );
 
+my %paymentech_countries = map { $_ => 1 } qw( US CA GB UK );
+
 sub default_transport {
   my $self = shift;
   Business::BatchPayment::Paymentech::Transport->new(
@@ -168,15 +170,18 @@ sub format_item {
       die "payment type ".$item->type." not supported";
     }
     push @order, (
-      avsZip      => $item->zip,
-      avsAddress1 => substr($item->address,   0, 30),
-      avsAddress2 => substr($item->address2,  0, 30),
-      avsCity     => substr($item->city,      0, 20),
-      avsState    => $item->state,
-      avsName     => substr($item->first_name .' '. $item->last_name, 0, 30),
-      avsCountryCode => $item->country,
-      orderID     => $item->tid,
-      amount      => int( $item->amount * 100 ),
+      avsZip         => $item->zip,
+      avsAddress1    => substr($item->address,   0, 30),
+      avsAddress2    => substr($item->address2,  0, 30),
+      avsCity        => substr($item->city,      0, 20),
+      avsState       => $item->state,
+      avsName        => substr($item->first_name .' '. $item->last_name, 0, 30),
+      avsCountryCode => ( $paymentech_countries{ $item->country }
+                            ? $_->country
+                            : ''
+                        ),
+      orderID        => $item->tid,
+      amount         => int( $item->amount * 100 ),
     );
     while (@order) {
       my $key = shift @order;