Issues (9)

src/Helpers/IpeClearance.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace HopekellDev\DanArewa\Helpers;
4
5
use Illuminate\Support\Facades\Http;
0 ignored issues
show
The type Illuminate\Support\Facades\Http was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
/**
8
 * DanArewa's Identity Verification laravel package
9
 * @author Hope Ezenwa- Hopekell <[email protected]>
10
 * @version 1
11
 **/
12
13
14
class IpeClearance
15
{
16
    protected string $apiKey;
17
    protected string $baseUrl;
18
19
    /**
20
     * Construct
21
     */
22
    public function __construct(string $apiKey, string $baseUrl)
23
    {
24
        $this->apiKey = $apiKey;
25
        $this->baseUrl = $baseUrl;
26
    }
27
28
    /**
29
     * ✔️ IPE Clearance - Instantly
30
     *
31
     * @param string $trackingID
32
     * @return array|null
33
     */
34
    public function ipeClearance(string $trackingID): ?array
35
    {
36
        $response = Http::withHeaders([
37
            'Authorization' => "Bearer {$this->apiKey}",
38
            'Content-Type'  => 'application/json',
39
        ])->post("{$this->baseUrl}/ipe/", [
40
            'number' => $trackingID,
41
        ]);
42
43
        return $response->json() ?? null;
44
    }
45
46
    /**
47
     * ✅ IPE Clearance - status check
48
     *
49
     * @param string $trackingID
50
     * @return array|null
51
     */
52
    public function ipeClearanceStatus(string $trackingID): ?array
53
    {
54
        $response = Http::withHeaders([
55
            'Authorization' => "Bearer {$this->apiKey}",
56
            'Content-Type'  => 'application/json',
57
        ])->post("{$this->baseUrl}/ipe/status", [
58
            'number' => $trackingID,
59
        ]);
60
61
        return $response->json() ?? null;
62
    }
63
64
}