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