X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=FS%2FFS%2FAPI.pm;h=39a959ade4ada4dd9cf388dfb97a6a2d9ad3a242;hb=dec15062e2df6f615e42d5f87193133a3e072826;hp=4ff1a3ab592c61d28cdd6dd4c5e959be9f8437ce;hpb=33cf0327e669dc03e9a33273eb082dd821d43347;p=freeside.git diff --git a/FS/FS/API.pm b/FS/FS/API.pm index 4ff1a3ab5..39a959ade 100644 --- a/FS/FS/API.pm +++ b/FS/FS/API.pm @@ -724,6 +724,41 @@ sub customer_info { } +=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