- Lots of general cleanup, no functional changes. "fill paragraphs" in
authorplobbes <plobbes>
Wed, 30 Aug 2006 19:04:47 +0000 (19:04 +0000)
committerplobbes <plobbes>
Wed, 30 Aug 2006 19:04:47 +0000 (19:04 +0000)
  POD, remove extra whitespace, sorted %fields, dump_contents now
  sorts %contents, added myself to AUTHORS.

OnlinePayment.pm

index d051c74..871d555 100644 (file)
@@ -11,20 +11,20 @@ $VERSION = '3.00_04';
 $VERSION = eval $VERSION; # modperlstyle: convert the string into a number
 
 my %fields = (
-    is_success       => undef,
+    authorization    => undef,
+    error_message    => undef,
     failure_status   => undef,
-    result_code      => undef,
-    test_transaction => undef,
+    fraud_detect     => undef,
+    is_success       => undef,
+    maximum_risk     => undef,
+    path             => undef,
+    port             => undef,
     require_avs      => undef,
-    transaction_type => undef,
-    error_message    => undef,
-    authorization    => undef,
+    result_code      => undef,
     server           => undef,
-    port             => undef,
-    path             => undef,
-    fraud_detect     => undef,
     server_response  => undef,
-    maximum_risk     => undef,
+    test_transaction => undef,
+    transaction_type => undef,
 );
 
 
