From fc2a9793683937105d8d6783a0fbe1b2d9da427f Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 6 Mar 2011 22:07:35 +0000 Subject: test fixes --- USAePay.pm | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'USAePay.pm') diff --git a/USAePay.pm b/USAePay.pm index a1ac81a..fd49797 100644 --- a/USAePay.pm +++ b/USAePay.pm @@ -15,7 +15,7 @@ $DEBUG = 0; sub _info { { - 'info_compat' => '0.01', + 'info_compat' => '0.02', 'gateway_name' => 'USAePay', 'gateway_url' => 'http://www.usaepay.com', 'module_version' => $VERSION, @@ -79,9 +79,12 @@ sub map_fields { } $content{'action'} = $actions{lc($content{'action'})} || $content{'action'}; - $content{'expiration'} =~ s/\D//g; + $content{'expiration'} =~ s/\D//g if exists $content{'expiration'}; - $content{'md5hash'} = md5_hex(join(':', map "$content{$_}", qw(action password amount invoice_number md5key))) if defined $content{'password'}; + $content{'md5hash'} = + md5_hex( join(':', map { defined($content{$_}) ? $content{$_} : '' } + qw(action password amount invoice_number md5key))) + if defined $content{'password'}; $self->content(%content); } @@ -151,12 +154,15 @@ sub submit { UMdlstate UMclerk UMterminal UMtable UMip UMsoftware UMredir UMredirApproved UMredirDeclined UMechofields UMtestmode ) ); + # test_transaction(0): normal mode # 1 : test mode (validates formatting only) # 2 : use sandbox server # 3 : test mode on sandbox server - $self->server('sandbox.usaepay.com') if ( $self->test_transaction & 2 ); - $post_data{'UMtestmode'} = ($self->test_transaction() & 1) ? 1 : 0; + my $test = $self->test_transaction || 0; + $self->server('sandbox.usaepay.com') if ( $test & 2 ); + $post_data{'UMtestmode'} = ($test & 1) ? 1 : 0; + $post_data{'UMsoftware'} = __PACKAGE__. " $VERSION"; if ( $DEBUG ) { warn "post_data:$_ => $post_data{$_}\n" foreach keys %post_data; @@ -241,7 +247,9 @@ http://www.usaepay.com/topics/api.html for details. =head1 AUTHOR -Jeff Finucane +Original author: Jeff Finucane + +0.02 update and current maintainer: Ivan Kohler =head1 SEE ALSO -- cgit v1.2.1