Utilities

Job Status

You may want to receive more information about a job. This is built into Web Api if you choose to set return_job_status as true in the options class. However, you also have the option to build the functionality yourself by using the Utilities class. Please note that if you are querying a job immediately after submitting it, you will need to poll it for the duration of the job.

from smile_id_core import Utilities,ServerError
try:
connection = Utilities("<partner_id>", "<the decoded-version of-your-api-key>", "<sid_server>")
job_status = connection.get_job_status("<partner_params>", "<option_params>", "<sec_key>", "<timestamp>")
print(job_status)
except ValueError:
# some of your params entered for a job are not valid or missing
print("handle ValueError")
except ServerError:
# Server returned an error
print("handle ServerError")

This returns the job status as json data.

Example Response

{
"job_success":true,
"result":{
"ConfidenceValue":"99",
"JSONVersion":"1.0.0",
"Actions":{
"Verify_ID_Number":"Verified",
"Return_Personal_Info":"Returned",
"Human_Review_Update_Selfie":"Not Applicable",
"Human_Review_Compare":"Not Applicable",
"Update_Registered_Selfie_On_File":"Not Applicable",
"Liveness_Check":"Not Applicable",
"Register_Selfie":"Approved",
"Human_Review_Liveness_Check":"Not Applicable",
"Selfie_To_ID_Authority_Compare":"Completed",
"Selfie_To_ID_Card_Compare":"Not Applicable",
"Selfie_To_Registered_Selfie_Compare":"Not Applicable"
},
"ResultText":"Enroll User",
"IsFinalResult":"true",
"IsMachineResult":"true",
"ResultType":"SAIA",
"PartnerParams":{
"job_type":"1",
"optional_info":"we are one",
"user_id":"HBBBBBBH57g",
"job_id":"HBBBBBBHg"
},
"Source":"WebAPI",
"ResultCode":"0810",
"SmileJobID":"0000001111"
},
"code":"2302",
"job_complete":true,
"signature":"HKBhxcv+1qaLy\C7PjVtk257dE=|1577b051a4313ed5e3e4d29893a66f966e31af0a2d2f6bec2a7f2e00f2701259",
"history":[
{
"ConfidenceValue":"99",
"JSONVersion":"1.0.0",
"Actions":{
"Verify_ID_Number":"Verified",
"Return_Personal_Info":"Returned",
"Human_Review_Update_Selfie":"Not Applicable",
"Human_Review_Compare":"Not Applicable",
"Update_Registered_Selfie_On_File":"Not Applicable",
"Liveness_Check":"Not Applicable",
"Register_Selfie":"Approved",
"Human_Review_Liveness_Check":"Not Applicable",
"Selfie_To_ID_Authority_Compare":"Completed",
"Selfie_To_ID_Card_Compare":"Not Applicable",
"Selfie_To_Registered_Selfie_Compare":"Not Applicable"
},
"ResultText":"Enroll User",
"IsFinalResult":"true",
"IsMachineResult":"true",
"ResultType":"SAIA",
"PartnerParams":{
"job_type":"1",
"optional_info":"we are one",
"user_id":"HBBBBBBH57g",
"job_id":"HBBBBBBHg"
},
"Source":"WebAPI",
"ResultCode":"0810",
"SmileJobID":"0000001111"
}
],
"image_links":{
"selfie_image":"image_link"
},
"timestamp":"2019-10-10T12:32:04.622Z"
}

validate_id_params

from smile_id_core import Utilities
try:
Utilities.validate_id_params("sid_server<0 for test or 1 for live or a string url>", "id_info_params", "partner_params", "use_validation_api=True")
except ValueError:
# some of your params entered for a job are not valid or missing
print("handle ValueError")

This will validate id parameters using the smile services endpoint which checks the provided user id and partner params. If use_validation_api is False it will only do a local validation to check for country, id type and id number but by default this is True and will check against the smile services endpoint and if any key is missing will throw an exception

get_smile_id_services

from smile_id_core import Utilities,ServerError
try:
Utilities.get_smile_id_services("sid_server<0 for test or 1 for live or a string url>")
except ValueError:
# some of your params entered for a job are not valid or missing
print("handle ValueError")
except ServerError:
# Server returned an error
print("handle ServerError")

This will return the smile services endpoint as a json object and can then be used for validation as per requirement

Example response

{
"id_types": {
"GH": {
"SSNIT": [
"country",
"id_type",
"id_number",
"user_id",
"job_id"
],
"VOTER_ID": [
"country",
"id_type",
"id_number",
"user_id",
"job_id"
],
"DRIVERS_LICENSE": [
"country",
"id_type",
"id_number",
"user_id",
"job_id"
],
"PASSPORT": [
"country",
"id_type",
"id_number",
"user_id",
"job_id"
]
},
"NG": {
"NIN": [
"country",
"id_type",
"id_number",
"user_id",
"job_id"
],
"CAC": [
"country",
"id_type",
"id_number",
"user_id",
"company",
"job_id"
],
"TIN": [
"country",
"id_type",
"id_number",
"user_id",
"job_id"
],
"VOTER_ID": [
"country",
"id_type",
"id_number",
"user_id",
"job_id"
],
"BVN": [
"country",
"id_type",
"id_number",
"user_id",
"job_id"
],
"PHONE_NUMBER": [
"country",
"id_type",
"id_number",
"user_id",
"job_id",
"first_name",
"last_name"
],
"DRIVERS_LICENSE": [
"country",
"id_type",
"id_number",
"user_id",
"job_id",
"first_name",
"last_name",
"dob"
],
},
"KE": {
"NATIONAL_ID": [
"country",
"id_type",
"id_number",
"user_id",
"job_id"
],
"ALIEN_CARD": [
"country",
"id_type",
"id_number",
"user_id",
"job_id"
],
"PASSPORT": [
"country",
"id_type",
"id_number",
"user_id",
"job_id"
]
},
"ZA": {
"NATIONAL_ID": [
"country",
"id_type",
"id_number",
"user_id",
"job_id"
],
"NATIONAL_ID_NO_PHOTO": [
"country",
"id_type",
"id_number",
"user_id",
"job_id"
]
}
},
"bank_codes": [
{
"name": "Access Bank",
"code": "044"
},
{
"name": "Access Bank (Diamond Bank)",
"code": "063"
},
{
"name": "Ecobank",
"code": "050"
},
{
"name": "Enterprise Bank",
"code": "084"
},
{
"name": "Fidelity Bank",
"code": "070"
},
{
"name": "First Bank",
"code": "011"
},
{
"name": "First City Monument Bank",
"code": "214"
},
{
"name": "Guaranty Trust Bank",
"code": "058"
},
{
"name": "Heritage Bank",
"code": "030"
},
{
"name": "Jaiz Bank",
"code": "301"
},
{
"name": "Keystone Bank",
"code": "082"
},
{
"name": "Mainstreet Bank",
"code": "014"
},
{
"name": "Polaris Bank",
"code": "076"
},
{
"name": "Stanbic IBTC",
"code": "039"
},
{
"name": "Skye Bank",
"code": "076"
},
{
"name": "Sterling Bank",
"code": "232"
},
{
"name": "Union Bank",
"code": "032"
},
{
"name": "UBA",
"code": "033"
},
{
"name": "Unity Bank",
"code": "215"
},
{
"name": "Wema Bank",
"code": "035"
},
{
"name": "Zenith Bank",
"code": "057"
}
]
}