From 153ef6d933766ab7ee98bd825d11224270573284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Gallego?= Date: Sat, 23 Nov 2013 22:54:56 +0100 Subject: [PATCH] Error handling --- CHANGELOG.md | 4 ++++ src/ZfrPaymill/Client/Listener/ErrorHandlerListener.php | 4 ++-- .../Client/Listener/ErrorHandlerListenerTest.php | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72ba701..7501b54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.0.1 + +* Better error handling + # 1.0.0 * Initial release diff --git a/src/ZfrPaymill/Client/Listener/ErrorHandlerListener.php b/src/ZfrPaymill/Client/Listener/ErrorHandlerListener.php index a266308..29b4e45 100644 --- a/src/ZfrPaymill/Client/Listener/ErrorHandlerListener.php +++ b/src/ZfrPaymill/Client/Listener/ErrorHandlerListener.php @@ -97,9 +97,9 @@ public function handleError(Event $event) $command = $event['command']; $result = $command->toArray(); - $code = isset($result['data']['response_code']) ? $result['data']['response_code'] : 10001; + $code = isset($result['data']['response_code']) ? $result['data']['response_code'] : 20000; - if ($code >= 40000) { + if ($code !== 20000) { $exception = new TransactionErrorException($this->errorCodes[$code], $code); $exception->setRequest($command->getRequest()); $exception->setResponse($command->getResponse()); diff --git a/tests/ZfrPaymillTest/Client/Listener/ErrorHandlerListenerTest.php b/tests/ZfrPaymillTest/Client/Listener/ErrorHandlerListenerTest.php index af6ce75..23adf05 100644 --- a/tests/ZfrPaymillTest/Client/Listener/ErrorHandlerListenerTest.php +++ b/tests/ZfrPaymillTest/Client/Listener/ErrorHandlerListenerTest.php @@ -28,7 +28,7 @@ public function provider() { return array( array( - 10000, + 20000, null, null ),