From 513c2cf250cfd3b9ed5507fded951aa85563de00 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Mon, 12 Nov 2012 23:54:48 -0800 Subject: [PATCH] don't send countries other than US/CA/GB/UK to paymentech, RT#20222 --- Changes | 3 +++ Paymentech.pm | 25 +++++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Changes b/Changes index a91e799..0ea0bd8 100644 --- 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 diff --git a/Paymentech.pm b/Paymentech.pm index 7fa2e44..09b5672 100644 --- a/Paymentech.pm +++ b/Paymentech.pm @@ -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; -- 2.11.0