X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FClientAPI%2FSignup.pm;h=2eefcf8d9d609c1d09d5768c5a0859248214efab;hb=01618f9ed8c0f96d9d17b355cc9db2e54b004397;hp=b9cd6c69f76e10dd27242ce094a40e641c73892d;hpb=40a7b3dc653e099f7bd0bd762b649b04c4432db2;p=freeside.git diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm index b9cd6c69f..2eefcf8d9 100644 --- a/FS/FS/ClientAPI/Signup.pm +++ b/FS/FS/ClientAPI/Signup.pm @@ -26,6 +26,15 @@ use FS::payby; $DEBUG = 0; $me = '[FS::ClientAPI::Signup]'; +sub clear_cache { + warn "$me clear_cache called\n" if $DEBUG; + my $cache = new FS::ClientAPI_SessionCache( { + 'namespace' => 'FS::ClientAPI::Signup', + } ); + $cache->clear(); + return {}; +} + sub signup_info { my $packet = shift; @@ -90,7 +99,7 @@ sub signup_info { ], 'agent' => [ map { my $agent = $_; - map { $_ => $agent->get($_) } @agent_fields; + +{ map { $_ => $agent->get($_) } @agent_fields } } qsearch('agent', { 'disabled' => '' } ) ], @@ -111,6 +120,9 @@ sub signup_info { 'payby' => [ $conf->config('signup_server-payby') ], + 'payby_longname' => [ map { FS::payby->longname($_) } + $conf->config('signup_server-payby') ], + 'card_types' => card_types(), 'paytypes' => [ @FS::cust_main::paytypes ], @@ -638,26 +650,22 @@ sub new_customer { if ( $conf->exists('signup_server-realtime') ) { - #warn "[fs_signup_server] Billing customer...\n" if $Debug; + #warn "$me Billing customer...\n" if $Debug; my $bill_error = $cust_main->bill; - #warn "[fs_signup_server] error billing new customer: $bill_error" + #warn "$me error billing new customer: $bill_error" # if $bill_error; $bill_error = $cust_main->apply_payments_and_credits; - #warn "[fs_signup_server] error applying payments and credits for". + #warn "$me error applying payments and credits for". # " new customer: $bill_error" # if $bill_error; - if ($cust_main->_new_bop_required()) { - $bill_error = $cust_main->realtime_collect( - method => FS::payby->payby2bop( $packet->{payby} ), - depend_jobnum => $placeholder->jobnum, - ); - } else { - $bill_error = $cust_main->collect('realtime' => 1); - } - #warn "[fs_signup_server] error collecting from new customer: $bill_error" + $bill_error = $cust_main->realtime_collect( + method => FS::payby->payby2bop( $packet->{payby} ), + depend_jobnum => $placeholder->jobnum, + ); + #warn "$me error collecting from new customer: $bill_error" # if $bill_error; if ($bill_error && ref($bill_error) eq 'HASH') { @@ -669,6 +677,11 @@ sub new_customer { }; } + $bill_error = $cust_main->apply_payments_and_credits; + #warn "$me error applying payments and credits for". + # " new customer: $bill_error" + # if $bill_error; + if ( $cust_main->balance > 0 ) { #this makes sense. credit is "un-doing" the invoice