├── .github └── workflows │ ├── node.js.yml │ └── npm-publish.yml ├── .gitignore ├── CONTRIBUTORS.md ├── README.md ├── docs ├── Client.html ├── bankstatements_deleteBankStatement.js.html ├── bankstatements_getBankStatement.js.html ├── bankstatements_getBankStatements.js.html ├── bankstatements_processBankStatement.js.html ├── bankstatements_processBankStatementBase64.js.html ├── bankstatements_processBankStatementStream.js.html ├── bankstatements_processBankStatementUrl.js.html ├── businesscards_deleteBusinessCard.js.html ├── businesscards_getBusinessCard.js.html ├── businesscards_getBusinessCards.js.html ├── businesscards_processBusinessCard.js.html ├── businesscards_processBusinessCardBase64.js.html ├── businesscards_processBusinessCardStream.js.html ├── businesscards_processBusinessCardUrl.js.html ├── checks_deleteCheck.js.html ├── checks_getCheck.js.html ├── checks_getChecks.js.html ├── checks_processCheck.js.html ├── checks_processCheckBase64.js.html ├── checks_processCheckStream.js.html ├── checks_processCheckUrl.js.html ├── client_constructor.js.html ├── documents_deleteDocument.js.html ├── documents_getDocument.js.html ├── documents_getDocuments.js.html ├── documents_processDocument.js.html ├── documents_processDocumentBase64.js.html ├── documents_processDocumentStream.js.html ├── documents_processDocumentUrl.js.html ├── documents_tags_addTag.js.html ├── documents_tags_addTags.js.html ├── documents_tags_deleteTags.js.html ├── documents_tags_replaceTags.js.html ├── documents_updateDocument.js.html ├── fonts │ ├── OpenSans-Bold-webfont.eot │ ├── OpenSans-Bold-webfont.svg │ ├── OpenSans-Bold-webfont.woff │ ├── OpenSans-BoldItalic-webfont.eot │ ├── OpenSans-BoldItalic-webfont.svg │ ├── OpenSans-BoldItalic-webfont.woff │ ├── OpenSans-Italic-webfont.eot │ ├── OpenSans-Italic-webfont.svg │ ├── OpenSans-Italic-webfont.woff │ ├── OpenSans-Light-webfont.eot │ ├── OpenSans-Light-webfont.svg │ ├── OpenSans-Light-webfont.woff │ ├── OpenSans-LightItalic-webfont.eot │ ├── OpenSans-LightItalic-webfont.svg │ ├── OpenSans-LightItalic-webfont.woff │ ├── OpenSans-Regular-webfont.eot │ ├── OpenSans-Regular-webfont.svg │ ├── OpenSans-Regular-webfont.woff │ ├── OpenSans-Semibold-webfont.eot │ ├── OpenSans-Semibold-webfont.svg │ ├── OpenSans-Semibold-webfont.ttf │ ├── OpenSans-Semibold-webfont.woff │ ├── OpenSans-SemiboldItalic-webfont.eot │ ├── OpenSans-SemiboldItalic-webfont.svg │ ├── OpenSans-SemiboldItalic-webfont.ttf │ └── OpenSans-SemiboldItalic-webfont.woff ├── index.html ├── scripts │ ├── linenumber.js │ └── prettify │ │ ├── Apache-License-2.0.txt │ │ ├── lang-css.js │ │ └── prettify.js ├── styles │ ├── jsdoc-default.css │ ├── prettify-jsdoc.css │ └── prettify-tomorrow.css ├── w2s_deleteW2.js.html ├── w2s_getW2.js.html ├── w2s_getW2s.js.html ├── w2s_processW2.js.html ├── w2s_processW2Base64.js.html ├── w2s_processW2Stream.js.html ├── w2s_processW2Url.js.html ├── w8bene_deleteW8BENE.js.html ├── w8bene_getW8BENE.js.html ├── w8bene_getW8BENEs.js.html ├── w8bene_processW8BENE.js.html ├── w8bene_processW8BENEBase64.js.html ├── w8bene_processW8BENEStream.js.html ├── w8bene_processW8BENEUrl.js.html ├── w9s_deleteW9.js.html ├── w9s_getW9.js.html ├── w9s_getW9s.js.html ├── w9s_processW9.js.html ├── w9s_processW9Base64.js.html ├── w9s_processW9Stream.js.html └── w9s_processW9Url.js.html ├── jest.config.js ├── jsdoc.json ├── lib ├── anydocs │ ├── deleteAnyDocument.js │ ├── getAnyDocument.js │ ├── getAnyDocuments.js │ ├── processAnyDocument.js │ ├── processAnyDocumentBase64.js │ ├── processAnyDocumentStream.js │ └── processAnyDocumentUrl.js ├── bankstatements │ ├── deleteBankStatement.js │ ├── getBankStatement.js │ ├── getBankStatements.js │ ├── processBankStatement.js │ ├── processBankStatementBase64.js │ ├── processBankStatementStream.js │ └── processBankStatementUrl.js ├── businesscards │ ├── deleteBusinessCard.js │ ├── getBusinessCard.js │ ├── getBusinessCards.js │ ├── processBusinessCard.js │ ├── processBusinessCardBase64.js │ ├── processBusinessCardStream.js │ └── processBusinessCardUrl.js ├── checks │ ├── deleteCheck.js │ ├── getCheck.js │ ├── getChecks.js │ ├── processCheck.js │ ├── processCheckBase64.js │ ├── processCheckStream.js │ └── processCheckUrl.js ├── client │ ├── client.js │ ├── constructor.js │ ├── function.js │ ├── generateSignature.js │ ├── getHeaders.js │ ├── getUrl.js │ └── request.js ├── documents │ ├── deleteDocument.js │ ├── getDocument.js │ ├── getDocuments.js │ ├── processDocument.js │ ├── processDocumentBase64.js │ ├── processDocumentStream.js │ ├── processDocumentUrl.js │ ├── tags │ │ ├── addTag.js │ │ ├── addTags.js │ │ ├── deleteTags.js │ │ └── replaceTags.js │ └── updateDocument.js ├── types │ ├── BillTo.ts │ ├── BoundingElement.ts │ ├── Client.ts │ ├── LineItem.ts │ ├── Payment.ts │ ├── ShipTo.ts │ ├── Tag.ts │ ├── TaxLine.ts │ ├── Vendor.ts │ ├── VeryfiDocument.ts │ └── VeryfiExtraArgs.ts ├── w2s │ ├── deleteW2.js │ ├── getW2.js │ ├── getW2s.js │ ├── processW2.js │ ├── processW2Base64.js │ ├── processW2Stream.js │ └── processW2Url.js ├── w8bene │ ├── deleteW8BENE.js │ ├── getW8BENE.js │ ├── getW8BENEs.js │ ├── processW8BENE.js │ ├── processW8BENEBase64.js │ ├── processW8BENEStream.js │ └── processW8BENEUrl.js └── w9s │ ├── deleteW9.js │ ├── getW9.js │ ├── getW9s.js │ ├── processW9.js │ ├── processW9Base64.js │ ├── processW9Stream.js │ └── processW9Url.js ├── mocks ├── addTag.json ├── deleteDocument.json ├── deleteTags.json ├── document.json ├── documents.json ├── getAnyDocuments.json ├── getBankStatements.json ├── getBusinessCards.json ├── getChecks.json ├── getTags.json ├── getW2s.json ├── getW8benes.json ├── getW9s.json ├── processAnyDocument.json ├── processBankStatement.json ├── processBusinesscard.json ├── processCheck.json ├── processW2.json ├── processW8bene.json ├── processW9.json ├── receipt.json └── updateDocument.json ├── package-lock.json ├── package.json ├── resources ├── bankstatement.pdf ├── business_card.jpg ├── check.pdf ├── driver_license.png ├── receipt.png ├── w2.png ├── w8bene.pdf └── w9.pdf ├── test └── main.test.js ├── tests └── main.test.ts └── tsconfig.json /.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: Node.js CI 5 | 6 | on: 7 | push: 8 | branches: [ main ] 9 | pull_request: 10 | branches: [ main ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | strategy: 18 | matrix: 19 | node-version: [16.x] 20 | # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ 21 | 22 | steps: 23 | - uses: actions/checkout@v3 24 | - name: Use Node.js ${{ matrix.node-version }} 25 | uses: actions/setup-node@v3 26 | with: 27 | node-version: ${{ matrix.node-version }} 28 | cache: 'npm' 29 | - run: npm ci 30 | - run: npm run build --if-present 31 | - run: npm test -- --coverage 32 | env: 33 | CI: true 34 | VERYFI_CLIENT_ID: ${{ secrets.VERYFI_CLIENT_ID }} 35 | VERYFI_CLIENT_SECRET: ${{ secrets.VERYFI_CLIENT_SECRET }} 36 | VERYFI_USERNAME: ${{ secrets.VERYFI_USERNAME }} 37 | VERYFI_API_KEY: ${{ secrets.VERYFI_API_KEY }} 38 | VERYFI_URL: ${{ secrets.VERYFI_URL }} 39 | -------------------------------------------------------------------------------- /.github/workflows/npm-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages 3 | 4 | name: Node.js Package 5 | 6 | on: 7 | release: 8 | types: [created] 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | - uses: actions/setup-node@v3 16 | with: 17 | node-version: 16 18 | - run: npm ci 19 | 20 | publish-npm: 21 | needs: build 22 | runs-on: ubuntu-latest 23 | steps: 24 | - uses: actions/checkout@v3 25 | - uses: actions/setup-node@v3 26 | with: 27 | node-version: 16 28 | registry-url: https://registry.npmjs.org/ 29 | - run: npm ci 30 | - run: npm config set "@veryfi:registry" "https://nexus.veryfi.com/repository/npm/" 31 | - run: npm config set "//nexus.veryfi.com/repository/npm/:_authToken" "${{secrets.nexus_npm_token}}" 32 | - run: npm publish 33 | env: 34 | NODE_AUTH_TOKEN: ${{secrets.npm_token}} 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .idea/ 3 | coverage/ 4 | package-lock.json 5 | *.xml 6 | .env 7 | .DS_Store 8 | -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | # Release process 2 | 3 | GitHub Actions is configured to handle the release and upload to NPM. To initiate a release, simply create a new tag and publish it at https://github.com/veryfi/veryfi-nodejs/releases 4 | 5 | ## Versioning 6 | 7 | package.json manages all the package metadata: 8 | * it uses version to track the current version of the package 9 | * it uses main to point to the entry point of the package 10 | * it uses typings to point to the typescript definition file 11 | * it uses scripts to create documentation, run tests, and build the package 12 | -------------------------------------------------------------------------------- /docs/checks_deleteCheck.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | checks/deleteCheck.js - Documentation 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 24 | 25 | 26 | 29 | 30 |
31 | 32 |

checks/deleteCheck.js

33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 |
42 |
const Client = require('../client/constructor');
43 | /**
44 |  * Delete a Check from Veryfi. https://docs.veryfi.com/api/checks/delete-a-check/
45 |  *
46 |  * @memberof Client
47 |  * @param {string} document_id ID of the document you'd like to delete
48 |  */
49 | Client.prototype.delete_check = async function (document_id) {
50 |     let endpoint_name = `/checks/${document_id}/`;
51 |     let request_arguments = {"id": document_id};
52 |     return this._request("DELETE", endpoint_name, request_arguments);
53 | }
54 | 
55 |
56 |
57 | 58 | 59 | 60 | 61 |
62 | 63 |
64 | 65 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Bold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/docs/fonts/OpenSans-Bold-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/docs/fonts/OpenSans-Bold-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-BoldItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/docs/fonts/OpenSans-BoldItalic-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-BoldItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/docs/fonts/OpenSans-BoldItalic-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Italic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/docs/fonts/OpenSans-Italic-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Italic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/docs/fonts/OpenSans-Italic-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Light-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/docs/fonts/OpenSans-Light-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Light-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/docs/fonts/OpenSans-Light-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-LightItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/docs/fonts/OpenSans-LightItalic-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-LightItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/docs/fonts/OpenSans-LightItalic-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/docs/fonts/OpenSans-Regular-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/docs/fonts/OpenSans-Regular-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Semibold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/docs/fonts/OpenSans-Semibold-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Semibold-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/docs/fonts/OpenSans-Semibold-webfont.ttf -------------------------------------------------------------------------------- /docs/fonts/OpenSans-Semibold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/docs/fonts/OpenSans-Semibold-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/OpenSans-SemiboldItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/docs/fonts/OpenSans-SemiboldItalic-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/OpenSans-SemiboldItalic-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/docs/fonts/OpenSans-SemiboldItalic-webfont.ttf -------------------------------------------------------------------------------- /docs/fonts/OpenSans-SemiboldItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/docs/fonts/OpenSans-SemiboldItalic-webfont.woff -------------------------------------------------------------------------------- /docs/scripts/linenumber.js: -------------------------------------------------------------------------------- 1 | /*global document */ 2 | (function() { 3 | var source = document.getElementsByClassName('prettyprint source linenums'); 4 | var i = 0; 5 | var lineNumber = 0; 6 | var lineId; 7 | var lines; 8 | var totalLines; 9 | var anchorHash; 10 | 11 | if (source && source[0]) { 12 | anchorHash = document.location.hash.substring(1); 13 | lines = source[0].getElementsByTagName('li'); 14 | totalLines = lines.length; 15 | 16 | for (; i < totalLines; i++) { 17 | lineNumber++; 18 | lineId = 'line' + lineNumber; 19 | lines[i].id = lineId; 20 | if (lineId === anchorHash) { 21 | lines[i].className += ' selected'; 22 | } 23 | } 24 | } 25 | })(); 26 | -------------------------------------------------------------------------------- /docs/scripts/prettify/lang-css.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", 2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); 3 | -------------------------------------------------------------------------------- /docs/styles/prettify-jsdoc.css: -------------------------------------------------------------------------------- 1 | /* JSDoc prettify.js theme */ 2 | 3 | /* plain text */ 4 | .pln { 5 | color: #000000; 6 | font-weight: normal; 7 | font-style: normal; 8 | } 9 | 10 | /* string content */ 11 | .str { 12 | color: hsl(104, 100%, 24%); 13 | font-weight: normal; 14 | font-style: normal; 15 | } 16 | 17 | /* a keyword */ 18 | .kwd { 19 | color: #000000; 20 | font-weight: bold; 21 | font-style: normal; 22 | } 23 | 24 | /* a comment */ 25 | .com { 26 | font-weight: normal; 27 | font-style: italic; 28 | } 29 | 30 | /* a type name */ 31 | .typ { 32 | color: #000000; 33 | font-weight: normal; 34 | font-style: normal; 35 | } 36 | 37 | /* a literal value */ 38 | .lit { 39 | color: #006400; 40 | font-weight: normal; 41 | font-style: normal; 42 | } 43 | 44 | /* punctuation */ 45 | .pun { 46 | color: #000000; 47 | font-weight: bold; 48 | font-style: normal; 49 | } 50 | 51 | /* lisp open bracket */ 52 | .opn { 53 | color: #000000; 54 | font-weight: bold; 55 | font-style: normal; 56 | } 57 | 58 | /* lisp close bracket */ 59 | .clo { 60 | color: #000000; 61 | font-weight: bold; 62 | font-style: normal; 63 | } 64 | 65 | /* a markup tag name */ 66 | .tag { 67 | color: #006400; 68 | font-weight: normal; 69 | font-style: normal; 70 | } 71 | 72 | /* a markup attribute name */ 73 | .atn { 74 | color: #006400; 75 | font-weight: normal; 76 | font-style: normal; 77 | } 78 | 79 | /* a markup attribute value */ 80 | .atv { 81 | color: #006400; 82 | font-weight: normal; 83 | font-style: normal; 84 | } 85 | 86 | /* a declaration */ 87 | .dec { 88 | color: #000000; 89 | font-weight: bold; 90 | font-style: normal; 91 | } 92 | 93 | /* a variable name */ 94 | .var { 95 | color: #000000; 96 | font-weight: normal; 97 | font-style: normal; 98 | } 99 | 100 | /* a function name */ 101 | .fun { 102 | color: #000000; 103 | font-weight: bold; 104 | font-style: normal; 105 | } 106 | 107 | /* Specify class=linenums on a pre to get line numbering */ 108 | ol.linenums { 109 | margin-top: 0; 110 | margin-bottom: 0; 111 | } 112 | -------------------------------------------------------------------------------- /docs/styles/prettify-tomorrow.css: -------------------------------------------------------------------------------- 1 | /* Tomorrow Theme */ 2 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */ 3 | /* Pretty printing styles. Used with prettify.js. */ 4 | /* SPAN elements with the classes below are added by prettyprint. */ 5 | /* plain text */ 6 | .pln { 7 | color: #4d4d4c; } 8 | 9 | @media screen { 10 | /* string content */ 11 | .str { 12 | color: hsl(104, 100%, 24%); } 13 | 14 | /* a keyword */ 15 | .kwd { 16 | color: hsl(240, 100%, 50%); } 17 | 18 | /* a comment */ 19 | .com { 20 | color: hsl(0, 0%, 60%); } 21 | 22 | /* a type name */ 23 | .typ { 24 | color: hsl(240, 100%, 32%); } 25 | 26 | /* a literal value */ 27 | .lit { 28 | color: hsl(240, 100%, 40%); } 29 | 30 | /* punctuation */ 31 | .pun { 32 | color: #000000; } 33 | 34 | /* lisp open bracket */ 35 | .opn { 36 | color: #000000; } 37 | 38 | /* lisp close bracket */ 39 | .clo { 40 | color: #000000; } 41 | 42 | /* a markup tag name */ 43 | .tag { 44 | color: #c82829; } 45 | 46 | /* a markup attribute name */ 47 | .atn { 48 | color: #f5871f; } 49 | 50 | /* a markup attribute value */ 51 | .atv { 52 | color: #3e999f; } 53 | 54 | /* a declaration */ 55 | .dec { 56 | color: #f5871f; } 57 | 58 | /* a variable name */ 59 | .var { 60 | color: #c82829; } 61 | 62 | /* a function name */ 63 | .fun { 64 | color: #4271ae; } } 65 | /* Use higher contrast and text-weight for printable form. */ 66 | @media print, projection { 67 | .str { 68 | color: #060; } 69 | 70 | .kwd { 71 | color: #006; 72 | font-weight: bold; } 73 | 74 | .com { 75 | color: #600; 76 | font-style: italic; } 77 | 78 | .typ { 79 | color: #404; 80 | font-weight: bold; } 81 | 82 | .lit { 83 | color: #044; } 84 | 85 | .pun, .opn, .clo { 86 | color: #440; } 87 | 88 | .tag { 89 | color: #006; 90 | font-weight: bold; } 91 | 92 | .atn { 93 | color: #404; } 94 | 95 | .atv { 96 | color: #060; } } 97 | /* Style */ 98 | /* 99 | pre.prettyprint { 100 | background: white; 101 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 102 | font-size: 12px; 103 | line-height: 1.5; 104 | border: 1px solid #ccc; 105 | padding: 10px; } 106 | */ 107 | 108 | /* Specify class=linenums on a pre to get line numbering */ 109 | ol.linenums { 110 | margin-top: 0; 111 | margin-bottom: 0; } 112 | 113 | /* IE indents via margin-left */ 114 | li.L0, 115 | li.L1, 116 | li.L2, 117 | li.L3, 118 | li.L4, 119 | li.L5, 120 | li.L6, 121 | li.L7, 122 | li.L8, 123 | li.L9 { 124 | /* */ } 125 | 126 | /* Alternate shading for lines */ 127 | li.L1, 128 | li.L3, 129 | li.L5, 130 | li.L7, 131 | li.L9 { 132 | /* */ } 133 | -------------------------------------------------------------------------------- /docs/w2s_deleteW2.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | w2s/deleteW2.js - Documentation 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 24 | 25 | 26 | 29 | 30 |
31 | 32 |

w2s/deleteW2.js

33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 |
42 |
const Client = require('../client/constructor');
43 | /**
44 |  * Delete w2 document from Veryfi https://docs.veryfi.com/api/w2s/delete-a-w-2/
45 |  *
46 |  * @memberof Client
47 |  * @param {string} document_id ID of the document you'd like to delete
48 |  */
49 | Client.prototype.delete_w2 = async function (document_id) {
50 |     let endpoint_name = `/w2s/${document_id}/`;
51 |     let request_arguments = {"id": document_id};
52 |     return this._request("DELETE", endpoint_name, request_arguments);
53 | }
54 | 
55 |
56 |
57 | 58 | 59 | 60 | 61 |
62 | 63 |
64 | 65 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /docs/w2s_getW2s.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | w2s/getW2s.js - Documentation 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 24 | 25 | 26 | 29 | 30 |
31 | 32 |

w2s/getW2s.js

33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 |
42 |
const Client = require('../client/constructor');
43 | /**
44 |  * Get all w2 documents. https://docs.veryfi.com/api/w2s/get-w-2-s/
45 |  * @memberOf Client
46 |  * @param {Object} kwargs Additional request parameters
47 |  * @return {Array} An array of JSON with all w2 documents.
48 |  */
49 | Client.prototype.get_w2s = async function ( {...kwargs} = {}) {
50 |     let endpoint_name = "/w2s/";
51 |     let request_arguments = {};
52 |     let response = await this._request("GET", endpoint_name, request_arguments, kwargs, false);
53 |     return response['data'];
54 | }
55 | 
56 |
57 |
58 | 59 | 60 | 61 | 62 |
63 | 64 |
65 | 66 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /docs/w8bene_deleteW8BENE.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | w8bene/deleteW8BENE.js - Documentation 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 24 | 25 | 26 | 29 | 30 |
31 | 32 |

w8bene/deleteW8BENE.js

33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 |
42 |
const Client = require('../client/constructor');
43 | /**
44 |  * Delete a W-8BEN-E from Veryfi. https://docs.veryfi.com/api/w-8ben-e/delete-a-w-8-ben-e/
45 |  *
46 |  * @memberof Client
47 |  * @param {string} document_id ID of the document you'd like to delete
48 |  */
49 | Client.prototype.delete_w8bene = async function (document_id) {
50 |     let endpoint_name = `/w-8ben-e/${document_id}/`;
51 |     let request_arguments = {"id": document_id};
52 |     return this._request("DELETE", endpoint_name, request_arguments);
53 | }
54 | 
55 |
56 |
57 | 58 | 59 | 60 | 61 |
62 | 63 |
64 | 65 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /docs/w9s_deleteW9.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | w9s/deleteW9.js - Documentation 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 24 | 25 | 26 | 29 | 30 |
31 | 32 |

w9s/deleteW9.js

33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 |
42 |
const Client = require('../client/constructor');
43 | /**
44 |  * Delete w9 document from Veryfi. https://docs.veryfi.com/api/w9s/delete-a-w-9/
45 |  *
46 |  * @memberof Client
47 |  * @param {string} document_id ID of the document you'd like to delete
48 |  */
49 | Client.prototype.delete_w9 = async function (document_id) {
50 |     let endpoint_name = `/w9s/${document_id}/`;
51 |     let request_arguments = {"id": document_id};
52 |     return this._request("DELETE", endpoint_name, request_arguments);
53 | }
54 | 
55 |
56 |
57 | 58 | 59 | 60 | 61 |
62 | 63 |
64 | 65 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ 2 | module.exports = { 3 | preset: 'ts-jest', 4 | testEnvironment: 'node', 5 | }; 6 | -------------------------------------------------------------------------------- /jsdoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "tags": { 3 | "allowUnknownTags": true, 4 | "dictionaries": ["jsdoc"] 5 | }, 6 | "source": { 7 | "include": ["lib", "package.json", "README.md"], 8 | "includePattern": ".js$", 9 | "excludePattern": "(node_modules/|docs)" 10 | }, 11 | "plugins": [ 12 | "plugins/markdown" 13 | ], 14 | "templates": { 15 | "cleverLinks": false, 16 | "monospaceLinks": true, 17 | "useLongnameInNav": false, 18 | "showInheritedInNav": true 19 | }, 20 | "opts": { 21 | "destination": "./docs/", 22 | "encoding": "utf8", 23 | "recurse": true, 24 | "template": "./node_modules/minami" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/anydocs/deleteAnyDocument.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Delete any document from Veryfi. https://docs.veryfi.com/api/anydocs/delete-a-%E2%88%80-doc/ 4 | * 5 | * @memberof Client 6 | * @param {string} document_id ID of the document you'd like to delete 7 | */ 8 | Client.prototype.delete_any_document = async function (document_id) { 9 | let endpoint_name = `/any-documents/${document_id}/`; 10 | let request_arguments = {"id": document_id}; 11 | return this._request("DELETE", endpoint_name, request_arguments); 12 | } 13 | -------------------------------------------------------------------------------- /lib/anydocs/getAnyDocument.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Get a specific any document. https://docs.veryfi.com/api/anydocs/get-a-%E2%88%80-doc/ 4 | * @memberof Client 5 | * @param {number} document_id The unique identifier of the document. 6 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 7 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 8 | * @param {Object} kwargs Additional request parameters 9 | * @returns {JSON} Object of a previously processed blueprinted document. 10 | */ 11 | Client.prototype.get_any_document = async function (document_id, 12 | bounding_boxes = false, 13 | confidence_details = false, 14 | {...kwargs} = {}) { 15 | let endpoint_name = `/any-documents/${document_id}/`; 16 | let request_arguments = { 17 | "bounding_boxes": bounding_boxes, 18 | "confidence_details": confidence_details 19 | }; 20 | let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); 21 | return document['data']; 22 | } 23 | -------------------------------------------------------------------------------- /lib/anydocs/getAnyDocuments.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Get all any documents. https://docs.veryfi.com/api/anydocs/get-%E2%88%80-docs/ 4 | * @memberof Client 5 | * @param {number} page The page number. The response is capped to maximum of 50 results per page. 6 | * @param {number} page_size The number of Documents per page. 7 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 8 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 9 | * @param {Object} kwargs Additional request parameters 10 | * @returns {JSON} Object of previously processed any documents 11 | */ 12 | Client.prototype.get_any_documents = async function ( 13 | page = 1, 14 | page_size = 50, 15 | bounding_boxes = false, 16 | confidence_details = false, 17 | {...kwargs} = {}) { 18 | let endpoint_name = "/any-documents/"; 19 | let request_arguments = { 20 | "page": page, 21 | "page_size": page_size, 22 | "bounding_boxes": bounding_boxes, 23 | "confidence_details": confidence_details 24 | }; 25 | let documents = await this._request("GET", endpoint_name, request_arguments, kwargs, false); 26 | if ("data" in documents) { 27 | documents = documents["data"]; 28 | } 29 | return documents; 30 | } 31 | -------------------------------------------------------------------------------- /lib/anydocs/processAnyDocument.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | const path = require('path'); 3 | const fs = require('fs'); 4 | /** 5 | * Process any document and extract all the fields from it. https://docs.veryfi.com/api/anydocs/process-%E2%88%80-doc/ 6 | * @example 7 | * veryfi_client.process_any_document('file/path','blue_print') 8 | * 9 | * @memberof Client 10 | * @param {String} file_path Path on disk to a file to submit for data extraction 11 | * @param {String} blueprint_name The name of the extraction blueprints to use. 12 | * @param {number} max_pages_to_process The number of pages to process for the document. The limit is 50 pages per document. 13 | * @param {Object} kwargs Additional request parameters 14 | * @returns {JSON} Data extracted from the document 15 | */ 16 | Client.prototype.process_any_document = async function ( 17 | file_path, 18 | blueprint_name, 19 | max_pages_to_process = 20, 20 | {...kwargs} = {} 21 | ) { 22 | 23 | let file = fs.createReadStream(file_path); 24 | let file_name = path.basename(file_path); 25 | 26 | return this.process_any_document_from_stream( 27 | file, 28 | file_name, 29 | blueprint_name, 30 | max_pages_to_process, 31 | kwargs 32 | ); 33 | } 34 | -------------------------------------------------------------------------------- /lib/anydocs/processAnyDocumentBase64.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Process any document and extract all the fields from it. https://docs.veryfi.com/api/anydocs/process-%E2%88%80-doc/ 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 {String} blueprint_name The name of the extraction blueprints to use. 9 | * @param {number} max_pages_to_process The number of pages to process for the document. The limit is 50 pages per document. 10 | * @param {Object} kwargs Additional request parameters 11 | * @returns {JSON} Data extracted from the document 12 | */ 13 | Client.prototype.process_any_document_from_base64 = async function ( 14 | file_name, 15 | file_base64_string, 16 | blueprint_name, 17 | max_pages_to_process = 20, 18 | {...kwargs} = {} 19 | ) { 20 | 21 | let endpoint_name = "/any-documents/"; 22 | let request_arguments = { 23 | "file_name": file_name, 24 | "file_data": file_base64_string, 25 | "blueprint_name": blueprint_name, 26 | "max_pages_to_process": max_pages_to_process, 27 | }; 28 | request_arguments = Object.assign(request_arguments, kwargs); 29 | let document = await this._request("POST", endpoint_name, request_arguments, null, false); 30 | return document['data']; 31 | } 32 | -------------------------------------------------------------------------------- /lib/anydocs/processAnyDocumentStream.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Process any document and extract all the fields from it. https://docs.veryfi.com/api/anydocs/process-%E2%88%80-doc/ 4 | * @example 5 | * veryfi_client.process_any_document('file/path','blue_print') 6 | * 7 | * @memberof Client 8 | * @param {stream.Readable} file ReadStream of a file to submit for data extraction 9 | * @param {String} file_name The file name including the extension 10 | * @param {String} blueprint_name The name of the extraction blueprints to use. 11 | * @param {number} max_pages_to_process The number of pages to process for the document. The limit is 50 pages per document. 12 | * @param {Object} kwargs Additional request parameters 13 | * @returns {JSON} Data extracted from the document 14 | */ 15 | Client.prototype.process_any_document_from_stream = async function ( 16 | file, 17 | file_name, 18 | blueprint_name, 19 | max_pages_to_process = 20, 20 | {...kwargs} = {} 21 | ) { 22 | 23 | let endpoint_name = "/any-documents/"; 24 | let request_arguments = { 25 | "file_name": file_name, 26 | "file": file, 27 | "blueprint_name": blueprint_name, 28 | "max_pages_to_process": max_pages_to_process, 29 | }; 30 | request_arguments = Object.assign(request_arguments, kwargs); 31 | let document = await this._request("POST", endpoint_name, request_arguments, null, true); 32 | return document['data']; 33 | } 34 | -------------------------------------------------------------------------------- /lib/anydocs/processAnyDocumentUrl.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Process any document and extract all the fields from it. https://docs.veryfi.com/api/anydocs/process-%E2%88%80-doc/ 4 | * @example 5 | * veryfi_client.process_any_document_from_url('file_url','blue_print') 6 | * 7 | * @memberof Client 8 | * @param {String} file_url url file to submit for data extraction 9 | * @param {String} blueprint_name The name of the extraction blueprints to use. 10 | * @param {number} max_pages_to_process The number of pages to process for the document. The limit is 50 pages per document. 11 | * @param {Object} kwargs Additional request parameters 12 | * @returns {JSON} Data extracted from the document 13 | */ 14 | Client.prototype.process_any_document_from_url = async function ( 15 | file_url, 16 | blueprint_name, 17 | max_pages_to_process = 20, 18 | {...kwargs} = {} 19 | ) { 20 | 21 | let endpoint_name = "/any-documents/"; 22 | let request_arguments = { 23 | "file_url": file_url, 24 | "blueprint_name": blueprint_name, 25 | "max_pages_to_process": max_pages_to_process, 26 | }; 27 | request_arguments = Object.assign(request_arguments, kwargs); 28 | let document = await this._request("POST", endpoint_name, request_arguments, null, false); 29 | return document['data']; 30 | } 31 | -------------------------------------------------------------------------------- /lib/bankstatements/deleteBankStatement.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Delete a Bank Statement from Veryfi. https://docs.veryfi.com/api/bank-statements/delete-a-bank-statement/ 4 | * 5 | * @memberof Client 6 | * @param {string} document_id ID of the document you'd like to delete 7 | */ 8 | Client.prototype.delete_bank_statement = async function (document_id) { 9 | let endpoint_name = `/bank-statements/${document_id}/`; 10 | let request_arguments = {"id": document_id}; 11 | return this._request("DELETE", endpoint_name, request_arguments); 12 | } 13 | -------------------------------------------------------------------------------- /lib/bankstatements/getBankStatement.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Get a specific bank statement. https://docs.veryfi.com/api/bank-statements/get-a-bank-statement/ 4 | * @memberof Client 5 | * @param {number} document_id The unique identifier of the document. 6 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 7 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 8 | * @param {Object} kwargs Additional request parameters 9 | * @returns {JSON} Object of a previously processed blueprinted document. 10 | */ 11 | Client.prototype.get_bank_statement = async function ( 12 | document_id, 13 | bounding_boxes = false, 14 | confidence_details = false, 15 | {...kwargs} = {} 16 | ) { 17 | let endpoint_name = `/bank-statements/${document_id}/`; 18 | let request_arguments = { 19 | "bounding_boxes": bounding_boxes, 20 | "confidence_details": confidence_details 21 | }; 22 | let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); 23 | return document['data']; 24 | } 25 | -------------------------------------------------------------------------------- /lib/bankstatements/getBankStatements.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Get all bank statements. https://docs.veryfi.com/api/bank-statements/get-bank-statements/ 4 | * @memberof Client 5 | * @param {number} page The page number. The response is capped to maximum of 50 results per page. 6 | * @param {number} page_size The number of Documents per page. 7 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 8 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 9 | * @param {Object} kwargs Additional request parameters 10 | * @returns {JSON} Object of previously processed any documents 11 | */ 12 | Client.prototype.get_bank_statements = async function ( 13 | page = 1, 14 | page_size = 50, 15 | bounding_boxes = false, 16 | confidence_details = false, 17 | {...kwargs} = {} 18 | ) { 19 | let endpoint_name = `/bank-statements/`; 20 | let request_arguments = { 21 | "page": page, 22 | "page_size": page_size, 23 | "bounding_boxes": bounding_boxes, 24 | "confidence_details": confidence_details 25 | }; 26 | let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); 27 | return document['data']; 28 | } 29 | -------------------------------------------------------------------------------- /lib/bankstatements/processBankStatement.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | const path = require('path'); 3 | const fs = require('fs'); 4 | /** 5 | * Process bank statement and extract all the fields from it. https://docs.veryfi.com/api/bank-statements/process-a-bank-statement/ 6 | * @example 7 | * veryfi_client.process_bank_statement('file_path') 8 | * 9 | * @memberof Client 10 | * @param {String} file_path Path on disk to a file to submit for data extraction 11 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 12 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 13 | * @param {Object} kwargs Additional request parameters 14 | * @returns {JSON} Data extracted from the document 15 | */ 16 | Client.prototype.process_bank_statement = async function ( 17 | file_path, 18 | bounding_boxes = false, 19 | confidence_details = false, 20 | {...kwargs} = {} 21 | ) { 22 | 23 | let file = fs.createReadStream(file_path); 24 | let file_name = path.basename(file_path); 25 | 26 | return this.process_bank_statement_from_stream( 27 | file, 28 | file_name, 29 | bounding_boxes, 30 | confidence_details, 31 | kwargs 32 | ); 33 | } 34 | -------------------------------------------------------------------------------- /lib/bankstatements/processBankStatementBase64.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Process bank statement and extract all the fields from it. https://docs.veryfi.com/api/bank-statements/process-a-bank-statement/ 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 {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 9 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 10 | * @param {Object} kwargs Additional request parameters 11 | * @returns {JSON} Data extracted from the document 12 | */ 13 | Client.prototype.process_bank_statement_from_base64 = async function ( 14 | file_name, 15 | file_base64_string, 16 | bounding_boxes = false, 17 | confidence_details = false, 18 | {...kwargs} = {} 19 | ) { 20 | 21 | let endpoint_name = "/bank-statements/"; 22 | let request_arguments = { 23 | "file_name": file_name, 24 | "file_data": file_base64_string, 25 | "bounding_boxes": bounding_boxes, 26 | "confidence_details": confidence_details, 27 | }; 28 | request_arguments = Object.assign(request_arguments, kwargs); 29 | let document = await this._request("POST", endpoint_name, request_arguments, null, false); 30 | return document['data']; 31 | } 32 | -------------------------------------------------------------------------------- /lib/bankstatements/processBankStatementStream.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Process bank statement and extract all the fields from it. https://docs.veryfi.com/api/bank-statements/process-a-bank-statement/ 4 | * 5 | * @memberof Client 6 | * @param {stream.Readable} file file to submit for data extraction 7 | * @param {String} file_name The file name including the extension 8 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 9 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 10 | * @param {Object} kwargs Additional request parameters 11 | * @returns {JSON} Data extracted from the document 12 | */ 13 | Client.prototype.process_bank_statement_from_stream = async function ( 14 | file, 15 | file_name, 16 | bounding_boxes = false, 17 | confidence_details = false, 18 | {...kwargs} = {} 19 | ) { 20 | 21 | let endpoint_name = "/bank-statements/"; 22 | let request_arguments = { 23 | "file": file, 24 | "file_name": file_name, 25 | "bounding_boxes": bounding_boxes, 26 | "confidence_details": confidence_details, 27 | }; 28 | request_arguments = Object.assign(request_arguments, kwargs); 29 | let document = await this._request("POST", endpoint_name, request_arguments, null, true); 30 | return document['data']; 31 | } 32 | -------------------------------------------------------------------------------- /lib/bankstatements/processBankStatementUrl.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Process bank statement and extract all the fields from it. https://docs.veryfi.com/api/bank-statements/process-a-bank-statement/ 4 | * @example 5 | * veryfi_client.process_bank_statement_from_url('file_url') 6 | * 7 | * @memberof Client 8 | * @param {String} file_url url file to submit for data extraction 9 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 10 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 11 | * @param {Object} kwargs Additional request parameters 12 | * @returns {JSON} Data extracted from the document 13 | */ 14 | Client.prototype.process_bank_statement_from_url = async function ( 15 | file_url, 16 | bounding_boxes = false, 17 | confidence_details = false, 18 | {...kwargs} = {} 19 | ) { 20 | 21 | let endpoint_name = "/bank-statements/"; 22 | let request_arguments = { 23 | "file_url": file_url, 24 | "bounding_boxes": bounding_boxes, 25 | "confidence_details": confidence_details, 26 | }; 27 | request_arguments = Object.assign(request_arguments, kwargs); 28 | let document = await this._request("POST", endpoint_name, request_arguments, null, false); 29 | return document['data']; 30 | } 31 | -------------------------------------------------------------------------------- /lib/businesscards/deleteBusinessCard.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Delete a Business Card from Veryfi. https://docs.veryfi.com/api/business-cards/delete-a-business-card/ 4 | * 5 | * @memberof Client 6 | * @param {string} document_id ID of the document you'd like to delete 7 | */ 8 | Client.prototype.delete_business_card = async function (document_id) { 9 | let endpoint_name = `/business-cards/${document_id}/`; 10 | let request_arguments = {"id": document_id}; 11 | return this._request("DELETE", endpoint_name, request_arguments); 12 | } 13 | -------------------------------------------------------------------------------- /lib/businesscards/getBusinessCard.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Get a specific Business card. https://docs.veryfi.com/api/business-cards/get-a-business-card/ 4 | * @memberof Client 5 | * @param {number} document_id The unique identifier of the document. 6 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 7 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 8 | * @param {Object} kwargs Additional request parameters 9 | * @returns {JSON} Object of a previously processed blueprinted document. 10 | */ 11 | Client.prototype.get_business_card = async function ( 12 | document_id, 13 | bounding_boxes = false, 14 | confidence_details = false, 15 | {...kwargs} = {} 16 | ) { 17 | let endpoint_name = `/business-cards/${document_id}/`; 18 | let request_arguments = { 19 | "bounding_boxes": bounding_boxes, 20 | "confidence_details": confidence_details 21 | }; 22 | let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); 23 | return document['data']; 24 | } 25 | -------------------------------------------------------------------------------- /lib/businesscards/getBusinessCards.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Get all Business cards. https://docs.veryfi.com/api/business-cards/get-business-cards/ 4 | * @memberof Client 5 | * @param {number} page The page number. The response is capped to maximum of 50 results per page. 6 | * @param {number} page_size The number of Documents per page. 7 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 8 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 9 | * @param {Object} kwargs Additional request parameters 10 | * @returns {JSON} Object of previously processed any documents 11 | */ 12 | Client.prototype.get_business_cards = async function ( 13 | page = 1, 14 | page_size = 50, 15 | bounding_boxes = false, 16 | confidence_details = false, 17 | {...kwargs} = {} 18 | ) { 19 | let endpoint_name = `/business-cards/`; 20 | let request_arguments = { 21 | "page": page, 22 | "page_size": page_size, 23 | "bounding_boxes": bounding_boxes, 24 | "confidence_details": confidence_details 25 | }; 26 | let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); 27 | return document['data']; 28 | } 29 | -------------------------------------------------------------------------------- /lib/businesscards/processBusinessCard.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | const path = require('path'); 3 | const fs = require('fs'); 4 | /** 5 | * Process Business card and extract all the fields from it. https://docs.veryfi.com/api/business-cards/process-a-business-card/ 6 | * @example 7 | * veryfi_client.process_business_card('file_path') 8 | * 9 | * @memberof Client 10 | * @param {String} file_path Path on disk to a file to submit for data extraction 11 | * @param {Object} kwargs Additional request parameters 12 | * @returns {JSON} Data extracted from the document 13 | */ 14 | Client.prototype.process_business_card = async function ( 15 | file_path, 16 | {...kwargs} = {} 17 | ) { 18 | 19 | let file = fs.createReadStream(file_path); 20 | let file_name = path.basename(file_path); 21 | 22 | return this.process_business_card_from_stream( 23 | file, 24 | file_name, 25 | kwargs 26 | ); 27 | } 28 | -------------------------------------------------------------------------------- /lib/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 | 17 | let endpoint_name = "/business-cards/"; 18 | let request_arguments = { 19 | "file_name": file_name, 20 | "file_data": file_base64_string, 21 | }; 22 | request_arguments = Object.assign(request_arguments, kwargs); 23 | let document = await this._request("POST", endpoint_name, request_arguments, null, false); 24 | return document['data']; 25 | } 26 | -------------------------------------------------------------------------------- /lib/businesscards/processBusinessCardStream.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 {stream.Readable} file file to submit for data extraction 7 | * @param {String} file_name The file name including the extension 8 | * @param {Object} kwargs Additional request parameters 9 | * @returns {JSON} Data extracted from the document 10 | */ 11 | Client.prototype.process_business_card_from_stream = async function ( 12 | file, 13 | file_name, 14 | {...kwargs} = {} 15 | ) { 16 | 17 | let endpoint_name = "/business-cards/"; 18 | let request_arguments = { 19 | "file": file, 20 | "file_name": file_name, 21 | }; 22 | request_arguments = Object.assign(request_arguments, kwargs); 23 | let document = await this._request("POST", endpoint_name, request_arguments, null, true); 24 | return document['data']; 25 | } 26 | -------------------------------------------------------------------------------- /lib/businesscards/processBusinessCardUrl.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Process Check and extract all the fields from it. https://docs.veryfi.com/api/checks/process-a-check/ 4 | * @example 5 | * veryfi_client.process_business_card_from_url('file_url') 6 | * 7 | * @memberof Client 8 | * @param {String} file_url url file to submit for data extraction 9 | * @param {Object} kwargs Additional request parameters 10 | * @returns {JSON} Data extracted from the document 11 | */ 12 | Client.prototype.process_business_card_from_url = async function ( 13 | file_url, 14 | {...kwargs} = {} 15 | ) { 16 | 17 | let endpoint_name = "/business-cards/"; 18 | let request_arguments = { 19 | "file_url": file_url, 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 | } 25 | -------------------------------------------------------------------------------- /lib/checks/deleteCheck.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Delete a Check from Veryfi. https://docs.veryfi.com/api/checks/delete-a-check/ 4 | * 5 | * @memberof Client 6 | * @param {string} document_id ID of the document you'd like to delete 7 | */ 8 | Client.prototype.delete_check = async function (document_id) { 9 | let endpoint_name = `/checks/${document_id}/`; 10 | let request_arguments = {"id": document_id}; 11 | return this._request("DELETE", endpoint_name, request_arguments); 12 | } 13 | -------------------------------------------------------------------------------- /lib/checks/getCheck.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Get a specific check. https://docs.veryfi.com/api/checks/get-a-check/ 4 | * @memberof Client 5 | * @param {number} document_id The unique identifier of the document. 6 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 7 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 8 | * @param {Object} kwargs Additional request parameters 9 | * @returns {JSON} Object of a previously processed blueprinted document. 10 | */ 11 | Client.prototype.get_check = async function ( 12 | document_id, 13 | bounding_boxes = false, 14 | confidence_details = false, 15 | {...kwargs} = {} 16 | ) { 17 | let endpoint_name = `/checks/${document_id}/`; 18 | let request_arguments = { 19 | "bounding_boxes": bounding_boxes, 20 | "confidence_details": confidence_details 21 | }; 22 | let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); 23 | return document['data']; 24 | } 25 | -------------------------------------------------------------------------------- /lib/checks/getChecks.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Get all checks. https://docs.veryfi.com/api/checks/get-checks/ 4 | * @memberof Client 5 | * @param {number} page The page number. The response is capped to maximum of 50 results per page. 6 | * @param {number} page_size The number of Documents per page. 7 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 8 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 9 | * @param {Object} kwargs Additional request parameters 10 | * @returns {JSON} Object of previously processed any documents 11 | */ 12 | Client.prototype.get_checks = async function ( 13 | page = 1, 14 | page_size = 50, 15 | bounding_boxes = false, 16 | confidence_details = false, 17 | {...kwargs} = {} 18 | ) { 19 | let endpoint_name = `/checks/`; 20 | let request_arguments = { 21 | "page": page, 22 | "page_size": page_size, 23 | "bounding_boxes": bounding_boxes, 24 | "confidence_details": confidence_details 25 | }; 26 | let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); 27 | return document['data']; 28 | } 29 | -------------------------------------------------------------------------------- /lib/checks/processCheck.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | const path = require('path'); 3 | const fs = require('fs'); 4 | /** 5 | * Process Check and extract all the fields from it.https://docs.veryfi.com/api/checks/process-a-check/ 6 | * @example 7 | * veryfi_client.process_check('file_path') 8 | * 9 | * @memberof Client 10 | * @param {String} file_path Path on disk to a file to submit for data extraction 11 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 12 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 13 | * @param {Object} kwargs Additional request parameters 14 | * @returns {JSON} Data extracted from the document 15 | */ 16 | Client.prototype.process_check = async function ( 17 | file_path, 18 | bounding_boxes = false, 19 | confidence_details = false, 20 | {...kwargs} = {} 21 | ) { 22 | 23 | let file = fs.createReadStream(file_path); 24 | let file_name = path.basename(file_path); 25 | 26 | return this.process_check_from_stream( 27 | file, 28 | file_name, 29 | bounding_boxes, 30 | confidence_details, 31 | kwargs 32 | ); 33 | } 34 | -------------------------------------------------------------------------------- /lib/checks/processCheckBase64.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Process Check and extract all the fields from it. https://docs.veryfi.com/api/bank-statements/process-a-bank-statement/ 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 {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 9 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 10 | * @param {Object} kwargs Additional request parameters 11 | * @returns {JSON} Data extracted from the document 12 | */ 13 | Client.prototype.process_check_from_base64 = async function ( 14 | file_name, 15 | file_base64_string, 16 | bounding_boxes = false, 17 | confidence_details = false, 18 | {...kwargs} = {} 19 | ) { 20 | 21 | let endpoint_name = "/checks/"; 22 | let request_arguments = { 23 | "file_name": file_name, 24 | "file_data": file_base64_string, 25 | "bounding_boxes": bounding_boxes, 26 | "confidence_details": confidence_details, 27 | }; 28 | request_arguments = Object.assign(request_arguments, kwargs); 29 | let document = await this._request("POST", endpoint_name, request_arguments, null, false); 30 | return document['data']; 31 | } 32 | -------------------------------------------------------------------------------- /lib/checks/processCheckStream.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Process Check and extract all the fields from it. https://docs.veryfi.com/api/bank-statements/process-a-bank-statement/ 4 | * 5 | * @memberof Client 6 | * @param {stream.Readable} file file to submit for data extraction 7 | * @param {String} file_name The file name including the extension 8 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 9 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 10 | * @param {Object} kwargs Additional request parameters 11 | * @returns {JSON} Data extracted from the document 12 | */ 13 | Client.prototype.process_check_from_stream = async function ( 14 | file, 15 | file_name, 16 | bounding_boxes = false, 17 | confidence_details = false, 18 | {...kwargs} = {} 19 | ) { 20 | 21 | let endpoint_name = "/checks/"; 22 | let request_arguments = { 23 | "file": file, 24 | "file_name": file_name, 25 | "bounding_boxes": bounding_boxes, 26 | "confidence_details": confidence_details, 27 | }; 28 | request_arguments = Object.assign(request_arguments, kwargs); 29 | let document = await this._request("POST", endpoint_name, request_arguments, null, true); 30 | return document['data']; 31 | } 32 | -------------------------------------------------------------------------------- /lib/checks/processCheckUrl.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Process Check and extract all the fields from it. https://docs.veryfi.com/api/checks/process-a-check/ 4 | * @example 5 | * veryfi_client.process_check_from_url('file_url') 6 | * 7 | * @memberof Client 8 | * @param {String} file_url url file to submit for data extraction 9 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 10 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 11 | * @param {Object} kwargs Additional request parameters 12 | * @returns {JSON} Data extracted from the document 13 | */ 14 | Client.prototype.process_check_from_url = async function ( 15 | file_url, 16 | bounding_boxes = false, 17 | confidence_details = false, 18 | {...kwargs} = {} 19 | ) { 20 | 21 | let endpoint_name = "/checks/"; 22 | let request_arguments = { 23 | "file_url": file_url, 24 | "bounding_boxes": bounding_boxes, 25 | "confidence_details": confidence_details, 26 | }; 27 | request_arguments = Object.assign(request_arguments, kwargs); 28 | let document = await this._request("POST", endpoint_name, request_arguments, null, false); 29 | return document['data']; 30 | } 31 | -------------------------------------------------------------------------------- /lib/client/client.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/function'); 2 | require('../anydocs/deleteAnyDocument'); 3 | require('../anydocs/getAnyDocument'); 4 | require('../anydocs/getAnyDocuments'); 5 | require('../anydocs/processAnyDocument'); 6 | require('../anydocs/processAnyDocumentBase64'); 7 | require('../anydocs/processAnyDocumentStream'); 8 | require('../anydocs/processAnyDocumentUrl'); 9 | require('../bankstatements/deleteBankStatement'); 10 | require('../bankstatements/getBankStatement'); 11 | require('../bankstatements/getBankStatements'); 12 | require('../bankstatements/processBankStatement'); 13 | require('../bankstatements/processBankStatementBase64'); 14 | require('../bankstatements/processBankStatementStream'); 15 | require('../bankstatements/processBankStatementUrl'); 16 | require('../businesscards/deleteBusinessCard'); 17 | require('../businesscards/getBusinessCard'); 18 | require('../businesscards/getBusinessCards'); 19 | require('../businesscards/processBusinessCard'); 20 | require('../businesscards/processBusinessCardBase64'); 21 | require('../businesscards/processBusinessCardStream'); 22 | require('../businesscards/processBusinessCardUrl'); 23 | require('../checks/deleteCheck'); 24 | require('../checks/getCheck'); 25 | require('../checks/getChecks'); 26 | require('../checks/processCheck'); 27 | require('../checks/processCheckBase64'); 28 | require('../checks/processCheckStream'); 29 | require('../checks/processCheckUrl'); 30 | require('../documents/deleteDocument'); 31 | require('../documents/getDocument'); 32 | require('../documents/getDocuments'); 33 | require('../documents/processDocument'); 34 | require('../documents/processDocumentBase64'); 35 | require('../documents/processDocumentStream'); 36 | require('../documents/processDocumentUrl'); 37 | require('../documents/updateDocument'); 38 | require('../documents/tags/addTags'); 39 | require('../documents/tags/addTag'); 40 | require('../documents/tags/deleteTags'); 41 | require('../documents/tags/replaceTags'); 42 | require('../w2s/deleteW2'); 43 | require('../w2s/getW2'); 44 | require('../w2s/getW2s'); 45 | require('../w2s/processW2'); 46 | require('../w2s/processW2Base64'); 47 | require('../w2s/processW2Stream'); 48 | require('../w2s/processW2Url'); 49 | require('../w8bene/deleteW8BENE'); 50 | require('../w8bene/getW8BENE'); 51 | require('../w8bene/getW8BENEs'); 52 | require('../w8bene/processW8BENE'); 53 | require('../w8bene/processW8BENEBase64'); 54 | require('../w8bene/processW8BENEStream'); 55 | require('../w8bene/processW8BENEUrl'); 56 | require('../w9s/deleteW9'); 57 | require('../w9s/getW9'); 58 | require('../w9s/getW9s'); 59 | require('../w9s/processW9'); 60 | require('../w9s/processW9Base64'); 61 | require('../w9s/processW9Stream'); 62 | require('../w9s/processW9Url'); 63 | module.exports = Client; 64 | -------------------------------------------------------------------------------- /lib/client/constructor.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Create instance of a Client 3 | * @class 4 | * @param {string} client_id Your Veryfi client id 5 | * @param {string | undefined} client_secret Your Veryfi client secret 6 | * @param {string} username Your Veryfi username 7 | * @param {string} api_key Your Veryfi API key 8 | * @param {string} base_url 9 | * @param {Number} timeout 10 | */ 11 | function Client( 12 | client_id, 13 | client_secret, 14 | username, 15 | api_key, 16 | base_url = "https://api.veryfi.com/", 17 | timeout = 120) { 18 | this.client_id = client_id; 19 | this.client_secret = client_secret; 20 | this.username = username; 21 | this.api_key = api_key; 22 | this.base_url = base_url; 23 | this.timeout = timeout; 24 | this.api_version = "v8"; 25 | } 26 | 27 | module.exports = Client; 28 | -------------------------------------------------------------------------------- /lib/client/function.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | require('../client/generateSignature'); 3 | require('../client/getHeaders'); 4 | require('../client/getUrl'); 5 | require('../client/request'); 6 | module.exports = Client; 7 | -------------------------------------------------------------------------------- /lib/client/generateSignature.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | const {createHmac} = require('crypto'); 3 | /** 4 | * Generate unique signature for payload params. 5 | * @private 6 | * @param {{}} payload_params JSON params to be sent to API request 7 | * @param {Number} timestamp Unix Long timestamp 8 | * @returns {string} Unique signature generated using the client_secret and the payload 9 | */ 10 | Client.prototype._generate_signature = function (payload_params, timestamp) { 11 | let payload = `timestamp:${timestamp}`; 12 | for (let i = 0; i < Object.keys(payload_params).length; i++) { 13 | let key = Object.keys(payload_params)[i]; 14 | let value = payload_params[key]; 15 | payload = `${payload},${key}:${value}`; 16 | } 17 | const secret_bytes = encodeURI(this.client_secret); 18 | const payload_bytes = encodeURI(payload); 19 | let hmac = createHmac('sha256', secret_bytes); 20 | hmac.update(payload_bytes); 21 | let tmp_signature = hmac.digest(); 22 | let base64_signature = Buffer.from(tmp_signature).toString('base64'); 23 | base64_signature = Buffer.from(base64_signature).toString('utf-8').trim(); 24 | 25 | return base64_signature; 26 | } 27 | -------------------------------------------------------------------------------- /lib/client/getHeaders.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | 3 | /** 4 | * Prepares the headers needed for a request. 5 | * @private 6 | * @param {Boolean} has_files Are there any files to be submitted as binary 7 | * @return {Object} Dictionary with headers 8 | */ 9 | Client.prototype._get_headers = function (has_files = false) { 10 | let final_headers = { 11 | "User-Agent": "Node.js Veryfi-Nodejs/1.4.5", 12 | "Accept": "application/json", 13 | "Content-Type": "application/json", 14 | "Client-Id": this.client_id, 15 | "Authorization": `apikey ${this.username}:${this.api_key}`, 16 | }; 17 | if (has_files) { 18 | final_headers["Content-Type"] = "multipart/form-data"; 19 | } 20 | return final_headers; 21 | } 22 | -------------------------------------------------------------------------------- /lib/client/getUrl.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Get API Base URL with API Version 4 | * @private 5 | * @returns {string} Base URL to Veryfi API 6 | */ 7 | Client.prototype._get_url = function () { 8 | return this.base_url + "api/" + this.api_version; 9 | } 10 | -------------------------------------------------------------------------------- /lib/client/request.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | const axios = require('axios').default; 3 | const FormData = require('form-data'); 4 | const {promisify} = require("util"); 5 | 6 | /** 7 | * Submit the HTTP request. 8 | * @private 9 | * @param {string} http_verb HTTP Method 10 | * @param {string} endpoint_name Endpoint name such as 'documents', 'users', etc. 11 | * @param {{}} request_arguments JSON payload to send to Veryfi 12 | * @param params {{}} query params. 13 | * @param {Boolean} has_files Are there any files to be submitted as binary 14 | * @returns {JSON} A JSON of the response data. 15 | */ 16 | Client.prototype._request = async function (http_verb, endpoint_name, request_arguments, params = {}, has_files = false) { 17 | let headers = this._get_headers(has_files); 18 | let api_url = `${this._get_url()}/partner${endpoint_name}`; 19 | 20 | if (this.client_secret) { 21 | let timestamp = Date.now(); 22 | let signature = this._generate_signature(request_arguments, timestamp); 23 | headers = Object.assign(headers, { 24 | "X-Veryfi-Request-Timestamp": timestamp, 25 | "X-Veryfi-Request-Signature": signature 26 | }); 27 | } 28 | 29 | if (has_files) { 30 | const formData = new FormData(); 31 | Object.entries(request_arguments).forEach(([key, value]) => { 32 | if (value != null) { 33 | formData.append(key, key === "file" ? value : value.toString()); 34 | } 35 | }); 36 | headers = Object.assign(headers, formData.getHeaders()); 37 | const getLength = promisify(formData.getLength).bind(formData); 38 | headers['Content-Length'] = await getLength() 39 | request_arguments = formData; 40 | } else { 41 | request_arguments = JSON.stringify(request_arguments); 42 | } 43 | try { 44 | return await axios.request({ 45 | method: http_verb, 46 | maxBodyLength: Infinity, 47 | url: api_url, 48 | headers: headers, 49 | data: request_arguments, 50 | timeout: this.timeout * 1000, 51 | params: params 52 | }); 53 | } catch (response) { 54 | let errorStatus = response?.response?.status; 55 | let errorInfo = response?.response?.data; 56 | throw new Error(`Error: ${errorStatus} ${JSON.stringify(errorInfo)}`); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/documents/deleteDocument.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Delete document from Veryfi. https://docs.veryfi.com/api/receipts-invoices/delete-a-document/ 4 | * 5 | * @memberof Client 6 | * @param {string} document_id ID of the document you'd like to delete 7 | */ 8 | Client.prototype.delete_document = async function (document_id) { 9 | let endpoint_name = `/documents/${document_id}/`; 10 | let request_arguments = {"id": document_id}; 11 | return this._request("DELETE", endpoint_name, request_arguments); 12 | } 13 | -------------------------------------------------------------------------------- /lib/documents/getDocument.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Retrieve document by ID. https://docs.veryfi.com/api/receipts-invoices/get-a-document/ 4 | * @memberof Client 5 | * @param {string} document_id ID of the document you'd like to retrieve 6 | * @param {Object} kwargs Additional request parameters 7 | * @returns {JSON} Data extracted from the Document 8 | */ 9 | Client.prototype.get_document = async function (document_id, {...kwargs} = {}) { 10 | let endpoint_name = `/documents/${document_id}/`; 11 | let request_arguments = {"id": document_id}; 12 | let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); 13 | return document['data']; 14 | } 15 | -------------------------------------------------------------------------------- /lib/documents/getDocuments.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Get JSON of documents. https://docs.veryfi.com/api/receipts-invoices/search-documents/ 4 | * @memberof Client 5 | * @param {number} page The page number. The response is capped to maximum of 50 results per page. 6 | * @param {number} page_size The number of Documents per page. 7 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 8 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 9 | * @param {Object} kwargs Additional request parameters 10 | * @returns {JSON} JSON object of previously processed documents 11 | */ 12 | Client.prototype.get_documents = async function ( 13 | page = 1, 14 | page_size = 50, 15 | bounding_boxes = false, 16 | confidence_details = false, 17 | {...kwargs} = {} 18 | ) { 19 | let endpoint_name = "/documents/"; 20 | let request_arguments = { 21 | "page": page, 22 | "page_size": page_size, 23 | "bounding_boxes": bounding_boxes, 24 | "confidence_details": confidence_details, 25 | }; 26 | let documents = await this._request("GET", endpoint_name, request_arguments, kwargs, false); 27 | if ("data" in documents) { 28 | documents = documents["data"]; 29 | } 30 | return documents; 31 | } 32 | -------------------------------------------------------------------------------- /lib/documents/processDocument.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | const path = require('path'); 3 | const fs = require('fs'); 4 | /** 5 | * Process a document and extract all the fields from it. https://docs.veryfi.com/api/receipts-invoices/process-a-document/ 6 | * @example 7 | * veryfi_client.process_document('file/path', 8 | * ['Entertainment','Food'], 9 | * true, 10 | * {"extra":"parameters"}) 11 | * 12 | * @memberof Client 13 | * @param {String} file_path Path on disk to a file to submit for data extraction 14 | * @param {Array} categories List of categories Veryfi can use to categorize the document 15 | * @param {Boolean} auto_delete Delete this document from Veryfi after data has been extracted 16 | * @param {Object} kwargs Additional request parameters 17 | * @returns {JSON} Data extracted from the document 18 | */ 19 | Client.prototype.process_document = async function ( 20 | file_path, 21 | categories = null, 22 | auto_delete = false, 23 | {...kwargs} = {} 24 | ) { 25 | 26 | let file = fs.createReadStream(file_path); 27 | let file_name = path.basename(file_path); 28 | 29 | return this.process_document_from_stream( 30 | file, 31 | file_name, 32 | auto_delete, 33 | kwargs 34 | ); 35 | } 36 | module.exports = Client; 37 | -------------------------------------------------------------------------------- /lib/documents/processDocumentBase64.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Process a document and extract all the fields from it. https://docs.veryfi.com/api/receipts-invoices/process-a-document/ 4 | * @example 5 | * veryfi_client.process_document_from_base64('base64_encoded_string', 6 | * 'receipt.png', 7 | * ['Entertainment','Food'], 8 | * true, 9 | * {'extra': 'parameters'}) 10 | * 11 | * @memberof Client 12 | * @param {String} base64_encoded_string Buffer string of a file to submit for data extraction 13 | * @param {String} file_name The file name including the extension 14 | * @param {Array} categories List of categories Veryfi can use to categorize the document 15 | * @param {Boolean} auto_delete Delete this document from Veryfi after data has been extracted 16 | * @param {Object} kwargs Additional request parameters 17 | * @returns {JSON} Data extracted from the document 18 | */ 19 | Client.prototype.process_document_from_base64 = async function ( 20 | base64_encoded_string, 21 | file_name, 22 | categories = null, 23 | auto_delete = false, 24 | {...kwargs} = {} 25 | ) { 26 | 27 | let endpoint_name = "/documents/"; 28 | let request_arguments = { 29 | "file_name": file_name, 30 | "file_data": base64_encoded_string, 31 | "categories": categories, 32 | "auto_delete": auto_delete, 33 | }; 34 | request_arguments = Object.assign(request_arguments, kwargs); 35 | let document = await this._request("POST", endpoint_name, request_arguments, null, false); 36 | return document['data']; 37 | } 38 | -------------------------------------------------------------------------------- /lib/documents/processDocumentStream.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Process a document and extract all the fields from it. https://docs.veryfi.com/api/receipts-invoices/process-a-document/ 4 | * @example 5 | * veryfi_client.process_document_stream('ReadStream', 6 | * 'receipt.png', 7 | * ['Entertainment','Food'], 8 | * true, 9 | * {'extra': 'parameters'}) 10 | * 11 | * @memberof Client 12 | * @param {stream.Readable} file ReadStream of a file to submit for data extraction 13 | * @param {String} file_name The file name including the extension 14 | * @param {Boolean} auto_delete Delete this document from Veryfi after data has been extracted 15 | * @param {Object} kwargs Additional request parameters 16 | * @returns {JSON} Data extracted from the document 17 | */ 18 | Client.prototype.process_document_from_stream = async function ( 19 | file, 20 | file_name, 21 | auto_delete = false, 22 | {...kwargs} = {} 23 | ) { 24 | let endpoint_name = "/documents/"; 25 | let request_arguments = { 26 | "file": file, 27 | "file_name": file_name, 28 | "auto_delete": auto_delete 29 | }; 30 | request_arguments = Object.assign(request_arguments, kwargs); 31 | let document = await this._request("POST", endpoint_name, request_arguments, null, true); 32 | return document['data']; 33 | } 34 | -------------------------------------------------------------------------------- /lib/documents/processDocumentUrl.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Process document from url and extract all the fields from it. https://docs.veryfi.com/api/receipts-invoices/process-a-document/ 4 | * @example 5 | * veryfi_client.process_document_from_url('https://cdn.example.com/receipt.jpg') 6 | * 7 | * @memberof Client 8 | * @param {string|null} file_url Required if file_urls isn't specified. Publicly accessible URL to a file, e.g. "https://cdn.example.com/receipt.jpg". 9 | * @param {Array} file_urls Required if file_url isn't specified. List of publicly accessible URLs to multiple files, e.g. ["https://cdn.example.com/receipt1.jpg", "https://cdn.example.com/receipt2.jpg"] 10 | * @param {Array} categories List of categories to use when categorizing the document 11 | * @param {boolean} auto_delete Delete this document from Veryfi after data has been extracted 12 | * @param {boolean} boost_mode Flag that tells Veryfi whether boost mode should be enabled. When set to 1, Veryfi will skip data enrichment steps, but will process the document faster. Default value for this flag is 0 13 | * @param {string|null} external_id Optional custom document identifier. Use this if you would like to assign your own ID to documents 14 | * @param {int} max_pages_to_process When sending a long document to Veryfi for processing, this parameter controls how many pages of the document will be read and processed, starting from page 1. 15 | * @param {Object} kwargs Additional request parameters 16 | * @return {JSON} Data extracted from the document. 17 | */ 18 | Client.prototype.process_document_from_url = async function ( 19 | file_url = null, 20 | file_urls = null, 21 | categories = null, 22 | auto_delete = false, 23 | boost_mode = false, 24 | external_id = null, 25 | max_pages_to_process = 1, 26 | {...kwargs} = {}, 27 | ) { 28 | let endpoint_name = "/documents/"; 29 | let request_arguments = { 30 | "auto_delete": auto_delete, 31 | "boost_mode": boost_mode, 32 | "categories": categories, 33 | "external_id": external_id, 34 | "file_url": file_url, 35 | "file_urls": file_urls, 36 | "max_pages_to_process": max_pages_to_process, 37 | }; 38 | request_arguments = Object.assign(request_arguments, kwargs); 39 | let response = await this._request("POST", endpoint_name, request_arguments, null, false); 40 | return response['data']; 41 | } 42 | -------------------------------------------------------------------------------- /lib/documents/tags/addTag.js: -------------------------------------------------------------------------------- 1 | const Client = require('../../client/constructor'); 2 | /** 3 | * Add a new tag on an existing document. https://docs.veryfi.com/api/receipts-invoices/add-a-tag-to-a-document/ 4 | * 5 | * @param {number} document_id ID of the document you'd like to add a Tag 6 | * @param {string} tag name to add 7 | * @return {JSON} response about tag added. 8 | */ 9 | Client.prototype.add_tag = async function (document_id, tag) { 10 | let endpoint_name = `/documents/${document_id}/tags/`; 11 | let request_arguments = {"name": tag}; 12 | let response = await this._request("PUT", endpoint_name, request_arguments); 13 | return response['data']; 14 | } 15 | -------------------------------------------------------------------------------- /lib/documents/tags/addTags.js: -------------------------------------------------------------------------------- 1 | const Client = require('../../client/constructor'); 2 | /** 3 | * Add multiple tags on an existing document. https://docs.veryfi.com/api/receipts-invoices/add-tags-to-a-document/ 4 | * 5 | * @param {number} document_id ID of the document you'd like to add a Tag 6 | * @param {string[]} tags array of tags to be added 7 | * @return {JSON} response about tag added. 8 | */ 9 | Client.prototype.add_tags = async function (document_id, tags) { 10 | let endpoint_name = `/documents/${document_id}/tags/`; 11 | let request_arguments = {"tags": tags}; 12 | let response = await this._request("POST", endpoint_name, request_arguments); 13 | return response['data']; 14 | } 15 | -------------------------------------------------------------------------------- /lib/documents/tags/deleteTags.js: -------------------------------------------------------------------------------- 1 | const Client = require('../../client/constructor'); 2 | /** 3 | * Delete all the tags on an existing document. https://docs.veryfi.com/api/receipts-invoices/unlink-all-tags-from-a-document/ 4 | * 5 | * @param {number} document_id ID of the document you'd like to delete tags 6 | * @return {JSON} response about deleted tags. 7 | */ 8 | Client.prototype.delete_tags = async function (document_id) { 9 | let endpoint_name = `/documents/${document_id}/tags/`; 10 | let request_arguments = {}; 11 | return this._request("DELETE", endpoint_name, request_arguments); 12 | } 13 | -------------------------------------------------------------------------------- /lib/documents/tags/replaceTags.js: -------------------------------------------------------------------------------- 1 | const Client = require('../../client/constructor'); 2 | /** 3 | * Replace multiple tags on an existing document. https://docs.veryfi.com/api/receipts-invoices/add-tags-to-a-document/ 4 | * 5 | * @param {number} document_id ID of the document you'd like to add a Tag 6 | * @param {string[]} tags array of tags to be added 7 | * @return {JSON} response about tag added. 8 | */ 9 | Client.prototype.replace_tags = async function (document_id, tags) { 10 | let endpoint_name = `/documents/${document_id}/`; 11 | let request_arguments = {"tags": tags}; 12 | let response = await this._request("PUT", endpoint_name, request_arguments); 13 | return response['data']; 14 | } 15 | -------------------------------------------------------------------------------- /lib/documents/updateDocument.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * https://docs.veryfi.com/api/receipts-invoices/update-a-document/ 4 | * Update data for a previously processed document, including almost any field like `vendor`, `date`, `notes` and etc. 5 | * @example 6 | * veryfi_client.update_document(id, {date:"2021-01-01", notes:"look what I did"}) 7 | * 8 | * @memberof Client 9 | * @param {string} document_id ID of the document you'd like to update 10 | * @param {Object} kwargs fields to update 11 | * @return {JSON} A document json with updated fields, if fields are writable. Otherwise a document with unchanged fields. 12 | */ 13 | Client.prototype.update_document = async function (document_id, {...kwargs} = {}) { 14 | let endpoint_name = `/documents/${document_id}/`; 15 | let response = await this._request("PUT", endpoint_name, kwargs); 16 | return response['data']; 17 | } 18 | -------------------------------------------------------------------------------- /lib/types/BillTo.ts: -------------------------------------------------------------------------------- 1 | import {BoundingElement} from "./BoundingElement"; 2 | 3 | export declare type BillTo = { 4 | address?: null | string | BoundingElement; 5 | email?: null | string | BoundingElement; 6 | name?: null | string | BoundingElement; 7 | parsed_address?: null | Record; 8 | phone_number?: null | number | string | BoundingElement; 9 | reg_number?: null | number | string | BoundingElement; 10 | vat_number?: null | number | string | BoundingElement; 11 | }; 12 | -------------------------------------------------------------------------------- /lib/types/BoundingElement.ts: -------------------------------------------------------------------------------- 1 | export declare type BoundingElement = { 2 | bounding_box?: null | number[]; 3 | bounding_region?: null | number[]; 4 | rotation?: null | number; 5 | value?: null | number | string; 6 | } 7 | -------------------------------------------------------------------------------- /lib/types/LineItem.ts: -------------------------------------------------------------------------------- 1 | import {BoundingElement} from "./BoundingElement"; 2 | 3 | export declare type LineItem = { 4 | category?: null | string | BoundingElement; 5 | country_of_origin?: null | string | BoundingElement; 6 | custom_fields?: Record; 7 | date?: null | string | BoundingElement; 8 | description?: null | string | BoundingElement; 9 | discount?: null | number | BoundingElement; 10 | discount_price?: null | number | BoundingElement; 11 | discount_rate?: null | number | BoundingElement; 12 | end_date?: null | string | BoundingElement; 13 | full_description?: null | string | BoundingElement; 14 | gross_total?: null | number | BoundingElement; 15 | hsn?: null | string; 16 | id?: null | number; 17 | lot?: null | string | BoundingElement; 18 | manufacturer?: null | string | BoundingElement; 19 | net_total?: null | number | BoundingElement; 20 | normalized_description?: null | string | BoundingElement; 21 | order?: null | number; 22 | price?: null | number | BoundingElement; 23 | quantity?: null | number | BoundingElement; 24 | reference?: null | string | BoundingElement; 25 | section?: null | string; 26 | sku?: null | string | BoundingElement; 27 | start_date?: null | string; 28 | subtotal?: null | number | BoundingElement; 29 | tags?: null | string[]; 30 | tax?: null | number | BoundingElement; 31 | tax_code?: null | string | BoundingElement; 32 | tax_rate?: null | number; 33 | text?: null | string | BoundingElement; 34 | total?: null | number | BoundingElement; 35 | type?: null | string; 36 | unit_of_measure?: null | string; 37 | upc?: null | string | BoundingElement; 38 | weight?: null | number | BoundingElement; 39 | }; 40 | -------------------------------------------------------------------------------- /lib/types/Payment.ts: -------------------------------------------------------------------------------- 1 | import {BoundingElement} from "./BoundingElement"; 2 | 3 | export declare type Payment = { 4 | card_number?: null | string | BoundingElement; 5 | display_name?: null | string | BoundingElement; 6 | terms?: null | number | BoundingElement; 7 | type?: null | string; 8 | }; 9 | -------------------------------------------------------------------------------- /lib/types/ShipTo.ts: -------------------------------------------------------------------------------- 1 | import {BoundingElement} from "./BoundingElement"; 2 | 3 | export declare type ShipTo = { 4 | address?: null | string | BoundingElement; 5 | name?: null | string | BoundingElement; 6 | parsed_address?: null | Record; 7 | }; 8 | -------------------------------------------------------------------------------- /lib/types/Tag.ts: -------------------------------------------------------------------------------- 1 | export declare type Tag = { 2 | id?: null | number; 3 | name?: null | string; 4 | }; 5 | -------------------------------------------------------------------------------- /lib/types/TaxLine.ts: -------------------------------------------------------------------------------- 1 | import {BoundingElement} from "./BoundingElement"; 2 | 3 | export declare type TaxLine = { 4 | base?: null | number | BoundingElement; 5 | name?: null | string | BoundingElement; 6 | order?: null | number; 7 | rate?: null | number | BoundingElement; 8 | total?: null | number | BoundingElement; 9 | }; 10 | -------------------------------------------------------------------------------- /lib/types/Vendor.ts: -------------------------------------------------------------------------------- 1 | import {BoundingElement} from "./BoundingElement"; 2 | 3 | export declare type Vendor = { 4 | abn_number?: null | string | BoundingElement; 5 | account_currency?: null | string | BoundingElement; 6 | account_number?: null | string | BoundingElement; 7 | address?: null | string | BoundingElement; 8 | bank_breakdown?: Array>; 9 | bank_name?: null | string | BoundingElement; 10 | bank_number?: null | string | BoundingElement; 11 | bank_swift?: null | string | BoundingElement; 12 | biller_code?: null | string | BoundingElement; 13 | category?: null | string | BoundingElement; 14 | country_code?: null | string | BoundingElement; 15 | email?: null | string | BoundingElement; 16 | external_id?: null | string | BoundingElement; 17 | external_ids?: Array; 18 | fax_number?: null | string | BoundingElement; 19 | iban?: null | string | BoundingElement; 20 | lat?: number; 21 | lng?: number; 22 | logo?: null | string | BoundingElement; 23 | logo_name?: null | string | BoundingElement; 24 | map_url?: null | string | BoundingElement; 25 | name?: null | string | BoundingElement; 26 | order_number?: null | string | BoundingElement; 27 | parsed_address?: null | Record; 28 | phone_number?: null | string | BoundingElement; 29 | raw_address?: null | string | BoundingElement; 30 | raw_name?: null | string; 31 | reg_number?: null | string | BoundingElement; 32 | type?: null | string | BoundingElement; 33 | vat_number?: null | string | BoundingElement; 34 | web?: null | string | BoundingElement; 35 | }; 36 | -------------------------------------------------------------------------------- /lib/types/VeryfiDocument.ts: -------------------------------------------------------------------------------- 1 | import {BoundingElement} from "./BoundingElement"; 2 | import {BillTo} from "./BillTo"; 3 | import {VeryfiExtraArgs} from "./VeryfiExtraArgs"; 4 | import {LineItem} from "./LineItem"; 5 | import {Payment} from "./Payment"; 6 | import {ShipTo} from "./ShipTo"; 7 | import {Tag} from "./Tag"; 8 | import {TaxLine} from "./TaxLine"; 9 | import {Vendor} from "./Vendor"; 10 | 11 | /** 12 | * Object of data extracted from the document 13 | */ 14 | export declare type VeryfiDocument = { 15 | abn_number?: null | string | BoundingElement; 16 | account_number?: null | string | BoundingElement; 17 | accounting_entry_type?: null | string; 18 | balance?: null | string | BoundingElement; 19 | barcodes?: null | Array<{ data: string; type: string }>; 20 | bill_to?: null | BillTo; 21 | card_number?: null | string | BoundingElement; 22 | cashback?: null | number | BoundingElement; 23 | category?: null | string | BoundingElement; 24 | created_date?: null | string; 25 | currency_code?: null | string | BoundingElement; 26 | custom_fields?: null | VeryfiExtraArgs; 27 | date?: null | string | BoundingElement; 28 | default_category?: null | string | BoundingElement; 29 | delivery_date?: null | string | BoundingElement; 30 | delivery_note_number?: null | string | BoundingElement; 31 | discount?: null | number | BoundingElement; 32 | document_reference_number?: null | string | BoundingElement; 33 | document_title?: null | string | BoundingElement; 34 | document_type?: null | string | BoundingElement; 35 | due_date?: null | string | BoundingElement; 36 | duplicate_of?: null | number; 37 | exch_rate?: null | number; 38 | external_id?: null | string; 39 | final_balance?: null | number | BoundingElement; 40 | guest_count?: null | number | BoundingElement; 41 | id?: null | number; 42 | img_blur?: null | boolean; 43 | img_file_name?: null | string; 44 | img_thumbnail_url?: null | string; 45 | img_url?: null | string; 46 | incoterms?: null | number | BoundingElement; 47 | insurance?: null | number | BoundingElement; 48 | invoice_number?: null | string | BoundingElement; 49 | is_approved?: null | boolean; 50 | is_blurry?: null | boolean[]; 51 | is_document?: null | boolean; 52 | is_duplicate?: null | boolean; 53 | is_money_in?: null | boolean | BoundingElement; 54 | language?: null | string[]; 55 | license_plate_number?: null | string | BoundingElement; 56 | line_items?: null | LineItem[]; 57 | line_items_with_scores?: null | LineItem[]; 58 | meta?: null | { 59 | device_id?: null | string; 60 | device_user_uuid?: null | string; 61 | duplicates?: Array<{ 62 | id: number; 63 | score: number; 64 | url: string; 65 | }>; 66 | fraud?: { 67 | attribution?: null | string; 68 | color?: string; 69 | custom_types?: string[]; 70 | decision?: string; 71 | images?: Array<{ 72 | is_lcd: boolean; 73 | score: number; 74 | }>; 75 | pages?: Array<{ 76 | is_lcd: { 77 | score: number; 78 | value: boolean; 79 | }; 80 | }>; 81 | score?: number; 82 | submissions?: Record; 83 | types?: string[]; 84 | version?: null | string; 85 | }; 86 | handwritten_fields?: null | string[]; 87 | language?: null | string[]; 88 | owner?: null | string; 89 | pages?: Array<{ 90 | height: number; 91 | is_blurry: { 92 | score: number; 93 | value: boolean; 94 | }; 95 | language: string[]; 96 | screenshot: { 97 | score: number; 98 | type: null | string; 99 | }; 100 | width: number; 101 | }>; 102 | processed_pages?: null | number; 103 | source?: null | string; 104 | source_documents?: Array<{ 105 | height: number; 106 | size_kb: number; 107 | width: number; 108 | }>; 109 | total_pages?: null | number; 110 | warnings?: Array<{ 111 | message: string; 112 | type: string; 113 | }>; 114 | }; 115 | notes?: null | string; 116 | ocr_text?: null | string; 117 | order_date?: null | string | BoundingElement; 118 | payment?: null | Payment; 119 | pdf_url?: null | string; 120 | previous_balance?: null | number | BoundingElement; 121 | purchase_order_number?: null | string | BoundingElement; 122 | reference_number?: null | string | BoundingElement; 123 | rounding?: null | number | BoundingElement; 124 | server_name?: null | string | BoundingElement; 125 | service_end_date?: null | string; 126 | service_start_date?: null | string; 127 | ship_date?: null | string | BoundingElement; 128 | ship_to?: null | ShipTo; 129 | shipping?: null | number | BoundingElement; 130 | status?: null | string; 131 | store_number?: null | string | BoundingElement; 132 | subtotal?: null | number | BoundingElement; 133 | tags?: null | Tag[]; 134 | tax?: null | number | BoundingElement; 135 | tax_lines?: null | TaxLine[]; 136 | tip?: null | number | BoundingElement; 137 | total?: null | number | BoundingElement; 138 | total_quantity?: null | string | BoundingElement; 139 | total_weight?: null | string | BoundingElement; 140 | tracking_number?: null | string | BoundingElement; 141 | tracking_numbers?: null | BoundingElement[]; 142 | updated_date?: null | string; 143 | vending_person?: null | string | BoundingElement; 144 | vending_person_number?: null | string | BoundingElement; 145 | vat_number?: null | string; 146 | vendor?: null | Vendor; 147 | vendors?: null | BoundingElement[]; 148 | vin_number?: null | string | BoundingElement; 149 | warnings?: null | string[]; 150 | weights?: null | BoundingElement[]; 151 | }; 152 | -------------------------------------------------------------------------------- /lib/types/VeryfiExtraArgs.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Additional request parameters type 3 | */ 4 | export declare type VeryfiExtraArgs = Record< 5 | string | number | symbol, 6 | string | number | boolean 7 | >; 8 | 9 | export type JsonObject = Record; 10 | -------------------------------------------------------------------------------- /lib/w2s/deleteW2.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Delete w2 document from Veryfi https://docs.veryfi.com/api/w2s/delete-a-w-2/ 4 | * 5 | * @memberof Client 6 | * @param {string} document_id ID of the document you'd like to delete 7 | */ 8 | Client.prototype.delete_w2 = async function (document_id) { 9 | let endpoint_name = `/w2s/${document_id}/`; 10 | let request_arguments = {"id": document_id}; 11 | return this._request("DELETE", endpoint_name, request_arguments); 12 | } 13 | -------------------------------------------------------------------------------- /lib/w2s/getW2.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Get a w2 document https://docs.veryfi.com/api/w2s/get-a-w-2/ 4 | * @memberOf Client 5 | * @param {string} document_id ID of the document you'd like to retrieve 6 | * @param {Object} kwargs Additional request parameters 7 | * @returns {JSON} Data extracted from the Document 8 | */ 9 | Client.prototype.get_w2 = async function ( 10 | document_id, 11 | {...kwargs} = {} 12 | ) { 13 | let endpoint_name = `/w2s/${document_id}/`; 14 | let request_arguments = {"id": document_id}; 15 | let response = await this._request("GET", endpoint_name, request_arguments, kwargs, false); 16 | return response['data']; 17 | } 18 | -------------------------------------------------------------------------------- /lib/w2s/getW2s.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Get all w2 documents. https://docs.veryfi.com/api/w2s/get-w-2-s/ 4 | * @memberOf Client 5 | * @param {Object} kwargs Additional request parameters 6 | * @return {Array} An array of JSON with all w2 documents. 7 | */ 8 | Client.prototype.get_w2s = async function ( {...kwargs} = {}) { 9 | let endpoint_name = "/w2s/"; 10 | let request_arguments = {}; 11 | let response = await this._request("GET", endpoint_name, request_arguments, kwargs, false); 12 | return response['data']; 13 | } 14 | -------------------------------------------------------------------------------- /lib/w2s/processW2.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | const path = require('path'); 3 | const fs = require('fs'); 4 | /** 5 | * Upload a document from a file path https://docs.veryfi.com/api/w2s/process-a-w-2/ 6 | * @param {String} file_path Path on disk to a file to submit for data extraction 7 | * @param {boolean} auto_delete Delete this document from Veryfi after data has been extracted 8 | * @param {int} max_pages_to_process When sending a long document to Veryfi for processing, this parameter controls how many pages of the document will be read and processed, starting from page 1. 9 | * @param {Object} kwargs Additional request parameters 10 | * @return {JSON} Data extracted from the document. 11 | */ 12 | Client.prototype.process_w2 = async function ( 13 | file_path, 14 | auto_delete = false, 15 | max_pages_to_process = 1, 16 | {...kwargs} = {} 17 | ) { 18 | let file = fs.createReadStream(file_path); 19 | let file_name = path.basename(file_path); 20 | 21 | return this.process_w2_from_stream( 22 | file, 23 | file_name, 24 | auto_delete, 25 | max_pages_to_process, 26 | kwargs 27 | ); 28 | } 29 | -------------------------------------------------------------------------------- /lib/w2s/processW2Base64.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Upload a w2 document from a buffer. https://docs.veryfi.com/api/w2s/process-a-w-2/ 4 | * @memberOf Client 5 | * @param {String} file_name The file name including the extension 6 | * @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} 7 | * @param {boolean} auto_delete Delete this document from Veryfi after data has been extracted 8 | * @param {int} max_pages_to_process When sending a long document to Veryfi for processing, this parameter controls how many pages of the document will be read and processed, starting from page 1. 9 | * @param {Object} kwargs Additional request parameters 10 | * @return {JSON} Data extracted from the document. 11 | */ 12 | Client.prototype.process_w2_from_base64 = async function ( 13 | file_name, 14 | file_base64_string, 15 | auto_delete = null, 16 | max_pages_to_process = null, 17 | {...kwargs} = {} 18 | ) { 19 | 20 | let endpoint_name = "/w2s/" 21 | let request_arguments = { 22 | "file_name": file_name, 23 | "file_data": file_base64_string, 24 | "auto_delete": auto_delete, 25 | "max_pages_to_process": max_pages_to_process, 26 | } 27 | request_arguments = Object.assign(request_arguments, kwargs); 28 | let response = await this._request("POST", endpoint_name, request_arguments, null, false); 29 | return response['data']; 30 | } 31 | -------------------------------------------------------------------------------- /lib/w2s/processW2Stream.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Upload a w2 document from a buffer. https://docs.veryfi.com/api/w2s/process-a-w-2/ 4 | * @memberOf Client 5 | * @param {stream.Readable} file file to submit for data extraction 6 | * @param {String} file_name The file name including the extension 7 | * @param {boolean} auto_delete Delete this document from Veryfi after data has been extracted 8 | * @param {int} max_pages_to_process When sending a long document to Veryfi for processing, this parameter controls how many pages of the document will be read and processed, starting from page 1. 9 | * @param {Object} kwargs Additional request parameters 10 | * @return {JSON} Data extracted from the document. 11 | */ 12 | Client.prototype.process_w2_from_stream = async function ( 13 | file, 14 | file_name, 15 | auto_delete = null, 16 | max_pages_to_process = null, 17 | {...kwargs} = {} 18 | ) { 19 | 20 | let endpoint_name = "/w2s/" 21 | let request_arguments = { 22 | "file": file, 23 | "file_name": file_name, 24 | "auto_delete": auto_delete, 25 | "max_pages_to_process": max_pages_to_process, 26 | } 27 | request_arguments = Object.assign(request_arguments, kwargs); 28 | let response = await this._request("POST", endpoint_name, request_arguments, null, true); 29 | return response['data']; 30 | } 31 | -------------------------------------------------------------------------------- /lib/w2s/processW2Url.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Process a w2 document from an url. https://docs.veryfi.com/api/w2s/process-a-w-2/ 4 | * @memberOf Client 5 | * @param {String} file_name The file name including the extension 6 | * @param {string} file_url Required if file_urls isn't specified. Publicly accessible URL to a file, e.g. "https://cdn.example.com/receipt.jpg". 7 | * @param {Array} file_urls Required if file_url isn't specified. List of publicly accessible URLs to multiple files, e.g. ["https://cdn.example.com/receipt1.jpg", "https://cdn.example.com/receipt2.jpg"] 8 | * @param {boolean} auto_delete Delete this document from Veryfi after data has been extracted 9 | * @param {int} max_pages_to_process When sending a long document to Veryfi for processing, this parameter controls how many pages of the document will be read and processed, starting from page 1. 10 | * @param {Object} kwargs Additional request parameters 11 | * @return {JSON} Data extracted from the document. 12 | */ 13 | Client.prototype.process_w2_from_url = async function ( 14 | file_name, 15 | file_url, 16 | file_urls = null, 17 | auto_delete = false, 18 | max_pages_to_process = 1, 19 | {...kwargs} = {} 20 | ) { 21 | let endpoint_name = "/w2s/" 22 | let request_arguments = { 23 | "file_name": file_name, 24 | "auto_delete": auto_delete, 25 | "file_url": file_url, 26 | "file_urls": file_urls, 27 | "max_pages_to_process": max_pages_to_process 28 | } 29 | request_arguments = Object.assign(request_arguments, kwargs); 30 | let response = await this._request("POST", endpoint_name, request_arguments, null, false); 31 | return response['data']; 32 | } 33 | -------------------------------------------------------------------------------- /lib/w8bene/deleteW8BENE.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Delete a W-8BEN-E from Veryfi. https://docs.veryfi.com/api/w-8ben-e/delete-a-w-8-ben-e/ 4 | * 5 | * @memberof Client 6 | * @param {string} document_id ID of the document you'd like to delete 7 | */ 8 | Client.prototype.delete_w8bene = async function (document_id) { 9 | let endpoint_name = `/w-8ben-e/${document_id}/`; 10 | let request_arguments = {"id": document_id}; 11 | return this._request("DELETE", endpoint_name, request_arguments); 12 | } 13 | -------------------------------------------------------------------------------- /lib/w8bene/getW8BENE.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Get a specific W-8BEN-E. https://docs.veryfi.com/api/w-8ben-e/get-a-w-8-ben-e/ 4 | * @memberof Client 5 | * @param {number} document_id The unique identifier of the document. 6 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 7 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 8 | * @param {Object} kwargs Additional request parameters. 9 | * @returns {JSON} Object of a previously processed blueprinted document. 10 | */ 11 | Client.prototype.get_w8bene = async function ( 12 | document_id, 13 | bounding_boxes = false, 14 | confidence_details = false, 15 | {...kwargs} = {} 16 | ) { 17 | let endpoint_name = `/w-8ben-e/${document_id}/`; 18 | let request_arguments = { 19 | "bounding_boxes": bounding_boxes, 20 | "confidence_details": confidence_details 21 | }; 22 | let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); 23 | return document['data']; 24 | } 25 | -------------------------------------------------------------------------------- /lib/w8bene/getW8BENEs.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Get all W-8BEN-E. https://docs.veryfi.com/api/w-8ben-e/get-w-8-ben-es/ 4 | * @memberof Client 5 | * @param {number} page The page number. The response is capped to maximum of 50 results per page. 6 | * @param {number} page_size The number of Documents per page. 7 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 8 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 9 | * @param {Object} kwargs Additional request parameters 10 | * @returns {JSON} Object of previously processed any documents 11 | */ 12 | Client.prototype.get_w8benes = async function ( 13 | page = 1, 14 | page_size = 50, 15 | bounding_boxes = false, 16 | confidence_details = false, 17 | {...kwargs} = {} 18 | ) { 19 | let endpoint_name = `/w-8ben-e/`; 20 | let request_arguments = { 21 | "page": page, 22 | "page_size": page_size, 23 | "bounding_boxes": bounding_boxes, 24 | "confidence_details": confidence_details 25 | }; 26 | let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); 27 | return document['data']; 28 | } 29 | -------------------------------------------------------------------------------- /lib/w8bene/processW8BENE.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | const path = require('path'); 3 | const fs = require('fs'); 4 | /** 5 | * Process a W-8BEN-E document. https://docs.veryfi.com/api/w-8ben-e/process-a-w-8-ben-e/ 6 | * @example 7 | * veryfi_client.process_w8bene('file_path') 8 | * 9 | * @memberof Client 10 | * @param {String} file_path Path on disk to a file to submit for data extraction 11 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 12 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 13 | * @param {Object} kwargs Additional request parameters 14 | * @returns {JSON} Data extracted from the document 15 | */ 16 | Client.prototype.process_w8bene = async function ( 17 | file_path, 18 | bounding_boxes = false, 19 | confidence_details = false, 20 | {...kwargs} = {} 21 | ) { 22 | 23 | let file = fs.createReadStream(file_path); 24 | let file_name = path.basename(file_path); 25 | 26 | return this.process_w8bene_from_stream( 27 | file, 28 | file_name, 29 | bounding_boxes, 30 | confidence_details, 31 | kwargs 32 | ); 33 | } 34 | -------------------------------------------------------------------------------- /lib/w8bene/processW8BENEBase64.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Upload a W-8BEN-E document from a buffer. https://docs.veryfi.com/api/w-8ben-e/process-a-w-8-ben-e/ 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 {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 9 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 10 | * @param {Object} kwargs Additional request parameters 11 | * @returns {JSON} Data extracted from the document 12 | */ 13 | Client.prototype.process_w8bene_from_base64 = async function ( 14 | file_name, 15 | file_base64_string, 16 | bounding_boxes = false, 17 | confidence_details = false, 18 | {...kwargs} = {} 19 | ) { 20 | 21 | let endpoint_name = "/w-8ben-e/"; 22 | let request_arguments = { 23 | "file_name": file_name, 24 | "file_data": file_base64_string, 25 | "bounding_boxes": bounding_boxes, 26 | "confidence_details": confidence_details, 27 | }; 28 | request_arguments = Object.assign(request_arguments, kwargs); 29 | let document = await this._request("POST", endpoint_name, request_arguments, null, false); 30 | return document['data']; 31 | } 32 | -------------------------------------------------------------------------------- /lib/w8bene/processW8BENEStream.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Upload a W-8BEN-E document from a buffer. https://docs.veryfi.com/api/w-8ben-e/process-a-w-8-ben-e/ 4 | * 5 | * @memberof Client 6 | * @param {stream.Readable} file file to submit for data extraction 7 | * @param {String} file_name The file name including the extension 8 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 9 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 10 | * @param {Object} kwargs Additional request parameters 11 | * @returns {JSON} Data extracted from the document 12 | */ 13 | Client.prototype.process_w8bene_from_stream = async function ( 14 | file, 15 | file_name, 16 | bounding_boxes = false, 17 | confidence_details = false, 18 | {...kwargs} = {} 19 | ) { 20 | 21 | let endpoint_name = "/w-8ben-e/"; 22 | let request_arguments = { 23 | "file": file, 24 | "file_name": file_name, 25 | "bounding_boxes": bounding_boxes, 26 | "confidence_details": confidence_details, 27 | }; 28 | request_arguments = Object.assign(request_arguments, kwargs); 29 | let document = await this._request("POST", endpoint_name, request_arguments, null, true); 30 | return document['data']; 31 | } 32 | -------------------------------------------------------------------------------- /lib/w8bene/processW8BENEUrl.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Process W-8BEN-E and extract all the fields from it. https://docs.veryfi.com/api/w-8ben-e/process-a-w-8-ben-e/ 4 | * @example 5 | * veryfi_client.process_w8bene_from_url('file_url') 6 | * 7 | * @memberof Client 8 | * @param {String} file_url url file to submit for data extraction 9 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 10 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 11 | * @param {Object} kwargs Additional request parameters 12 | * @returns {JSON} Data extracted from the document 13 | */ 14 | Client.prototype.process_w8bene_from_url = async function ( 15 | file_url, 16 | bounding_boxes = false, 17 | confidence_details = false, 18 | {...kwargs} = {} 19 | ) { 20 | 21 | let endpoint_name = "/w-8ben-e/"; 22 | let request_arguments = { 23 | "file_url": file_url, 24 | "bounding_boxes": bounding_boxes, 25 | "confidence_details": confidence_details, 26 | }; 27 | request_arguments = Object.assign(request_arguments, kwargs); 28 | let document = await this._request("POST", endpoint_name, request_arguments, null, false); 29 | return document['data']; 30 | } 31 | -------------------------------------------------------------------------------- /lib/w9s/deleteW9.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Delete w9 document from Veryfi. https://docs.veryfi.com/api/w9s/delete-a-w-9/ 4 | * 5 | * @memberof Client 6 | * @param {string} document_id ID of the document you'd like to delete 7 | */ 8 | Client.prototype.delete_w9 = async function (document_id) { 9 | let endpoint_name = `/w9s/${document_id}/`; 10 | let request_arguments = {"id": document_id}; 11 | return this._request("DELETE", endpoint_name, request_arguments); 12 | } 13 | -------------------------------------------------------------------------------- /lib/w9s/getW9.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Get a w9 document https://docs.veryfi.com/api/w9s/get-a-w-9/ 4 | * @memberof Client 5 | * @param {number} document_id The unique identifier of the document. 6 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 7 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 8 | * @param {Object} kwargs Additional request parameters 9 | * @returns {JSON} Object of a previously processed blueprinted document. 10 | */ 11 | Client.prototype.get_w9 = async function ( 12 | document_id, 13 | bounding_boxes = false, 14 | confidence_details = false, 15 | {...kwargs} = {} 16 | ) { 17 | let endpoint_name = `/w9s/${document_id}/`; 18 | let request_arguments = { 19 | "bounding_boxes": bounding_boxes, 20 | "confidence_details": confidence_details 21 | }; 22 | let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); 23 | return document['data']; 24 | } 25 | -------------------------------------------------------------------------------- /lib/w9s/getW9s.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Get all w9 documents. https://docs.veryfi.com/api/w9s/get-w-9-s/ 4 | * @memberof Client 5 | * @param {number} page The page number. The response is capped to maximum of 50 results per page. 6 | * @param {number} page_size The number of Documents per page. 7 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 8 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 9 | * @param {Object} kwargs Additional request parameters 10 | * @returns {JSON} Object of previously processed any documents 11 | */ 12 | Client.prototype.get_w9s = async function ( 13 | page = 1, 14 | page_size = 50, 15 | bounding_boxes = false, 16 | confidence_details = false, 17 | {...kwargs} = {} 18 | ) { 19 | let endpoint_name = `/w9s/`; 20 | let request_arguments = { 21 | "page": page, 22 | "page_size": page_size, 23 | "bounding_boxes": bounding_boxes, 24 | "confidence_details": confidence_details 25 | }; 26 | let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); 27 | return document['data']; 28 | } 29 | -------------------------------------------------------------------------------- /lib/w9s/processW9.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | const path = require('path'); 3 | const fs = require('fs'); 4 | /** 5 | * Upload a w9 document from a file path. https://docs.veryfi.com/api/w9s/process-a-w-9/ 6 | * @memberof Client 7 | * @param {String} file_path Path on disk to a file to submit for data extraction 8 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 9 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 10 | * @param {Object} kwargs Additional request parameters 11 | * @returns {JSON} Data extracted from the document 12 | */ 13 | Client.prototype.process_w9 = async function ( 14 | file_path, 15 | bounding_boxes = false, 16 | confidence_details = false, 17 | {...kwargs} = {} 18 | ) { 19 | 20 | let file = fs.createReadStream(file_path); 21 | let file_name = path.basename(file_path); 22 | 23 | return this.process_w9_from_stream( 24 | file, 25 | file_name, 26 | bounding_boxes, 27 | confidence_details, 28 | kwargs 29 | ); 30 | } 31 | -------------------------------------------------------------------------------- /lib/w9s/processW9Base64.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Upload a w9 document from a buffer. https://docs.veryfi.com/api/w9s/process-a-w-9/ 4 | * @memberof Client 5 | * @param {String} file_name The file name including the extension 6 | * @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} 7 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 8 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 9 | * @param {Object} kwargs Additional request parameters 10 | * @returns {JSON} Data extracted from the document 11 | */ 12 | Client.prototype.process_w9_from_base64 = async function ( 13 | file_name, 14 | file_base64_string, 15 | bounding_boxes = false, 16 | confidence_details = false, 17 | {...kwargs} = {} 18 | ) { 19 | 20 | let endpoint_name = "/w9s/"; 21 | let request_arguments = { 22 | "file_name": file_name, 23 | "file_data": file_base64_string, 24 | "bounding_boxes": bounding_boxes, 25 | "confidence_details": confidence_details, 26 | }; 27 | request_arguments = Object.assign(request_arguments, kwargs); 28 | let document = await this._request("POST", endpoint_name, request_arguments); 29 | return document['data']; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /lib/w9s/processW9Stream.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Upload a w9 document from a buffer. https://docs.veryfi.com/api/w9s/process-a-w-9/ 4 | * @memberof Client 5 | * @param {stream.Readable} file file to submit for data extraction 6 | * @param {String} file_name The file name including the extension 7 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 8 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 9 | * @param {Object} kwargs Additional request parameters 10 | * @returns {JSON} Data extracted from the document 11 | */ 12 | Client.prototype.process_w9_from_stream = async function ( 13 | file, 14 | file_name, 15 | bounding_boxes = false, 16 | confidence_details = false, 17 | {...kwargs} = {} 18 | ) { 19 | 20 | let endpoint_name = "/w9s/"; 21 | let request_arguments = { 22 | "file": file, 23 | "file_name": file_name, 24 | "bounding_boxes": bounding_boxes, 25 | "confidence_details": confidence_details, 26 | }; 27 | request_arguments = Object.assign(request_arguments, kwargs); 28 | let document = await this._request("POST", endpoint_name, request_arguments, null, true); 29 | return document['data']; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /lib/w9s/processW9Url.js: -------------------------------------------------------------------------------- 1 | const Client = require('../client/constructor'); 2 | /** 3 | * Process a w9 document from an url. https://docs.veryfi.com/api/w9s/process-a-w-9/ 4 | * @memberof Client 5 | * @param {String} file_url url file to submit for data extraction 6 | * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. 7 | * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. 8 | * @param {Object} kwargs Additional request parameters 9 | * @returns {JSON} Data extracted from the document 10 | */ 11 | Client.prototype.process_w9_from_url = async function ( 12 | file_url, 13 | bounding_boxes = false, 14 | confidence_details = false, 15 | {...kwargs} = {} 16 | ) { 17 | 18 | let endpoint_name = "/w9s/"; 19 | let request_arguments = { 20 | "file_url": file_url, 21 | "bounding_boxes": bounding_boxes, 22 | "confidence_details": confidence_details, 23 | }; 24 | request_arguments = Object.assign(request_arguments, kwargs); 25 | let document = await this._request("POST", endpoint_name, request_arguments, null, false); 26 | return document['data']; 27 | } 28 | -------------------------------------------------------------------------------- /mocks/addTag.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "id": 6673474, 4 | "name": "TEST_TAG" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /mocks/deleteDocument.json: -------------------------------------------------------------------------------- 1 | { 2 | "status":"ok", 3 | "message":"Document has been deleted" 4 | } 5 | -------------------------------------------------------------------------------- /mocks/deleteTags.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /mocks/document.json: -------------------------------------------------------------------------------- 1 | { "data": { 2 | "account_number": "test1", 3 | "accounting_entry_type": "debit", 4 | "balance": null, 5 | "barcodes": [], 6 | "bill_to": { 7 | "address": null, 8 | "email": null, 9 | "name": null, 10 | "parsed_address": null, 11 | "phone_number": null, 12 | "reg_number": null, 13 | "vat_number": null 14 | }, 15 | "cashback": null, 16 | "category": "Grocery", 17 | "created_date": "2024-10-22 01:25:27", 18 | "currency_code": "COP", 19 | "custom_fields": { 20 | "box_number": null, 21 | "dsadasas": "dasdsadas", 22 | "foo": "bar" 23 | }, 24 | "date": "2024-09-15 00:00:00", 25 | "default_category": "Meals & Entertainment", 26 | "delivery_date": null, 27 | "delivery_note_number": null, 28 | "discount": -40, 29 | "document_reference_number": null, 30 | "document_title": null, 31 | "document_type": "receipt", 32 | "due_date": null, 33 | "duplicate_of": null, 34 | "exch_rate": 0.00023739936623357158, 35 | "external_id": null, 36 | "final_balance": null, 37 | "guest_count": null, 38 | "id": 252469322, 39 | "img_blur": false, 40 | "img_file_name": "252469322.jpg", 41 | "img_thumbnail_url": "https://scdn.veryfi.com/receipts/222782c2-58f1-4324-a0e1-fb75ed775e3a/thumbnail.jpg?Expires=1730212855&Signature=M2L9yhqN2H5dmri4KihWIUH8SaPuujAAfG7IBV1RXh-0cw3ZOV~Ktl3wwSzVHtCeSLIn4IDvadUtlHI7qMAKdUXI30v0btVMnlY~74zXtMsTavNQRXH24WcvYh8sy3EeLx5nOUu2cuy7yMiBLe3C0kxX-KZqQMmmtxOHbLUz6EURradcgW9nR~SqZLRxt2M7q74my-q7D7i7Vt-onlVThdzrqfx0N6xBD5HXm1DjwZTxAK8OArxIifw2II-z2HKrG9J-2ngbgGE7yKyHhVORjIkRLMHBEo4j6sjwbbhUBgAh~eST7-qS2YDhi7WAzKj48xLBm~xIQbKMvqCRQdZeBA__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", 42 | "img_url": "https://scdn.veryfi.com/receipts/222782c2-58f1-4324-a0e1-fb75ed775e3a/b3252b81-f60d-40ee-a29f-04982949f57d.jpg?Expires=1730212855&Signature=PKR1peq2bBYRIaAHU~03rzG0wvHVeVXUAN7zuvZk6VW0~pUl4Lqvrc2n6eIwdO~ZZD-xzNV4-NGg8xNtB5KwwuRnVWigOHn4UZQRAWC40e9RVrq4uE2CvC5nUc3GPHgiQmaItuJGuWLSVX1RMQbDnXXsYPJewqc2gbY~Wjoo~FTNYtWh54deyME1JB6zn5~BjP7aar8xtJS5O~8C4Zm5VQdbNXCAKPBe7hMRnEN0wEiHnoy7ZA~aXScw6DRsBYnJ5U4A2G5rygXgAVbyQZjaxjf3rUC8B1iPHJJMsH73SfR4oGPcbuv~DafE39SSf9tOvrZJK0oCAyyNoXbblbLxcw__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", 43 | "incoterms": "Nit", 44 | "insurance": null, 45 | "invoice_number": "R2F628461", 46 | "is_approved": false, 47 | "is_blurry": [], 48 | "is_document": true, 49 | "is_duplicate": false, 50 | "is_money_in": false, 51 | "is_transaction": false, 52 | "license_plate_number": null, 53 | "line_items": [ 54 | { 55 | "category": "Grocery", 56 | "country_of_origin": null, 57 | "custom_fields": {}, 58 | "date": null, 59 | "description": "MINI CROISSANT", 60 | "discount": null, 61 | "discount_price": null, 62 | "discount_rate": null, 63 | "end_date": null, 64 | "full_description": "MINI CROISSANT", 65 | "gross_total": null, 66 | "hsn": null, 67 | "id": 1133456985, 68 | "lot": null, 69 | "manufacturer": null, 70 | "net_total": null, 71 | "normalized_description": null, 72 | "order": 0, 73 | "price": 3800, 74 | "quantity": 2, 75 | "reference": null, 76 | "section": null, 77 | "sku": "07700304928064", 78 | "start_date": null, 79 | "subtotal": null, 80 | "tags": [ 81 | "line_items_total_greater_than_1" 82 | ], 83 | "tax": null, 84 | "tax_code": "6", 85 | "tax_rate": null, 86 | "text": "2 UN X $3,800\n07700304928064 MINI CROISSANT\t7,600 6", 87 | "total": 7600, 88 | "type": "food", 89 | "unit_of_measure": "UN", 90 | "upc": null, 91 | "weight": null 92 | }, 93 | { 94 | "category": "Grocery", 95 | "country_of_origin": null, 96 | "custom_fields": {}, 97 | "date": null, 98 | "description": "HUEVO TIPO A SO", 99 | "discount": null, 100 | "discount_price": null, 101 | "discount_rate": null, 102 | "end_date": null, 103 | "full_description": "HUEVO TIPO A SO", 104 | "gross_total": null, 105 | "hsn": null, 106 | "id": 1133456986, 107 | "lot": null, 108 | "manufacturer": null, 109 | "net_total": null, 110 | "normalized_description": null, 111 | "order": 1, 112 | "price": 13490, 113 | "quantity": 1, 114 | "reference": null, 115 | "section": null, 116 | "sku": "07700304323852", 117 | "start_date": null, 118 | "subtotal": null, 119 | "tags": [ 120 | "line_items_total_greater_than_1" 121 | ], 122 | "tax": null, 123 | "tax_code": "5", 124 | "tax_rate": null, 125 | "text": "1 UN X\t$13,490\n07700304323852 HUEVO TIPO A SO\t13,490 5", 126 | "total": 13490, 127 | "type": "food", 128 | "unit_of_measure": "UN", 129 | "upc": null, 130 | "weight": null 131 | } 132 | ], 133 | "meta": { 134 | "device_id": "C92EBD0A-D384-4A00-84DC-C0AF870CD682", 135 | "device_user_uuid": "3f026250-a975-422b-93bf-e2247d94ae82", 136 | "duplicates": [], 137 | "fraud": { 138 | "attribution": null, 139 | "color": "green", 140 | "custom_types": [], 141 | "decision": "Not Fraud", 142 | "images": [ 143 | {} 144 | ], 145 | "pages": [ 146 | {} 147 | ], 148 | "score": 0.5, 149 | "submissions": {}, 150 | "types": [], 151 | "version": null 152 | }, 153 | "handwritten_fields": [], 154 | "language": [ 155 | "es" 156 | ], 157 | "owner": "devapitest", 158 | "pages": [ 159 | { 160 | "height": 3339, 161 | "is_blurry": { 162 | "value": null 163 | }, 164 | "language": [ 165 | "es", 166 | "en" 167 | ], 168 | "screenshot": { 169 | "score": 0.9300000071525574, 170 | "type": null 171 | }, 172 | "width": 1827 173 | } 174 | ], 175 | "processed_pages": 1, 176 | "source": "lens.receipt", 177 | "source_documents": [ 178 | { 179 | "height": 3339, 180 | "size_kb": 1894, 181 | "width": 1827 182 | } 183 | ], 184 | "total_pages": 1, 185 | "warnings": [] 186 | }, 187 | "model": "2.49.3", 188 | "notes": null, 189 | "ocr_text": "NIT900276962-1 Gran contribuyente\nretenedor de IVA Res.012220/22\nD1 SAS\nAgente\tCL 30 A 80 62 MEDELLIN\ny\nDOMICILIO PRINCIPAL CRA 7 155C 30 North\nTorre E Piso 38 TEL: 018000120201\nPoint\tCLIENTE: Consumidor Final\nPoint\nC.C: 2222222222\nGeneracion: 2024-09-15 19:45:11\nValidacion Dian: 2024-09-15 19:45:16\nITEM CANT UND.MED VALOR UN\nCODIGO\tDESCRIPCION\tVALOR ID\n2 UN X $3,800\n07700304928064 MINI CROISSANT\t7,600 6\n2\t1 UN X\t$13,490\n07700304323852 HUEVO TIPO A SO\t13,490 5\nTOTAL\t\t\t21,090\nAJUSTE VUELTAS EXACTAS $\t-40\nVALOR PAGADO\t\t21,050\nFORMA DE PAGO: CONTADO\nEFECTIVO $\t\t40,000\nCAMBIO\t\t\t18,950\nRESUMEN DE IMPUESTOS\nID\tTOTAL\tBASE\tIVA\n6\t7,600\t7,600\t0\n5\t13.490\t13,490\t0\n\t21,090\t0\n6=EXCLU 5=EXENTO C=5% A=19% 0=NO GRAVADO\nID. CLIENTE: undefined\nSISTEMA P.O.S ARS - DESARROLLADO POR:\nNCR COLOMBIA LTDA NIT 860.005.074-8\nFACTURADOR ELECTRONICO:\nE factura Cadena Nit: 890.930.534\nATENDIDO POR: ISABEL PEREZ 602072\nNUM ART ENTREGADOS:3 TRX: 2071 02 6049\nRes.DIAN 18764063610933 de 20240111 R2F6\nDE 1 HASTA 1999999 18 Meses\nFactura Electronica de Venta R2F628461\n\nCUFE 3e08378d9b708b47332a87e7d196cbb2662\n282868712b295d0b8ac7c6249d2c68f9ee758d6b\n5cd27974f459103f05f\nBon", 190 | "order_date": null, 191 | "payment": { 192 | "card_number": null, 193 | "display_name": "Cash", 194 | "terms": null, 195 | "type": "cash" 196 | }, 197 | "pdf_url": "https://scdn.veryfi.com/receipts/222782c2-58f1-4324-a0e1-fb75ed775e3a/48f261ac-bc9d-40e1-b55c-53ecd5ec6176.pdf?Expires=1730212855&Signature=HLj-A~ZW2vl9iQWwToBx6BUdk48Xeq1DcWflmDJKZNd50oDllJ38ZBkxMronnzwuIFAfm49vQmewuQLCswI96~l8rexYTjV3i5a2xMuXQQST~GbY0-DpWSRQ4aDqSDdmH8-j3K1mIvJU5tPHcDu-FnAQFtmrKhSpK1bLkoflmDI79YOl66yYtOTP5A4Syvys1JaNklDFyLzJmHQaU170ulYCyu~iqAF-jlnxU1z9JLw3AGgK96hPrWsT1Yt8jyKunJuU3NVikopf93ITJP2rNVU6wsfVLZzPTGLv-xDed-LhzF3EEfIygGpa8a8lxhFB-romojdiOFbU7jhgvJX~fA__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", 198 | "previous_balance": null, 199 | "purchase_order_number": null, 200 | "reference_number": "VCDEE-69322", 201 | "rounding": null, 202 | "server_name": null, 203 | "service_end_date": null, 204 | "service_start_date": null, 205 | "ship_date": null, 206 | "ship_to": { 207 | "address": null, 208 | "name": null, 209 | "parsed_address": null 210 | }, 211 | "shipping": null, 212 | "status": "reviewed", 213 | "store_number": null, 214 | "subtotal": 21090, 215 | "tags": [ 216 | { 217 | "id": 9018171, 218 | "name": "line_items_total_greater_than_1" 219 | }, 220 | { 221 | "id": 9018172, 222 | "name": "is_document" 223 | }, 224 | { 225 | "id": 9018173, 226 | "name": "total_greater_than_1" 227 | }, 228 | { 229 | "id": 9018396, 230 | "name": "extract_tags" 231 | }, 232 | { 233 | "id": 9277238, 234 | "name": "is_fraud_green" 235 | }, 236 | { 237 | "id": 9675131, 238 | "name": "newtah" 239 | }, 240 | { 241 | "id": 11996332, 242 | "name": "1.6 Liters part" 243 | }, 244 | { 245 | "id": 12926297, 246 | "name": "test_rule_1_failure" 247 | } 248 | ], 249 | "tax": null, 250 | "tax_lines": [ 251 | { 252 | "base": 7600, 253 | "code": "6", 254 | "name": null, 255 | "order": 0, 256 | "rate": null, 257 | "total": 0, 258 | "total_inclusive": 7600 259 | }, 260 | { 261 | "base": 13490, 262 | "code": "5", 263 | "name": null, 264 | "order": 1, 265 | "rate": null, 266 | "total": 0, 267 | "total_inclusive": 13490 268 | } 269 | ], 270 | "tip": null, 271 | "total": 21050, 272 | "total_pages": 1, 273 | "total_quantity": null, 274 | "total_weight": null, 275 | "tracking_number": null, 276 | "tracking_numbers": [ 277 | null 278 | ], 279 | "updated_date": "2024-10-22 01:25:33", 280 | "vending_person": "ISABEL PEREZ 602072", 281 | "vending_person_number": null, 282 | "vendor": { 283 | "abn_number": null, 284 | "account_currency": null, 285 | "account_number": null, 286 | "address": "Torre E Piso 38", 287 | "bank_breakdown": [ 288 | {} 289 | ], 290 | "bank_name": null, 291 | "bank_number": null, 292 | "bank_swift": null, 293 | "biller_code": null, 294 | "category": "Grocery", 295 | "country_code": "CO", 296 | "email": null, 297 | "external_id": null, 298 | "external_ids": [], 299 | "fax_number": null, 300 | "iban": null, 301 | "lat": null, 302 | "lng": null, 303 | "logo": "https://cdn.veryfi.com/logos/us/675164122.png", 304 | "logo_name": null, 305 | "map_url": null, 306 | "name": "Tiendas D1", 307 | "order_number": null, 308 | "parsed_address": {}, 309 | "phone_number": "018000120201", 310 | "raw_address": "Torre E Piso 38", 311 | "raw_name": "D1 SAS", 312 | "reg_number": null, 313 | "type": "Grocery", 314 | "vat_number": "Res.012220/22", 315 | "web": null 316 | }, 317 | "vendors": [ 318 | "Tiendas D1" 319 | ], 320 | "vin_number": null, 321 | "warnings": [], 322 | "weights": [ 323 | null 324 | ] 325 | } 326 | } 327 | -------------------------------------------------------------------------------- /mocks/getTags.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "tags": [ 4 | { 5 | "id": 6673474, 6 | "name": "tag_123" 7 | } 8 | ] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /mocks/processAnyDocument.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "pdf_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/cf1363b8-a38f-47e8-b9ee-8105342121cd/7179c430-eb38-4251-b015-9ceb20129371.pdf?Expires=1727203608&Signature=ZSfZmJRLtJ6DeIRioIQSExufnR4fDvADq1Fs-x~WnbU1JueQ1PLtY~7b~Krk7eda6EAQkMBa2wamDDcE2lCvrutHCS3jUbhlFFhSuQd1XljbYjBlWOdxYyXpYMmluDlaWlkgm41vA92UD3LSsBPBLrBasotjqNYLGnTg87guXTtUG1rSWlK2FhHxzborReNdrpXUcDMs4-kkQ46tTDgFH~mCPkh5F9DSpm-UsyJ6SmJgm1SWfw09KbQizyp4lIwte1yumKXtORtTCKv5WFWRUFUWD6Kv1eIkh5XJ5jfMzSfaTEikZlYF4t08Lbp5Apk5-alOW-1yYIwqb5RqZhQ26w__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", 4 | "id": 4559535, 5 | "external_id": null, 6 | "created_date": "2024-09-24 18:31:48", 7 | "updated_date": "2024-09-24 18:31:48", 8 | "img_thumbnail_url": "https://scdn.veryfi.com/other-documents/919ba4778c039560/cf1363b8-a38f-47e8-b9ee-8105342121cd/thumbnail.png?Expires=1727203608&Signature=SIRru1E-r1VT5KmufOC9A3UXlWzpgaZWUn0GhSj~veGagGAISV7sztEA7bER~kZlVnowRBSu19UaR8VeGfQ39uzUxEVlzdxPgjITt7IEgfGa~B-0EUI8izLDfRoOMkdRrOknLJKpCq87hz8fMn6wfKSgWxGgyCFKuvO2zcdla~fmtcTOrR4OMAPA3TX4Y4ZRnwCfUDQwNMw72Zihh9bxulzgjM6Cqffc7wta6wC84rYRlztPgGQj51ARcewG5s-IouvrJKoTAONLJZaq8CEc-iMh~TRzKf4MiI5HoheBFmjKb2NdoJFDpHR~~aLW8RxWkEV87JtglILAumkjrY7jjw__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", 9 | "blueprint_name": "us_driver_license", 10 | "template_name": "us_driver_license", 11 | "address": "892 MOMONA ST HONOLULU, HI 96820", 12 | "birth_date": "1981-06-03", 13 | "expiration_date": "2008-06-03", 14 | "eyes_color": "BRO", 15 | "first_name": null, 16 | "height": "5-10", 17 | "issue_date": "1998-06-18", 18 | "last_name": "McLovin", 19 | "license_class": "3", 20 | "license_number": "01-47-87441", 21 | "sex": "M", 22 | "state": "HAWAII", 23 | "weight": "150" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /mocks/processBankStatement.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "transactions": [ 4 | { 5 | "order": 0, 6 | "account_number": "1111111", 7 | "balance": 1803.9, 8 | "card_number": null, 9 | "credit_amount": null, 10 | "date": "2013-10-22", 11 | "debit_amount": 190.4, 12 | "description": "AUTOMATED PAY IN 650274051211-CHB\nCALL REF. NO. 3442, FROM", 13 | "transaction_id": null, 14 | "text": "22 Oct 2013 AUTOMATED PAY IN 650274051211-CHB\t\t\t\t190.40\t1803.9\nCALL REF. NO. 3442, FROM" 15 | }, 16 | { 17 | "order": 1, 18 | "account_number": "1111111", 19 | "balance": 1613.5, 20 | "card_number": null, 21 | "credit_amount": null, 22 | "date": "2013-10-22", 23 | "debit_amount": 140, 24 | "description": "DIGITAL BANKING\nA/C 22222222", 25 | "transaction_id": null, 26 | "text": "22 Oct 2013 DIGITAL BANKING\t\t\t\t\t\t140.00\t1613.5\nA/C 22222222" 27 | }, 28 | { 29 | "order": 2, 30 | "account_number": "1111111", 31 | "balance": 1473.5, 32 | "card_number": null, 33 | "credit_amount": null, 34 | "date": "2013-10-24", 35 | "debit_amount": 132.3, 36 | "description": "Amazon", 37 | "transaction_id": null, 38 | "text": "24 Oct 2013 Faster Payment\tAmazon\t\t\t\t\t132.30\t1473.5" 39 | }, 40 | { 41 | "order": 3, 42 | "account_number": "1111111", 43 | "balance": 1341.2, 44 | "card_number": null, 45 | "credit_amount": null, 46 | "date": "2013-10-24", 47 | "debit_amount": 515.22, 48 | "description": "Tebay Trading Co.", 49 | "transaction_id": null, 50 | "text": "24 Oct 2013 BACS\tTebay Trading Co.\t\t\t\t515.22\t1341.2" 51 | }, 52 | { 53 | "order": 4, 54 | "account_number": "1111111", 55 | "balance": 825.98, 56 | "card_number": null, 57 | "credit_amount": null, 58 | "date": "2013-10-25", 59 | "debit_amount": 80, 60 | "description": "Morrisons Petrol", 61 | "transaction_id": null, 62 | "text": "25 Oct 2013 Faster Payment\tMorrisons Petrol\t\t\t\t80.00\t825.98" 63 | }, 64 | { 65 | "order": 5, 66 | "account_number": "1111111", 67 | "balance": 745.98, 68 | "card_number": null, 69 | "credit_amount": 20000, 70 | "date": "2013-10-25", 71 | "debit_amount": null, 72 | "description": "Business Loan", 73 | "transaction_id": null, 74 | "text": "25 Oct 2013 BACS\tBusiness Loan\t\t20,000.00\t\t745.98" 75 | }, 76 | { 77 | "order": 6, 78 | "account_number": "1111111", 79 | "balance": 20745.98, 80 | "card_number": null, 81 | "credit_amount": null, 82 | "date": "2013-10-26", 83 | "debit_amount": 2461.55, 84 | "description": "James White Media", 85 | "transaction_id": null, 86 | "text": "26 Oct 2013 BACS\tJames White Media\t\t\t2,461.55\t20745.98" 87 | }, 88 | { 89 | "order": 7, 90 | "account_number": "1111111", 91 | "balance": 18284.43, 92 | "card_number": null, 93 | "credit_amount": null, 94 | "date": "2013-10-27", 95 | "debit_amount": 100, 96 | "description": "ATM High Street", 97 | "transaction_id": null, 98 | "text": "27 Oct 2013 Faster Payment\tATM High Street\t\t\t\t100.00\t18284.43" 99 | }, 100 | { 101 | "order": 8, 102 | "account_number": "1111111", 103 | "balance": 18184.43, 104 | "card_number": null, 105 | "credit_amount": null, 106 | "date": "2013-11-01", 107 | "debit_amount": 150, 108 | "description": "Acorn Advertising Studies", 109 | "transaction_id": null, 110 | "text": "01 Nov 2013 BACS\tAcorn Advertising Studies\t\t\t150.00\t18184.43" 111 | }, 112 | { 113 | "order": 9, 114 | "account_number": "1111111", 115 | "balance": 18034.43, 116 | "card_number": null, 117 | "credit_amount": null, 118 | "date": "2013-11-01", 119 | "debit_amount": 177, 120 | "description": "Marriott Hotel", 121 | "transaction_id": null, 122 | "text": "01 Nov 2013 BACS\tMarriott Hotel\t\t\t\t177.00\t18034.43" 123 | }, 124 | { 125 | "order": 10, 126 | "account_number": "1111111", 127 | "balance": 17857.43, 128 | "card_number": null, 129 | "credit_amount": null, 130 | "date": "2013-11-01", 131 | "debit_amount": 122.22, 132 | "description": "Abellio Scotrail Ltd", 133 | "transaction_id": null, 134 | "text": "01 Nov 2013 Faster Payment\tAbellio Scotrail Ltd\t\t\t\t122.22\t17857.43" 135 | }, 136 | { 137 | "order": 11, 138 | "account_number": "1111111", 139 | "balance": 17735.21, 140 | "card_number": null, 141 | "credit_amount": null, 142 | "date": "2013-11-01", 143 | "debit_amount": 1200, 144 | "description": "Cheque 0000234", 145 | "transaction_id": null, 146 | "text": "01 Nov 2013 CHQ\tCheque 0000234\t\t\t\t1,200.00\t17735.21" 147 | }, 148 | { 149 | "order": 12, 150 | "account_number": "1111111", 151 | "balance": 16535.21, 152 | "card_number": null, 153 | "credit_amount": 9.33, 154 | "date": "2013-12-01", 155 | "debit_amount": null, 156 | "description": "Interest Paid", 157 | "transaction_id": null, 158 | "text": "01 Dec 2013 Int. Bank\tInterest Paid\t\t\t9.33\t\t16535.21" 159 | }, 160 | { 161 | "order": 13, 162 | "account_number": "1111111", 163 | "balance": 16544.54, 164 | "card_number": null, 165 | "credit_amount": null, 166 | "date": "2013-12-01", 167 | "debit_amount": 2470, 168 | "description": "OVO Energy", 169 | "transaction_id": null, 170 | "text": "01 Dec 2013 DD\t\tOVO Energy\t\t\t\t2470.00\t16544.54" 171 | }, 172 | { 173 | "order": 14, 174 | "account_number": "1111111", 175 | "balance": 14074.54, 176 | "card_number": null, 177 | "credit_amount": null, 178 | "date": "2013-12-21", 179 | "debit_amount": 10526.4, 180 | "description": "Various Payment", 181 | "transaction_id": null, 182 | "text": "21 Dec 2013 BACS\tVarious Payment\t\t\t\t10,526.40\t14074.54" 183 | }, 184 | { 185 | "order": 15, 186 | "account_number": "1111111", 187 | "balance": 3548.14, 188 | "card_number": null, 189 | "credit_amount": null, 190 | "date": "2013-12-21", 191 | "debit_amount": 1000, 192 | "description": "HMRC", 193 | "transaction_id": null, 194 | "text": "21 Dec 2013 BACS\tHMRC\t\t\t\t\t1,000.00\t3548.14" 195 | }, 196 | { 197 | "order": 16, 198 | "account_number": "1111111", 199 | "balance": 2548.14, 200 | "card_number": null, 201 | "credit_amount": null, 202 | "date": "2013-12-21", 203 | "debit_amount": 280, 204 | "description": "DVLA", 205 | "transaction_id": null, 206 | "text": "21 Dec 2013 DD\t\tDVLA\t\t\t\t\t280.00\t2548.14" 207 | } 208 | ], 209 | "summaries": [ 210 | { 211 | "name": "Paid Out", 212 | "total": 2684.1 213 | }, 214 | { 215 | "name": "Paid In", 216 | "total": 2180.4 217 | } 218 | ], 219 | "account_numbers": [ 220 | "1111111" 221 | ], 222 | "routing_numbers": [ 223 | "16-10-00" 224 | ], 225 | "pdf_url": "https://scdn.veryfi.com/bank_statements/919ba4778c039560/f02a38ed-e486-4d30-8354-23c25a0a4446/fe286c1b-bbdb-4a10-b9a8-81546f229de8.pdf?Expires=1727204326&Signature=K8v0yzgwW4NjvFC6k9smjmyznCirxI3z12ODX233hwtdnh9dY3DoqauItMoIkzcG6XL6y5sFoQPlisbck4FSyAXtEUGGGKgCgiezte3y4xMt43~zPR4WWbojPp4zGvZQpBwkxscGI-EFEcBPzLth2GGE0geYNg6R~nKeLn0mQ0rknTiqt4ras70-xC0KsgfwLdYa2xY8Kq56XtjgrsoKJSGIwFaUn0NmML8x~lTr3ifhp5s1t5KnylKDkaNynUNI2hCEUouqILknmmYmi8yLcL9BY3U9vZj0SbobqOnNbN41cMzPfGVm6WTBY~PCrAFNhal03L583hUhy5KHQjBzmQ__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", 226 | "id": 4559568, 227 | "external_id": null, 228 | "created_date": "2024-09-24 18:43:46", 229 | "updated_date": "2024-09-24 18:43:46", 230 | "img_thumbnail_url": "https://scdn.veryfi.com/bank_statements/919ba4778c039560/f02a38ed-e486-4d30-8354-23c25a0a4446/thumbnail.png?Expires=1727204326&Signature=V9YEjDC-W-XaMLsWOFdKmC2X0h9moWf5Mh-j-5UEGNdeyf4dvYCCK6ByXubxeu-fzwTfCpgKl25y7CyCynsH~URsX~1wxsWE~bSLPA7CwkL54NpLmsmrksgAIdU67iV-O-ZDEwdOIQHBX5bUd2QaiGsK3wF2Z~xX5ouOMX3UkzPujYCBZtMB4pbidJmbuB6vC51y8V-yDbuRdHyoYA7ixNiczrSSuqpmkix6KC7ZGIu4eiIBPUnCpIlFc9~qaWkKeecJlLBeOM6SknJD~xTlYxGanbCWbvPYvIFeZX2sWUJPG2A9t~nknMsENymtGqrgy78kcweuv4uyUAbWMr-GxA__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", 231 | "account_holder_address": "San Mateo", 232 | "account_holder_name": "Mr Robot Roboto", 233 | "account_number": "1111111", 234 | "account_type": "CURRENT ACCOUNT", 235 | "bank_address": "The Mound, Edinburgh EH1 1YZ.", 236 | "bank_name": "Royal Bank of Scotland Plc.", 237 | "bank_website": null, 238 | "beginning_balance": 1803.9, 239 | "due_date": null, 240 | "ending_balance": 300.2, 241 | "minimum_due": null, 242 | "period_end_date": "2023-12-21", 243 | "period_start_date": "2023-10-22", 244 | "routing_number": "16-10-00", 245 | "statement_date": null, 246 | "statement_number": null, 247 | "currency_code": "GBP", 248 | "iban_number": "GB11RBOS 1610 0011 1111 11", 249 | "swift": "RBOSGB2L", 250 | "account_vat_number": null, 251 | "bank_vat_number": "SC327000" 252 | } 253 | } 254 | -------------------------------------------------------------------------------- /mocks/processBusinesscard.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "text": "Dmitry Birulia\ndmitry@veryfi.com\nVERYFI\twww.veryfi.com", 4 | "id": 4662609, 5 | "external_id": null, 6 | "created_date": "2024-10-29 19:41:34", 7 | "updated_date": "2024-10-29 19:41:34", 8 | "organization": "VERYFI", 9 | "logo_url": "https://cdn.veryfi.com/logos/us/421973497.png", 10 | "img_url": "https://scdn.veryfi.com/business_cards/919ba4778c039560/235aaf5b-e464-4e03-adc2-443c39f1c053/d42e1e30-4170-4c81-927d-17c31317a94a.jpg?Expires=1730231794&Signature=bP807q99xtc0BcMPVD0SrnFw~aqr-zFUcJhlSEEKX2LnM2QnX4yDFdjITazqKbyJUjTxz1DtEuEN~fkN1ArE5C7u0Q70lLDsMcShRQgWylaQ45S3ulaECcwusdPnmJWczeGzyFj9CQ2RUvUfemuSffg8igP80~~MKdts0I9OJO4eg5FMV4Sh5cOg1y8H2DTbgPZHKO6VHMXQzBh8EW5PlM4IuCZAg5xKrJK2-XF~B8xCDzBECRMAVBjEu8hlm8SFs7D07LR9d6bXZMKv8egZ1HzyhTVdzm-TVBPNM328ou1qIGwLAOxq9PGJK3~2Vd9TSq5ONgPUesh8RAyc-NORcA__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", 11 | "person": "Dmitry Birulia", 12 | "parsed_name": { 13 | "family_name": "Birulia", 14 | "given_name": "Dmitry" 15 | }, 16 | "title": null, 17 | "email": "dmitry@veryfi.com", 18 | "address": null, 19 | "parsed_address": {}, 20 | "mobile": null, 21 | "phone": null, 22 | "fax": null, 23 | "web": "www.veryfi.com" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /mocks/processCheck.json: -------------------------------------------------------------------------------- 1 | {"data": { 2 | "pdf_url": "https://scdn.veryfi.com/checks/919ba4778c039560/78535c60-e371-40fd-ae78-6d0c019b2c35/067e7057-e38b-4c32-9d87-720e0a8e232f.pdf?Expires=1730233783&Signature=fbR-arwLoH1YC8GVK52SvvilH59eHWIYp1o2WXw5UWr0s0CjKkrJ1Bx-PORKVzLbnJHOoYJDC4lU1iiqdq4~yDyz~-ygRHTNxyT9BJovFSzCBAc3Gnzv7uWMNIp-9mdV0QGk-Fu25eZfwd56Dfd2ZhG-EzreCRfh66r6338UF4EaHK5SG5b4i-NwkDaZ~qRZC6jNzYUJOGbXexYPbQxF5tMinc97ok~~fLQ--r0HWr7SvQyJisUqDnKS0DMTQujDz-7lStMJmvvlQX0jmpdcsq8DBIR6SnWZxHA7tM-ydD27Jt8l753X3uNtZuao61CeGSpQP09CnWlctTewm4IHKQ__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", 3 | "id": 4662680, 4 | "external_id": null, 5 | "created_date": "2024-10-29 20:14:43", 6 | "updated_date": "2024-10-29 20:14:43", 7 | "img_thumbnail_url": "https://scdn.veryfi.com/checks/919ba4778c039560/78535c60-e371-40fd-ae78-6d0c019b2c35/thumbnail.jpg?Expires=1730233783&Signature=Sy8RUK0FLkeyhI3tpR8d60j-4BWyUH82D1frNU5FGGgGqumWWer6JgXbqM2eoHrgz04kwtKMwC-UZME0AZa-HtZr8j6a7TRO6M2uT0GoCHNQKv7rNcWUPajn4GsdU8VyY3b8KDx7WaGLd3VXP1TWAIqhW~DC07ZzjWbJ3K~8Ieyztt6Naijb~JbDFgUuIcNu8oikfoK3GAE8vzyElU5ctX4nmG1H-BEySCY-eIjf7GVwvaKjnZjab4h0Ox8SIdRyqVp~sj7dwlAtMlJmv6TxsNS14EDi91pxWPcvQlD7JCyQOH6brsgD0pkYVa4JFBF7yUTnGS4NXcCTiqkBhLh1Tw__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", 8 | "text": "THIS DOCUMENT WAS PRINTED ON PAPER CONTAINING ULTRAVIOLET FIBERS AND AN ARTIFICIAL WATERMARK ON BACK\n\n\t70-2328/719 IL\nNationwide\nis on your side\t\t\tOctober 4, 2021\t\tCheck No. 118408359\nPO Box 2344\nBrea, CA 92822-2344\nPay: One Thousand Three Hundred Eight And 45/100 Dollars\t\t\t$1,308.45\n\nPay to the\tDmitry Birulia\nOrder of:\t733 Long Bridge\nSan Francisco CA 94158\n\n\tAUTHORIZED SIGNATURE\nMemo :F-602441-2021092406733\t\t\t\t\tVOID AFTER SIX MONTHS\n\n⑈0118408359⑈ ⑆031923284⑆ 8765129397⑈", 9 | "meta": {}, 10 | "amount": 1308.45, 11 | "amount_text": "One Thousand Three Hundred Eight And 45/100 Dollars", 12 | "bank_address": "Brea, CA 92822-2344", 13 | "bank_name": null, 14 | "fractional_routing_number": "70-2328/719", 15 | "routing_from_fractional": "071923284", 16 | "check_number": "0118408359", 17 | "date": "2021-10-04", 18 | "memo": "F-602441-2021092406733", 19 | "payer_address": "PO Box 2344", 20 | "payer_name": null, 21 | "receiver_address": "733 Long Bridge\nSan Francisco CA 94158", 22 | "receiver_name": "Dmitry Birulia", 23 | "is_signed": true, 24 | "is_endorsed": null, 25 | "endorsement": { 26 | "is_signed": null, 27 | "is_mobile_or_remote_deposit_only": null 28 | }, 29 | "micr": { 30 | "routing_number": "031923284", 31 | "account_number": "8765129397", 32 | "serial_number": null, 33 | "raw": "C0118408359C A031923284A 8765129397C" 34 | } 35 | }} 36 | -------------------------------------------------------------------------------- /mocks/processW2.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "pdf_url": null, 4 | "id": 4559395, 5 | "external_id": null, 6 | "created_date": "2024-09-24 18:04:25", 7 | "updated_date": "2024-09-24 18:04:25", 8 | "img_thumbnail_url": null, 9 | "advance_eic_payment": null, 10 | "employee_ssn": "123-45-6789", 11 | "ein": "11-2233445", 12 | "employer_name": "The Big Company", 13 | "employer_address": "123 Main Street\nAnywhere, PA 12345", 14 | "control_number": "A1B2", 15 | "employee_name": "Jane A DOE", 16 | "employee_address": "123 Elm Street\nAnywhere Else, PA 23456", 17 | "wages_other_comps": 48500, 18 | "federal_income_tax": 6835, 19 | "ss_wages": 50000, 20 | "ss_tax": 3100, 21 | "medicare_wages": 50000, 22 | "medicare_tax": 725, 23 | "ss_tips": null, 24 | "allocated_tips": null, 25 | "dependent_care_benefits": null, 26 | "non_qualified_plans": null, 27 | "state": "PAL", 28 | "employer_state_id": "1235", 29 | "state_wages_tips": 50000, 30 | "state_income_tax": 1535, 31 | "local_wages_tips": 50000, 32 | "local_income_tax": 750, 33 | "locality_name": "MU", 34 | "field_12a_col1": "D", 35 | "field_12a_col2": 1500, 36 | "field_12b_col1": "DD", 37 | "field_12b_col2": 1000, 38 | "field_12c_col1": "P", 39 | "field_12c_col2": 4800, 40 | "field_12d_col1": null, 41 | "field_12d_col2": null, 42 | "is_13a": false, 43 | "is_13b": true, 44 | "is_13c": false, 45 | "states": [ 46 | { 47 | "state": "PAL", 48 | "employer_state_id": "1235", 49 | "state_wages_tips": 50000, 50 | "state_income_tax": 1535, 51 | "local_wages_tips": 50000, 52 | "local_income_tax": 750, 53 | "locality_name": "MU" 54 | } 55 | ], 56 | "field_14_other": [] 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /mocks/processW8bene.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "pdf_url": "https://scdn.veryfi.com/w8s/919ba4778c039560/64ea51e9-4293-4a0e-99a6-8c3cd0a4f7ab/8468d271-2943-46e7-b9a2-3dd0372d3648.pdf?Expires=1730234368&Signature=e1bOil~yK4P4uKYLxX1NPfHA3PxiTxd-Ds4HVnjNXxY22D-ng2NGJQQrWAst5E0ionsdkkFPc7mKy0fp6MkmwnZF~I-j8e1P9fhbI-T-0NhiDji4gp6xt4~vm-i9MG34K~Xa3TWPA~kMbQ~Hj2gjiMMniXsH6HeqH99yfl-Vt2ZWEMdWl3~ZlMWEpnPVIzDXdDBc~uRYCOS0KiLD2pfNAORYwp1ayNiuhiJzucJPAfRuK00y0BoUEPBmBS-aLa62VhNYVKmUPtVNobS2MjcGcnqnBhOZlbw0B5VTLNqrSIgKSVy6I6Co4zAwLjgviQyoPArVtgmJR8UNdFRk9LuDqw__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", 4 | "id": 4662698, 5 | "external_id": null, 6 | "created_date": "2024-10-29 20:24:28", 7 | "updated_date": "2024-10-29 20:24:28", 8 | "img_thumbnail_url": "https://scdn.veryfi.com/w8s/919ba4778c039560/64ea51e9-4293-4a0e-99a6-8c3cd0a4f7ab/thumbnail.jpg?Expires=1730234368&Signature=ch2MJSewRZV3LkSlMVKMK1~BXsUiO~wNT5bSllXXv1N85jGIqsJHYTkrTaL1fXSZERLXBC6DFIzOcgSYB~zPu3r3nzr7v2Q-WBc~jk8tSxRWGg4eYLkwW34h-RwhckXuiH6UCo6Q01SF6P4RAt9~YL4mIXOLmeahsjFQ-w0VHVuqsBQrsVJYoft7N-VXGgo-SRxKHBKX1eWEqYkV3hZJHslUxQvb0V1m3hEBuKHlj4gX5LcEHv-8wj90QlFujFUkRjJpMLqgsi3z-McQSOHNBc6fi3WqOWspiPzzUTQMqMswRPnkOMTlOIqNBoDO6oOrOIHR4CNtN6DZx9KjGTFSCQ__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", 9 | "certify_checkbox": false, 10 | "field_1_name": null, 11 | "field_2_country": null, 12 | "field_3_disregarded_entity_name": null, 13 | "field_4_checkbox_central_issue_bank": false, 14 | "field_4_checkbox_complex_trust": false, 15 | "field_4_checkbox_corporation": false, 16 | "field_4_checkbox_disregarded_entity": false, 17 | "field_4_checkbox_estate": false, 18 | "field_4_checkbox_foreign_government_controlled_entity": false, 19 | "field_4_checkbox_foreign_government_integral_part": false, 20 | "field_4_checkbox_grantor_trust": false, 21 | "field_4_checkbox_hybrid_no": false, 22 | "field_4_checkbox_hybrid_yes": false, 23 | "field_4_checkbox_international_organization": false, 24 | "field_4_checkbox_partnership": false, 25 | "field_4_checkbox_private_foundation": false, 26 | "field_4_checkbox_simple_trust": false, 27 | "field_4_checkbox_tax_exempt_organization": false, 28 | "field_5_checkbox_active_nffe": false, 29 | "field_5_checkbox_certain_investment_entities_that_do_not_maintain_financial_accounts": false, 30 | "field_5_checkbox_certified_deemed_compliant_ffi_low_value_accounts": false, 31 | "field_5_checkbox_certified_deemed_compliant_limited_life_debt_investment_entity": false, 32 | "field_5_checkbox_certified_deemed_compliant_nonregistering_local_bank": false, 33 | "field_5_checkbox_certified_deemed_compliant_sponsored_closely_held_investment_vehicle": false, 34 | "field_5_checkbox_direct_reporting_nffe": false, 35 | "field_5_checkbox_entity_wholly_owned_exempt": false, 36 | "field_5_checkbox_excepted_inter_affiliate_ffi": false, 37 | "field_5_checkbox_excepted_nonfiancial_entity_bankruptcy": false, 38 | "field_5_checkbox_excepted_nonfiancial_group_entity": false, 39 | "field_5_checkbox_excepted_nonfiancial_start_up": false, 40 | "field_5_checkbox_excepted_territory_nffe": false, 41 | "field_5_checkbox_exempt_retirement_plans": false, 42 | "field_5_checkbox_foreign_government": false, 43 | "field_5_checkbox_international_organization": false, 44 | "field_5_checkbox_nonparticipating_ffi": false, 45 | "field_5_checkbox_nonprofit": false, 46 | "field_5_checkbox_nonreporting_iga_ffi": false, 47 | "field_5_checkbox_not_financial_account": false, 48 | "field_5_checkbox_organization_501c": false, 49 | "field_5_checkbox_owner_documented_ffi": true, 50 | "field_5_checkbox_participating_ffi": false, 51 | "field_5_checkbox_passive_nffe": false, 52 | "field_5_checkbox_publicly_traded_nffe": false, 53 | "field_5_checkbox_registered_deemed_compliant_ffi": false, 54 | "field_5_checkbox_reporting_model_one_ffi": false, 55 | "field_5_checkbox_reporting_model_two_ffi": false, 56 | "field_5_checkbox_restricted_distributor": false, 57 | "field_5_checkbox_sponsored_direct_reporting_nffe": false, 58 | "field_5_checkbox_sponsored_ffi": false, 59 | "field_5_checkbox_territory_financial_institutions": false, 60 | "field_6_address": null, 61 | "field_6_city": null, 62 | "field_6_country": null, 63 | "field_7_mailing_city": null, 64 | "field_7_mailing_country": null, 65 | "field_7_mailing_street": null, 66 | "field_8_tin": null, 67 | "field_9a_giin": null, 68 | "field_9b_foreign_tin": null, 69 | "field_9c_checkbox_tin_not_required": false, 70 | "field_10_reference_number": null, 71 | "field_11_checkbox_branch_nonparticipating_ffi": false, 72 | "field_11_checkbox_participating_ffi": false, 73 | "field_11_checkbox_reporting_model_one_ffi": false, 74 | "field_11_checkbox_reporting_model_two_ffi": false, 75 | "field_11_checkbox_us_branch": false, 76 | "field_12_disregarded_entity_city": null, 77 | "field_12_disregarded_entity_country": null, 78 | "field_12_disregarded_entity_street": null, 79 | "field_13_disregarded_entity_giin": null, 80 | "field_14a_checkbox": false, 81 | "field_14a_resident_of": null, 82 | "field_14b_checkbox_active_trade_or_business_test": false, 83 | "field_14b_checkbox_benefit_items": false, 84 | "field_14b_checkbox_derivative_benefits_test": false, 85 | "field_14b_checkbox_favorable": false, 86 | "field_14b_checkbox_government": false, 87 | "field_14b_checkbox_no_lob_article_in_treaty": false, 88 | "field_14b_checkbox_other_tax_exempt": false, 89 | "field_14b_checkbox_other": false, 90 | "field_14b_checkbox_ownership_and_base_erosion_test": false, 91 | "field_14b_checkbox_publicly_traded_corporation": false, 92 | "field_14b_checkbox_subsidiary_of_publicly_traded_corporation": false, 93 | "field_14b_checkbox_tax_exempt_pension": false, 94 | "field_14b_other_article": null, 95 | "field_14c_checkbox_dividends": false, 96 | "field_15_special_rates_article": null, 97 | "field_15_special_rates_explanation": null, 98 | "field_15_special_rates_income_type": null, 99 | "field_15_special_rates_percentage": null, 100 | "field_16_name": null, 101 | "field_17a_checkbox": false, 102 | "field_17b_checkbox": false, 103 | "field_18_checkbox": false, 104 | "field_19_checkbox": false, 105 | "field_20_name": null, 106 | "field_21_checkbox": false, 107 | "field_22_checkbox": false, 108 | "field_23_checkbox": false, 109 | "field_24a_checkbox": false, 110 | "field_24b_checkbox": false, 111 | "field_24c_checkbox": false, 112 | "field_24d_checkbox": false, 113 | "field_25a_checkbox": false, 114 | "field_25b_checkbox": false, 115 | "field_25c_checkbox": false, 116 | "field_26_checkbox_model_one": false, 117 | "field_26_checkbox_model_two": false, 118 | "field_26_checkbox_trustee_foreign": false, 119 | "field_26_checkbox_trustee_us": false, 120 | "field_26_checkbox": false, 121 | "field_26_country": null, 122 | "field_26_treated_as": null, 123 | "field_26_trustee_name": null, 124 | "field_27_checkbox": false, 125 | "field_28a_checkbox": false, 126 | "field_28b_checkbox": false, 127 | "field_29a_checkbox": false, 128 | "field_29b_checkbox": false, 129 | "field_29c_checkbox": false, 130 | "field_29d_checkbox": false, 131 | "field_29e_checkbox": false, 132 | "field_29f_checkbox": false, 133 | "field_30_checkbox": false, 134 | "field_31_checkbox": false, 135 | "field_32_checkbox": false, 136 | "field_33_checkbox": false, 137 | "field_33_date": null, 138 | "field_34_checkbox": false, 139 | "field_34_date": null, 140 | "field_35_checkbox": false, 141 | "field_35_date": null, 142 | "field_36_checkbox": false, 143 | "field_37a_checkbox": false, 144 | "field_37a_name": null, 145 | "field_37b_checkbox": false, 146 | "field_37b_market_name": null, 147 | "field_37b_name": null, 148 | "field_38_checkbox": false, 149 | "field_39_checkbox": false, 150 | "field_40a_checkbox": false, 151 | "field_40b_checkbox": false, 152 | "field_40c_checkbox": false, 153 | "field_41_checkbox": false, 154 | "field_42_name": null, 155 | "field_43_checkbox": false, 156 | "passive_nffe_owners": [], 157 | "signature_date": null, 158 | "signature_name": null, 159 | "signed": true 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /mocks/processW9.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "pdf_url": "https://scdn.veryfi.com/w9s/919ba4778c039560/e271665d-f447-4623-a454-866d741842ef/c6b0e692-eee8-4f33-8e42-3f9f700066f1.pdf?Expires=1730235061&Signature=De-VFGdPrkIOflL3CR2ur8bJgocDjLUTMa53y~0lj46k93fQjNkqZ8X-sZ4BfipWo3G1CYh1KDTAuJ5jSlaBXGp~Nbhs5knP3IASgEXckseA-W-AqSzh3YCnsHqIfhYQ4yV~JCTms~PBjtODW9IAe7E9~y1zPf5wiCguu312yHovSb4j0GgnnhOD1KibVu9z1Cqp92bao-kIuxpLyyTQUQJLEdrALO0x6vOLiwGaPx5KU4J9x67YFJbRGMNYZ8L2w4AXWYPLrud1uYNk~deX8CJy~Nzsn-~ktarz2b9MgYvwTA8z3JMTfJZA4HQBWonnRt7XZVhYheXGY4Ixjo5cdw__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", 4 | "id": 4662722, 5 | "external_id": null, 6 | "created_date": "2024-10-29 20:36:01", 7 | "updated_date": "2024-10-29 20:36:01", 8 | "img_thumbnail_url": "https://scdn.veryfi.com/w9s/919ba4778c039560/e271665d-f447-4623-a454-866d741842ef/thumbnail.jpeg?Expires=1730235061&Signature=Y36A4tKeGGQj-gBVgHukyJXc4jsr8FJSDov3fGbEgHENT6q7Kg~ktfmwQ1fE8cOhY6IexoZG3SD46jjanF1QzGgql3AnbgTRikdv4MjqKKS7HRpGpq-zUhHCEcQFei-an9zUBH7uKNjQ7L4r9QUI0VuP7xcU4imjyA-2aGbWeeyXX8f7kXeeFIOfG6cnGOtAjChXWyl2xKlk9I2NBxnQMRE4kd5JVIkEKy~U5aB9gdppaMDns0gA~j0zD57ZT-AwmL2UbLAK4rH2kDcs-1zIAFwgM0BE58Ek-f9wHnx~8Yslc0uqW4JlfAhzkV4ODr~5KSgthYDrKkgXu9qI7BndfA__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ", 9 | "text": "Form\tW-9\t\t\t\tRequest for Taxpayer\t\t\t\tGive Form to the\n(Rev. October 2018)\t\tIdentification Number and Certification\t\trequester. Do not\nDepartment of the Treasury\t\t\t\t\t\t\t\t\t\t\t\tsend to the IRS.\nInternal Revenue Service\t\t► Go to www.irs.gov/FormW9 for instructions and the latest information.\n1 Name (as shown on your income tax return). Name is required on this line; do not leave this line blank.\nVeryfi, Inc.\n2 Business name/disregarded entity name, if different from above\n\n3 Check appropriate box for federal tax classification of the person whose name is entered on line 1. Check only one of the\t4 Exemptions (codes apply only to\nfollowing seven boxes.\t\t\t\t\t\t\t\t\t\tcertain entities, not individuals; see\n\tinstructions on page 3):\n☐ Individual/sole proprietor or\t☐ C Corporation ✓ S Corporation\t☐ Partnership\t☐\tTrust/estate\nsingle-member LLC\t\t\t\t\t\t\t\t\t\tExempt payee code (if any)\n☐\tLimited liability company. Enter the tax classification (C=C corporation, S-S corporation, P=Partnership) ►\nNote: Check the appropriate box in the line above for the tax classification of the single-member owner. Do not check\tExemption from FATCA reporting\nLLC if the LLC is classified as a single-member LLC that is disregarded from the owner unless the owner of the LLC is\nanother LLC that is not disregarded from the owner for U.S. federal tax purposes. Otherwise, a single-member LLC that code\tany)\nis disregarded from the owner should check the appropriate box for the tax classification of its owner.\n☐\tOther (see instructions) ►\t\t\t\t\t\t\t\t\t\t(Applies to accounts maintained outside the U.S.)\n5 Address (number, street, and apt. or suite no.) See instructions.\t\t\t\tRequester's name and address (optional)\n28 E 3rd Ave, Suite 201\t\t\t\t\t\t\tAcMe Corporation 1010 Elm Str,\n6 City, state, and ZIP code\t\t\t\t\t\t\t\tMountain View, CA 94043\nSan Mateo, California, 94401\n7 List account number(s) here (optional)\n\nPart I\tTaxpayer Identification Number (TIN)\nEnter your TIN in the appropriate box. The TIN provided must match the name given on line 1 to avoid\tSocial security number\nbackup withholding. For individuals, this is generally your social security number (SSN). However, for a\nresident alien, sole proprietor, or disregarded entity, see the instructions for Part I, later. For other\nentities, it is your employer identification number (EIN). If you do not have a number, see How to get a\nTIN, later.\t\t\t\t\t\t\t\t\t\t\tor\nNote: If the account is in more than one name, see the instructions for line 1. Also see What Name and\tEmployer identification number\nNumber To Give the Requester for guidelines on whose number to enter.\t\t\t\t45\n\nPart II\tCertification\nUnder penalties of perjury, I certify that:\n1. The number shown on this form is my correct taxpayer identification number (or I am waiting for a number to be issued to me); and\n2. I am not subject to backup withholding because: (a) I am exempt from backup withholding, or (b) I have not been notified by the Internal Revenue\nService (IRS) that I am subject to backup withholding as a result of a failure to report all interest or dividends, or (c) the IRS has notified me that I am\nno longer subject to backup withholding; and\n3. I am a U.S. citizen or other U.S. person (defined below); and\n4. The FATCA code(s) entered on this form (if any) indicating that I am exempt from FATCA reporting is correct.\nCertification instructions. You must cross out item 2 above if you have been notified by the IRS that you are currently subject to backup withholding because\nyou have failed to report all interest and dividends on your tax return. For real estate transactions, item 2 does not apply. For mortgage interest paid,\nacquisition or abandonment of secured property, cancellation of debt, contributions to an individual retirement arrangement (IRA), and generally, payments\nother than interest and dividends, you are not required to sign the certification, but you must provide your correct TIN. See the instructions for Part II, later.\nSign\tSignature of\nHere\tU.S. person\t\t\t\t\t\t\t\t\tDate▸ June 19, 2020\nGeneral Instructions\t\t\t\t• Form 1099-DIV (dividends, including those from stocks or mutual\n\tfunds)\nSection references are to the Internal Revenue Code unless otherwise\t• Form 1099-MISC (various types of income, prizes, awards, or gross\nnoted.\t\t\t\t\t\t\t\tproceeds)\nFuture developments. For the latest information about developments\t• Form 1099-B (stock or mutual fund sales and certain other\nrelated to Form W-9 and its instructions, such as legislation enacted\ttransactions by brokers)\nafter they were published, go to www.irs.gov/FormW9.\n\tForm 1099-S (proceeds from real estate transactions)\nPurpose of Form\t\t\t\t\t\t• Form 1099-K (merchant card and third party network transactions)\nAn individual or entity (Form W-9 requester) who is required to file an\t• Form 1098 (home mortgage interest), 1098-E (student loan interest),\ninformation return with the IRS must obtain your correct taxpayer\t1098-T (tuition)\nidentification number (TIN) which may be your social security number\tForm 1099-C (canceled debt)\n(SSN), individual taxpayer identification number (ITIN), adoption\n\t• Form 1099-A (acquisition or abandonment of secured property)\ntaxpayer identification number (ATIN), or employer identification number\n(EIN), to report on an information return the amount paid to you, or other\tUse Form W-9 only if you are a U.S. person (including a resident\namount reportable on an information return. Examples of information\talien), to provide your correct TIN.\nreturns include, but are not limited to, the following.\t\t\tIf you do not return Form W-9 to the requester with a TIN, you might\n⚫Form 1099-INT (interest earned or paid)\t\t\t\tbe subject to backup withholding. See What is backup withholding,\n\tlater.\n\nCat. No. 10231X\t\t\t\t\t\tForm W-9 (Rev. 10-2018)\n\t(if\nPrint or type.\nSee Specific Instructions on page 3.", 10 | "account_numbers": null, 11 | "address1": "28 E 3rd Ave, Suite 201", 12 | "address2": "San Mateo, California, 94401", 13 | "parsed_address": {}, 14 | "business_name": null, 15 | "c_corp": false, 16 | "ein": "45-2604821", 17 | "exempt_payee_code": null, 18 | "exemption": null, 19 | "individual": false, 20 | "llc": false, 21 | "llc_type": null, 22 | "name": "Veryfi, Inc.", 23 | "other_description": null, 24 | "other": false, 25 | "partnership": false, 26 | "requester": "AcMe Corporation 1010 Elm Str,\nMountain View, CA 94043", 27 | "s_corp": true, 28 | "signature_date": "2020-06-19", 29 | "signature": true, 30 | "ssn": "to_ocr", 31 | "trust_estate": false, 32 | "3b_foreign": null 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@veryfi/veryfi-sdk", 3 | "version": "1.4.5", 4 | "description": "Node.js module for communicating with the Veryfi OCR API", 5 | "main": "lib/client/client.js", 6 | "typings": "lib/types/Client.ts", 7 | "scripts": { 8 | "test": "jest", 9 | "doc": "jsdoc -d docs --configure jsconf.json main.js", 10 | "generate-docs": "jsdoc --configure jsdoc.json --verbose", 11 | "postpublish": "npm run publish-npm", 12 | "publish-npm": "npm publish --access public --ignore-scripts --@veryfi:registry='https://registry.npmjs.org'" 13 | }, 14 | "author": "Veryfi (https://www.veryfi.com)", 15 | "homepage": "https://veryfi.github.io/veryfi-nodejs/", 16 | "contributors": [ 17 | "Matthew Eng ", 18 | "Alejandro Uribe " 19 | ], 20 | "license": "MIT", 21 | "files": [ 22 | "lib", 23 | "lib/types" 24 | ], 25 | "directories": { 26 | "lib": "lib", 27 | "test": "test" 28 | }, 29 | "devDependencies": { 30 | "jest": "^29.0.0", 31 | "jsdoc": "^4.0.3", 32 | "minami": "^1.2.3", 33 | "ts-jest": "^29.0.1", 34 | "typescript": "^4.8.3" 35 | }, 36 | "dependencies": { 37 | "@jest/globals": "^29.0.3", 38 | "axios": "^1.8.2", 39 | "docdash": "^1.2.0", 40 | "form-data": "^4.0.0", 41 | "jest-config": "^29.0.3" 42 | }, 43 | "repository": { 44 | "type": "git", 45 | "url": "git+https://github.com/veryfi/veryfi-nodejs.git" 46 | }, 47 | "keywords": [ 48 | "nodejs", 49 | "api", 50 | "ocr", 51 | "receipt", 52 | "invoice", 53 | "sdk-nodejs", 54 | "veryfi", 55 | "veryfi-api" 56 | ], 57 | "bugs": { 58 | "url": "https://github.com/veryfi/veryfi-nodejs/issues" 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /resources/bankstatement.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/resources/bankstatement.pdf -------------------------------------------------------------------------------- /resources/business_card.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/resources/business_card.jpg -------------------------------------------------------------------------------- /resources/check.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/resources/check.pdf -------------------------------------------------------------------------------- /resources/driver_license.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/resources/driver_license.png -------------------------------------------------------------------------------- /resources/receipt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/resources/receipt.png -------------------------------------------------------------------------------- /resources/w2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/resources/w2.png -------------------------------------------------------------------------------- /resources/w8bene.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/resources/w8bene.pdf -------------------------------------------------------------------------------- /resources/w9.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/veryfi/veryfi-nodejs/e3d72a05aa74a1a6921af46f672ea84502279186/resources/w9.pdf -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { "compilerOptions": { 2 | "esModuleInterop": true} 3 | } 4 | --------------------------------------------------------------------------------