[freeside-commits] branch FREESIDE_4_BRANCH updated. c1fa45998f0abdc3ed1b491d769e4204a4a260ec

Ivan ivan at 420.am
Mon May 2 15:15:26 PDT 2016


The branch, FREESIDE_4_BRANCH has been updated
       via  c1fa45998f0abdc3ed1b491d769e4204a4a260ec (commit)
      from  1cb69e777f13f3efb75edfdaccea80bde6b66ee4 (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 c1fa45998f0abdc3ed1b491d769e4204a4a260ec
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon May 2 15:15:25 2016 -0700

    verify credit card changes via $1 auth, RT#37632

diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 8b04436..ecac223 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -1627,6 +1627,22 @@ sub insert_payby {
   
 }
 
+sub verify_payby {
+  my $p = shift;
+
+  my($context, $session, $custnum) = _custoragent_session_custnum($p);
+  return { 'error' => $session } if $context eq 'error';
+
+  my $cust_payby = qsearchs('cust_payby', {
+                              'custnum'      => $custnum,
+                              'custpaybynum' => $p->{'custpaybynum'},
+                           })
+    or return { 'error' => 'unknown custpaybynum '. $p->{'custpaybynum'} };
+
+  return { 'error' => $cust_payby->verify };
+  
+}
+
 sub delete_payby {
   my $p = shift;
 
diff --git a/FS/FS/cust_payby.pm b/FS/FS/cust_payby.pm
index 030aed6..ec4eb7a 100644
--- a/FS/FS/cust_payby.pm
+++ b/FS/FS/cust_payby.pm
@@ -237,6 +237,11 @@ sub replace {
   {
     my $error = $self->check_payinfo_cardtype;
     return $error if $error;
+
+    if ( $conf->exists('business-onlinepayment-verification') ) {
+      $error = $self->verify;
+      return $error if $error;
+    }
   }
 
   local $SIG{HUP} = 'IGNORE';
@@ -489,7 +494,11 @@ sub check {
 
   }
 
-  ###
+  if ( ! $self->custpaybynum
+       && $conf->exists('business-onlinepayment-verification') ) {
+    $error = $self->verify;
+    return $error if $error;
+  }
 
   $self->SUPER::check;
 }
@@ -617,6 +626,30 @@ sub realtime_bop {
 
 }
 
+=item verify 
+
+=cut
+
+sub verify {
+  my $self = shift;
+  return '' unless $self->payby =~ /^(CARD|DCRD)$/;
+
+  my %opt = ();
+
+  $opt{$_} = $self->$_() for qw( payinfo payname paydate );
+
+  if ( $self->locationnum ) {
+    my $cust_location = $self->cust_location;
+    $opt{$_} = $cust_location->$_() for qw( address1 address2 city state zip );
+  }
+
+  $self->cust_main->realtime_verify_bop({
+    'method' => FS::payby->payby2bop( $self->payby ),
+    %opt,
+  });
+
+}
+
 =item paytypes
 
 Returns a list of valid values for the paytype field (bank account type for

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

Summary of changes:
 FS/FS/ClientAPI/MyAccount.pm |   16 ++++++++++++++++
 FS/FS/cust_payby.pm          |   35 ++++++++++++++++++++++++++++++++++-
 2 files changed, 50 insertions(+), 1 deletion(-)




More information about the freeside-commits mailing list