[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 68d4d9a02aa280f79614be40f8eb05e9d18f72cd

Ivan ivan at 420.am
Thu Mar 6 12:06:42 PST 2014


The branch, FREESIDE_2_3_BRANCH has been updated
       via  68d4d9a02aa280f79614be40f8eb05e9d18f72cd (commit)
      from  2b4ca5eec4564db2df08da6fa71592d010343783 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 68d4d9a02aa280f79614be40f8eb05e9d18f72cd
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Mar 6 12:06:38 2014 -0800

    backoffice API: add new_customer, RT#22830

diff --git a/FS/FS/API.pm b/FS/FS/API.pm
index 0bc0d08..3d10dce 100644
--- a/FS/FS/API.pm
+++ b/FS/FS/API.pm
@@ -41,13 +41,64 @@ Enter cash refund.
 
 #---
 
-
-
 # "2 way syncing" ?  start with non-sync pulling info here, then if necessary
 # figure out how to trigger something when those things change
 
 # long-term: package changes?
 
+
+=item new_customer
+
+=cut
+
+#certainly false laziness w/ClientAPI::Signup new_customer/new_customer_minimal
+# but approaching this from a clean start / back-office perspective
+#  i.e. no package/service, no immediate credit card run, etc.
+
+sub new_customer {
+  my( $class, %opt ) = @_;
+  my $conf = new FS::Conf;
+  return { 'error' => 'Incorrect shared secret' }
+    unless $opt{secret} eq $conf->config('api_shared_secret');
+
+  #default agentnum like signup_server-default_agentnum?
+ 
+  #same for refnum like signup_server-default_refnum
+
+  my $cust_main = new FS::cust_main ( {
+      'agentnum'      => $agentnum,
+      'refnum'        => $opt{refnum}
+                         || $conf->config('signup_server-default_refnum'),
+      'payby'         => 'BILL',
+
+      map { $_ => $opt{$_} } qw(
+        agentnum refnum agent_custid
+        last first company 
+        address1 address2 city county state zip country
+        latitude longitude
+        geocode censustract censusyear
+        ship_address1 ship_address2 ship_city ship_county ship_state ship_zip ship_country
+        ship_latitude ship_longitude
+        daytime night fax mobile
+        payby payinfo paydate paycvv payname
+      ),
+
+  } );
+
+  my @invoicing_list = $opt{'invoicing_list'}
+                         ? split( /\s*\,\s*/, $opt{'invoicing_list'} )
+                         : ();
+  push @invoicing_list, 'POST' if $opt{'postal_invoicing'};
+
+  $error = $cust_main->insert( {}, \@invoicing_list );
+  return { 'error'   => $error } if $error;
+  
+  return { 'error'   => '',
+           'custnum' => $cust_main->custnum,
+         };
+
+}
+
 =item customer_info
 
 =cut

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/API.pm |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 53 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list