Skip to content

Commit

Permalink
fix for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jcarrier-vp committed May 20, 2019
1 parent 30abbce commit 6477a07
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ignore config file
/tests/config/*
/tests/config

# Ignore the /vendor/ directory
/vendor/
Expand All @@ -11,4 +11,4 @@ composer.lock
.DS_Store

# ignore PhpStorm .idea folder
.idea
.idea
18 changes: 10 additions & 8 deletions src/Adyen/HttpClient/CurlClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Adyen\HttpClient;

use Adyen\AdyenException;

class CurlClient implements ClientInterface
{
/**
Expand All @@ -11,7 +13,7 @@ class CurlClient implements ClientInterface
* @param $requestUrl
* @param $params
* @return mixed
* @throws \Adyen\AdyenException
* @throws AdyenException
*/
public function requestJson(\Adyen\Service $service, $requestUrl, $params)
{
Expand Down Expand Up @@ -51,7 +53,7 @@ public function requestJson(\Adyen\Service $service, $requestUrl, $params)
$headers[] = 'x-api-key: ' . $xApiKey;
} elseif ($service->requiresApiKey()) {
$msg = "Please provide a valid Checkout API Key";
throw new \Adyen\AdyenException($msg);
throw new AdyenException($msg);
} else {

//Set the basic auth credentials
Expand Down Expand Up @@ -108,7 +110,7 @@ public function requestJson(\Adyen\Service $service, $requestUrl, $params)
* @param $requestUrl
* @param $params
* @return mixed
* @throws \Adyen\AdyenException
* @throws AdyenException
*/
public function requestPost(\Adyen\Service $service, $requestUrl, $params)
{
Expand Down Expand Up @@ -173,7 +175,7 @@ public function requestPost(\Adyen\Service $service, $requestUrl, $params)
if (!$result) {
$msg = "The result is empty, looks like your request is invalid";
$logger->error($msg);
throw new \Adyen\AdyenException($msg);
throw new AdyenException($msg);
}

// log the array result
Expand Down Expand Up @@ -224,24 +226,24 @@ protected function handleCurlError($url, $errno, $message, $logger)
*
* @param $result
* @param $logger
* @throws \Adyen\AdyenException
* @throws AdyenException
*/
protected function handleResultError($result, $logger)
{
$decodeResult = json_decode($result, true);
if (isset($decodeResult['message']) && isset($decodeResult['errorCode'])) {
$logger->error($decodeResult['errorCode'] . ': ' . $decodeResult['message']);
throw new \Adyen\AdyenException(
throw new AdyenException(
$decodeResult['message'],
$decodeResult['errorCode'],
null,
$decodeResult['status'],
$decodeResult['errorType'],
$decodeResult['pspReference']
isset($decodeResult['pspReference']) ? $decodeResult['pspReference'] : null
);
}
$logger->error($result);
throw new \Adyen\AdyenException($result);
throw new AdyenException($result);
}

/**
Expand Down

0 comments on commit 6477a07

Please sign in to comment.