Flag to disable passing AVS and CVV information, so Moneris doesn't error out, and... master
authorIvan Kohler <ivan@freeside.biz>
Wed, 23 Apr 2014 00:57:25 +0000 (17:57 -0700)
committerIvan Kohler <ivan@freeside.biz>
Wed, 23 Apr 2014 00:57:25 +0000 (17:57 -0700)
Changes
eSelectPlus.pm

diff --git a/Changes b/Changes
index 2ec011a..1a82ae9 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,7 +1,9 @@
 Revision history for Perl extension Business::OnlinePayment::eSelectPlus
 
 0.08  unreleased
-        - Pass AVS and CVV information
+        - (0.08_01) Pass AVS and CVV information
+        - (0.08_02) Flag to disable passing AVS and CVV information, so Moneris
+          doesn't error out, and documentation on the behavior change
 
 0.07  Wed Aug 21 11:53:36 PDT 2013
         - eSelectPlus cust_id: Use customer number instead of invoice number
index b118080..806fb65 100644 (file)
@@ -8,11 +8,12 @@ use Business::OnlinePayment::HTTPS 0.03;
 use vars qw($VERSION $DEBUG @ISA);
 
 @ISA = qw(Business::OnlinePayment::HTTPS);
-$VERSION = '0.08_01';
+$VERSION = '0.08_02';
 $DEBUG = 0;
 
 sub set_defaults {
     my $self = shift;
+    my %opts = @_;
 
     #USD
     #$self->server('esplusqa.moneris.com');  # development
@@ -26,8 +27,11 @@ sub set_defaults {
 
     $self->port('443');
 
-    $self->build_subs(qw( order_number avs_code ));
+    $self->build_subs(qw( order_number avs_code skip_avs skip_cvv ));
     # avs_code order_type md5 cvv2_response cavv_response
+
+    $self->skip_avs( $opts{skip_avs} );
+    $self->skip_cvv( $opts{skip_cvv} );
 }
 
 sub submit {
@@ -188,14 +192,14 @@ sub submit {
           '<avs_info>'.  
             join('', map "<$_>$avs_fields{$_}</$_>", keys %avs_fields ).
           '</avs_info>'
-       if grep $_, values %avs_fields;
+       if ! $self->skip_avs && grep $_, values %avs_fields;
 
       tie my %cvd_fields, 'Tie::IxHash', $self->get_fields( $self->cvd_fields );
       $post_data .=
           '<cvd_info>'.  
             join('', map "<$_>$cvd_fields{$_}</$_>", keys %cvd_fields ).
           '</cvd_info>'
-        if grep $_, values %cvd_fields;
+        if ! $self->skip_cvv && grep $_, values %cvd_fields;
     }
 
     $post_data .=
@@ -431,6 +435,17 @@ so that authorization() and order_number() can return the 2 fields needed
 for capture.  See also
 cpansearch.perl.org/src/IVAN/Business-OnlinePayment-3.02/notes_for_module_writers_v3
 
+=head2 Note for upgrading to 0.08 without AVS/CVV enabled with Moneris
+
+This version now passes AVS and CVV info (previous versions did not).  If your
+Moneris account is not enabled for these services, you can omit them by passing
+the "skip_avs" and/or "skip_cvv" options set to a true value:
+
+  my $tx = new Business::OnlinePayment('eSelectPlus',
+                                         'skip_avs' => 1,
+                                         'skip_cvv' => 1,
+                                      );
+
 =head1 AUTHOR
 
 Ivan Kohler <ivan-eselectplus@420.am>