billbeeio / billbee-php-sdk

🔌 The official Billbee API SDK for PHP 💻
MIT License
21 stars 25 forks source link

Latest jms/serializer 3.3.0 breaks post requests #80

Open IhorDerTaler opened 3 months ago

IhorDerTaler commented 3 months ago

With latest version of jms/serializer 3.3.0 the code

use BillbeeDe\BillbeeAPI\Client;
use BillbeeDe\BillbeeAPI\Model\Order;

$user = 'Your Billbee username';
$apiPassword = 'Your Billbee API Password';
$apiKey = 'Your Billbee API Key';

$client = new Client($user, $apiPassword, $apiKey);

$orderObject = new Order();
$orderObject->setCreatedAt(new \DateTime());
$billbeeOrder = $client->orders()->createOrder($orderObject, 123456789);

will result in error:

"Client error: `POST https://api.billbee.io/api/v1/orders?shopId=123456789` resulted in a `400 Bad Request` response:
{"Message":"The request is invalid.","ModelState":{"orderData":["Required property 'CreatedAt' not found in JSON. Path ' (truncated...)
"

Because latest version of jms/serializer sends json data as 'create_at' instead of 'CreatedAt'.

Temporary fix: downgrading to previous version of jms/serializer 3.29.1 seams to fix this particular case.

StanProg commented 1 month ago

Related issue: #78