[freeside-commits] branch master updated. eb439974e7aa85bb7ee31ed1e3f432bc2a7a250b

Jonathan Prykop jonathan at 420.am
Tue Sep 29 19:44:31 PDT 2015


The branch, master has been updated
       via  eb439974e7aa85bb7ee31ed1e3f432bc2a7a250b (commit)
      from  f474f79841172f506370814b14a7efe80545f472 (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 eb439974e7aa85bb7ee31ed1e3f432bc2a7a250b
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Tue Sep 29 21:43:23 2015 -0500

    RT#38048: not storing credit card #s [save-first fix for selfservice]

diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 6332dd7..98b87ad 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -1142,37 +1142,6 @@ sub do_process_payment {
 
   my $payby = delete $validate->{'payby'};
 
-  my $error = $cust_main->realtime_bop( $FS::payby::payby2bop{$payby}, $amount,
-    'quiet'       => 1,
-    'manual'      => 1,
-    'selfservice' => 1,
-    'paynum_ref'  => \$paynum,
-    %$validate,
-  );
-  return { 'error' => $error } if $error;
-
-  #no error, so order the fee package if applicable...
-  my $conf = new FS::Conf;
-  my $fee_pkgpart = $conf->config('selfservice_process-pkgpart', $cust_main->agentnum);
-  my $fee_skip_first = $conf->exists('selfservice_process-skip_first');
-  
-  if ( $fee_pkgpart and ! $fee_skip_first || scalar($cust_main->cust_pay) ) {
-
-    my $cust_pkg = new FS::cust_pkg { 'pkgpart' => $fee_pkgpart };
-
-    $error = $cust_main->order_pkg( 'cust_pkg' => $cust_pkg );
-    return { 'error' => "payment processed successfully, but error ordering fee: $error" }
-      if $error;
-
-    #and generate an invoice for it now too
-    $error = $cust_main->bill( 'pkg_list' => [ $cust_pkg ] );
-    return { 'error' => "payment processed and fee ordered sucessfully, but error billing fee: $error" }
-      if $error;
-
-  }
-
-  $cust_main->apply_payments;
-
   if ( $validate->{'save'} ) {
     my $new = new FS::cust_main { $cust_main->hash };
     if ($payby eq 'CARD' || $payby eq 'DCRD') {
@@ -1193,7 +1162,7 @@ sub do_process_payment {
                     stateid stateid_state );
       $new->set( 'payby' => $validate->{'auto'} ? 'CHEK' : 'DCHK' );
     }
-    $new->set( 'payinfo' => $cust_main->card_token || $validate->{'payinfo'} );
+    $new->payinfo( $validate->{'payinfo'} ); #to properly set paymask
     $new->set( 'paydate' => $validate->{'paydate'} );
     my $error = $new->replace($cust_main);
     if ( $error ) {
@@ -1201,18 +1170,48 @@ sub do_process_payment {
       #return { 'error' => $error };
       #XXX just warn verosely for now so i can figure out how these happen in
       # the first place, eventually should redirect them to the "change
-      #address" page but indicate the payment did process??
+      #address" page but indicate if the payment processed?
       delete($validate->{'payinfo'}); #don't want to log this!
       warn "WARNING: error changing customer info when processing payment (not returning to customer as a processing error): $error\n".
            "NEW: ". Dumper($new)."\n".
            "OLD: ". Dumper($cust_main)."\n".
            "PACKET: ". Dumper($validate)."\n";
-    #} else {
-      #not needed...
-      #$cust_main = $new;
+    } else {
+      $cust_main = $new;
     }
   }
 
+  my $error = $cust_main->realtime_bop( $FS::payby::payby2bop{$payby}, $amount,
+    'quiet'       => 1,
+    'manual'      => 1,
+    'selfservice' => 1,
+    'paynum_ref'  => \$paynum,
+    %$validate,
+  );
+  return { 'error' => $error } if $error;
+
+  #no error, so order the fee package if applicable...
+  my $conf = new FS::Conf;
+  my $fee_pkgpart = $conf->config('selfservice_process-pkgpart', $cust_main->agentnum);
+  my $fee_skip_first = $conf->exists('selfservice_process-skip_first');
+  
+  if ( $fee_pkgpart and ! $fee_skip_first || scalar($cust_main->cust_pay) ) {
+
+    my $cust_pkg = new FS::cust_pkg { 'pkgpart' => $fee_pkgpart };
+
+    $error = $cust_main->order_pkg( 'cust_pkg' => $cust_pkg );
+    return { 'error' => "payment processed successfully, but error ordering fee: $error" }
+      if $error;
+
+    #and generate an invoice for it now too
+    $error = $cust_main->bill( 'pkg_list' => [ $cust_pkg ] );
+    return { 'error' => "payment processed and fee ordered sucessfully, but error billing fee: $error" }
+      if $error;
+
+  }
+
+  $cust_main->apply_payments;
+
   my $cust_pay = '';
   my $receipt_html = '';
   if ($paynum) {

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

Summary of changes:
 FS/FS/ClientAPI/MyAccount.pm |   71 +++++++++++++++++++++---------------------
 1 file changed, 35 insertions(+), 36 deletions(-)




More information about the freeside-commits mailing list