@veryfi/veryfi-sdk 1.3.1 → 1.4.0
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.
- package/README.md +443 -145
- package/lib/anydocs/deleteAnyDocument.js +12 -0
- package/lib/anydocs/getAnyDocument.js +22 -0
- package/lib/anydocs/getAnyDocuments.js +30 -0
- package/lib/anydocs/processAnyDocument.js +33 -0
- package/lib/anydocs/processAnyDocumentBase64.js +31 -0
- package/lib/anydocs/processAnyDocumentStream.js +33 -0
- package/lib/anydocs/processAnyDocumentUrl.js +30 -0
- package/lib/bankstatements/deleteBankStatement.js +12 -0
- package/lib/bankstatements/getBankStatement.js +24 -0
- package/lib/bankstatements/getBankStatements.js +28 -0
- package/lib/bankstatements/processBankStatement.js +33 -0
- package/lib/bankstatements/processBankStatementBase64.js +31 -0
- package/lib/bankstatements/processBankStatementStream.js +31 -0
- package/lib/bankstatements/processBankStatementUrl.js +30 -0
- package/lib/businesscards/deleteBusinessCard.js +12 -0
- package/lib/businesscards/getBusinessCard.js +24 -0
- package/lib/businesscards/getBusinessCards.js +28 -0
- package/lib/businesscards/processBusinessCard.js +27 -0
- package/lib/businesscards/processBusinessCardBase64.js +25 -0
- package/lib/businesscards/processBusinessCardStream.js +25 -0
- package/lib/businesscards/processBusinessCardUrl.js +24 -0
- package/lib/checks/deleteCheck.js +12 -0
- package/lib/checks/getCheck.js +24 -0
- package/lib/checks/getChecks.js +28 -0
- package/lib/checks/processCheck.js +33 -0
- package/lib/checks/processCheckBase64.js +31 -0
- package/lib/checks/processCheckStream.js +31 -0
- package/lib/checks/processCheckUrl.js +30 -0
- package/lib/client/client.js +63 -0
- package/lib/client/constructor.js +27 -0
- package/lib/client/function.js +6 -0
- package/lib/client/generateSignature.js +26 -0
- package/lib/client/getHeaders.js +21 -0
- package/lib/client/getUrl.js +9 -0
- package/lib/client/request.js +58 -0
- package/lib/documents/deleteDocument.js +12 -0
- package/lib/documents/getDocument.js +14 -0
- package/lib/documents/getDocuments.js +31 -0
- package/lib/documents/processDocument.js +37 -0
- package/lib/documents/processDocumentBase64.js +37 -0
- package/lib/documents/processDocumentStream.js +33 -0
- package/lib/documents/processDocumentUrl.js +41 -0
- package/lib/documents/tags/addTag.js +14 -0
- package/lib/documents/tags/addTags.js +14 -0
- package/lib/documents/tags/deleteTags.js +12 -0
- package/lib/documents/tags/replaceTags.js +14 -0
- package/lib/documents/updateDocument.js +17 -0
- package/lib/types/BillTo.ts +11 -0
- package/lib/types/BoundingElement.ts +6 -0
- package/lib/types/Client.ts +1058 -0
- package/lib/types/LineItem.ts +24 -0
- package/lib/types/Payment.ts +8 -0
- package/lib/types/ShipTo.ts +7 -0
- package/lib/types/Tag.ts +4 -0
- package/lib/types/TaxLine.ts +9 -0
- package/lib/types/Vendor.ts +15 -0
- package/lib/types/VeryfiDocument.ts +93 -0
- package/lib/types/VeryfiExtraArgs.ts +9 -0
- package/lib/w2s/deleteW2.js +12 -0
- package/lib/w2s/getW2.js +17 -0
- package/lib/w2s/getW2s.js +13 -0
- package/lib/w2s/processW2.js +28 -0
- package/lib/w2s/processW2Base64.js +30 -0
- package/lib/w2s/processW2Stream.js +30 -0
- package/lib/w2s/processW2Url.js +32 -0
- package/lib/w8bene/deleteW8BENE.js +12 -0
- package/lib/w8bene/getW8BENE.js +24 -0
- package/lib/w8bene/getW8BENEs.js +28 -0
- package/lib/w8bene/processW8BENE.js +33 -0
- package/lib/w8bene/processW8BENEBase64.js +31 -0
- package/lib/w8bene/processW8BENEStream.js +31 -0
- package/lib/w8bene/processW8BENEUrl.js +30 -0
- package/lib/w9s/deleteW9.js +12 -0
- package/lib/w9s/getW9.js +24 -0
- package/lib/w9s/getW9s.js +28 -0
- package/lib/w9s/processW9.js +30 -0
- package/lib/w9s/processW9Base64.js +31 -0
- package/lib/w9s/processW9Stream.js +31 -0
- package/lib/w9s/processW9Url.js +27 -0
- package/package.json +4 -4
- package/lib/main.js +0 -569
- package/lib/types/main.d.ts +0 -413
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {BoundingElement} from "./BoundingElement";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export declare type LineItem = {
|
|
5
|
+
date?: null | string | BoundingElement;
|
|
6
|
+
description?: null | string | BoundingElement;
|
|
7
|
+
discount?: null | number | BoundingElement;
|
|
8
|
+
end_date?: null | string | BoundingElement;
|
|
9
|
+
hsn?: null | string;
|
|
10
|
+
id?: null | number;
|
|
11
|
+
order?: null | number;
|
|
12
|
+
price?: null | number | BoundingElement;
|
|
13
|
+
quantity?: null | number | BoundingElement;
|
|
14
|
+
reference?: null | string | BoundingElement;
|
|
15
|
+
section?: null | string;
|
|
16
|
+
sku?: null | string | BoundingElement;
|
|
17
|
+
start_date?: null | string;
|
|
18
|
+
tags?: null | null[];
|
|
19
|
+
tax?: null | number | BoundingElement;
|
|
20
|
+
tax_rate?: null | number;
|
|
21
|
+
total?: null | number | BoundingElement;
|
|
22
|
+
type?: null | string;
|
|
23
|
+
unit_of_measure?: null | string;
|
|
24
|
+
};
|
package/lib/types/Tag.ts
ADDED
|
@@ -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,15 @@
|
|
|
1
|
+
import {BoundingElement} from "./BoundingElement";
|
|
2
|
+
|
|
3
|
+
export declare type Vendor = {
|
|
4
|
+
address?: null | string | BoundingElement;
|
|
5
|
+
category?: null | string | BoundingElement;
|
|
6
|
+
email?: null | string | BoundingElement;
|
|
7
|
+
fax_number?: null | string | BoundingElement;
|
|
8
|
+
name?: null | string | BoundingElement;
|
|
9
|
+
phone_number?: null | string | BoundingElement;
|
|
10
|
+
raw_name?: null | string;
|
|
11
|
+
vendor_logo?: null | string | BoundingElement;
|
|
12
|
+
vendor_reg_number?: null | string | BoundingElement;
|
|
13
|
+
vendor_type?: null | string;
|
|
14
|
+
web?: null | string | BoundingElement;
|
|
15
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
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 | string[] | BoundingElement[];
|
|
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
|
+
license_plate_number?: null | string | BoundingElement;
|
|
55
|
+
line_items?: null | LineItem[];
|
|
56
|
+
line_items_with_scores?: null | LineItem[];
|
|
57
|
+
notes?: null | string;
|
|
58
|
+
ocr_text?: null | string;
|
|
59
|
+
order_date?: null | string | BoundingElement;
|
|
60
|
+
payment?: null | Payment;
|
|
61
|
+
pdf_url?: null | string;
|
|
62
|
+
previous_balance?: null | number | BoundingElement;
|
|
63
|
+
purchase_order_number?: null | string | BoundingElement;
|
|
64
|
+
rounding?: null | number | BoundingElement;
|
|
65
|
+
server_name?: null | string | BoundingElement;
|
|
66
|
+
service_end_date?: null | string;
|
|
67
|
+
service_start_date?: null | string;
|
|
68
|
+
ship_date?: null | string | BoundingElement;
|
|
69
|
+
ship_to?: null | ShipTo;
|
|
70
|
+
shipping?: null | number | BoundingElement;
|
|
71
|
+
status?: null | string;
|
|
72
|
+
store_number?: null | string | BoundingElement;
|
|
73
|
+
subtotal?: null | number | BoundingElement;
|
|
74
|
+
tags?: null | Tag[];
|
|
75
|
+
tax?: null | number | BoundingElement;
|
|
76
|
+
tax_lines?: null | TaxLine[];
|
|
77
|
+
tip?: null | number | BoundingElement;
|
|
78
|
+
total?: null | number | BoundingElement;
|
|
79
|
+
total_pages?: null | number;
|
|
80
|
+
total_quantity?: null | string | BoundingElement;
|
|
81
|
+
total_weight?: null | string | BoundingElement;
|
|
82
|
+
tracking_number?: null | string | BoundingElement;
|
|
83
|
+
tracking_numbers?: null | BoundingElement[];
|
|
84
|
+
updated_date?: null | string;
|
|
85
|
+
vending_person?: null | string | BoundingElement;
|
|
86
|
+
vending_person_number?: null | string | BoundingElement;
|
|
87
|
+
vat_number?: null | string;
|
|
88
|
+
vendor?: null | Vendor;
|
|
89
|
+
vendors?: null | BoundingElement[];
|
|
90
|
+
vin_number?: null | string | BoundingElement;
|
|
91
|
+
warnings?: null | string[];
|
|
92
|
+
weights?: null | BoundingElement[];
|
|
93
|
+
};
|
|
@@ -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
|
+
}
|
package/lib/w2s/getW2.js
ADDED
|
@@ -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
|
+
}
|
package/lib/w9s/getW9.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
}
|