depend on B:OP:HTTPS 0.06 for Crypt::SSLeay fixes
[Business-OnlinePayment-PayflowPro.git] / PayflowPro.pm
index c63b13e..6439903 100644 (file)
 package Business::OnlinePayment::PayflowPro;
 
 use strict;
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
-use Carp qw(croak);
-use AutoLoader;
-use Business::OnlinePayment;
+use vars qw($VERSION $DEBUG);
+use Carp qw(carp croak);
+use CGI;
+use Digest::MD5;
+use Business::OnlinePayment::HTTPS 0.06;
 
-#PayflowPRO SDK from Verisign
-use PFProAPI qw( pfpro );
+use base qw(Business::OnlinePayment::HTTPS);
 
-require Exporter;
+$VERSION = '0.07_04';
+$VERSION = eval $VERSION;
+$DEBUG   = 0;
 
-@ISA = qw(Exporter AutoLoader Business::OnlinePayment);
-@EXPORT = qw();
-@EXPORT_OK = qw();
-$VERSION = '0.02';
+sub request_id {
+    my $self = shift;
+    my $md5  = Digest::MD5->new();
+    $md5->add( $$, time(), rand(time) );
+    return $md5->hexdigest();
+}
 
-sub set_defaults {
+sub debug {
     my $self = shift;
 
-    #$self->server('staging.linkpt.net');
-    $self->server('payflow.verisign.com');
-    $self->port('443');
+    if (@_) {
+        my $level = shift || 0;
+        if ( ref($self) ) {
+            $self->{"__DEBUG"} = $level;
+        }
+        else {
+            $DEBUG = $level;
+        }
+        $Business::OnlinePayment::HTTPS::DEBUG = $level;
+    }
+    return ref($self) ? ( $self->{"__DEBUG"} || $DEBUG ) : $DEBUG;
+}
+
+sub set_defaults {
+    my $self = shift;
+    my %opts = @_;
+
+    # standard B::OP methods/data
+    #$self->server("payflow.verisign.com");
+    $self->server("payflowpro.verisign.com");
+    $self->port("443");
+    $self->path("/transaction");
+
+    $self->build_subs(qw( 
+                          partner vendor client_certification_id
+                          headers test_server
+                          cert_path
+                          order_number avs_code cvv2_response
+                          response_page response_code response_headers
+                     ));
+
+    # module specific data
+    if ( $opts{debug} ) {
+        $self->debug( $opts{debug} );
+        delete $opts{debug};
+    }
 
-    $self->build_subs(qw( vendor partner order_number cert_path ));
+    $self->test_server( "pilot-payflowpro.verisign.com" );
 
 }
 
-sub map_fields {
-    my($self) = @_;
+sub _map_fields {
+    my ($self) = @_;
 
     my %content = $self->content();
 
-    my $action = lc($content{'action'});
-    if ( $action eq 'normal authorization' ) {
-    } else {
-      croak "$action not (yet) supported";
-    }
-
     #ACTION MAP
-    my %actions = ('normal authorization' => 'S', #Sale
-                   'authorization only'   => 'A', #Authorization
-                   'credit'               => 'C', #Credit (refund)
-                   'post authorization'   => 'D', #Delayed Capture
-                   'void'                 => 'V',
-                  );
-    $content{'action'} = $actions{lc($content{'action'})} || $content{'action'};
+    my %actions = (
+        'normal authorization' => 'S',    # Sale transaction
+        'credit'               => 'C',    # Credit (refund)
+        'authorization only'   => 'A',    # Authorization
+        'post authorization'   => 'D',    # Delayed Capture
+        'void'                 => 'V',    # Void
+    );
+
+    $content{'action'} = $actions{ lc( $content{'action'} ) }
+      || $content{'action'};
 
     # TYPE MAP
-    my %types = ('visa'               => 'C',
-                 'mastercard'         => 'C',
-                 'american express'   => 'C',
-                 'discover'           => 'C',
-                 'cc'                 => 'C'
-                 #'check'              => 'ECHECK',
-                );
-    $content{'type'} = $types{lc($content{'type'})} || $content{'type'};
-    $self->transaction_type($content{'type'});
+    my %types = (
+        'visa'             => 'C',
+        'mastercard'       => 'C',
+        'american express' => 'C',
+        'discover'         => 'C',
+        'cc'               => 'C',
+
+        #'check'            => 'ECHECK',
+    );
 
-    # stuff it back into %content
-    $self->content(%content);
-}
+    $content{'type'} = $types{ lc( $content{'type'} ) } || $content{'type'};
 
-sub build_subs {
-    my $self = shift;
-    foreach(@_) {
-        #no warnings; #not 5.005
-        local($^W)=0;
-        eval "sub $_ { my \$self = shift; if(\@_) { \$self->{$_} = shift; } return \$self->{$_}; }";
-    }
-}
+    $self->transaction_type( $content{'type'} );
 
-sub remap_fields {
-    my($self,%map) = @_;
-
-    my %content = $self->content();
-    foreach(keys %map) {
-        $content{$map{$_}} = $content{$_};
-    }
+    # stuff it back into %content
     $self->content(%content);
 }
 
-sub revmap_fields {
-    my($self, %map) = @_;
+sub _revmap_fields {
+    my ( $self, %map ) = @_;
     my %content = $self->content();
-    foreach(keys %map) {
-#    warn "$_ = ". ( ref($map{$_})
-#                         ? ${ $map{$_} }
-#                         : $content{$map{$_}} ). "\n";
-        $content{$_} = ref($map{$_})
-                         ? ${ $map{$_} }
-                         : $content{$map{$_}};
+    foreach ( keys %map ) {
+        $content{$_} =
+          ref( $map{$_} )
+          ? ${ $map{$_} }
+          : $content{ $map{$_} };
     }
     $self->content(%content);
 }
 
-sub get_fields {
-    my($self,@fields) = @_;
-
-    my %content = $self->content();
-    my %new = ();
-    foreach( grep defined $content{$_}, @fields) { $new{$_} = $content{$_}; }
-    return %new;
+sub expdate_mmyy {
+    my $self       = shift;
+    my $expiration = shift;
+    my $expdate_mmyy;
+    if ( defined($expiration) and $expiration =~ /^(\d+)\D+\d*(\d{2})$/ ) {
+        my ( $month, $year ) = ( $1, $2 );
+        $expdate_mmyy = sprintf( "%02d", $month ) . $year;
+    }
+    return defined($expdate_mmyy) ? $expdate_mmyy : $expiration;
 }
 
 sub submit {
-    my($self) = @_;
+    my ($self) = @_;
 
-    $self->map_fields();
+    $self->_map_fields();
 
     my %content = $self->content;
 
-    my($month, $year, $zip);
+    if ( $self->transaction_type() ne 'C' ) {
+        croak( "PayflowPro can't (yet?) handle transaction type: "
+              . $self->transaction_type() );
+    }
 
-    #unless ( $content{action} eq 'BillOrders' ) {
+    my $expdate_mmyy = $self->expdate_mmyy( $content{"expiration"} );
+    my $zip          = $content{'zip'};
+    $zip =~ s/[^[:alnum:]]//g;
+
+    $self->server( $self->test_server ) if $self->test_transaction;
+
+    my $vendor  = $self->vendor;
+    my $partner = $self->partner;
+
+    $self->_revmap_fields(
+
+        # BUG?: VENDOR B::OP:PayflowPro < 0.05 backward compatibility.  If
+        # vendor not set use login although test indicate undef vendor is ok
+        VENDOR => $vendor ? \$vendor : 'login',
+        PARTNER  => \$partner,
+        USER     => 'login',
+        PWD      => 'password',
+        TRXTYPE  => 'action',
+        TENDER   => 'type',
+        ORIGID   => 'order_number',
+        COMMENT1 => 'description',
+        COMMENT2 => 'invoice_number',
+
+        ACCT    => 'card_number',
+        CVV2    => 'cvv2',
+        EXPDATE => \$expdate_mmyy,    # MM/YY from 'expiration'
+        AMT     => 'amount',
+
+        FIRSTNAME   => 'first_name',
+        LASTNAME    => 'last_name',
+        NAME        => 'name',
+        EMAIL       => 'email',
+        COMPANYNAME => 'company',
+        STREET      => 'address',
+        CITY        => 'city',
+        STATE       => 'state',
+        ZIP         => \$zip,          # 'zip' with non-alnums removed
+        COUNTRY     => 'country',
+    );
 
-        if (  $self->transaction_type() eq 'C' ) {
-        } else {
-            Carp::croak("PayflowPro can't (yet?) handle transaction type: ".
-                        $self->transaction_type());
+    my @required = qw( TRXTYPE TENDER PARTNER VENDOR USER PWD );
+    if ( $self->transaction_type() eq 'C' ) {    # credit card
+        if (   $content{'action'} =~ /^[CDV]$/
+            && defined( $content{'ORIGID'} )
+            && length( $content{'ORIGID'} ) )
+        {
+            push @required, qw(ORIGID);
         }
+        else {
 
-      if ( exists($content{'expiration'}) && defined($content{'expiration'})
-           && length($content{'expiration'})                                 ) {
-        $content{'expiration'} =~ /^(\d+)\D+\d*(\d{2})$/
-          or croak "unparsable expiration $content{expiration}";
+            # never get here, we croak above if transaction_type ne 'C'
+            push @required, qw(AMT ACCT EXPDATE);
+        }
+    }
+    $self->required_fields(@required);
 
-        ( $month, $year ) = ( $1, $2 );
-        $month = '0'. $month if $month =~ /^\d$/;
-      }
+    my %params = $self->get_fields(
+        qw(
+          VENDOR PARTNER USER PWD TRXTYPE TENDER ORIGID COMMENT1 COMMENT2
+          ACCT CVV2 EXPDATE AMT
+          FIRSTNAME LASTNAME NAME EMAIL COMPANYNAME
+          STREET CITY STATE ZIP COUNTRY
+          )
+    );
 
-      $zip = $content{'zip'} =~ s/\D//;
-    #}
+    # get header data, get request_id from %content if defined for ease of use
+    my %req_headers = %{ $self->headers || {} };
+    if ( defined $content{"request_id"} ) {
+        $req_headers{"X-VPS-Request-ID"} = $content{"request_id"};
+    }
+    unless ( defined( $req_headers{"X-VPS-Request-ID"} ) ) {
+        $req_headers{"X-VPS-Request-ID"} = $self->request_id();
+    }
 
-    #$content{'address'} =~ /^(\S+)\s/;
-    #my $addrnum = $1;
+    unless ( defined( $req_headers{"X-VPS-VIT-Client-Certification-Id"} ) ) {
+        $req_headers{"X-VPS-VIT-Client-Certification-Id"} =
+          $self->client_certification_id;
+    }
 
-    $self->server('test-payflow.verisign.com') if $self->test_transaction;
+    my %options = (
+        "Content-Type" => "text/namevalue",
+        "headers"      => \%req_headers,
+    );
 
-    $self->revmap_fields(
-      ACCT       => 'card_number',
-      EXPDATE     => \( $month.$year ),
-      AMT         => 'amount',
-      USER        => 'login',
-      #VENDOR      => \( $self->vendor ),
-      VENDOR      => 'login',
-      PARTNER     => \( $self->partner ),
-      PWD         => 'password',
-      TRXTYPE     => 'action',
-      TENDER      => 'type',
+    my ( $page, $resp, %resp_headers ) =
+      $self->https_post( \%options, \%params );
 
-      STREET      => 'address',
-      ZIP         => \$zip,
+    $self->response_code( $resp );
+    $self->response_page( $page );
+    $self->response_headers( \%resp_headers );
 
-      CITY        => 'city',
-      COMMENT1    => 'description',
-      COMMENT2    => 'invoice_number',
-      COMPANYNAME => 'company',
-      COUNTRY     => 'country',
-      FIRSTNAME   => 'first_name',
-      LASTNAME    => 'last_name',
-      NAME        => 'name',
-      EMAIL       => 'email',
-      STATE       => 'state',
+    # $page should contain name=value[[&name=value]...] pairs
+    my $cgi = CGI->new("$page");
 
-      CVV2        => 'cvv2',
-      ORIGID      => 'order_number'
+    # AVS and CVS values may be set on success or failure
+    my $avs_code;
+    if ( defined $cgi->param("AVSADDR") or defined $cgi->param("AVSZIP") ) {
+        if ( $cgi->param("AVSADDR") eq "Y" && $cgi->param("AVSZIP") eq "Y" ) {
+            $avs_code = "Y";
+        }
+        elsif ( $cgi->param("AVSADDR") eq "Y" ) {
+            $avs_code = "A";
+        }
+        elsif ( $cgi->param("AVSZIP") eq "Y" ) {
+            $avs_code = "Z";
+        }
+        elsif ( $cgi->param("AVSADDR") eq "N" or $cgi->param("AVSZIP") eq "N" )
+        {
+            $avs_code = "N";
+        }
+        else {
+            $avs_code = "";
+        }
+    }
 
-    );
+    $self->avs_code($avs_code);
+    $self->cvv2_response( $cgi->param("CVV2MATCH") );
+    $self->result_code( $cgi->param("RESULT") );
+    $self->order_number( $cgi->param("PNREF") );
+    $self->error_message( $cgi->param("RESPMSG") );
+    $self->authorization( $cgi->param("AUTHCODE") );
 
-    my @required = qw( TRXTYPE TENDER PARTNER VENDOR USER PWD );
-    if (  $self->transaction_type() eq 'C' ) { #credit card
-      if ( $self->action() =~ /^[CDV]$/ && exists($content{'ORIGID'})
-           && defined($content{'ORIGID'}) && length($content{'ORIGID'}) ) {
-        push @required, qw(ORIGID);
-      } else {
-        push @required, qw(AMT ACCT EXPDATE);
-      }
+    # RESULT must be an explicit zero, not just numerically equal
+    if ( $cgi->param("RESULT") eq "0" ) {
+        $self->is_success(1);
     }
-    $self->required_fields(@required);
-
-    my %params = $self->get_fields(qw(
-      ACCT EXPDATE AMT USER VENDOR PARTNER PWD TRXTYPE TENDER
-      STREET ZIP
-      CITY COMMENT1 COMMENT2 COMPANYNAME COUNTRY FIRSTNAME LASTNAME NAME EMAIL
-        STATE
-      CVV2 ORIGID
-    ));
-
-    #print "$_ => $params{$_}\n" foreach keys %params;
-
-    $ENV{'PFPRO_CERT_PATH'} = $self->cert_path;
-    my( $response, $resultstr ) = pfpro( \%params, $self->server, $self->port );
-
-    #if ( $response->{'RESULT'} == 0 ) {
-    if ( $response->{'RESULT'} eq '0' ) { #want an explicit zero, not just
-                                          #numerically equal
-      $self->is_success(1);
-      $self->result_code(   $response->{'RESULT'}   );
-      $self->error_message( $response->{'RESPMSG'}  );
-      $self->authorization( $response->{'AUTHCODE'} );
-      $self->order_number(  $response->{'PNREF'}    );
-      my $avs_code = '';
-      if ( $response->{AVSADDR} eq 'Y' && $response->{AVSZIP} eq 'Y' ) {
-        $avs_code = 'Y';
-      } elsif ( $response->{AVSADDR} eq 'Y' ) {
-        $avs_code = 'A';
-      } elsif ( $response->{AVSZIP} eq 'Y' ) {
-        $avs_code = 'Z';
-      } elsif ( $response->{AVSADDR} eq 'N' || $response->{AVSZIP} eq 'N' ) {
-        $avs_code = 'N';
-      }
-      $self->avs_code(      $avs_code               );
-    } else {
-      $self->is_success(0);
-      $self->result_code(   $response->{'RESULT'}  );
-      $self->error_message( $response->{'RESPMSG'} );
+    else {
+        $self->is_success(0);
     }
-
 }
 
 1;
+
 __END__
 
 =head1 NAME
 
-Business::OnlinePayment::PayflowPro - Verisign PayflowPro backend for Business::OnlinePayment
+Business::OnlinePayment::PayflowPro - Payflow Pro backend for Business::OnlinePayment
 
 =head1 SYNOPSIS
 
   use Business::OnlinePayment;
-
-  my $tx = new Business::OnlinePayment( 'PayflowPro',
-    'vendor'    => 'your_vendor',
-    'partner'   => 'your_partner',
-    'cert_path' => '/path/to/your/certificate/file/', #just the dir
+  
+  my $tx = new Business::OnlinePayment(
+      'PayflowPro',
+      'vendor'    => 'your_vendor',
+      'partner'   => 'your_partner',
+      'client_certification_id' => 'assigned_certification_id',
   );
-
+  
+  # See the module documentation for details of content()
   $tx->content(
       type           => 'VISA',
       action         => 'Normal Authorization',
-      description    => 'Business::OnlinePayment test',
+      description    => 'Business::OnlinePayment::PayflowPro test',
       amount         => '49.95',
       invoice_number => '100100',
       customer_id    => 'jsk',
       name           => 'Jason Kohles',
       address        => '123 Anystreet',
       city           => 'Anywhere',
-      state          => 'UT',
-      zip            => '84058',
+      state          => 'GA',
+      zip            => '30004',
       email          => 'ivan-payflowpro@420.am',
-      card_number    => '4007000000027',
-      expiration     => '09/04',
-
-      #advanced params
-      cvv2           => '420',
-      order_number   => 'string', # returned by $tx->order_number() from an
-                                  # "authorization only" or
-                                  # "normal authorization" action, used by a
-                                  # "credit", "void", or "post authorization"
+      card_number    => '4111111111111111',
+      expiration     => '12/09',
+      cvv2           => '123',
+      order_number   => 'string',
+      request_id     => 'unique_identifier_for_transaction',
   );
+  
   $tx->submit();
-
-  if($tx->is_success()) {
-      print "Card processed successfully: ".$tx->authorization."\n";
-      print "order number: ". $tx->order_number. "\n";
-      print "AVS code: ". $tx->avs_code. "\n"; # Y - Address and ZIP match
-                                               # A - Address matches but not ZIP
-                                               # Z - ZIP matches bu tnot address
-                                               # N - no match
-                                               # E - AVS error or unsupported
-                                               # (null) - AVS error
-
-  } else {
-      print "Card was rejected: ".$tx->error_message;
-      print " (CVV2 mismatch)" if $tx->result_code == 114;
-      print "\n";
+  
+  if ( $tx->is_success() ) {
+      print(
+          "Card processed successfully: ", $tx->authorization, "\n",
+          "order number: ",                $tx->order_number,  "\n",
+          "CVV2 response: ",               $tx->cvv2_response, "\n",
+          "AVS code: ",                    $tx->avs_code,      "\n",
+      );
+  }
+  else {
+      my $info = "";
+      $info = " (CVV2 mismatch)" if ( $tx->result_code == 114 );
+      
+      print(
+          "Card was rejected: ", $tx->error_message, $info, "\n",
+          "order number: ",      $tx->order_number,         "\n",
+      );
   }
 
-=head1 SUPPORTED TRANSACTION TYPES
+=head1 DESCRIPTION
 
-=head2 Visa, MasterCard, American Express, JCB, Discover/Novus, Carte blanche/Diners Club, CC
+This module is a back end driver that implements the interface
+specified by L<Business::OnlinePayment> to support payment handling
+via the PayPal's Payflow Pro Internet payment solution.
 
-=head1 SUPPORTED ACTIONS
+See L<Business::OnlinePayment> for details on the interface this
+modules supports.
 
-=head2 Normal Authorization, Authorization Only, Post Authorization, Credit, Void
+=head1 Standard methods
 
-=head1 DESCRIPTION
+=over 4
 
-For detailed information see L<Business::OnlinePayment>.
+=item set_defaults()
 
-=head1 COMPATIBILITY
+This method sets the 'server' attribute to 'payflowpro.verisign.com' and
+the port attribute to '443'.  This method also sets up the
+L</Module specific methods> described below.
+
+=item submit()
+
+=back
+
+=head1 Unofficial methods
+
+This module provides the following methods which are not officially part of the
+standard Business::OnlinePayment interface (as of 3.00_06) but are nevertheless
+supported by multiple gateways modules and expected to be standardized soon:
+
+=over 4
+
+=item L<order_number()|/order_number()>
+
+=item L<avs_code()|/avs_code()>
+
+=item L<cvv2_response()|/cvv2_response()>
 
-This module implements an interface to the PayflowPro Perl API, which can
-be downloaded at https://manager.verisign.com/ with a valid login.
+=back
 
-=head1 BUGS
+=head1 Module specific methods
 
-=head1 AUTHOR
+This module provides the following methods which are not currently
+part of the standard Business::OnlinePayment interface:
+
+=over 4
+
+=item L<expdate_mmyy()|/expdate_mmyy()>
+
+=item L<requeset_id()/request_id()>
+
+=item L<debug()|/debug()>
+
+=back
+
+=head2 Deprecated methods
+
+The following methods are deprecated and may be removed in a future
+release.  Values for vendor and partner should now be set as arguments to
+Business::OnlinePayment->new().  The value for cert_path was used to support
+passing a path to PFProAPI.pm (a Perl module/SDK from Verisign/Paypal) which is
+no longer used.
+
+=over 4
+
+=item vendor()
+
+=item partner()
+
+=item cert_path()
+
+=back
+
+=head1 Settings
+
+The following default settings exist:
+
+=over 4
+
+=item server
+
+payflowpro.verisign.com or pilot-payflowpro.verisign.com if
+test_transaction() is TRUE
+
+=item port
+
+443
+
+=back
+
+=head1 Handling of content(%content)
+
+The following rules apply to content(%content) data:
+
+=head2 action
+
+If 'action' matches one of the following keys it is replaced by the
+right hand side value:
+
+  'normal authorization' => 'S', # Sale transaction
+  'credit'               => 'C', # Credit (refund)
+  'authorization only'   => 'A', # Authorization
+  'post authorization'   => 'D', # Delayed Capture
+  'void'                 => 'V',
+
+If 'action' is 'C', 'D' or 'V' and 'order_number' is not set then
+'amount', 'card_number' and 'expiration' must be set.
+
+=head2 type
+
+If 'type' matches one of the following keys it is replaced by the
+right hand side value:
+
+  'visa'               => 'C',
+  'mastercard'         => 'C',
+  'american express'   => 'C',
+  'discover'           => 'C',
+  'cc'                 => 'C',
+
+The value of 'type' is used to set transaction_type().  Currently this
+module only supports a transaction_type() of 'C' any other values will
+cause Carp::croak() to be called in submit().
+
+Note: Payflow Pro supports multiple credit card types, including:
+American Express/Optima, Diners Club, Discover/Novus, Enroute, JCB,
+MasterCard and Visa.
+
+=head1 Setting Payflow Pro parameters from content(%content)
+
+The following rules are applied to map data to Payflow Pro parameters
+from content(%content):
+
+      # PFP param => $content{<key>}
+      VENDOR      => $self->vendor ? \( $self->vendor ) : 'login',
+      PARTNER     => \( $self->partner ),
+      USER        => 'login',
+      PWD         => 'password',
+      TRXTYPE     => 'action',
+      TENDER      => 'type',
+      ORIGID      => 'order_number',
+      COMMENT1    => 'description',
+      COMMENT2    => 'invoice_number',
+
+      ACCT        => 'card_number',
+      CVV2        => 'cvv2',
+      EXPDATE     => \( $month.$year ), # MM/YY from 'expiration'
+      AMT         => 'amount',
+
+      FIRSTNAME   => 'first_name',
+      LASTNAME    => 'last_name',
+      NAME        => 'name',
+      EMAIL       => 'email',
+      COMPANYNAME => 'company',
+      STREET      => 'address',
+      CITY        => 'city',
+      STATE       => 'state',
+      ZIP         => \$zip, # 'zip' with non-alphanumerics removed
+      COUNTRY     => 'country',
+
+The required Payflow Pro parameters for credit card transactions are:
+
+  TRXTYPE TENDER PARTNER VENDOR USER PWD ORIGID
+
+=head1 Mapping Payflow Pro transaction responses to object methods
+
+The following methods provides access to the transaction response data
+resulting from a Payflow Pro request (after submit()) is called:
+
+=head2 order_number()
+
+This order_number() method returns the PNREF field, also known as the
+PayPal Reference ID, which is a unique number that identifies the
+transaction.
+
+=head2 result_code()
+
+The result_code() method returns the RESULT field, which is the
+numeric return code indicating the outcome of the attempted
+transaction.
+
+A RESULT of 0 (zero) indicates the transaction was approved and
+is_success() will return '1' (one/TRUE).  Any other RESULT value
+indicates a decline or error and is_success() will return '0'
+(zero/FALSE).
+
+=head2 error_message()
+
+The error_message() method returns the RESPMSG field, which is a
+response message returned with the transaction result.
+
+=head2 authorization()
+
+The authorization() method returns the AUTHCODE field, which is the
+approval code obtained from the processing network.
+
+=head2 avs_code()
+
+The avs_code() method returns a combination of the AVSADDR and AVSZIP
+fields from the transaction result.  The value in avs_code is as
+follows:
+
+  Y     - Address and ZIP match
+  A     - Address matches but not ZIP
+  Z     - ZIP matches but not address
+  N     - no match
+  undef - AVS values not available
+
+=head2 cvv2_response()
+
+The cvv2_response() method returns the CVV2MATCH field, which is a
+response message returned with the transaction result.
+
+=head2 expdate_mmyy()
+
+The expdate_mmyy() method takes a single scalar argument (typically
+the value in $content{expiration}) and attempts to parse and format
+and put the date in MMYY format as required by PayflowPro
+specification.  If unable to parse the expiration date simply leave it
+as is and let the PayflowPro system attempt to handle it as-is.
+
+=head2 request_id()
+
+The request_id() method uses Digest::MD5 to attempt to generate a
+request_id for a transaction.  It is recommended that you specify your
+own unique request_id for each transaction in %content.  A request_id
+is REQUIRED by the PayflowPro processor.
+
+=head2 debug()
+
+Enable or disble debugging.  The value specified here will also set
+$Business::OnlinePayment::HTTPS::DEBUG in submit() to aid in
+troubleshooting problems.
+
+=head1 COMPATIBILITY
+
+This module implements an interface to the Payflow Pro Perl API, which
+can be downloaded at https://manager.paypal.com/ with a valid login.
+
+=head1 AUTHORS
 
 Ivan Kohler <ivan-payflowpro@420.am>
 
-Based on Busienss::OnlinePayment::AuthorizeNet written by Jason Kohles.
+Phil Lobbes E<lt>phil at perkpartners.comE<gt>
+
+Based on Business::OnlinePayment::AuthorizeNet written by Jason Kohles.
 
 =head1 SEE ALSO
 
-perl(1), L<Business::OnlinePayment>.
+perl(1), L<Business::OnlinePayment>, L<Carp>, and the PayPal
+Integration Center Payflow Pro resources at
+L<https://www.paypal.com/IntegrationCenter/ic_payflowpro.html>
 
 =cut
-