You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Constants.DOCUMENT_TYPES={PAN_CARD: "PAN_CARD",AADHAAR_CARD: "AADHAAR_CARD"// // Add new document type here};
Implementation changes
src/document-parser/index.ts
importYourParserfrom"./your-parser-goes-here";// Make strategy for new documentDocumentParser[Constants.DOCUMENT_TYPES.NEW_DOCUMENT]={parseDocumentDetails: YourParser.parseDocumentDetails};
src/document-parser/your-parser-goes-here.ts
Your parser should expose a function called parseDocumentDetails.
For function contract check src/interfaces/DocumentParser.ts
For reference please check the source code of other parsers.
import{ParseDocumentDetailsRequest,ParseDocumentDetailsResponse}from"../interfaces/DocumentParser";// ******************************************************* //// Logic for API handlers starts here //// ******************************************************* //YourParser.parseDocumentDetails=(params: ParseDocumentDetailsRequest): ParseDocumentDetailsResponse=>{
....
....
....return{is_document_valid: true,document_details: parsedDetails};};// ******************************************************* //// Logic for API handlers ends here //// ******************************************************* //exportdefaultYourParser;