add customer fields option with agent, display_custnum, status and name, RT#73721
[freeside.git] / fs_selfservice / php / freeside_agent_new_customer_example.php
1 <?
2
3 require('freeside.class.php');
4 $freeside = new FreesideSelfService();
5
6 $session_id = $_POST['session_id'];
7
8 $response = $freeside->new_customer( array(
9   'session_id' => $session_id,
10
11   'first'          => $_POST['first'],
12   'last'           => $_POST['last'],
13   'address1'       => $_POST['address1'],
14   'address2'       => $_POST['address2'],
15   'city'           => $_POST['city'],
16   'state'          => $_POST['state'],
17   'zip'            => $_POST['zip'],
18   'country'        => 'US',
19   'daytime'        => $_POST['daytime'],
20   'fax'            => $_POST['fax'],
21
22   'payby'          => 'BILL',
23   'invoicing_list' => $_POST['email'],
24
25   'pkgpart'        => 2,
26   'username'       => strtolower($_POST['username']),
27   '_password'      => strtolower($_POST['password'])
28 ) );
29
30 error_log("[new_customer] received response from freeside: $response");
31 $error = $response['error'];
32
33 if ( ! $error ) {
34
35     // sucessful signup
36
37     $custnum = $response['custnum'];
38
39     error_log("[new_customer] signup up with custnum $custnum");
40
41 } else {
42
43     // unsucessful signup
44
45     error_log("[new_customer] signup error:: $error");
46
47     // display error message to user
48
49 }
50
51 ?>