summaryrefslogtreecommitdiff
path: root/ng_selfservice
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-10-06 16:26:31 -0700
committerMark Wells <mark@freeside.biz>2016-10-06 16:26:31 -0700
commit25eda4efc27a2f7aecece010bee4ef1ef6ce81f2 (patch)
treead2b980fd878b9dc667ff4a5788c62c0b6777580 /ng_selfservice
parent87807a1e2d66cea4aa4bcc7c6694adab11a5f5a0 (diff)
create prospects from towercoverage.com EUS, #39776
Diffstat (limited to 'ng_selfservice')
-rw-r--r--ng_selfservice/coverage_post.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/ng_selfservice/coverage_post.php b/ng_selfservice/coverage_post.php
new file mode 100644
index 000000000..657a2ffb8
--- /dev/null
+++ b/ng_selfservice/coverage_post.php
@@ -0,0 +1,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(var_dump($cd));
+}
+
+// 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(var_dump($prospect));
+$freeside = new FreesideSelfService();
+$result = $freeside->new_prospect($prospect);
+error_log(var_dump($result));
+
+?>