-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetStatuslogs.php
More file actions
29 lines (22 loc) · 900 Bytes
/
getStatuslogs.php
File metadata and controls
29 lines (22 loc) · 900 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
<?php
declare(strict_types=1);
use Qvickly\Api\Portal\PortalAPI;
require __DIR__ . '/../../vendor/autoload.php';
use Dotenv\Dotenv;
$dotenv = Dotenv::createImmutable(__DIR__ . '/../..');
$dotenv->load();
$portalAPI = new PortalAPI($_ENV['TOKEN'], testMode: true);
$invoices = $portalAPI->get('invoices', params: ['filter' => 'search', 'search' => 'Testperson']);
if(is_array($invoices) && array_key_exists('error', $invoices)) {
echo "Code: " . $invoices['code'] . "\n";
echo "Error: " . $invoices['error'] . "\n";
exit;
}
echo "Found " . count($invoices) . " invoices\n";
if(count($invoices) > 0) {
$oneInvoice = array_pop($invoices);
$oneInvoiceId = $oneInvoice['invoiceid_real'];
$statusLog = $portalAPI->get('invoices/' . $oneInvoiceId . '/statuslog');
echo "And the statuslog for the last invoice is:\n";
echo json_encode($statusLog, JSON_PRETTY_PRINT);
}