Thomas Sibley and, using it, provide more descriptive error messages.
- Switch to Business::OnlinePayment::HTTPS instead of using Net::SSLeay
directly
Michael Peters fixed a bug in email address handling.
+Thomas Sibley <trs@bestpractical.com> wrote B:OP:AuthorizeNet::AIM::ErrorCodes
+which was borged and used to provide more descriptive error messages.
+
=head1 CONTRIBUTIONS AND REPOSITORY
Please send patches as unified diffs (diff -u) to (in order of preference):
http://freeside.biz/cgi-bin/viewvc.cgi/Business-OnlinePayment-AuthorizeNet/
+=head1 A WORD FROM OUR SPONSOR
+
+This module and the Business::OnlinePayment framework are maintained by by
+Freeside Internet Services. If you need a complete, open-source web-based
+application to manage your customers, billing and trouble ticketing, please
+visit http://freeside.biz/
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2010 Freeside Internet Services, Inc.
+Copyright 2008 Thomas Sibley
+All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
=head1 SEE ALSO
perl(1). L<Business::OnlinePayment>.
use strict;
use Carp;
+use Business::OnlinePayment::HTTPS;
use Business::OnlinePayment::AuthorizeNet;
-use Net::SSLeay qw/make_form post_https make_headers/;
+use Business::OnlinePayment::AuthorizeNet::AIM::ErrorCodes '%ERRORS';
use Text::CSV_XS;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
-require Exporter;
-
-@ISA = qw(Exporter Business::OnlinePayment::AuthorizeNet);
-@EXPORT = qw();
-@EXPORT_OK = qw();
-$VERSION = '3.21';
+@ISA = qw(Business::OnlinePayment::AuthorizeNet Business::OnlinePayment::HTTPS);
+$VERSION = '3.22';
sub set_defaults {
my $self = shift;
$content{'account_type'} = $account_types{lc($content{'account_type'})}
|| $content{'account_type'};
- $content{'referer'} = defined( $content{'referer'} )
- ? make_headers( 'Referer' => $content{'referer'} )
- : "";
-
if (length $content{'password'} == 15) {
$content{'transaction_key'} = delete $content{'password'};
}
$post_data{'x_ADC_URL'} = 'FALSE';
$post_data{'x_Version'} = '3.1';
- my $pd = make_form(%post_data);
- my $s = $self->server();
- my $p = $self->port();
- my $t = $self->path();
- my $r = $self->{_content}->{referer};
- my($page,$server_response,%headers) = post_https($s,$p,$t,$r,$pd);
+ my $opt = defined( $self->{_content}->{referer} )
+ ? { 'headers' => { 'Referer' => $self->{_content}->{referer} } }
+ : {};
+
+ my($page, $server_response, %headers) =
+ $self->https_post( $opt, \%post_data );
+
#escape NULL (binary 0x00) values
$page =~ s/\x00/\^0/g;
$self->is_success(0);
$self->result_code($col[2]);
$self->error_message($col[3]);
- unless ( $self->result_code() ) { #additional logging information
+ if ( $self->result_code ) {
+ my $addl = $ERRORS{ $self->result_code };
+ $self->error_message( $self->error_message. ' - '. $addl->{notes})
+ if $addl && ref($addl) eq 'HASH' && $addl->{notes};
+ } else { #additional logging information
#$page =~ s/\x00/\^0/g;
$self->error_message($col[3].
" DEBUG: No x_response_code from server, ".
3.22 unreleased
- Add missing t/lib/Business/FraudDetect/_Fake.pm to MANIFEST to fix
tests. Patch from Rob Brown, thanks! (closes: CPAN#52444)
+ - Incorporate Business::OnlinePayment::AuthorizeNet::AIM::ErrorCodes by
+ Thomas Sibley and, using it, provide more descriptive error messages.
+ - Switch to Business::OnlinePayment::HTTPS instead of using Net::SSLeay
+ directly
3.21 Tue Nov 24 10:45:21 PST 2009
- Add repository, contributing and contirbutor information to the docs.
'VERSION_FROM' => 'AuthorizeNet.pm', # finds $VERSION
'AUTHOR' => 'Ivan Kohler <ivan-authorizenet@420.am>', #really just
#the maintainer
- 'PREREQ_PM' => { 'Net::SSLeay' => 0,
- 'Text::CSV_XS' => 0,
+ 'PREREQ_PM' => { 'Text::CSV_XS' => 0,
'Business::OnlinePayment' => 3,
'Business::OnlinePayment::HTTPS' => 0,
+ 'Net::HTTPS::Any' => 0,
'Test::More' => 0.42,
'Tie::IxHash' => 0,
'XML::Simple' => 0,
#!/usr/bin/perl -w
-use Test::More;
+use Test::More skip_all => 'Authorize.net test account throwing errors about duplicates';
require "t/lib/test_account.pl";
my($login, $password) = test_account_or_skip('arb');
--- /dev/null
+#!/usr/bin/perl -w
+
+use Test::More;
+require "t/lib/test_account.pl";
+
+my($login, $password) = test_account_or_skip();
+plan tests => 3;
+
+use_ok 'Business::OnlinePayment';
+
+my $tx = Business::OnlinePayment->new("AuthorizeNet");
+$tx->server('test.authorize.net');
+$tx->content(
+ type => 'VISA',
+ login => $login,
+ password => $password,
+ action => 'Normal Authorization',
+ description => 'Business::OnlinePayment visa test',
+ amount => '49.95',
+ invoice_number => '100100',
+ customer_id => 'jsk',
+ first_name => 'Tofu',
+ last_name => 'Beast',
+ address => '123 Anystreet',
+ city => 'Anywhere',
+ state => 'UT',
+ zip => '84058',
+ card_number => '4007000000027',
+ expiration => 'BADFORMAT', #expiration_date(),
+);
+$tx->test_transaction(1); # test, dont really charge
+$tx->submit();
+
+ok(!$tx->is_success);
+
+ok($tx->error_message() =~ /The format of the date submitted was incorrect/ );