bump version
[Business-OnlinePayment-USAePay.git] / USAePay.pm
index a1ac81a..a8eb4ee 100644 (file)
@@ -9,7 +9,7 @@ use URI::Escape;
 use vars qw($VERSION @ISA $DEBUG);
 
 @ISA = qw(Business::OnlinePayment::HTTPS);
-$VERSION = '0.02';
+$VERSION = '0.03';
 
 $DEBUG = 0;
 
@@ -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;
@@ -209,7 +215,8 @@ Business::OnlinePayment::USAePay - USA ePay backend for Business::OnlinePayment
 
   my $tx = new Business::OnlinePayment("USAePay");
   $tx->content(
-      login          => 'igztOatyqbpd1wsxijl4xnxjodldwdxR', #USA ePay source key
+      login          => 'igztOatyqbpd1wsxijl4xnxjodldwdxR', #USAePay source key
+      password       => 'abcdef', #USAePay PIN
       action         => 'Normal Authorization',
       description    => 'Business::OnlinePayment test',
       amount         => '49.95',
@@ -232,20 +239,36 @@ Business::OnlinePayment::USAePay - USA ePay backend for Business::OnlinePayment
 
 For detailed information see L<Business::OnlinePayment>.
 
-=head1 NOTE
-
 =head1 COMPATIBILITY
 
-This module implements USAePay's CGI Gateway API v2.9.5.  See
+This module was developed against USAePay's CGI Gateway API v2.9.5 and
+also tested against v2.17.1 without problems.  See
 http://www.usaepay.com/topics/api.html for details.
 
 =head1 AUTHOR
 
-Jeff Finucane <jeff@cmh.net>
+Original author: Jeff Finucane <jeff@cmh.net>
+
+0.02 update and current maintainer: Ivan Kohler <ivan-usaepay@freeside.biz>
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright (C) 2011 Freeside Internet Services, Inc. (http://freeside.biz/)
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+=head1 ADVERTISEMENT
+
+Need a complete, open-source back-office and customer self-service solution?
+The Freeside software includes support for credit card and electronic check
+processing with USAePay and over 50 other gateways, invoicing, integrated
+trouble ticketing, and customer signup and self-service web interfaces.
+
+http://freeside.biz/freeside/
 
 =head1 SEE ALSO
 
 perl(1). L<Business::OnlinePayment>.
 
 =cut
-