Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 1.91 KB

PLUGINS.md

File metadata and controls

40 lines (31 loc) · 1.91 KB

Plugin Development

Prerequisites

  • Plugin names MUST be unique

Instructions

  1. Create new git branch with a name of the form feat/<retailer>-<country>
  2. cd packages
  3. cp -R <plugin-name>/ <new-plugin-name>/
  4. Open package.json in new plugin folder and update name and description values
  5. Go back to plugin folder and open src/index.ts
  6. Rename plugin class name and update merchant meta attributes
  7. Rename parser class name and update meta attributes
  8. Go to packages/tsconfig.json and add plugin path to references section
  9. Go to cli-starter/ and add new plugin to dependencies in package.json
  10. Open openreceipt.config.js and add plugin name to plugins section
  11. Open tsconfig.json and add plugin path to references section
  12. Ensure you have emails in the cli-starter/examples/ folder. ls -la examples/
  13. Run yarn build --watch
  14. In a new terminal session, run DEBUG=* yarn start run examples/<YOUR EML FILE>
  15. copy recieved from emails and add to meta src addresses
  16. extract html out of .eml file -------this.engine.log.info(this.engine.state.email.html)
  17. yarn start run examples/.eml file
  18. copy html from console output into file.html
  19. inspect the html file headers for important info such as order number, order items,quantity, tax and markers.
  20. comment out everything except the items property in the parse method of the parser.

-----------------now you have to find markers, extract text from between them, convert to dom (and back to strings!) when appropriate in order to reduce the html to the data that we need----------------

-----------------now examine nodes for unique properties and build the parser around them--------------------------------

FAQ

I keep getting build errors, what do I do?

Sometimes the composite builds seem to get cached and don't work correctly, the easiest way to fix this is to go to the project root and run yarn cleanup.