Merge branch 'master' of git.freeside.biz:/home/git/freeside
authorIvan Kohler <ivan@freeside.biz>
Mon, 29 Apr 2013 19:31:20 +0000 (12:31 -0700)
committerIvan Kohler <ivan@freeside.biz>
Mon, 29 Apr 2013 19:31:20 +0000 (12:31 -0700)
1  2 
FS/FS/ClientAPI/Signup.pm
FS/FS/Conf.pm

@@@ -98,7 -98,7 +98,7 @@@ sub signup_info 
  
      my @signup_bools = qw( no_company recommend_daytime recommend_email );
  
 -    my @signup_server_scalars = qw( default_pkgpart default_svcpart );
 +    my @signup_server_scalars = qw( default_pkgpart default_svcpart default_domsvc );
  
      my @selfservice_textareas = qw( head body_header body_footer );
  
@@@ -670,7 -670,7 +670,7 @@@ sub new_customer 
      my $svc = new FS::svc_acct {
        'svcpart'   => $svcpart,
        map { $_ => $packet->{$_} }
 -        qw( username _password sec_phrase popnum ),
 +        qw( username _password sec_phrase popnum domsvc ),
      };
  
      my @acct_snarf;
@@@ -946,15 -946,27 +946,27 @@@ sub capture_payment 
    }
  
    my $cust_main = $cust_pay_pending->cust_main;
-   my $bill_error =
-     $cust_main->realtime_botpp_capture( $cust_pay_pending, 
-       %{$packet->{data}},
-       apply => 1,
-   );
+   if ( $packet->{cancel} ) {
+     # the user has chosen not to make this payment
+     # (probably should be a separate API call, but I don't want to duplicate
+     # all of the above...which should eventually go away)
+     my $error = $cust_pay_pending->delete;
+     # don't show any errors related to this; they're not meaningful
+     warn "error canceling pending payment $paypendingnum: $error\n" if $error;
+     return { 'error'      => '_cancel',
+              'session_id' => $cust_pay_pending->session_id };
+   } else {
+     # create the payment
+     my $bill_error =
+       $cust_main->realtime_botpp_capture( $cust_pay_pending, 
+         %{$packet->{data}},
+         apply => 1,
+     );
  
-   return { 'error'      => ( $bill_error->{bill_error} ? '_decline' : '' ),
-            %$bill_error,
-          };
+     return { 'error'      => ( $bill_error->{bill_error} ? '_decline' : '' ),
+              %$bill_error,
+            };
+   }
  
  }
  
diff --combined FS/FS/Conf.pm
@@@ -2098,7 -2098,7 +2098,7 @@@ and customer address. Include units.'
      'section'     => 'self-service',
      'description' => 'Acceptable payment types for the signup server',
      'type'        => 'selectmultiple',
-     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB PREPAY BILL COMP) ],
+     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB PREPAY PPAL BILL COMP) ],
    },
  
    {
    {
      'key'         => 'signup_server-default_svcpart',
      'section'     => 'self-service',
 -    'description' => 'Default service definition for the signup server - only necessary for services that trigger special provisioning widgets (such as DID provisioning).',
 +    'description' => 'Default service definition for the signup server - only necessary for services that trigger special provisioning widgets (such as DID provisioning or domain selection).',
      'type'        => 'select-part_svc',
    },
  
    {
 +    'key'         => 'signup_server-default_domsvc',
 +    'section'     => 'self-service',
 +    'description' => 'If specified, the default domain svcpart for signup (useful when domain is set to selectable choice).',
 +    'type'        => 'text',
 +  },
 +
 +  {
      'key'         => 'signup_server-mac_addr_svcparts',
      'section'     => 'self-service',
      'description' => 'Service definitions which can receive mac addresses (current mapped to username for svc_acct).',
      'section'     => 'billing',
      'description' => 'Available payment types.',
      'type'        => 'selectmultiple',
-     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP) ],
+     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD PPAL COMP) ],
    },
  
    {
      'section'     => 'UI',
      'description' => 'Default payment type.  HIDE disables display of billing information and sets customers to BILL.',
      'type'        => 'select',
-     'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP HIDE) ],
+     'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD PPAL COMP HIDE) ],
    },
  
    {