[freeside-commits] branch master updated. f8b1ee4818c40fa7cbc7dd060efb24df87c1669c

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


The branch, master has been updated
       via  f8b1ee4818c40fa7cbc7dd060efb24df87c1669c (commit)
      from  d860f85d2a4823a040996f9b1055e2d4054b864e (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 f8b1ee4818c40fa7cbc7dd060efb24df87c1669c
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon May 2 15:15:24 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