mirakl / sdk-php-shop

Mirakl PHP SDK for sellers
30 stars 16 forks source link

Bad Request ShipOrderRequest #56

Closed maslias closed 10 months ago

maslias commented 10 months ago

I get always a Bad Reqest for this one:

` use Mirakl\MMP\Shop\Request\Order\Ship\ShipOrderRequest; use Mirakl\MMP\Shop\Client\ShopApiClient as ShopApiClientOut;

    $request = new ShipOrderRequest('de5628027008-A');
    $api = new ShopApiClientOut($apiUrl, $apiKey, $apiShop);
    try {
        $api->shipOrder($request);
    } catch (\Exception $e) {
        var_dump($e);
    }

`

private 'handlerContext' (GuzzleHttp\Exception\RequestException) => 
    array (size=0)
      empty
  protected 'message' => string 'Client error: `PUT https://marketplace-decathlon-eu.mirakl.net/api/orders/de5628027008-A/ship?shop_id=9179` resulted in a `400 Bad Request` response' (length=148)
  private 'string' (Exception) => string '' (length=0)
  protected 'code' => int 400

Any ideas?

jreinke commented 10 months ago

Hello,

The documentation of the API OR24 says:

Validate the shipment of an order in the SHIPPING status

The order id you mentioned is not in the SHIPPING status. Do you reproduce the same error with a valid order?

Thank you. Regards.

maslias commented 10 months ago

Hello,

The documentation of the API OR24 says:

Validate the shipment of an order in the SHIPPING status

The order id you mentioned is not in the SHIPPING status. Do you reproduce the same error with a valid order?

Thank you. Regards.

Yeah this is right. My Onboarding Agent insisted that the status is irrelevant for that. And i was hoping for a more clear error message.

Thanks for the help!

jreinke commented 10 months ago

You're right, the error is not really explicit in the Guzzle wrapped exception but maybe you have more information in the original message thrown by the Mirakl API. Something like:

(string) $e->getResponse()->getBody()