Skip to content

Commit fee21e3

Browse files
committed
Fix encryption when bad response exception
1 parent 24278ab commit fee21e3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Hyperwallet/Util/ApiClient.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ private function doRequest($method, $url, array $urlParams, array $options) {
185185
)));
186186
throw new HyperwalletApiException($errorResponse, $e);
187187
} catch (BadResponseException $e) {
188-
$body = \GuzzleHttp\json_decode($e->getResponse()->getBody(), true);
188+
$body = $this->isEncrypted ? \GuzzleHttp\json_decode(\GuzzleHttp\json_encode($this->encryption->decrypt($e->getResponse()->getBody())), true) :
189+
\GuzzleHttp\json_decode($e->getResponse()->getBody(), true);
189190
if (is_null($body) || !isset($body['errors']) || empty($body['errors'])) {
190191
$body = array('errors' => array(
191192
array(

0 commit comments

Comments
 (0)