[freeside-commits] branch FREESIDE_3_BRANCH updated. 5b2b242ad80a2efac3fb3f4d919142307084bd73

Jonathan Prykop jonathan at 420.am
Tue May 3 13:21:15 PDT 2016


The branch, FREESIDE_3_BRANCH has been updated
       via  5b2b242ad80a2efac3fb3f4d919142307084bd73 (commit)
      from  29a7178b002a00aea85973a056cfecb0e23cb99e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5b2b242ad80a2efac3fb3f4d919142307084bd73
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Mon May 2 21:44:40 2016 -0500

    RT#37632: Credit card validation [v3 fixes]

diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 6e66646..22b7a16 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -542,6 +542,16 @@ sub insert {
 
   }
 
+  # validate card (needs custnum already set)
+  if ( $self->payby =~ /^(CARD|DCRD)$/
+       && $conf->exists('business-onlinepayment-verification') ) {
+    $error = $self->realtime_verify_bop({ 'method'=>'CC' });
+    if ( $error ) {
+      $dbh->rollback if $oldAutoCommit;
+      return $error;
+    }
+  }
+
   warn "  setting contacts\n"
     if $DEBUG > 1;
 
@@ -1540,6 +1550,20 @@ sub replace {
     return $error if $error;
 
     if ( $conf->exists('business-onlinepayment-verification') ) {
+      #need to standardize paydate for this, false laziness with check
+      my( $m, $y );
+      if ( $self->paydate =~ /^(\d{1,2})[\/\-](\d{2}(\d{2})?)$/ ) {
+        ( $m, $y ) = ( $1, length($2) == 4 ? $2 : "20$2" );
+      } elsif ( $self->paydate =~ /^19(\d{2})[\/\-](\d{1,2})[\/\-]\d+$/ ) {
+        ( $m, $y ) = ( $2, "19$1" );
+      } elsif ( $self->paydate =~ /^(20)?(\d{2})[\/\-](\d{1,2})[\/\-]\d+$/ ) {
+        ( $m, $y ) = ( $3, "20$2" );
+      } else {
+        return "Illegal expiration date: ". $self->paydate;
+      }
+      $m = sprintf('%02d',$m);
+      $self->paydate("$y-$m-01");
+
       $error = $self->realtime_verify_bop({ 'method'=>'CC' });
       return $error if $error;
     }
diff --git a/FS/FS/cust_main/Billing_Realtime.pm b/FS/FS/cust_main/Billing_Realtime.pm
index 90fda5e..4c28d0e 100644
--- a/FS/FS/cust_main/Billing_Realtime.pm
+++ b/FS/FS/cust_main/Billing_Realtime.pm
@@ -1938,8 +1938,10 @@ sub realtime_verify_bop {
                                 );
 
     $reverse->content( 'action'        => 'Reverse Authorization',
+                       $self->_bop_auth(\%options),          
 
                        # B:OP
+                       'amount'        => '1.00',
                        'authorization' => $transaction->authorization,
                        'order_number'  => $ordernum,
 

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_main.pm                  |   24 ++++++++++++++++++++++++
 FS/FS/cust_main/Billing_Realtime.pm |    2 ++
 2 files changed, 26 insertions(+)




More information about the freeside-commits mailing list