@veryfi/veryfi-sdk 1.3.2 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/README.md +443 -145
  2. package/lib/anydocs/deleteAnyDocument.js +12 -0
  3. package/lib/anydocs/getAnyDocument.js +22 -0
  4. package/lib/anydocs/getAnyDocuments.js +30 -0
  5. package/lib/anydocs/processAnyDocument.js +33 -0
  6. package/lib/anydocs/processAnyDocumentBase64.js +31 -0
  7. package/lib/anydocs/processAnyDocumentStream.js +33 -0
  8. package/lib/anydocs/processAnyDocumentUrl.js +30 -0
  9. package/lib/bankstatements/deleteBankStatement.js +12 -0
  10. package/lib/bankstatements/getBankStatement.js +24 -0
  11. package/lib/bankstatements/getBankStatements.js +28 -0
  12. package/lib/bankstatements/processBankStatement.js +33 -0
  13. package/lib/bankstatements/processBankStatementBase64.js +31 -0
  14. package/lib/bankstatements/processBankStatementStream.js +31 -0
  15. package/lib/bankstatements/processBankStatementUrl.js +30 -0
  16. package/lib/businesscards/deleteBusinessCard.js +12 -0
  17. package/lib/businesscards/getBusinessCard.js +24 -0
  18. package/lib/businesscards/getBusinessCards.js +28 -0
  19. package/lib/businesscards/processBusinessCard.js +27 -0
  20. package/lib/businesscards/processBusinessCardBase64.js +25 -0
  21. package/lib/businesscards/processBusinessCardStream.js +25 -0
  22. package/lib/businesscards/processBusinessCardUrl.js +24 -0
  23. package/lib/checks/deleteCheck.js +12 -0
  24. package/lib/checks/getCheck.js +24 -0
  25. package/lib/checks/getChecks.js +28 -0
  26. package/lib/checks/processCheck.js +33 -0
  27. package/lib/checks/processCheckBase64.js +31 -0
  28. package/lib/checks/processCheckStream.js +31 -0
  29. package/lib/checks/processCheckUrl.js +30 -0
  30. package/lib/client/client.js +63 -0
  31. package/lib/client/constructor.js +27 -0
  32. package/lib/client/function.js +6 -0
  33. package/lib/client/generateSignature.js +26 -0
  34. package/lib/client/getHeaders.js +21 -0
  35. package/lib/client/getUrl.js +9 -0
  36. package/lib/client/request.js +58 -0
  37. package/lib/documents/deleteDocument.js +12 -0
  38. package/lib/documents/getDocument.js +14 -0
  39. package/lib/documents/getDocuments.js +31 -0
  40. package/lib/documents/processDocument.js +37 -0
  41. package/lib/documents/processDocumentBase64.js +37 -0
  42. package/lib/documents/processDocumentStream.js +33 -0
  43. package/lib/documents/processDocumentUrl.js +41 -0
  44. package/lib/documents/tags/addTag.js +14 -0
  45. package/lib/documents/tags/addTags.js +14 -0
  46. package/lib/documents/tags/deleteTags.js +12 -0
  47. package/lib/documents/tags/replaceTags.js +14 -0
  48. package/lib/documents/updateDocument.js +17 -0
  49. package/lib/types/BillTo.ts +11 -0
  50. package/lib/types/BoundingElement.ts +6 -0
  51. package/lib/types/Client.ts +1058 -0
  52. package/lib/types/LineItem.ts +39 -0
  53. package/lib/types/Payment.ts +8 -0
  54. package/lib/types/ShipTo.ts +7 -0
  55. package/lib/types/Tag.ts +4 -0
  56. package/lib/types/TaxLine.ts +9 -0
  57. package/lib/types/Vendor.ts +35 -0
  58. package/lib/types/VeryfiDocument.ts +151 -0
  59. package/lib/types/VeryfiExtraArgs.ts +9 -0
  60. package/lib/w2s/deleteW2.js +12 -0
  61. package/lib/w2s/getW2.js +17 -0
  62. package/lib/w2s/getW2s.js +13 -0
  63. package/lib/w2s/processW2.js +28 -0
  64. package/lib/w2s/processW2Base64.js +30 -0
  65. package/lib/w2s/processW2Stream.js +30 -0
  66. package/lib/w2s/processW2Url.js +32 -0
  67. package/lib/w8bene/deleteW8BENE.js +12 -0
  68. package/lib/w8bene/getW8BENE.js +24 -0
  69. package/lib/w8bene/getW8BENEs.js +28 -0
  70. package/lib/w8bene/processW8BENE.js +33 -0
  71. package/lib/w8bene/processW8BENEBase64.js +31 -0
  72. package/lib/w8bene/processW8BENEStream.js +31 -0
  73. package/lib/w8bene/processW8BENEUrl.js +30 -0
  74. package/lib/w9s/deleteW9.js +12 -0
  75. package/lib/w9s/getW9.js +24 -0
  76. package/lib/w9s/getW9s.js +28 -0
  77. package/lib/w9s/processW9.js +30 -0
  78. package/lib/w9s/processW9Base64.js +31 -0
  79. package/lib/w9s/processW9Stream.js +31 -0
  80. package/lib/w9s/processW9Url.js +27 -0
  81. package/package.json +4 -4
  82. package/lib/main.js +0 -783
  83. package/lib/types/main.d.ts +0 -541
@@ -0,0 +1,39 @@
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<string, unknown>;
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
+ };
@@ -0,0 +1,8 @@
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
+ };
@@ -0,0 +1,7 @@
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 | string;
7
+ };
@@ -0,0 +1,4 @@
1
+ export declare type Tag = {
2
+ id?: null | number;
3
+ name?: null | string;
4
+ };
@@ -0,0 +1,9 @@
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
+ };
@@ -0,0 +1,35 @@
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<null | Record<string, unknown>>;
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<null | string>;
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<string, unknown>;
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
+ };
@@ -0,0 +1,151 @@
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<string, unknown>;
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
+ };
@@ -0,0 +1,9 @@
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<string, any>;
@@ -0,0 +1,12 @@
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
+ }
@@ -0,0 +1,17 @@
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
+ }
@@ -0,0 +1,13 @@
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
+ }
@@ -0,0 +1,28 @@
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
+ }
@@ -0,0 +1,30 @@
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
+ }
@@ -0,0 +1,30 @@
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 {fs.ReadStream} 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
+ }
@@ -0,0 +1,32 @@
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
+ }
@@ -0,0 +1,12 @@
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
+ }
@@ -0,0 +1,24 @@
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
+ }
@@ -0,0 +1,28 @@
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
+ }
@@ -0,0 +1,33 @@
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
+ }
@@ -0,0 +1,31 @@
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
+ }
@@ -0,0 +1,31 @@
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 {fs.ReadStream} 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
+ }
@@ -0,0 +1,30 @@
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
+ }
@@ -0,0 +1,12 @@
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
+ }