Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions src/Kount/Ris/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,11 @@ public function getResponse()
// Call the RIS server and get the response
$output = curl_exec($ch);

$curlErrNo = curl_errno($ch);
$curlError = curl_error($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$time = microtime(true) - $startTimer;
$timeInMs = round($time * 1000) . "ms";

Expand All @@ -349,13 +354,18 @@ public function getResponse()
}
$this->logger->debug(__METHOD__ . " Raw RIS response:\n {$output}");

if (curl_errno($ch)) {
$result = curl_error($ch);
$this->logger->error(__METHOD__ . " An error occurred posting to RIS. " .
"Curl error [$result]");
throw new Kount_Ris_Exception();
if ($curlErrNo || $httpCode >= 400) {
$errorMessage = 'An error occurred posting to RIS.';
if ($curlErrNo) {
$errorMessage .= " Curl error [$curlError]";
$errorCode = $curlErrNo;
} else {
$errorMessage .= " HTTP code [$httpCode]";
$errorCode = $httpCode;
}
$this->logger->error(__METHOD__ . " $errorMessage");
throw new Kount_Ris_Exception($errorMessage, $errorCode);
}
curl_close($ch);

return new Kount_Ris_Response($output);
} //end getResponse
Expand Down Expand Up @@ -991,7 +1001,7 @@ public function setPayment($paymentType, $paymentToken)
/**
* Set the Bank Identification Number.
* Supports BIN lengths of 6 digits or greater
*
*
* @param string $lbin Long Bank Identification Number
* @return this
*/
Expand Down