diff options
author | Ivan Kohler <ivan@freeside.biz> | 2017-07-24 23:59:54 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2017-07-24 23:59:54 -0700 |
commit | 11e1b0aa5f1811e75ab3fd5c51d43304301567b3 (patch) | |
tree | 14a07eb5ab090e8466ce66cf2f8ac9789954af01 /FS/FS/API.pm | |
parent | 7e0041398e919fa865d096ea2349b9f399b44038 (diff) |
new backoffice API call customer_list_svcs
Diffstat (limited to 'FS/FS/API.pm')
-rw-r--r-- | FS/FS/API.pm | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/FS/FS/API.pm b/FS/FS/API.pm index 6ca2b55..fd3793d 100644 --- a/FS/FS/API.pm +++ b/FS/FS/API.pm @@ -537,6 +537,41 @@ sub customer_info { $cust_main->API_getinfo; } +=item customer_list_svcs OPTION => VALUE, ... + +Returns customer service information. Takes a list of keys and values as +parameters with the following keys: custnum, secret + +=cut + +sub customer_list_svcs { + my( $class, %opt ) = @_; + return _shared_secret_error() unless _check_shared_secret($opt{secret}); + + my $cust_main = qsearchs('cust_main', { 'custnum' => $opt{custnum} }) + or return { 'error' => 'Unknown custnum' }; + + #$cust_main->API_list_svcs; + + #false laziness w/ClientAPI/list_svcs + + my @cust_svc = (); + #my @cust_pkg_usage = (); + #foreach my $cust_pkg ( $p->{'ncancelled'} + # ? $cust_main->ncancelled_pkgs + # : $cust_main->unsuspended_pkgs ) { + foreach my $cust_pkg ( $cust_main->all_pkgs ) { + #next if $pkgnum && $cust_pkg->pkgnum != $pkgnum; + push @cust_svc, @{[ $cust_pkg->cust_svc ]}; #@{[ ]} to force array context + #push @cust_pkg_usage, $cust_pkg->cust_pkg_usage; + } + + return { + 'cust_svc' => [ map $_->API_getinfo, @cust_svc ], + }; + +} + =item location_info Returns location specific information for the customer. Takes a list of keys |