X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FClientAPI%2FSignup.pm;h=61325b9e1e8f9dd129f65ace867af3cb23e00176;hb=5e05724a635a22776f1b973f5d7e77989da4e048;hp=39485b06d3df5bb25d94cc28f8ecd476abde960b;hpb=86330b16240feb45baeaa5aa466b2b42c8a3e7fe;p=freeside.git diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm index 39485b06d..61325b9e1 100644 --- a/FS/FS/ClientAPI/Signup.pm +++ b/FS/FS/ClientAPI/Signup.pm @@ -20,7 +20,7 @@ use FS::acct_snarf; use FS::queue; use FS::reg_code; -$DEBUG = 2; +$DEBUG = 0; $me = '[FS::ClientAPI::Signup]'; sub signup_info { @@ -287,6 +287,32 @@ sub signup_info { } +sub domain_select_hash { + my $packet = shift; + + my $response = {}; + + if ($packet->{pkgpart}) { + my $part_pkg = qsearchs('part_pkg' => { 'pkgpart' => $packet->{pkgpart} } ); + #$packet->{svcpart} = $part_pkg->svcpart('svc_acct') + $packet->{svcpart} = $part_pkg->svcpart + if $part_pkg; + } + + if ($packet->{svcpart}) { + my $part_svc = qsearchs('part_svc' => { 'svcpart' => $packet->{svcpart} } ); + $response->{'domsvc'} = $part_svc->part_svc_column('domsvc')->columnvalue + if ($part_svc && $part_svc->part_svc_column('domsvc')->columnflag eq 'D'); + } + + $response->{'domains'} + = { domain_select_hash FS::svc_acct( map { $_ => $packet->{$_} } + qw(svcpart pkgnum) + ) }; + + $response; +} + sub new_customer { my $packet = shift; @@ -439,7 +465,10 @@ sub new_customer { #warn "[fs_signup_server] error billing new customer: $bill_error" # if $bill_error; - $cust_main->apply_payments_and_credits; + $bill_error = $cust_main->apply_payments_and_credits; + #warn "[fs_signup_server] error applying payments and credits for". + # " new customer: $bill_error" + # if $bill_error; $bill_error = $cust_main->collect('realtime' => 1); #warn "[fs_signup_server] error collecting from new customer: $bill_error" @@ -448,7 +477,9 @@ 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' ); + $cust_main->credit( $cust_main->balance, 'signup server decline', + 'reason_type' => $conf->config('signup_credit_type'), + ); $cust_main->apply_credits; #should check list for errors...