[freeside-commits] branch master updated. a87e91ee19d14a6fc3da62f4b44a9628d32bb6a3

Ivan ivan at 420.am
Tue Nov 3 09:00:25 PST 2015


The branch, master has been updated
       via  a87e91ee19d14a6fc3da62f4b44a9628d32bb6a3 (commit)
       via  4fdc6b443f4f9f51f0879cc19b2fe8c5ef1dac14 (commit)
      from  863c1ca1d9363c8fda3136514cef90584a1f4427 (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 a87e91ee19d14a6fc3da62f4b44a9628d32bb6a3
Merge: 4fdc6b4 863c1ca
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Nov 3 09:00:21 2015 -0800

    Merge branch 'master' of git.freeside.biz:/home/git/freeside


commit 4fdc6b443f4f9f51f0879cc19b2fe8c5ef1dac14
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Nov 3 09:00:17 2015 -0800

    fix self-service signup with payment information in 4.x, RT#38881

diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm
index a4ea21b..bc69a5f 100644
--- a/FS/FS/ClientAPI/Signup.pm
+++ b/FS/FS/ClientAPI/Signup.pm
@@ -26,6 +26,7 @@ use FS::reg_code;
 use FS::payby;
 use FS::banned_pay;
 use FS::part_tag;
+use FS::cust_payby;
 
 $DEBUG = 1;
 $me = '[FS::ClientAPI::Signup]';
@@ -175,7 +176,7 @@ sub signup_info {
       'nomadix'            => $conf->exists('signup_server-nomadix'),
       'payby'              => [ $conf->config('signup_server-payby') ],
       'card_types'         => card_types(),
-      'paytypes'           => [ @FS::cust_main::paytypes ],
+      'paytypes'           => [ FS::cust_payby->paytypes ],
       'cvv_enabled'        => 1,
       'require_cvv'        => $conf->exists('signup-require_cvv'),
       'stateid_enabled'    => $conf->exists('show_stateid'),
@@ -533,20 +534,27 @@ sub new_customer {
     ( map { $_ => $packet->{$_} } qw(
             salesnum
             ss stateid stateid_state
-
-            payby
-            payinfo paycvv paydate payname paystate paytype
-            paystart_month paystart_year payissue
-            payip
-
             locale
-
             referral_custnum comments
           )
     ),
 
   );
 
+  my %insert_options = ();
+  if ( $packet->{payby} =~ /^(CARD|DCRD|CHEK|DCHK)$/ ) {
+    $insert_options{cust_payby} = [
+      new FS::cust_payby {
+        map { $_ => $packet->{$_} } qw(
+          payby
+          payinfo paycvv paydate payname paystate paytype
+          paystart_month paystart_year payissue
+          payip
+        ),
+      }
+    ];
+  }
+
   my $template_custnum = $conf->config('signup_server-prepaid-template-custnum');
   my $cust_main;
   if ( $template_custnum && $packet->{prepaid_shortform} ) {
@@ -644,8 +652,6 @@ sub new_customer {
                          ? split( /\s*\,\s*/, $packet->{'invoicing_list'} )
                          : ();
 
-  my %insert_options = ();
-
   my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
   my @tax_exempt = grep { $packet->{"tax_$_"} eq 'Y' } @exempt_groups;
   $insert_options{'tax_exemption'} = {
@@ -948,16 +954,25 @@ sub new_customer_minimal {
         last first company daytime night fax mobile
         ss stateid stateid_state
 
-        payby
-        payinfo paycvv paydate payname paystate paytype
-        paystart_month paystart_year payissue
-        payip
-
         locale
       ),
 
   } );
 
+  my %opt = ();
+  if ( $packet->{payby} =~ /^(CARD|DCRD|CHEK|DCHK)$/ ) {
+    $opt{cust_payby} = [
+      new FS::cust_payby {
+        map { $_ => $packet->{$_} } qw(
+          payby
+          payinfo paycvv paydate payname paystate paytype
+          paystart_month paystart_year payissue
+          payip
+        ),
+      }
+    ];
+  }
+
   if ( grep length($packet->{$_}), FS::cust_main->location_fields ) {
     my $bill_hash;
     foreach my $f (FS::cust_main->location_fields) {
@@ -1041,7 +1056,6 @@ sub new_customer_minimal {
 
   }
 
-  my %opt = ();
   if ( $invoicing_list[0] && $packet->{'_password'} ) {
     $opt{'contact'} = [
       new FS::contact { 'first'        => $cust_main->first,
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 2d6d459..1f64b9e 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -599,7 +599,18 @@ sub insert {
   warn "  setting cust_payby\n"
     if $DEBUG > 1;
 
-  if ( my $cust_payby_params = delete $options{'cust_payby_params'} ) {
+  if ( $options{cust_payby} ) {
+
+    foreach my $cust_payby ( @{ $options{cust_payby} } ) {
+      $cust_payby->custnum($self->custnum);
+      my $error = $cust_payby->insert;
+      if ( $error ) {
+        $dbh->rollback if $oldAutoCommit;
+        return $error;
+      }
+    }
+
+  } elsif ( my $cust_payby_params = delete $options{'cust_payby_params'} ) {
 
     my $error = $self->process_o2m(
       'table'         => 'cust_payby',

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

Summary of changes:
 FS/FS/ClientAPI/Signup.pm |   46 +++++++++++++++++++++++++++++----------------
 FS/FS/cust_main.pm        |   13 ++++++++++++-
 2 files changed, 42 insertions(+), 17 deletions(-)




More information about the freeside-commits mailing list