X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FClientAPI%2FSignup.pm;h=50295981773e445109b8d65ce554f0009b17143d;hp=1dbb20bc755018ec9283d510a0fe84c9c6b55843;hb=99273ca31c2da59ad01e77154268cdd1b0502d3d;hpb=54a357b171aa44f9399b4c146acd2afd3b686075 diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm index 1dbb20bc7..502959817 100644 --- a/FS/FS/ClientAPI/Signup.pm +++ b/FS/FS/ClientAPI/Signup.pm @@ -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 ); @@ -174,6 +174,7 @@ sub signup_info { 'card_types' => card_types(), 'paytypes' => [ @FS::cust_main::paytypes ], 'cvv_enabled' => 1, + 'require_cvv' => $conf->exists('signup-require_cvv'), 'stateid_enabled' => $conf->exists('show_stateid'), 'paystate_enabled' => $conf->exists('show_bankstate'), 'ship_enabled' => 1, @@ -530,7 +531,7 @@ sub new_customer { || $conf->config('signup_server-default_refnum'), ( map { $_ => $template_cust->$_ } qw( - last first company daytime night fax + last first company daytime night fax mobile ) ), @@ -561,7 +562,8 @@ sub new_customer { map { $_ => $packet->{$_} } qw( last first ss company - daytime night fax stateid stateid_state + daytime night fax mobile + stateid stateid_state payby payinfo paycvv paydate payname paystate paytype paystart_month paystart_year payissue @@ -631,6 +633,11 @@ sub new_customer { if $gw && $gw->gateway_namespace eq 'Business::OnlineThirdPartyPayment'; } + return { 'error' => "CVV2 is required" } + if $cust_main->payby =~ /^(CARD|DCRD)$/ + && ! $cust_main->paycvv + && $conf->exists('signup-require_cvv'); + $cust_main->payinfo($cust_main->daytime) if $cust_main->payby eq 'LECB' && ! $cust_main->payinfo; @@ -670,7 +677,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 +953,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, + }; + } }