GBG Developers

Guides   |   Using the Verify People Service

Using the Verify People Service

The VerifyPeopleService class can be used to verify text based name and address information. Create an instance of it:

val peopleService = VerifyPeopleService ()

The address to be verified is built using VerifyNewPersonRequest.Address.Builder:

// create a verify request
// a. create an address
val address = VerifyNewPersonRequest.Address.Builder()
    .building("222")
    .street("BAKER STREET")
    .city("LONDON")
    .postCode("SW2 222Q")
    .country("GB")
    .build()

Now build the entire person request, including that address:

// b. build the request
val personRequest = VerifyNewPersonRequest.Builder()
    .firstName("BOB")
    .lastname("KIRK")
    .gender("MALE")
      .birthdate("1984-11-29")
    .addresses(
        listOf(
            VerifyNewPersonRequest.Addresses(
                type="CURRENT",
                    address = address
            )
        )
    )
    .build()

Finally, use the SDK to send the request and then the application code can handle the result.   If you have already performed a verification then you can use the verifyPersonID method instead of the verifyNewPerson and include the person identifier (person-id) that will specify the same individual to continue checks on.  The example here prints some debug output indicating success or failure.

// submit the request to the service and handle the result
peopleService.verifyNewPerson(
    journeyId = "0b39fc26-74bc-433e-b394-4adc8aa96f99",
    journeyVersion = 1,
    request = personRequest,
  
    resultListener = object : VerifyResultListener<Response<VerifyNewPersonResponse>> {
        override fun success(response: Response<VerifyNewPersonResponse>){
            Log.d(TAG, "success: verifyPerson")
            Log.d(TAG, response.body().toString())
        }

        override fun failure(error: ErrorResponse) {
            Log.e(TAG, "got error fron verifyPerson")
            Log.e(TAG, error.message)
            Log.e(TAG, error.responseCode.toString())
        }
    }
)

When this example is run, a success message should be displayed when debugging the application.