@veryfi/veryfi-sdk 1.1.1 → 1.1.4

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.
@@ -0,0 +1,255 @@
1
+ {
2
+ "abn_number":"",
3
+ "account_number":"",
4
+ "barcodes":[
5
+
6
+ ],
7
+ "bill_to_address":"",
8
+ "bill_to_name":"",
9
+ "card_number":"",
10
+ "category":"Meals",
11
+ "created":"2021-07-12 01:00:59",
12
+ "currency_code":"COP",
13
+ "date":"2020-01-07 11:19:53",
14
+ "delivery_date":"",
15
+ "discount":0.0,
16
+ "document_title":"",
17
+ "document_type":"receipt",
18
+ "due_date":"",
19
+ "external_id":"",
20
+ "id":37769250,
21
+ "img_file_name":"c5d8edc4-189b-4da7-b702-1eb65ab8cb3f.jpg",
22
+ "img_thumbnail_url":"https://scdn.veryfi.com/receipts/c5d8edc4-189b-4da7-b702-1eb65ab8cb3f_t.jpg?Expires=1626052560&Signature=b4n3sN0fyVaYHAY3BUXAyvOSWUcgmcDoqQHsahUu8gnLzR1tek1CERIYF7VeOmxS1kFyCf92HPVotyyS3pU1quhuVnXcExQfMykDq1fgMWxCIWnZYMqglQKp3Ut0OfNUSGlwjjVeovWwTotuN1lr~mMjMJoykaOMxN~v9DM8sXD9qO231YON7tCfkR-RSg362zCa~iJSeSSRGYHmFizhxvNza0LvfB1kVPdQRFssByo3C1hiaZ9oOkfg199Z0McZoDruaY0zhfhoOMl1A08J4Q4WSH90NEu-xuGVn0SdYNIZvdueoR~~fon4PED2kIB5I8yCKJFUPks5J3T3oy7rYQ__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ",
23
+ "img_url":"https://scdn.veryfi.com/receipts/c5d8edc4-189b-4da7-b702-1eb65ab8cb3f.jpg?Expires=1626052560&Signature=Ozt1qulJtk3TInOrWk~F-d8-hCx9PU7g780T96MnnR1ufZ9qcy7BotklwinSzcEW-RhcJ46v7HNZhh1upAzFMr0DNfjR3JjNCLcuVfSGmMs6z91S5voMDEJa4Ls2AlE9VmUNs1NzNe8lpRYIxSXADote0rsKXCV5GzGDPc17C-qoGm3uQFCfW7FHN-Rs6zsQAH2rcmxbxRv5dOseVlgDINDTt1~zv-ZJdZ8Yl7wn8MQPBNp4txZJ7l1eYiPk35rSMvKZ1LeixxioXyCJaNv7rmG9y5N2j1ZNGvmqH9gIBMwlcFm-bJcFLvpV5zU2UpDdBIVJ2ILwMkI~auEBxC4qnQ__&Key-Pair-Id=APKAJCILBXEJFZF4DCHQ",
24
+ "incoterms":"",
25
+ "insurance":"",
26
+ "invoice_number":"206136",
27
+ "is_document":1,
28
+ "is_money_in":0,
29
+ "line_items":[
30
+ {
31
+ "date":"",
32
+ "description":"DETERGENTE FAB\nG",
33
+ "discount":0.0,
34
+ "id":70455283,
35
+ "order":0,
36
+ "price":0.0,
37
+ "quantity":1.0,
38
+ "reference":"",
39
+ "section":"",
40
+ "sku":"004967",
41
+ "tax":0.0,
42
+ "tax_rate":0.0,
43
+ "total":6200.0,
44
+ "type":"product",
45
+ "unit_of_measure":"",
46
+ "weight":""
47
+ },
48
+ {
49
+ "date":"",
50
+ "description":"FILETE PECHUGA",
51
+ "discount":0.0,
52
+ "id":70455284,
53
+ "order":1,
54
+ "price":0.0,
55
+ "quantity":1.0,
56
+ "reference":"",
57
+ "section":"",
58
+ "sku":"004573",
59
+ "tax":0.0,
60
+ "tax_rate":0.0,
61
+ "total":19900.0,
62
+ "type":"food",
63
+ "unit_of_measure":"",
64
+ "weight":""
65
+ },
66
+ {
67
+ "date":"",
68
+ "description":"BROCOLI KILO",
69
+ "discount":0.0,
70
+ "id":70455285,
71
+ "order":2,
72
+ "price":48.0,
73
+ "quantity":1.0,
74
+ "reference":"",
75
+ "section":"",
76
+ "sku":"005015",
77
+ "tax":0.0,
78
+ "tax_rate":0.0,
79
+ "total":2328.0,
80
+ "type":"food",
81
+ "unit_of_measure":"",
82
+ "weight":""
83
+ },
84
+ {
85
+ "date":"",
86
+ "description":"CEBOLLA DE HUEVO",
87
+ "discount":0.0,
88
+ "id":70455286,
89
+ "order":3,
90
+ "price":0.0,
91
+ "quantity":1.0,
92
+ "reference":"",
93
+ "section":"",
94
+ "sku":"005021",
95
+ "tax":0.0,
96
+ "tax_rate":0.0,
97
+ "total":880.0,
98
+ "type":"food",
99
+ "unit_of_measure":"",
100
+ "weight":""
101
+ },
102
+ {
103
+ "date":"",
104
+ "description":"ZANAHORIA KILO",
105
+ "discount":0.0,
106
+ "id":70455287,
107
+ "order":4,
108
+ "price":0.0,
109
+ "quantity":1.0,
110
+ "reference":"",
111
+ "section":"",
112
+ "sku":"005107",
113
+ "tax":0.0,
114
+ "tax_rate":0.0,
115
+ "total":1320.0,
116
+ "type":"food",
117
+ "unit_of_measure":"",
118
+ "weight":""
119
+ },
120
+ {
121
+ "date":"",
122
+ "description":"PAPA CAPIRA X",
123
+ "discount":0.0,
124
+ "id":70455288,
125
+ "order":5,
126
+ "price":0.0,
127
+ "quantity":1.0,
128
+ "reference":"",
129
+ "section":"",
130
+ "sku":"004736",
131
+ "tax":0.0,
132
+ "tax_rate":0.0,
133
+ "total":1935.0,
134
+ "type":"food",
135
+ "unit_of_measure":"",
136
+ "weight":""
137
+ },
138
+ {
139
+ "date":"",
140
+ "description":"BOLSA DE",
141
+ "discount":0.0,
142
+ "id":70455289,
143
+ "order":6,
144
+ "price":0.0,
145
+ "quantity":1.0,
146
+ "reference":"",
147
+ "section":"",
148
+ "sku":"005157",
149
+ "tax":0.0,
150
+ "tax_rate":0.0,
151
+ "total":500.0,
152
+ "type":"product",
153
+ "unit_of_measure":"",
154
+ "weight":""
155
+ },
156
+ {
157
+ "date":"",
158
+ "description":"BOLSAS/EMPAQUES",
159
+ "discount":0.0,
160
+ "id":70455290,
161
+ "order":7,
162
+ "price":0.0,
163
+ "quantity":1.0,
164
+ "reference":"",
165
+ "section":"",
166
+ "sku":"008777",
167
+ "tax":0.0,
168
+ "tax_rate":0.0,
169
+ "total":50.0,
170
+ "type":"product",
171
+ "unit_of_measure":"",
172
+ "weight":""
173
+ },
174
+ {
175
+ "date":"",
176
+ "description":"INC Bolsa",
177
+ "discount":0.0,
178
+ "id":70455292,
179
+ "order":8,
180
+ "price":0.0,
181
+ "quantity":1.0,
182
+ "reference":"",
183
+ "section":"",
184
+ "sku":"",
185
+ "tax":0.0,
186
+ "tax_rate":0.0,
187
+ "total":50.0,
188
+ "type":"product",
189
+ "unit_of_measure":"",
190
+ "weight":""
191
+ },
192
+ {
193
+ "date":"",
194
+ "description":"Bolsa Pilstica",
195
+ "discount":0.0,
196
+ "id":70455293,
197
+ "order":9,
198
+ "price":0.0,
199
+ "quantity":1.0,
200
+ "reference":"",
201
+ "section":"",
202
+ "sku":"",
203
+ "tax":0.0,
204
+ "tax_rate":0.0,
205
+ "total":0.0,
206
+ "type":"product",
207
+ "unit_of_measure":"",
208
+ "weight":""
209
+ }
210
+ ],
211
+ "notes":"Note updated",
212
+ "ocr_text":"SUPERMERCADOS MERKAHORRO S.A.S.\nNIT :901150440-9\nRESPONSABLES DE IVA\n2892932-PBX 4806360\nCALLE 11 # 16-43\nFACTURA DE VENTA: C11 206136\nCODIGO DESCRIPCION\tCANT. VR.TOTAL\n004967 DETERGENTE FAB 1.00 6200 G\n004573 FILETE PECHUGA 1.00 19900 X\n005015 BROCOLI KILO\t0.48 2328 X\n005021 CEBOLLA DE HUEVO 0.40 880 X\n005107 ZANAHORIA KILO 0.66 1320 X\n004736 PAPA CAPIRA X\t1.08 1935 X\n005157 BOLSA DE\t1.00 500 X\n008777 BOLSAS/EMPAQUES 1.00 50 X\nINC Bolsa\t\t50\nSUBTOTAL\t33,113\nIMPUESTO\t50\nBASE\t32,073\nIVA\t990\nINC Bolsa Pilstica\t50\n>>>>> TOTAL\t33,113\nEFECTIVO\t50,100\nCAMBIO\t16,987\nDISCRIMINACION TARIFAS IVA\nTARI-A COMPRA\tBASE\tIVA\nX 26,863 26,863\t0\n19 % 6,200 5,210\t990\nArticulos:6.61\nFecha Fac:07/01/2020 11:19:53 AM\nImpresjon:07/01/2020 11:20:05 AM\nCajero(a):BIVIANA BETANCUR SUAREZ\nAuditoria:010102 0107 0119\nAUTORIZACION FACTURACION No.\n18762016141372 DE:06/08/2019 VIGENCIA: 18\nMESES, HABILITA NUMERO DESDE:C11 155963\nHASTA:C11 500000\nSERIAL CAJA02: 9GVG8V1\nDelfin Software - Dlp Systems\nwww.dlpsystems.co",
213
+ "order_date":"",
214
+ "payment_display_name":"Cash",
215
+ "payment_terms":"",
216
+ "payment_type":"cash",
217
+ "phone_number":"010102 0107 0119",
218
+ "purchase_order_number":"",
219
+ "reference_number":"VBJHG-9250",
220
+ "service_end_date":"",
221
+ "service_start_date":"",
222
+ "ship_date":"",
223
+ "shipping":0.0,
224
+ "subtotal":33113.0,
225
+ "tags":[
226
+
227
+ ],
228
+ "tax":990.0,
229
+ "tax_lines":[
230
+
231
+ ],
232
+ "tip":0.0,
233
+ "total":33113.0,
234
+ "total_weight":"",
235
+ "tracking_number":"",
236
+ "updated":"2021-07-12 01:01:00",
237
+ "vat_number":"901150440-9",
238
+ "vendor":{
239
+ "address":"",
240
+ "fax_number":"",
241
+ "name":"Supermercados Merkahorro S.a.s.",
242
+ "phone_number":"010102 0107 0119",
243
+ "raw_name":"SUPERMERCADOS MERKAHORRO S.A.S.",
244
+ "vendor_logo":"https://cdn.veryfi.com/logos/tmp/038634479.png",
245
+ "vendor_type":"Grocery"
246
+ },
247
+ "vendor_account_number":"",
248
+ "vendor_bank_name":"",
249
+ "vendor_bank_number":"",
250
+ "vendor_bank_swift":"",
251
+ "vendor_iban":"",
252
+ "warnings":[
253
+
254
+ ]
255
+ }
@@ -0,0 +1,270 @@
1
+ /**
2
+ * Additional request parameters type
3
+ */
4
+ export declare type VeryfiExtraArgs = Record<
5
+ string | number | symbol,
6
+ string | number | boolean
7
+ >;
8
+
9
+ /**
10
+ * Object of data extracted from the document
11
+ */
12
+ export declare type VeryfiDocument = {
13
+ abn_number?: null | string;
14
+ account_number?: null | string;
15
+ bill_to_address?: null | string;
16
+ bill_to_name?: null | string;
17
+ bill_to_vat_number?: null | string;
18
+ card_number?: null | string;
19
+ cashback?: null | number;
20
+ category?: null | string;
21
+ created?: null | string;
22
+ currency_code?: null | string;
23
+ date?: null | string;
24
+ delivery_date?: null | string;
25
+ discount?: null | number;
26
+ document_reference_number?: null | string;
27
+ document_title?: null | string;
28
+ document_type?: null | string;
29
+ due_date?: null | string;
30
+ duplicate_of?: null | number;
31
+ external_id?: null | string;
32
+ id?: null | number;
33
+ img_file_name?: null | string;
34
+ img_thumbnail_url?: null | string;
35
+ img_url?: null | string;
36
+ insurance?: null | number;
37
+ invoice_number?: null | string;
38
+ is_duplicate?: null | number;
39
+ line_items?: null | LineItem[];
40
+ notes?: null | string;
41
+ ocr_text?: null | string;
42
+ order_date?: null | string;
43
+ payment_display_name?: null | string;
44
+ payment_terms?: null | string;
45
+ payment_type?: null | string;
46
+ phone_number?: null | string;
47
+ purchase_order_number?: null | string;
48
+ rounding?: null | number;
49
+ service_end_date?: null | string;
50
+ service_start_date?: null | string;
51
+ ship_date?: null | string;
52
+ ship_to_address?: null | string;
53
+ ship_to_name?: null | string;
54
+ shipping?: null | number;
55
+ store_number?: null | string;
56
+ subtotal?: null | number;
57
+ tax?: null | number;
58
+ tax_lines?: null | TaxLine[];
59
+ tip?: null | number;
60
+ total?: null | number;
61
+ total_weight?: null | string;
62
+ tracking_number?: null | string;
63
+ updated?: null | string;
64
+ vat_number?: null | string;
65
+ vendor?: null | Vendor;
66
+ vendor_account_number?: null | string;
67
+ vendor_bank_name?: null | string;
68
+ vendor_bank_number?: null | string;
69
+ vendor_bank_swift?: null | string;
70
+ vendor_iban?: null | string;
71
+ };
72
+
73
+ declare type LineItem = {
74
+ date?: null | string;
75
+ description?: null | string;
76
+ discount?: null | number;
77
+ end_date?: null | string;
78
+ hsn?: null | string;
79
+ id?: null | number;
80
+ order?: null | number;
81
+ price?: null | number;
82
+ quantity?: null | number;
83
+ reference?: null | string;
84
+ section?: null | string;
85
+ sku?: null | string;
86
+ start_date?: null | string;
87
+ tags?: null | null[];
88
+ tax?: null | number;
89
+ tax_rate?: null | number;
90
+ total?: null | number;
91
+ type?: null | string;
92
+ unit_of_measure?: null | string;
93
+ };
94
+
95
+ declare type TaxLine = {
96
+ base?: null | number;
97
+ name?: null | string;
98
+ order?: null | number;
99
+ rate?: null | number;
100
+ total?: null | number;
101
+ };
102
+
103
+ declare type Vendor = {
104
+ address?: null | string;
105
+ category?: null | string;
106
+ email?: null | string;
107
+ fax_number?: null | string;
108
+ name?: null | string;
109
+ phone_number?: null | string;
110
+ raw_name?: null | string;
111
+ vendor_logo?: null | string;
112
+ vendor_reg_number?: null | string;
113
+ vendor_type?: null | string;
114
+ web?: null | string;
115
+ };
116
+
117
+ export declare class Client {
118
+ /**
119
+ * Create instance of a Client
120
+ * @class
121
+ * @param {string} client_id Your Veryfi client id
122
+ * @param {string} client_secret Your Veryfi client secret
123
+ * @param {string} username Your Veryfi username
124
+ * @param {string} api_key Your Veryfi API key
125
+ * @param {string} base_url
126
+ * @param {string} api_version
127
+ * @param {number} timeout
128
+ */
129
+ constructor(
130
+ client_id: string,
131
+ client_secret: string,
132
+ username: string,
133
+ api_key: string,
134
+ base_url?: string,
135
+ api_version?: string,
136
+ timeout?: number
137
+ );
138
+
139
+ client_id: string;
140
+
141
+ client_secret: string;
142
+
143
+ username: string;
144
+
145
+ api_key: string;
146
+
147
+ base_url: string;
148
+
149
+ api_version: string;
150
+
151
+ CATEGORIES: string[];
152
+
153
+ private _get_headers;
154
+
155
+ private _get_url;
156
+
157
+ private _generate_signature;
158
+
159
+ private _request;
160
+
161
+ /**
162
+ * Get all documents
163
+ * @memberof Client
164
+ * @returns {Promise<VeryfiDocument>} Object of previously processed documents
165
+ */
166
+ public get_documents(): Promise<VeryfiDocument[]>;
167
+
168
+ /**
169
+ * Retrieve document by ID
170
+ * @memberof Client
171
+ * @param {string} document_id ID of the document you'd like to retrieve
172
+ * @returns {Promise<VeryfiDocument>} Object of data extracted from the document
173
+ */
174
+ public get_document(document_id: string): Promise<VeryfiDocument>;
175
+
176
+ /**
177
+ * Process a document and extract all the fields from it
178
+ * @example
179
+ * veryfi_client.process_document(
180
+ * 'file/path',
181
+ * ['Entertainment', 'Food'],
182
+ * true,
183
+ * { extra: 'parameters' }
184
+ * )
185
+ * @memberof Client
186
+ * @param {string} file_path Path on disk to a file to submit for data extraction
187
+ * @param {string[]} categories List of categories Veryfi can use to categorize the document
188
+ * @param {boolean} delete_after_processing Delete this document from Veryfi after data has been extracted
189
+ * @param {VeryfiExtraArgs} kwargs Additional request parameters
190
+ * @returns {Promise<VeryfiDocument>} Object of data extracted from the document
191
+ */
192
+ public process_document(
193
+ file_path: string,
194
+ categories?: string[],
195
+ delete_after_processing?: boolean,
196
+ { ...kwargs }?: VeryfiExtraArgs
197
+ ): Promise<VeryfiDocument>;
198
+
199
+ /**
200
+ * Process document from url and extract all the fields from it.
201
+ * @memberof Client
202
+ * @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'.
203
+ * @param {string[]} 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']
204
+ * @param {string[]} categories List of categories to use when categorizing the document
205
+ * @param {boolean} delete_after_processing Delete this document from Veryfi after data has been extracted
206
+ * @param {number} 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.
207
+ * @param {number} 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
208
+ * @param {string} external_id Optional custom document identifier. Use this if you would like to assign your own ID to documents
209
+ * @param {VeryfiExtraArgs} kwargs Additional request parameters
210
+ * @return {Promise<VeryfiDocument>} Object of data extracted from the document
211
+ */
212
+ public process_document_url(
213
+ file_url?: string,
214
+ categories?: string[],
215
+ delete_after_processing?: boolean,
216
+ boost_mode?: number,
217
+ external_id?: string,
218
+ max_pages_to_process?: number,
219
+ file_urls?: string[],
220
+ { ...kwargs }?: VeryfiExtraArgs
221
+ ): Promise<VeryfiDocument>;
222
+
223
+ /**
224
+ * Delete document from Veryfi
225
+ * @memberof Client
226
+ * @param {string} document_id ID of the document you'd like to delete
227
+ * @returns {Promise<VeryfiDocument>} Object of data extracted from the document
228
+ */
229
+ public delete_document(document_id: string): Promise<VeryfiDocument>;
230
+
231
+ /**
232
+ * Update data for a previously processed document, including almost any field like `vendor`, `date`, `notes` and etc.
233
+ * @example
234
+ * veryfi_client.update_document(
235
+ * id,
236
+ * { date: '2021-01-01', notes: 'look what I did' }
237
+ * )
238
+ * @memberof Client
239
+ * @param {string} document_id ID of the document you'd like to update
240
+ * @param {VeryfiExtraArgs} kwargs fields to update
241
+ * @return {Promise<VeryfiDocument>} Object of data extracted from the document with updated fields, if fields are writable. Otherwise, a document with unchanged fields.
242
+ */
243
+ public update_document(
244
+ document_id: string,
245
+ { ...kwargs }?: VeryfiExtraArgs
246
+ ): Promise<VeryfiDocument>;
247
+ }
248
+
249
+ /**
250
+ * Create instance of a Client
251
+ * @class
252
+ * @param {string} client_id Your Veryfi client id
253
+ * @param {string} client_secret Your Veryfi client secret
254
+ * @param {string} username Your Veryfi username
255
+ * @param {string} api_key Your Veryfi API key
256
+ * @param {string} base_url
257
+ * @param {string} api_version
258
+ * @param {number} timeout
259
+ */
260
+ export declare function Client(
261
+ client_id: string,
262
+ client_secret: string,
263
+ username: string,
264
+ api_key: string,
265
+ base_url?: string,
266
+ api_version?: string,
267
+ timeout?: number
268
+ ): Client;
269
+
270
+ export default Client;