billbeeio / billbee-php-sdk

šŸ”Œ The official Billbee API SDK for PHP šŸ’»
MIT License
22 stars 25 forks source link

Default initialization of shippingProductId leads to server error #41

Closed JensMe closed 2 years ago

JensMe commented 3 years ago

Hi @devtronic, I noticed an issue with the SDK's code when creating a new product in Billbee with the API endpoint "POST /api/v1/products". First, I did not initiate the Product's field shippingProductId. Therefore, the PHP SDK used the integer "0" as default. However, the Billbee API responded an server error:

When explicitly initiating the field shippingProductId as "null", the Billbee endpoint accepts my request. Ironically, the request's response specifies the shippingProductId to be the integer "0" instead of "null" but when requesting the newly created product with the API endpoint "GET /api/v1/products/{id}", it shows "null" instead of the integer "0".

Hence, I propose to initiate that field with "null" instead of an integer "0" by default. I hope this eases the use of this SDK for others.

devtronic commented 3 years ago

Thanks for the information. You're right. The field should be initialized with <NULL>.

JensMe commented 3 years ago

I witnessed another initialization issue. The product's field "condition" is initialized as "brand new" in the SDK, even though the Swagger UI returns "null" as default. Hence both systems differ on their output. (@devtronic)

devtronic commented 2 years ago

Fixed in v2.2.0-RC1