mirakl / sdk-php-shop

Mirakl PHP SDK for sellers
30 stars 16 forks source link

OR74 - Problems with order_documents #52

Closed silvialort closed 1 year ago

silvialort commented 1 year ago

Hello, we're trying to upload some customer's invoices to an order with documentation provided in resource OR74. When we try to curl, we receive the error:

400 - Bad Request: problem with form param \'order_documents\'

This is the data we send to Mirakl:

array ( 'files' => CURLFile::__set_state(array( 'name' => '/path/to/invoice.pdf', 'mime' => 'application/pdf', 'postname' => 'orderid.pdf', )), 'order_documents' => '{"file_name":"orderid.pdf","type_code":"CUSTOMER_INVOICE"}', )

Is there something we aren't taking into account when sending order_documents?

Thank you very much

jreinke commented 1 year ago

Hello,

I think the problem is that the order_documents field must be an array of object. It should be something like that instead:

'order_documents' => '[{"file_name":"orderid.pdf","type_code":"CUSTOMER_INVOICE"}]'
silvialort commented 1 year ago

Hello, we tried that way and we couldn't make it work. However, we passed the order_documents info with xml format and it worked.