larafale / mangopay

Mango API Wrapper
22 stars 19 forks source link

Cannot add page to a document #50

Closed lmancel closed 9 years ago

lmancel commented 9 years ago

Hi,

Using the same file the "create" function works fine but I have troubles adding a page to an existing document using the "createPage" function, MangoPay returns: { [MangoPayError: Error: Invalid JSON] name: 'MangoPayError', message: [Error: Invalid JSON] }

The parameters passed to the function seem to be correct since the same request (copy-pasted) sent by Postman and cURL in the terminal returns a 204 no Content response as expected.

Here is a sample of the code:

if (mangoId) { mango.document.createPage({ UserId: me.user.Id, Id: mangoId, File: file }, callback); } else { mango.document.create({ UserId: me.user.Id, Type: type, File: file }, callback); }

Don't really know where it could come from...

larafale commented 9 years ago

this is fixed in 0.0.15 0dec2f1cfde0840b9f643462bd903abcfdc460ee

note that createPage was renamed with addFile and now you have 2 methods for creating documents, create & createWithFile

lmancel commented 9 years ago

Thanks a lot !