IdFilter::getAddress()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Bytesfield\SimpleKyc\Classes;
4
5
6
class IdFilter
7
{
8
    public const COUNTRIES = [
9
        'NIGERIA' => 'NG',
10
        'GHANA' => 'GH',
11
        'KENYA' => 'KE',
12
        'UGANDA' => 'UG',
13
        'SOUTH_AFRICA' => 'ZA'
14
    ];
15
16
    public const REQUEST_FORMAT = [
17
        'ID' => 'id',
18
        'COUNTRY' => 'country',
19
        'ID_TYPE' => 'id_type',
20
        'FIRST_NAME' => 'first_name',
21
        'LAST_NAME' => 'last_name',
22
        'MIDDLE_NAME' => 'middle_name',
23
        'DOB' => 'date_of_birth',
24
        'PHONE' => 'phone_number',
25
        'PIN' => 'pin',
26
        'TIN' => 'tin',
27
        'GENDER' => 'gender',
28
        'USER_ID' => 'user_id',
29
        'COMPANY' => 'company',
30
        'REGISTRATION_NUMBER' => 'registration_number'
31
    ];
32
33
    public const IDVALUES = [
34
        'TYPE_PASSPORT' => 'PASSPORT',
35
        'TYPE_NATIONAL_ID'  => 'NATIONAL_ID',
36
        'TYPE_SSNIT'  => 'SSNIT',
37
        'TYPE_VOTER_CARD' => 'VOTER_CARD',
38
        'TYPE_VOTER_ID' => 'VOTER_ID',
39
        'TYPE_ALIEN_CARD' => 'ALIEN_CARD',
40
        'TYPE_BVN' => 'BVN',
41
        'TYPE_NIN' => 'NIN',
42
        'TYPE_NIN_SLIP' => 'NIN_SLIP',
43
        'TYPE_DRIVERS_LICENSE' => 'DRIVERS_LICENSE',
44
        'TYPE_TIN' => 'TIN',
45
        'TYPE_CAC' => 'CAC',
46
        'NATIONAL_ID_NO_PHOTO' => 'NATIONAL_ID_NO_PHOTO',
47
        'TELCO_SUBSCRIBER' =>  'TELCO_SUBSCRIBER',
48
        'TYPE_CUSTOMER_PROFILE' => 'CUSTOMER_PROFILE',
49
        'TYPE_KRA' => 'KRA',
50
51
    ];
52
53
    private ?string $country;
54
    private string $idType;
55
    private ?string $idNumber;
56
    private ?string $firstName;
57
    private ?string $lastName;
58
    private ?string $dob;
59
    private ?string $phoneNumber;
60
    private ?string $middleName;
61
    private ?string $userId;
62
    private ?string $gender;
63
    private ?string $expiry;
64
    private ?string $address;
65
    private ?string $IdentificationProof;
66
    private ?string $faceProof;
67
    private array $data = [];
68
    private bool $success = false;
69
    private array $error = [];
70
    private bool $withImage = false;
71
72
    private string $handler = '';
73
    private array $credequityProfile = [];
74
75
    public function __construct(
76
        string $country,
77
        ?string $idType,
78
        ?string $idNumber = null,
79
        ?string $firstName = null,
80
        ?string $lastName = null,
81
        ?string $middleName = null,
82
        ?string $dob = null,
83
        ?string $phoneNumber = null,
84
        ?string $pin = null,
85
        ?string $tin = null,
86
        ?string $gender = null,
87
        ?string $full_name = null,
88
        ?string $userId = null,
89
        ?string $company = null,
90
        ?string $expiry = null,
91
        ?string $address = null,
92
        ?string $registration_number = null,
93
        ?string $IdentificationProof = null,
94
        ?string $faceProof = null
95
    ) {
96
        $this->country = $country;
97
        $this->idType = $idType;
98
        $this->idNumber = $idNumber;
99
        $this->firstName = $firstName;
100
        $this->lastName = $lastName;
101
        $this->middleName = $middleName;
102
        $this->dob = $dob;
103
        $this->phoneNumber = $phoneNumber;
104
        $this->pin = $pin;
0 ignored issues
show
Bug Best Practice introduced by
The property pin does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
105
        $this->tin = $tin;
0 ignored issues
show
Bug Best Practice introduced by
The property tin does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
106
        $this->gender = $gender;
107
        $this->full_name = $full_name;
0 ignored issues
show
Bug Best Practice introduced by
The property full_name does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
108
        $this->userId = $userId;
109
        $this->company = $company;
0 ignored issues
show
Bug Best Practice introduced by
The property company does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
110
        $this->expiry = $expiry;
111
        $this->address = $address;
112
        $this->registration_number = $registration_number;
0 ignored issues
show
Bug Best Practice introduced by
The property registration_number does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
113
        $this->IdentificationProof = $IdentificationProof;
114
        $this->faceProof = $faceProof;
115
    }
116
117
118
    public function getIDNumber()
119
    {
120
        return $this->idNumber;
121
    }
122
123
    public function getCountry()
124
    {
125
        return $this->country;
126
    }
127
128
    public function getCompany()
129
    {
130
        return $this->company;
131
    }
132
133
    public function getRegistrationNumber()
134
    {
135
        return $this->registration_number;
136
    }
137
138
    public function getFullName()
139
    {
140
        return $this->full_name;
141
    }
142
143
    public function getIDType()
144
    {
145
        return $this->idType;
146
    }
147
148
    public function getPin()
149
    {
150
        return $this->pin;
151
    }
152
153
    public function getTin()
154
    {
155
        return $this->tin;
156
    }
157
158
    public function getFirstName()
159
    {
160
        return $this->firstName;
161
    }
162
163
    public function getMiddleName()
164
    {
165
        return $this->middleName;
166
    }
167
168
    public function getLastName()
169
    {
170
        return $this->lastName;
171
    }
172
173
    public function getGender()
174
    {
175
        return $this->gender;
176
    }
177
178
    public function getAddress()
179
    {
180
        return $this->address;
181
    }
182
183
    public function getExpiry()
184
    {
185
        return $this->expiry;
186
    }
187
188
    public function getDOB()
189
    {
190
        return $this->dob;
191
    }
192
193
    public function getIdentificationProof()
194
    {
195
        return $this->identificationProof;
0 ignored issues
show
Bug Best Practice introduced by
The property identificationProof does not exist on Bytesfield\SimpleKyc\Classes\IdFilter. Did you maybe forget to declare it?
Loading history...
196
    }
197
198
    public function getFaceProof()
199
    {
200
        return $this->faceProof;
201
    }
202
203
    public function setWithImage()
204
    {
205
        $this->withImage = true;
206
    }
207
208
    public function isWithImage()
209
    {
210
        return $this->withImage;
211
    }
212
213
    public function setCredequityProfile($nin, $frscno, $bvn)
214
    {
215
        $this->credequityProfile = ['nin' => $nin, 'frscno' => $frscno, 'bvn' => $bvn];
216
    }
217
218
    public function getCredequityProfile()
219
    {
220
        return $this->credequityProfile;
221
    }
222
223
    /**
224
     * Returns user phone
225
     *
226
     * @return string|null
227
     */
228
    public function getPhoneNumber()
229
    {
230
        return $this->phoneNumber;
231
    }
232
233
    /**
234
     * Returns the user id
235
     *
236
     * @return string
237
     */
238
    public function getUserId()
239
    {
240
        return $this->userId;
241
    }
242
243
244
    /**
245
     * Sets success to true
246
     *
247
     * @return void
248
     */
249
    public function confirmSuccess(): void
250
    {
251
        $this->success = true;
252
    }
253
254
    /**
255
     * Sets the pipe that handled the request
256
     *
257
     * @param string $handler
258
     * @return void
259
     */
260
    public function setHandler($handler): void
261
    {
262
        $this->handler = $handler;
263
    }
264
265
    /**
266
     * Gets the pipe that handled the request
267
     *
268
     * @return string
269
     */
270
    public function getHandler()
271
    {
272
        return $this->handler;
273
    }
274
275
    /**
276
     * Sets data returned from the request
277
     *
278
     * @param array $data
279
     * @return void
280
     */
281
    public function setData($data = []): void
282
    {
283
        $this->data = $data;
284
    }
285
286
    /**
287
     * Sets the error associated with request
288
     *
289
     * @param array $error
290
     * @return void
291
     */
292
    public function setError($error = []): void
293
    {
294
        $this->error = $error;
295
    }
296
297
    /**
298
     * Return error associated with request
299
     *
300
     * @return string
301
     */
302
    public function getError()
303
    {
304
        return $this->error['error'];
305
    }
306
307
    /**
308
     * Returns the data gotten from the request
309
     *
310
     * @return array
311
     */
312
    public function getData()
313
    {
314
        return $this->data;
315
    }
316
317
    /**
318
     * Checks if the request is successful
319
     *
320
     * @return bool
321
     */
322
    public function isSuccessful()
323
    {
324
        return $this->success;
325
    }
326
}
327