-
Notifications
You must be signed in to change notification settings - Fork 0
/
govChecksNigeria.go
301 lines (256 loc) · 10.3 KB
/
govChecksNigeria.go
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
package metamap
type (
//National ID
NigeriaNINRequest struct {
//VNIN is a required parameter that must be passed in
DocumentNumber string `json:"documentNumber"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
DateOfBirth string `json:"dateOfBirth"`
//Metadata is an optional parameter
Metadata map[string]interface{} `json:"metadata"`
Phone string `json:"phone"`
//CallbackUrl is a required parameter that must be passed in
CallbackUrl string `json:"callbackUrl"`
}
NigeriaNINResponse struct {
Error interface{} `json:"error"`
Data struct {
ID string `json:"id"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
DateOfBirth string `json:"dateOfBirth"`
Gender string `json:"gender"`
Phone string `json:"phone"`
VNin string `json:"vNin"`
Photo string `json:"photo"`
} `json:"data"`
}
//Voters Card
NigeriaVotingIDNumberRequest struct {
DocumentNumber string `json:"documentNumber"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
DateOfBirth string `json:"dateOfBirth"`
CallbackUrl string `json:"callbackUrl"`
}
NigeriaVotingIDNumberResponse struct {
Status string `json:"status"`
ID string `json:"id"`
Error interface{} `json:"error"`
Data struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
MiddleName string `json:"middlename"`
Gender string `json:"gender"`
Occupation string `json:"occupation"`
StateOfOrigin string `json:"stateOfOrigin"`
LgaOfOrigin string `json:"lgaOfOrigin"`
OnSpokenLang string `json:"onspokenlang"`
PollingUnit string `json:"pollingUnit"`
} `json:"data"`
Timestamp string `json:"timestamp"`
}
//Drivers Licence
NigeriaDriversLicenceRequest struct {
DocumentNumber string `json:"documentNumber"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
CallbackUrl string `json:"callbackUrl"`
}
NigeriaDriversLicenceResponse struct {
Status string `json:"status"`
ID string `json:"id"`
Error interface{} `json:"error"`
Data struct {
LicenseNo string `json:"license_no"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
IssuedDate string `json:"issuedDate"`
ExpirationDate string `json:"expirationDate"`
StateOfIssue string `json:"stateOfIssue"`
Gender string `json:"gender"`
Birthdate string `json:"birthdate"`
MiddleName string `json:"middlename"`
GovernmentFaceMatch struct {
Photo string `json:"photo"`
Matched bool `json:"matched"`
Score int `json:"score"`
} `json:"governmentFaceMatch"`
} `json:"data"`
Timestamp string `json:"timestamp"`
}
//Corporate Affairs Commission
NigeriaCACRequest struct {
RegistrationNumber string `json:"registrationNumber"`
CallbackUrl string `json:"callbackUrl"`
}
NigeriaCACResponse struct {
Error interface{} `json:"error"`
Data struct {
Type string `json:"type"`
CompanyName string `json:"companyName"`
CacNumber string `json:"cacNumber"`
Status string `json:"status"`
CompanyAddress string `json:"companyAddress"`
CompanyEmail string `json:"companyEmail"`
RegistrationDate string `json:"registrationDate"`
} `json:"data"`
}
// Tax Identification Number
NigeriaTaxIdentificationNumberRequest struct {
TaxNumber string `json:"taxNumber"`
CallbackUrl string `json:"callbackUrl"`
}
NigeriaTaxIdentificationNumberResponse struct {
Error interface{} `json:"error"`
Data struct {
CompanyName string `json:"companyName"`
FirsNumber string `json:"FirsNumber"`
CacNumber string `json:"cacNumber"`
JtbNumber string `json:"JtbNumber"`
TaxOffice string `json:"taxOffice"`
CompanyPhone string `json:"companyPhone"`
CompanyEmail string `json:"companyEmail"`
} `json:"data"`
}
//Corporate Affairs Commission Affilaite
NigeriaCACAffiliatesRequest struct {
RegistrationNumber string `json:"registrationNumber"`
CallbackUrl string `json:"callbackUrl"`
}
NigeriaCACAffiliatesResponse struct {
Error interface{} `json:"error"`
Data struct {
Shareholders []struct {
Name string `json:"name"`
Position string `json:"position"`
Status string `json:"status"`
DateOfBirth string `json:"dateOfBirth"`
PhoneNumber string `json:"phoneNumber"`
Email string `json:"email"`
City string `json:"city"`
Address string `json:"address"`
IdType string `json:"idType"`
IdNumber string `json:"idNumber"`
Shares string `json:"shares"`
AccreditationNumber string `json:"accreditationNumber"`
} `json:"shareholders"`
} `json:"data"`
}
// Bank Verification Number
NigeriaBVNRequest struct {
DocumentNumber string `json:"documentNumber"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
CallbackUrl string `json:"callbackUrl"`
}
)
/*
NigeriaVirtualNIN verifies NIN(National Identification Number).
This method takes in the NigeriaNINRequest{} struct as a parameter. Both the VNIN and CallbackUrl field are required parameter that must be passed in for the request.
NOTE: The format for the DateOfBirth is yyyy-mm-dd.
It also takes in an optional parameter `metadata` which is a map[string]interface that is passed in to add custom data to the request.
MetaMap takes a user's virtual NIN - one-time verification code from the official NIMC Application or code generated via USSD request *346*3*Your NIN*715461# to verify their identity through the National Identity Management Commission (NIMC) database.
You can reach out to the official NIMC article(https://nimc.gov.ng/nin-tokenization/) to learn more about the tokenization initiative.
*/
func (c *Client) NigeriaVirtualNIN(req NigeriaNINRequest) (*NigeriaNINResponse, error) {
url := "govchecks/v1/ng/nin"
method := MethodPOST
var response NigeriaNINResponse
c.IsBasic = false
if err := c.newRequest(method, url, req, response); err != nil {
return &NigeriaNINResponse{}, err
}
return &response, nil
}
/*
NigeriaVotingIDNumber verifies Voting Identity Number.
This method takes in the NigeriaVotingIDNumberRequest{} struct as a parameter.
NOTE: The format for the DateOfBirth is yyyy-mm-dd.
MetaMap verifies a user's identity information and their Voting Identity Number (VIN) through the Independent National Electoral Commission (INEC).
*/
func (c *Client) NigeriaVotingIDNumber(req NigeriaVotingIDNumberRequest) (*NigeriaVotingIDNumberResponse, error) {
url := "govchecks/v1/ng/vin"
method := MethodPOST
var response NigeriaVotingIDNumberResponse
c.IsBasic = false
if err := c.newRequest(method, url, req, response); err != nil {
return &NigeriaVotingIDNumberResponse{}, err
}
return &response, nil
}
/*
NigeriaDriversLicence verifies drivers licence.
This method takes in the NigeriaDriversLicenceRequest{} struct as a parameter.
MetaMap verifies a user's identity information and their driver license number through the Federal Road Safety Commission (FRSC).
*/
func (c *Client) NigeriaDriversLicence(req NigeriaDriversLicenceRequest) (*NigeriaDriversLicenceResponse, error) {
url := "govchecks/v1/ng/dl"
method := MethodPOST
var response NigeriaDriversLicenceResponse
c.IsBasic = false
if err := c.newRequest(method, url, req, response); err != nil {
return &NigeriaDriversLicenceResponse{}, err
}
return &response, nil
}
/*
NigeriaCAC verifies a company's CAC (Corporate Affairs Commission) number.
This method takes in the NigeriaCACRequest{} struct as a parameter.
MetaMap checks that a company's Corporate Affairs Commission (CAC) registration number is valid as either a business name (BN) or a registered company (RC) for a limited liability company (LLC).
*/
func (c *Client) NigeriaCAC(req NigeriaCACRequest) (*NigeriaCACResponse, error) {
url := "govchecks/v1/ng/cac"
method := MethodPOST
var response NigeriaCACResponse
c.IsBasic = false
if err := c.newRequest(method, url, req, response); err != nil {
return &NigeriaCACResponse{}, err
}
return &response, nil
}
/*
NigeriaTaxIdentificationNumber verifies a company's Tax Identification Number.
This method takes in the NigeriaTaxIdentificationNumberRequest{} struct as a parameter.
MetaMap checks that a company's tax ID number (TIN) — issued from either the Federal Inland Revenue Service (FIRS) or Joint Tax Board (JBT) — is valid as either a business name (BN) or registered company (RC) for a limited liability company (LLC).
*/
func (c *Client) NigeriaTaxIdentificationNumber(req NigeriaTaxIdentificationNumberRequest) (*NigeriaTaxIdentificationNumberResponse, error) {
url := "govchecks/v1/ng/tin"
method := MethodPOST
var response NigeriaTaxIdentificationNumberResponse
c.IsBasic = false
if err := c.newRequest(method, url, req, response); err != nil {
return &NigeriaTaxIdentificationNumberResponse{}, err
}
return &response, nil
}
/*
NigeriaCACAffiliates verifies a major shareholder names and titles if a company's Corporate Affairs Commission number is valid.
This method takes in the NigeriaCACAffiliatesRequest{} struct as a parameter.
If a company's Corporate Affairs Commission (CAC) registration number is valid, MetaMap will return the names of major shareholders and their titles.
*/
func (c *Client) NigeriaCACAffiliates(req NigeriaCACAffiliatesRequest) (*NigeriaCACAffiliatesResponse, error) {
url := "govchecks/v1/ng/cac-affiliates"
method := MethodPOST
var response NigeriaCACAffiliatesResponse
c.IsBasic = false
if err := c.newRequest(method, url, req, response); err != nil {
return &NigeriaCACAffiliatesResponse{}, err
}
return &response, nil
}
/*
NigeriaBVN verifies a BVN (Bank Verification Number).
This method takes in the NigeriaBVNRequest{} struct as a parameter.
*/
func (c *Client) NigeriaBVN(req NigeriaBVNRequest) (*map[string]interface{}, error) {
url := "govchecks/v1/ng/bvn"
method := MethodPOST
var response map[string]interface{}
c.IsBasic = false
if err := c.newRequest(method, url, req, response); err != nil {
return nil, err
}
return &response, nil
}