X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FAPI.pm;h=df488023e50ebf32a26a67a6c6efe0651f6ceab9;hb=00b3fa892f2fe5665fd6415a2806d706bff0e745;hp=c107621cdad2320e65e3f4a57181b0b4f2a8c72b;hpb=eb472623cd8d18ee2d142ae6d61acd465c268e6e;p=freeside.git diff --git a/FS/FS/API.pm b/FS/FS/API.pm index c107621cd..df488023e 100644 --- a/FS/FS/API.pm +++ b/FS/FS/API.pm @@ -1,9 +1,8 @@ package FS::API; use FS::Conf; -use FS::Record qw( qsearch qsearchs ); +use FS::Record qw( qsearchs ); use FS::cust_main; -use FS::cust_location; =head1 NAME @@ -41,8 +40,28 @@ Enter cash refund. #--- -#generally, the more useful data from the cust_main record the better. +#Customer data +# pull customer info +# The fields needed are: +# +# cust_main.custnum +# cust_main.first +# cust_main.last +# cust_main.company +# cust_main.address1 +# cust_main.address2 +# cust_main.city +# cust_main.state +# cust_main.zip +# cust_main.daytime +# cust_main.night +# cust_main_invoice.dest +# +# at minimum + +#Customer balances +#Advertising sources? # "2 way syncing" ? start with non-sync pulling info here, then if necessary # figure out how to trigger something when those things change @@ -79,48 +98,15 @@ sub customer_info { 'error' => '', 'display_custnum' => $cust_main->display_custnum, 'name' => $cust_main->first. ' '. $cust_main->get('last'), - 'balance' => $cust_main->balance, - 'status' => $cust_main->status, - 'statuscolor' => $cust_main->statuscolor, ); $return{$_} = $cust_main->get($_) - foreach ( @cust_main_editable_fields, - @location_editable_fields, - map "ship_$_", @location_editable_fields, - ); - - my @invoicing_list = $cust_main->invoicing_list; - $return{'invoicing_list'} = - join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ); - $return{'postal_invoicing'} = - 0 < ( grep { $_ eq 'POST' } @invoicing_list ); + foreach @cust_main_editable_fields; return \%return; } -#I also monitor for changes to the additional locations that are applied to -# packages, and would like for those to be exportable as well. basically the -# location data passed with the custnum. -sub location_info { - my( $class, %opt ) = @_; - my $conf = new FS::Conf; - return { 'error' => 'Incorrect shared secret' } - unless $opt{secret} eq $conf->config('api_shared_secret'); - - my @cust_location = qsearch('cust_location', { 'custnum' => $opt{custnum} }); - - my %return = ( - 'error' => '', - 'locations' => [ @cust_location ], - ); - - return \%return; -} - -#Advertising sources? - =back 1;