X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=lib%2FBusiness%2FOnlinePayment%2FPaymenTech.pm;h=3d060bb54020ec2c89df59319c3a08b3fbcc052e;hb=31753c35b06e7e95ea19b5c00e3d6e0ac8fc47af;hp=554bcde5b489468e6a65bc8eefdaf0fb8204f552;hpb=f07eb4018968c09179b93b08cc5785555d82f2f3;p=Business-OnlinePayment-PaymenTech.git diff --git a/lib/Business/OnlinePayment/PaymenTech.pm b/lib/Business/OnlinePayment/PaymenTech.pm index 554bcde..3d060bb 100644 --- a/lib/Business/OnlinePayment/PaymenTech.pm +++ b/lib/Business/OnlinePayment/PaymenTech.pm @@ -8,7 +8,10 @@ use Tie::IxHash; use vars qw($VERSION $DEBUG @ISA $me); @ISA = qw(Business::OnlinePayment::HTTPS); -$VERSION = '2.03'; + +$VERSION = '2.05'; +$VERSION = eval $VERSION; # modperlstyle: convert the string into a number + $DEBUG = 0; $me='Business::OnlinePayment::PaymenTech'; @@ -39,6 +42,7 @@ tie my %new_order, 'Tie::IxHash', ( AVSaddress1 => [ ':address', 30 ], AVScity => [ ':city', 20 ], AVSstate => [ ':state', 2 ], + AVScountryCode => [ ':country', 2 ], OrderID => [ ':invoice_number', 22 ], Amount => [ ':amount', 12 ], Comments => [ ':email', 64 ], @@ -93,6 +97,8 @@ my %currency_code = ( MXN => [484, 2], ); +my %paymentech_countries = map { $_ => 1 } qw( US CA GB UK ); + sub set_defaults { my $self = shift; @@ -190,7 +196,15 @@ sub map_fields { $content{invoice_number} ||= sprintf("%04x%04x",time % 2**16,int(rand() * 2**16)); } - $content{expiration} =~ s/\D//g; # Because Freeside sends it as mm/yy, not mmyy. + # Always send as MMYY + $content{expiration} =~ s/\D//g; + $content{expiration} = sprintf('%04d',$content{expiration}); + + $content{country} ||= 'US'; + $content{country} = ( $paymentech_countries{ $content{country} } + ? $content{country} + : '' + ), $self->content(%content); return;