-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetLogos.php
More file actions
30 lines (22 loc) · 795 Bytes
/
getLogos.php
File metadata and controls
30 lines (22 loc) · 795 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
<?php
declare(strict_types=1);
use Qvickly\Api\Portal\PortalAPI;
require __DIR__ . '/../../vendor/autoload.php';
use Dotenv\Dotenv;
$dotenv = Dotenv::createImmutable(__DIR__ . '/../..');
$dotenv->load();
$tokenParts = explode('.', $_ENV['TOKEN']);
$userData = json_decode(base64_decode($tokenParts[1]), true);
$portalAPI = new PortalAPI($_ENV['TOKEN'], testMode: true);
$logos = $portalAPI->get('logos/' . $userData['Merchant']['id']);
if(is_array($logos) && array_key_exists('error', $logos)) {
echo "Code: " . $logos['code'] . "\n";
echo "Error: " . $logos['error'] . "\n";
exit;
}
echo "Found " . count($logos) . " logos\n";
if(count($logos) > 0) {
$oneLogo = array_pop($logos);
echo "And the last logo is:\n";
echo json_encode($oneLogo, JSON_PRETTY_PRINT);
}