gopaycommunity / gopay-php-api

GoPay's PHP SDK for Payments REST API
MIT License
81 stars 38 forks source link

When the $response is unsuccessful, $response->json is an object instead of an array #27

Closed Revisor closed 5 years ago

Revisor commented 6 years ago

https://github.com/gopaycommunity/gopay-php-api/blob/8ce477a45fe29015c456789a4d591f28a4d747f8/src/Http/JsonBrowser.php#L42

The documentation promises that $response->json is an associative array. But if the response is unsuccessful, $response->json is an object (of stdClass).

In the line above, json_decode() is missing its second argument.

The potential bugfix breaks compatibility for all who process Gopay response errors.

Edit: Ahh, I see the same issue is mentioned in #21

FSichinger commented 5 years ago

Fixed in 4195dc2185fe6f0a8f578cac9a05431fd77f6e71

Recently two version have been released.

v1.3.6 - new payment instrument and new session sub state codes which our gateway may return were added v1.4.0 - includes 1.3.6 + fixes the issue described here, but breaks backwards compatibility