Skip to content

Commit

Permalink
#29 Add status and ErrorType into the AdyenException
Browse files Browse the repository at this point in the history
  • Loading branch information
rikterbeek committed Jul 3, 2017
1 parent b7017c6 commit e7b42bf
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
39 changes: 35 additions & 4 deletions src/Adyen/AdyenException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,39 @@
class AdyenException extends Exception
{

//"status": 403,
//"errorCode": "901",
//"message": "Invalid Merchant Account",
//"errorType": "security"
protected $_status;
protected $_errorType;

/**
* AdyenException constructor.
* @param string $message
* @param int $code
* @param Exception|null $previous
* @param null $status
* @param null $errorType
*/
public function __construct($message = "", $code = 0, Exception $previous = null, $status = null, $errorType = null)
{
$this->_status = $status;
$this->_errorType = $errorType;
parent::__construct($message, $code, $previous);
}

/**
* Get status
*
* @return null
*/
public function getStatus()
{
return $this->_status;
}

/**
* Get Adyen Error type
*/
public function getErrorType()
{
return $this->_errorType;
}
}
2 changes: 1 addition & 1 deletion src/Adyen/HttpClient/CurlClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ protected function handleResultError($result, $logger)

if(isset($decodeResult['message']) && isset($decodeResult['errorCode'])) {
$logger->error($decodeResult['errorCode'] . ': ' . $decodeResult['message']);
throw new \Adyen\AdyenException($decodeResult['message'], $decodeResult['errorCode']);
throw new \Adyen\AdyenException($decodeResult['message'], $decodeResult['errorCode'], null, $decodeResult['status'], $decodeResult['errorType']);
}
$logger->error($result);
throw new \Adyen\AdyenException($result);
Expand Down

0 comments on commit e7b42bf

Please sign in to comment.