Added documentation about referrer field at Authorize.Net
[Business-OnlinePayment-AuthorizeNet.git] / AuthorizeNet.pm
index 028b6d8..40c01d9 100644 (file)
@@ -1,11 +1,11 @@
 package Business::OnlinePayment::AuthorizeNet;
 
-# $Id: AuthorizeNet.pm,v 1.11 2002-07-31 14:38:17 ivan Exp $
+# $Id: AuthorizeNet.pm,v 1.14 2002-08-16 06:53:28 ivan Exp $
 
 use strict;
 use Carp;
 use Business::OnlinePayment;
-use Net::SSLeay qw/make_form post_https/;
+use Net::SSLeay qw/make_form post_https make_headers/;
 use Text::CSV_XS;
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
 
@@ -49,6 +49,10 @@ sub map_fields {
     $content{'type'} = $types{lc($content{'type'})} || $content{'type'};
     $self->transaction_type($content{'type'});
 
+    $content{'referer'} = defined( $content{'referer'} )
+                            ? make_headers( 'Referer' => $content{'referer'} )
+                            : "";
+
     # stuff it back into %content
     $self->content(%content);
 }
@@ -103,6 +107,7 @@ sub submit {
         company        => 'x_Company',
        order_number   => 'x_Trans_ID',
        cvv2           => 'x_Card_Code',
+       currency       => 'x_Currency_Code',
     );
 
     if($self->transaction_type() eq "ECHECK") {
@@ -141,7 +146,8 @@ sub submit {
     my $s = $self->server();
     my $p = $self->port();
     my $t = $self->path();
-    my($page,$server_response,%headers) = post_https($s,$p,$t,'',$pd);
+    my $r = $self->{_content}->{referer};
+    my($page,$server_response,%headers) = post_https($s,$p,$t,$r,$pd);
     #escape NULL (binary 0x00) values
     $page =~ s/\x00/\^0/g;
 
@@ -202,6 +208,7 @@ Business::OnlinePayment::AuthorizeNet - AuthorizeNet backend for Business::Onlin
       card_number    => '4007000000027',
       expiration     => '09/02',
       cvv2           => '1234', #optional
+      referer        => 'http://valid.referer.url/',
   );
   $tx->submit();
 
@@ -231,6 +238,13 @@ Unlike Business::OnlinePayment or pre-3.0 verisons of
 Business::OnlinePayment::AuthorizeNet, 3.1 requires separate first_name and
 last_name fields.
 
+Business::OnlinePayment::AuthorizeNet uses the ADC direct response method,
+and sends a username and password with every transaction.  Therefore,
+Authorize.Net's referrer "security" is not necessary.  In your Authorize.Net
+interface at https://secure.authorize.net/ make sure the list of allowable
+referers is blank.  Alternatively, set the B<referer> field in the transaction
+content.
+
 To settle an authorization-only transaction (where you set action to
 'Authorization Only'), submit the nine-digit transaction id code in
 the field "order_number" with the action set to "Post Authorization".
@@ -263,6 +277,10 @@ 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.
 
+T.J. Mather <tjmather@maxmind.com> sent a patch for the CVV2 field.
+
+Mike Barry <mbarry@cos.com> sent in a patch for the referer field.
+
 =head1 SEE ALSO
 
 perl(1). L<Business::OnlinePayment>.