muenzpraeger / salesforce-einstein-vision-apex

Apache License 2.0
30 stars 24 forks source link

Issue when trying to upload file #13

Closed snehaheda closed 6 years ago

snehaheda commented 6 years ago

Hey,

I am using using multipart data upload class taken from Metamind repo.

I'm trying to take a PNG blob from a ContentVersion and upload the file to stripe. But that was not working with above code.

It always resulted in error parameter purpose is required though i am setting it.

Came across this https://github.com/muenzpraeger/salesforce-einstein-vision-apex/blob/master/src/classes/EinsteinVision_HttpBodyPart.cls

So picked up the new Method WriteBlobBodyParameter . But I am still not able to upload the file successfully . String body = ''; body += WriteBoundary(); body += WriteBodyParameter('purpose', 'identity_document'); body += WriteBoundary(); body += WriteBlobBodyParameter('file', EncodingUtil.base64Encode(cv.VersionData), file_name, resolveMimeType(file_name));
Blob formBlob = EncodingUtil.base64Decode(body);

Still results in the same error.Invalid purpose must be one of business_logo, customer_signature, dispute_evidence, founders_stock_document, identity_document,

Any help would be grateful

muenzpraeger commented 6 years ago

This projects uses the same mechanisms as the Metamind project. You should debug the output of the Apex wrapper with i. e. a Postman output and see if that maps for the Stripe API.

As this issue isn't related to this project I'm closing it.