Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / FS / FS / ClientAPI / Signup.pm
index 8272b20..a4ea21b 100644 (file)
@@ -539,6 +539,8 @@ sub new_customer {
             paystart_month paystart_year payissue
             payip
 
+            locale
+
             referral_custnum comments
           )
     ),
@@ -781,7 +783,11 @@ sub new_customer {
 
     #warn "$me Billing customer...\n" if $Debug;
 
-    my $bill_error = $cust_main->bill( 'depend_jobnum'=>$placeholder->jobnum );
+    my @cust_bill;
+    my $bill_error = $cust_main->bill(
+      'depend_jobnum' => $placeholder->jobnum,
+      'return_bill'   => \@cust_bill,
+    );
     #warn "$me error billing new customer: $bill_error"
     #  if $bill_error;
 
@@ -816,11 +822,11 @@ sub new_customer {
 
     if ( $cust_main->balance > 0 ) {
 
-      #this makes sense.  credit is "un-doing" the invoice
-      $cust_main->credit( $cust_main->balance, 'signup server decline',
-                          'reason_type' => $conf->config('signup_credit_type'),
-                        );
-      $cust_main->apply_credits;
+      #this used to apply a credit, but now we can void invoices...
+      foreach my $cust_bill (@cust_bill) {
+        my $voiderror = $cust_bill->void();
+        warn "Error voiding cust bill after decline: $voiderror";
+      }
 
       #should check list for errors...
       #$cust_main->suspend;
@@ -946,6 +952,8 @@ sub new_customer_minimal {
         payinfo paycvv paydate payname paystate paytype
         paystart_month paystart_year payissue
         payip
+
+        locale
       ),
 
   } );