Skip to content

Commit 9a45386

Browse files
committed
Add return values
1 parent c69c820 commit 9a45386

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Client.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function isValidAuth($merchant = '')
4444
$this->initCurl(
4545
$this->_endpoint .
4646
'/merchants' .
47-
$merchant?'/'.$merchant:'' .
47+
($merchant?'/'.$merchant:'') .
4848
'/credentials'
4949
);
5050
curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, 'GET');
@@ -87,6 +87,7 @@ public function getIdentificationForm($uri, $options = array())
8787
$this->sendRequest();
8888
$this->dealWithResponse();
8989
curl_close($this->ch);
90+
return $this->curl_result;
9091
}
9192

9293
public function sendIdentificationForm($uri, $options = array())
@@ -98,6 +99,7 @@ public function sendIdentificationForm($uri, $options = array())
9899
$this->verbThePayload('POST', $options);
99100
$this->dealWithResponse();
100101
curl_close($this->ch);
102+
return $this->curl_result;
101103
}
102104

103105
public function startCards($order)
@@ -188,6 +190,9 @@ public function orderUpdate($order)
188190
$this->initCurl($uri);
189191
$this->verbThePayload('PUT', array('order' => $order));
190192
$this->dealWithResponse();
193+
if ($this->status == 409) {
194+
$this->cart_has_changed = true;
195+
}
191196
curl_close($this->ch);
192197
}
193198

@@ -291,12 +296,12 @@ private function sendRequest()
291296

292297
private function dealWithResponse()
293298
{
299+
$this->json = json_decode($this->curl_result, true);
294300
if (200 <= $this->status && $this->status <= 299) {
295301
$this->success = true;
296302
$this->log("Start " . $this->status . ": Ok!");
297303
} else {
298304
$this->success = false;
299-
$this->json = json_decode($this->curl_result, true);
300305
$this->log("Start " . $this->status . ": " . $this->curl_result);
301306
}
302307
}

0 commit comments

Comments
 (0)