@@ -74,7 +74,7 @@ sub _risk_detect {
 
     my %parent_content = $self->content();
     $parent_content{action} = 'Fraud Detect';
-    $risk_transaction->content( %parent_content ); 
+    $risk_transaction->content( %parent_content );
     $risk_transaction->submit();
     if ($risk_transaction->is_success()) {
        if ( $risk_transaction->fraud_score <= $self->maximum_fraud_score()) {
@@ -93,19 +93,12 @@ sub _pre_submit{
     my ($self) = @_;
     my $fraud_detection = $self->fraud_detect();
 
-    #
     # early return if user does not want optional risk mgt
-    #
-
     return $self->{_child_submit}->($self,@_) unless $fraud_detection && length $fraud_detection;
 
-    #
-
     # Search for an appropriate FD module
-    #
-    
     foreach my $subclass ( q(Business::OnlinePayment::) . $fraud_detection,
-                          q(Business::FraudDetect::).$fraud_detection) {
+                          q(Business::FraudDetect::) . $fraud_detection) {
 
        if (!defined(&$subclass)) {
            eval "use $subclass";
@@ -180,7 +173,7 @@ sub dump_contents {
 
     my %content = $self->content();
     my $dump = "";
-    foreach(keys %content) {
+    foreach(sort keys %content) {
         $dump .= "$_ = $content{$_}\n";
     }
     return $dump;
@@ -208,7 +201,7 @@ Business::OnlinePayment - Perl extension for online payment processing
 =head1 SYNOPSIS
 
   use Business::OnlinePayment;
-
+  
   my $transaction = new Business::OnlinePayment($processor, %processor_info);
   $transaction->content(
                         type        => 'Visa',
@@ -218,7 +211,7 @@ Business::OnlinePayment - Perl extension for online payment processing
                         name        => 'John Q Doe',
                        );
   $transaction->submit();
-
+  
   if($transaction->is_success()) {
     print "Card processed successfully: ".$transaction->authorization()."\n";
   } else {
@@ -227,25 +220,36 @@ Business::OnlinePayment - Perl extension for online payment processing
 
 =head1 DESCRIPTION
 
-Business::OnlinePayment is a generic module for processing payments through
-online credit card processors, electronic cash systems, etc.
+Business::OnlinePayment is a generic module for processing payments
+through online credit card processors, electronic cash systems, etc.
 
 =head1 METHODS AND FUNCTIONS
 
 =head2 new($processor, %processor_options);
 
-Create a new Business::OnlinePayment object, $processor is required, and defines the online processor to use.  If necessary, processor options can be specified, currently supported options are 'Server', 'Port', and 'Path', which specify how to find the online processor (https://server:port/path), but individual processor modules should supply reasonable defaults for this information, override the defaults only if absolutely necessary (especially path), as the processor module was probably written with a specific target script in mind.
+Create a new Business::OnlinePayment object, $processor is required,
+and defines the online processor to use.  If necessary, processor
+options can be specified, currently supported options are 'Server',
+'Port', and 'Path', which specify how to find the online processor
+(https://server:port/path), but individual processor modules should
+supply reasonable defaults for this information, override the defaults
+only if absolutely necessary (especially path), as the processor
+module was probably written with a specific target script in mind.
 
 =head2 content(%content);
 
-The information necessary for the transaction, this tends to vary a little depending on the processor, so we have chosen to use a system which defines specific fields in the frontend which get mapped to the correct fields in the backend.  The currently defined fields are:
+The information necessary for the transaction, this tends to vary a
+little depending on the processor, so we have chosen to use a system
+which defines specific fields in the frontend which get mapped to the
+correct fields in the backend.  The currently defined fields are:
 
 =over 4
 
 =item * type
 
 Transaction type, supported types are:
-Visa, MasterCard, American Express, Discover, Check (not all processors support all these transaction types).
+Visa, MasterCard, American Express, Discover, Check (not all
+processors support all these transaction types).
 
 =item * login
 
@@ -257,19 +261,23 @@ Your password to use for authentication to the online processor.
 
 =item * action
 
-What to do with the transaction (currently available are: Normal Authorization, Authorization Only, Credit, Post Authorization)
+What to do with the transaction (currently available are: Normal
+Authorization, Authorization Only, Credit, Post Authorization)
 
 =item * description
 
-A description of the transaction (used by some processors to send information to the client, normally not a required field).
+A description of the transaction (used by some processors to send
+information to the client, normally not a required field).
 
 =item * amount
 
-The amount of the transaction, most processors dont want dollar signs and the like, just a floating point number.
+The amount of the transaction, most processors don't want dollar signs
+and the like, just a floating point number.
 
 =item * invoice_number
 
-An invoice number, for your use and not normally required, many processors require this field to be a numeric only field.
+An invoice number, for your use and not normally required, many
+processors require this field to be a numeric only field.
 
 =item * customer_id
 
@@ -281,19 +289,23 @@ The customers name, your processor may not require this.
 
 =item * address
 
-The customers address (your processor may not require this unless you are requiring AVS Verification).
+The customers address (your processor may not require this unless you
+are requiring AVS Verification).
 
 =item * city
 
-The customers city (your processor may not require this unless you are requiring AVS Verification).
+The customers city (your processor may not require this unless you are
+requiring AVS Verification).
 
 =item * state
 
-The customers state (your processor may not require this unless you are requiring AVS Verification).
+The customers state (your processor may not require this unless you
+are requiring AVS Verification).
 
 =item * zip
 
-The customers zip code (your processor may not require this unless you are requiring AVS Verification).
+The customers zip code (your processor may not require this unless you
+are requiring AVS Verification).
 
 =item * country
 
@@ -313,11 +325,13 @@ Customer's email address.
 
 =item * card_number
 
-Credit card number (obviously not required for non-credit card transactions).
+Credit card number (obviously not required for non-credit card
+transactions).
 
 =item * exp_date
 
-Credit card expiration (obviously not required for non-credit card transactions).
+Credit card expiration (obviously not required for non-credit card
+transactions).
 
 =item * account_number
 
@@ -339,46 +353,62 @@ Submit the transaction to the processor for completion
 
 =head2 is_success();
 
-Returns true if the transaction was submitted successfully, false if it failed (or undef if it has not been submitted yet).
+Returns true if the transaction was submitted successfully, false if
+it failed (or undef if it has not been submitted yet).
 
 =head2 failure_status();
 
-If the transactdion failed, it can optionally return a specific failure status
-(normalized, not gateway-specific).  Currently defined statuses are: "expired",
-"nsf" (non-sufficient funds), "stolen", "pickup", "blacklisted" and
-"declined" (card/transaction declines only, not other errors).
+If the transaction failed, it can optionally return a specific
+failure status (normalized, not gateway-specific).  Currently defined
+statuses are: "expired", "nsf" (non-sufficient funds), "stolen",
+"pickup", "blacklisted" and "declined" (card/transaction declines
+only, not other errors).
 
-Note that (as of Aug 2006) this is only supported by some of the newest
-processor modules, and that, even if supported, a failure status is an entirely
-optional field that is only set for specific kinds of failures.
+Note that (as of Aug 2006) this is only supported by some of the
+newest processor modules, and that, even if supported, a failure
+status is an entirely optional field that is only set for specific
+kinds of failures.
 
 =head2 result_code();
 
-Returns the precise result code that the processor returned, these are normally one letter codes that don't mean much unless you understand the protocol they speak, you probably don't need this, but it's there just in case.
+Returns the precise result code that the processor returned, these are
+normally one letter codes that don't mean much unless you understand
+the protocol they speak, you probably don't need this, but it's there
+just in case.
 
 =head2 test_transaction();
 
-Most processors provide a test mode, where submitted transactions will not actually be charged or added to your batch, calling this function with a true argument will turn that mode on if the processor supports it, or generate a fatal error if the processor does not support a test mode (which is probably better than accidentally making real charges).
+Most processors provide a test mode, where submitted transactions will
+not actually be charged or added to your batch, calling this function
+with a true argument will turn that mode on if the processor supports
+it, or generate a fatal error if the processor does not support a test
+mode (which is probably better than accidentally making real charges).
 
 =head2 require_avs();
 
-Providing a true argument to this module will turn on address verification (if the processor supports it).
+Providing a true argument to this module will turn on address
+verification (if the processor supports it).
 
 =head2 transaction_type();
 
-Retrieve the transaction type (the 'type' argument to contents();).  Generally only used internally, but provided in case it is useful.
+Retrieve the transaction type (the 'type' argument to contents();).
+Generally only used internally, but provided in case it is useful.
 
 =head2 error_message();
 
-If the transaction has been submitted but was not accepted, this function will return the provided error message (if any) that the processor returned.
+If the transaction has been submitted but was not accepted, this
+function will return the provided error message (if any) that the
+processor returned.
 
 =head2 authorization();
 
-If the transaction has been submitted and accepted, this function will provide you with the authorization code that the processor returned.
+If the transaction has been submitted and accepted, this function will
+provide you with the authorization code that the processor returned.
 
 =head2 server();
 
-Retrieve or change the processor submission server address (CHANGE AT YOUR OWN RISK).
+Retrieve or change the processor submission server address (CHANGE AT
+YOUR OWN RISK).
 
 =head2 port();
 
@@ -394,13 +424,14 @@ Jason Kohles, email@jasonkohles.com
 
 (v3 rewrite) Ivan Kohler <ivan-business-onlinepayment@420.am>
 
+Phil Lobbes E<lt>phil at perkpartners dot comE<gt>
+
 =head1 DISCLAIMER
 
 THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
-
 =head1 SEE ALSO
 
 http://420.am/business-onlinepayment/