separate state and country <SELECT> in signup server also, closes: Bug#353
[freeside.git] / fs_signup / fs_signup_server
index 7f962e0..e0fa9ba 100755 (executable)
@@ -94,7 +94,11 @@ while (1) {
 
     'msgcat' => { map { $_=>gettext($_) } qw(
       passwords_dont_match invalid_card unknown_card_type not_a
-    ) }
+    ) },
+
+    'statedefault' => $conf->config('statedefault') || 'CA',
+
+    'countrydefault' => $conf->config('countrydefault') || 'US',
 
   };
 
@@ -140,6 +144,9 @@ while (1) {
     $error ||= "Illegal payment type"
       unless grep { $_ eq $signup_data->{'payby'} } @payby;
 
+    $cust_main->payinfo($cust_main->daytime)
+      if $cust_main->payby eq 'LECB' && ! $cust_main->payinfo;
+
     my @invoicing_list = split( /\s*\,\s*/, $signup_data->{'invoicing_list'} );
 
     $signup_data->{'pkgpart'} =~ /^(\d+)$/ or '' =~ /^()$/;
@@ -188,9 +195,15 @@ while (1) {
         if $bill_error;
 
       if ( $cust_main->balance > 0 ) {
+
+        #this makes sense.  credit is "un-doing" the invoice
+        $cust_main->credit( $cust_main->balance, 'signup server decline' );
+        $cust_main->apply_credits;
+
         #should check list for errors...
         #$cust_main->suspend;
         $cust_main->cancel;
+
         $error = '_decline';
       }
     }