}
- my $agentnum = $conf->config('signup_server-default_agentnum');
+ my $agentnum = $packet->{'agentnum'}
+ || $conf->config('signup_server-default_agentnum');
my $session = '';
if ( exists $packet->{'session_id'} ) {
} else {
return { 'error' => "Can't resume session" }; #better error message
}
+ }elsif( exists $packet->{'customer_session_id'} ) {
+ my $cache = new FS::ClientAPI_SessionCache( {
+ 'namespace' => 'FS::ClientAPI::MyAccount',
+ } );
+ $session = $cache->get($packet->{'customer_session_id'});
+ if ( $session ) {
+ my $custnum = $session->{'custnum'};
+ my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum });
+ return { 'error' => "Can't find your customer record" } unless $cust_main;
+ $agentnum = $cust_main->agentnum;
+ } else {
+ return { 'error' => "Can't resume session" }; #better error message
+ }
}
$signup_info->{'part_pkg'} = [];
# delete $signup_info->{'part_pkg'};
#}
- if ( $session ) {
+ if ( exists $packet->{'session_id'} ) {
my $agent_signup_info = { %$signup_info };
delete $agent_signup_info->{agentnum2part_pkg};
$agent_signup_info->{'agent'} = $session->{'agent'};
#warn "[fs_signup_server] error billing new customer: $bill_error"
# if $bill_error;
- $cust_main->apply_payments;
- $cust_main->apply_credits;
+ $cust_main->apply_payments_and_credits;
$bill_error = $cust_main->collect('realtime' => 1);
#warn "[fs_signup_server] error collecting from new customer: $bill_error"