TeknooSoftware / sellsy-client

PHP library to connect your applications to your Sellsy account account using the Sellsy API and build your websites and your platforms on the Sellsy technology.
https://teknoo.software/libraries/sellsy
MIT License
17 stars 16 forks source link

Exception thrown on succeded response with null response index, and empty error #27

Closed ngandemeratslsy closed 2 years ago

ngandemeratslsy commented 2 years ago

In version 2.0.8, on Result::getResponse(), test made on error index was isset($this->decodedResult['error']) and now in version 3, the test is empty($this->decoded['error'])

But on the following endpoint https://api.sellsy.fr/documentation/methodes#documentsendbymail, the payload response is {"response":null,"error":"","status":"success"}

By consequence, in the last version when dealing with this endpoint you get the following error : No response available In 2.0.8, isset($this->decodedResult['error']) on empty value == true, now empty("") throw an exception

frenchcomp commented 2 years ago

This behavior is excpected, the client can not create a response when there are no data to return.

You can test the presence of a response by calling the method Result::hasResponse(), and test if the document has been sent thanks to Result::isSuccess()