Issues (16)

src/Helpers/Nin.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace HopekellDev\Confirmident\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
 * Confirmident's Identity Verification laravel package
9
 * @author Hope Ezenwa- Hopekell <[email protected]>
10
 * @version 1
11
 **/
12
class Nin
13
{
14
    protected string $apiKey;
15
    protected string $baseUrl;
16
17
    /**
18
     * Construct
19
     */
20
    public function __construct(string $apiKey, string $baseUrl)
21
    {
22
        $this->apiKey = $apiKey;
23
        $this->baseUrl = $baseUrl;
24
    }
25
26
    /**
27
     * Search by NIN
28
     *
29
     * @param string $nin
30
     * @return array|null
31
     */
32
    public function searchByNIN(string $nin): ?array
33
    {
34
        $response = Http::withHeaders([
35
            'api-key' => $this->apiKey,
36
            'Content-Type' => 'application/json',
37
        ])->post("$this->baseUrl/nin_search", [
38
            'nin' => $nin,
39
        ]);
40
41
        return $response->json();
42
    }
43
44
     /**
45
     * Search by Phone Number
46
     *
47
     * @param string $phone
48
     * @return array|null
49
     */
50
    public function searchByPhoneNumber(string $phone): ?array
51
    {
52
        $response = Http::withHeaders([
53
            'api-key' => $this->apiKey,
54
            'Content-Type' => 'application/json',
55
        ])->post("$this->baseUrl/nin_phone", [
56
            'phone' => $phone,
57
        ]);
58
59
        return $response->json();
60
    }
61
62
    /**
63
     * Search NIN by Demographic Information
64
     *
65
     * @param array $payload ['firstname' => '', 'lastname' => '', 'dob' => '', 'gender' => '']
66
     * @return array|null
67
     */
68
    public function searchByDemographicInfo(array $payload): ?array
69
    {
70
        $response = Http::withHeaders([
71
            'api-key' => $this->apiKey,
72
            'Content-Type' => 'application/json',
73
        ])->post("$this->baseUrl/nin_demo", $payload);
74
75
        return $response->json();
76
    }
77
78
}
79
80