-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInvoiceParserClient.php
More file actions
40 lines (34 loc) · 1013 Bytes
/
InvoiceParserClient.php
File metadata and controls
40 lines (34 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
declare(strict_types=1);
namespace SharpAPI\FinanceParseInvoice;
use GuzzleHttp\Exception\GuzzleException;
use SharpAPI\Core\Client\SharpApiClient;
class InvoiceParserClient extends SharpApiClient
{
public function __construct(
string $apiKey,
?string $apiBaseUrl = 'https://sharpapi.com/api/v1',
?string $userAgent = 'SharpAPIPHPInvoiceParser/1.0.0'
) {
parent::__construct($apiKey, $apiBaseUrl, $userAgent);
}
/**
* Parse an invoice file and return the async status URL.
*
* Supported formats: PDF, TIFF/TIF, JPG/JPEG/JPE, PNG.
* Max file size: 100 MB. Max filename length: 255 characters.
*
* @api
* @throws GuzzleException
*/
public function parseInvoice(string $invoiceFilePath): string
{
$response = $this->makeRequest(
'POST',
'/finance/parse_invoice',
[],
$invoiceFilePath
);
return $this->parseStatusUrl($response);
}
}