4.x style
[freeside.git] / ng_selfservice / coverage_post.php
1 <?
2
3 $DEBUG = 1;
4
5 require_once('freeside.class.php');
6
7 $xml = file_get_contents('php://input');
8 //error_log($xml);
9
10 $doc = new SimpleXMLElement($xml);
11 $cd = $doc->CustomerDetails;
12 if ($DEBUG) {
13     error_log(print_r($cd),1);
14 }
15
16 // State and Country are names rather than codes, but we fix that on the other
17 // end.
18 // It doesn't look like TowerCoverage ever sends a company name.
19 $map_fields = Array(
20     'first'           => 'FirstName',
21     'last'            => 'LastName',
22     'address1'        => 'StreetAddress',
23     'city'            => 'City',
24     'state'           => 'State',
25     'country'         => 'Country',
26     'zip'             => 'ZIP',
27     'phone_daytime'   => 'PhoneNumber',
28     'emailaddress'    => 'EmailAddress',
29     'comment'         => 'Comment',
30     'referral_title'  => 'HearAbout',
31 );
32
33 $prospect = Array();
34 // missing from this: any way to set the agent. this should use the API key.
35 foreach ($map_fields as $k => $v) {
36     $prospect[$k] = (string)($cd->$v);
37 }
38 error_log(print_r($prospect),1);
39 $freeside = new FreesideSelfService();
40 $result = $freeside->new_prospect($prospect);
41 error_log(print_r($result),1);
42
43 ?>