working post auth support
authorivan <ivan>
Wed, 13 Mar 2002 16:11:55 +0000 (16:11 +0000)
committerivan <ivan>
Wed, 13 Mar 2002 16:11:55 +0000 (16:11 +0000)
AuthorizeNet.pm
MANIFEST
t/check.t
t/credit_card.t

index 43fc382..b312a28 100644 (file)
@@ -1,6 +1,6 @@
 package Business::OnlinePayment::AuthorizeNet;
 
-# $Id: AuthorizeNet.pm,v 1.5 2002-02-16 06:54:36 thalakan Exp $
+# $Id: AuthorizeNet.pm,v 1.6 2002-03-13 16:11:55 ivan Exp $
 
 use strict;
 use Business::OnlinePayment;
@@ -13,7 +13,7 @@ require Exporter;
 @ISA = qw(Exporter AutoLoader Business::OnlinePayment);
 @EXPORT = qw();
 @EXPORT_OK = qw();
-$VERSION = '3.02';
+$VERSION = '3.10';
 
 sub set_defaults {
     my $self = shift;
@@ -21,6 +21,8 @@ sub set_defaults {
     $self->server('secure.authorize.net');
     $self->port('443');
     $self->path('/gateway/transact.dll');
+
+    $self->build_subs('order_number'); #no idea how it worked for jason w/o this
 }
 
 sub map_fields {
@@ -106,8 +108,13 @@ sub submit {
                                   first_name account_number routing_code
                                   bank_name/);
     } elsif($self->transaction_type() eq 'CC' ) {
+      if ( $self->{_content}->{action} eq 'PRIOR_AUTH_CAPTURE' ) {
+        $self->required_fields(qw/type login password action amount
+                                  card_number expiration/);
+      } else {
         $self->required_fields(qw/type login password action amount last_name
                                   first_name card_number expiration/);
+      }
     } else {
         Carp::croak("AuthorizeNet can't handle transaction type: ".
                     $self->transaction_type());
@@ -125,7 +132,7 @@ sub submit {
     $post_data{'x_Test_Request'} = $self->test_transaction()?"TRUE":"FALSE";
     $post_data{'x_ADC_Delim_Data'} = 'TRUE';
     $post_data{'x_ADC_URL'} = 'FALSE';
-    $post_data{'x_Version'} = '3.0';
+    $post_data{'x_Version'} = '3.1';
 
     my $pd = make_form(%post_data);
     my $s = $self->server();
@@ -204,8 +211,8 @@ For detailed information see L<Business::OnlinePayment>.
 
 =head1 NOTE
 
-Unlike Business::OnlinePayment or previous verisons of
-Business::OnlinePayment::AuthorizeNet, 3.0 requires separate first_name and
+Unlike Business::OnlinePayment or pre-3.0 verisons of
+Business::OnlinePayment::AuthorizeNet, 3.1 requires separate first_name and
 last_name fields.
 
 To settle an authorization-only transaction (where you set action to
@@ -221,11 +228,11 @@ verification on by default for all merchants.  If you do not have
 valid address information for your customer (such as in an IVR
 application), you must disable address verification in the Merchant
 Menu page at https://secure.authorize.net/ so that the transactions
-aren't denied due to a lack of addres information.
+aren't denied due to a lack of address information.
 
 =head1 COMPATIBILITY
 
-This module implements Authorize.Net's API verison 3.0 using the ADC
+This module implements Authorize.Net's API verison 3.1 using the ADC
 Direct Response method.  See
 https://secure.authorize.net/docs/developersguide.pml for details.
 
@@ -234,10 +241,11 @@ https://secure.authorize.net/docs/developersguide.pml for details.
 Jason Kohles, jason@mediabang.com
 
 Ivan Kohler <ivan-authorizenet@420.am> updated it for Authorize.Net protocol
-3.0 and is the current maintainer.
+3.0/3.1 and is the current maintainer.
 
-Jason Spence <jspence@lightconsulting.com> got settlements working and
-wrote some docs.  OST <services@ostel.com> paid for it.
+Jason Spence <jspence@lightconsulting.com> contributed support for separate
+Authorization Only and Post Authorization steps and wrote some docs.
+OST <services@ostel.com> paid for it.
 
 =head1 SEE ALSO
 
index b7ad129..83b9998 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -7,3 +7,4 @@ t/load.t
 t/credit_card.t
 t/check.t
 t/bop.t
+t/capture.t
index a22b727..29344f6 100644 (file)
--- a/t/check.t
+++ b/t/check.t
@@ -1,6 +1,6 @@
 BEGIN { $| = 1; print "1..1\n"; }
 
-print "ok 1 # Skipped: testdrive account won't accept ACH transactions\n"; exit;
+print "ok 1 # Skipped: testing account won't accept ACH transactions\n"; exit;
 
 use Business::OnlinePayment;
 
@@ -8,8 +8,8 @@ use Business::OnlinePayment;
 my $ctx = new Business::OnlinePayment("AuthorizeNet");
 $ctx->content(
     type           => 'CHECK',
-    login          => 'testdrive',
-    password       => 'testdrive',
+    login          => 'testing',
+    password       => 'testing',
     action         => 'Normal Authorization',
     amount         => '49.95',
     invoice_number => '100100',
index df6c001..0c9e856 100644 (file)
@@ -1,14 +1,15 @@
 BEGIN { $| = 1; print "1..1\n"; }
 
-print "ok 1 # Skipped: need a valid Authorize.Net login/password to test\n"; exit;
+#testing/testing is valid and seems to work...
+#print "ok 1 # Skipped: need a valid Authorize.Net login/password to test\n"; exit;
 
 use Business::OnlinePayment;
 
 my $tx = new Business::OnlinePayment("AuthorizeNet");
 $tx->content(
     type           => 'VISA',
-    login          => 'testdrive', # CHANGE THESE TO TEST
-    password       => 'testdrive', #
+    login          => 'testing',
+    password       => 'testing',
     action         => 'Normal Authorization',
     description    => 'Business::OnlinePayment visa test',
     amount         => '49.95',
@@ -22,6 +23,8 @@ $tx->content(
     zip            => '84058',
     card_number    => '4007000000027',
     expiration     => '08/06',
+#    company        => 'Company co',
+#    country        => 'US',
 );
 $tx->test_transaction(1); # test, dont really charge
 $tx->submit();
@@ -29,5 +32,6 @@ $tx->submit();
 if($tx->is_success()) {
     print "ok 1\n";
 } else {
+    #warn $tx->error_message;
     print "not ok 1\n";
 }