Skip to content

Commit 79a8f95

Browse files
DrArmanskykirillsagan
authored and
kirillsagan
committed
Fix encryption when bad response exception
1 parent 27747f2 commit 79a8f95

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Hyperwallet/Util/ApiClient.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ private function doRequest($method, $url, array $urlParams, array $options) {
182182
)));
183183
throw new HyperwalletApiException($errorResponse, $e);
184184
} catch (BadResponseException $e) {
185-
$body = \GuzzleHttp\json_decode($e->getResponse()->getBody(), true);
185+
$body = $this->isEncrypted ? \GuzzleHttp\json_decode(\GuzzleHttp\json_encode($this->encryption->decrypt($e->getResponse()->getBody())), true) :
186+
\GuzzleHttp\json_decode($e->getResponse()->getBody(), true);
186187
if (is_null($body) || !isset($body['errors']) || empty($body['errors'])) {
187188
$body = array('errors' => array(
188189
array(

0 commit comments

Comments
 (0)