businesscards/processBusinessCardBase64.js

  1. const Client = require('../client/constructor');
  2. /**
  3. * Process Business card and extract all the fields from it. https://docs.veryfi.com/api/business-cards/process-a-business-card/
  4. *
  5. * @memberof Client
  6. * @param {String} file_name The file name including the extension
  7. * @param {String} file_base64_string To submit a file for data extraction, encode the file in Base64 format and ensure it includes the MIME type. The Base64 string should follow this structure: data:${mimeType};base64,${base64String}
  8. * @param {Object} kwargs Additional request parameters
  9. * @returns {JSON} Data extracted from the document
  10. */
  11. Client.prototype.process_business_card_from_base64 = async function (
  12. file_name,
  13. file_base64_string,
  14. {...kwargs} = {}
  15. ) {
  16. let endpoint_name = "/business-cards/";
  17. let request_arguments = {
  18. "file_name": file_name,
  19. "file_data": file_base64_string,
  20. };
  21. request_arguments = Object.assign(request_arguments, kwargs);
  22. let document = await this._request("POST", endpoint_name, request_arguments, null, false);
  23. return document['data'];
  24. }