Skip to content

Commit b445e2d

Browse files
Merge pull request #106 from TourCMS/release/4.10.0
Release/4.10.0
2 parents be0600c + 8e54982 commit b445e2d

1 file changed

Lines changed: 29 additions & 15 deletions

File tree

src/TourCMS.php

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323

2424
# TourCMS: PHP wrapper class for TourCMS Rest API
25-
# Version: 4.9.0
25+
# Version: 4.10.0
2626

2727
namespace TourCMS\Utils;
2828

@@ -124,10 +124,16 @@ public function request($path, $channel = 0, $verb = 'GET', $post_data = null) {
124124
*/
125125
// curl_setopt($ch, CURLOPT_CAINFO, "c:/path/to/ca-bundle.crt");
126126

127-
if($verb == "POST") {
128-
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'POST' );
129-
if(!is_null($post_data))
127+
if ($verb == self::HTTP_VERB_POST) {
128+
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, self::HTTP_VERB_POST);
129+
if (!is_null($post_data)) {
130+
if (is_string($post_data)) {
131+
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
132+
}
133+
if ($post_data instanceof SimpleXMLElement) {
130134
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data->asXML());
135+
}
136+
}
131137
}
132138

133139
// Callback function to populate the response headers on curl_exec
@@ -655,11 +661,6 @@ public function create_enquiry($enquiry_data, $channel)
655661
return($this->request('/c/enquiry/new.xml', $channel, "POST", $enquiry_data));
656662
}
657663

658-
public function update_customer($customer_data, $channel)
659-
{
660-
return($this->request('/c/customer/update.xml', $channel, "POST", $customer_data));
661-
}
662-
663664
public function search_enquiries($params = "", $channel = 0) {
664665
$params = $this->validateParams($params);
665666
if($channel==0)
@@ -673,13 +674,28 @@ public function show_enquiry($enquiry, $channel)
673674
return($this->request('/c/enquiry/show.xml?enquiry_id='.$enquiry, $channel));
674675
}
675676

677+
public function check_customer_login($customer, $password, $channel) {
678+
return ($this->request('/c/customers/login_search.xml?customer_username='.$customer.'&customer_password='.$password, $channel));
679+
}
680+
681+
public function create_customer($customer, $channel)
682+
{
683+
return ($this->request('/c/customer/create.xml', $channel, self::HTTP_VERB_POST, $customer));
684+
}
685+
676686
public function show_customer($customer, $channel)
677687
{
678-
return($this->request('/c/customer/show.xml?customer_id='.$customer, $channel));
688+
return ($this->request('/c/customer/show.xml?customer_id='.$customer, $channel));
679689
}
680690

681-
public function check_customer_login($customer, $password, $channel) {
682-
return($this->request('/c/customers/login_search.xml?customer_username='.$customer.'&customer_password='.$password, $channel));
691+
public function update_customer($customer, $channel)
692+
{
693+
return ($this->request('/c/customer/update.xml', $channel, self::HTTP_VERB_POST, $customer));
694+
}
695+
696+
public function verify_customer($customer, $channel)
697+
{
698+
return ($this->request('/c/customer/verification.xml', $channel, self::HTTP_VERB_POST, $customer));
683699
}
684700

685701
# Agents
@@ -918,6 +934,4 @@ protected function generate_signature($path, $verb, $channel, $outbound_time)
918934
return $signature;
919935
}
920936

921-
}
922-
923-
?>
937+
}

0 commit comments

Comments
 (0)