Identity Verification Module
First you need to import and instantiate PRIVO verification module:
import com.privo.sdk.PrivoVerification
You can instantiate the PRIVO verification module with Context:
val verification = PrivoVerification(this)
Functionality:
verification.showVerification(profile) { events -> }
Used to show PRIVO Verification Modal Dialog
params: UserVerificationProfile - optional user predefined profile
data class UserVerificationProfile (
var firstName: String?,
var lastName: String?,
var birthDateYYYYMMDD: String?, // Optional date string in the "yyyy-MM-dd" date-format
var email: String?,
var postalCode: String?,
var phone: String?, // Optional phone number in E.164 format. Example: "+12133734253"
var partnerDefinedUniqueID: String? // Optional unique identifier passed by Partner and returned in all responses by PRIVO.
)
response: Array<VerificationEvent> - Array of Verification Events
data class VerificationEvent(
val event: VerificationEventType,
val result: VerificationResult?,
val data: String?,
val errorCode: String?,
val errorMessage: String?
)
Verification Events:
VerifyInitialized - When the verification widget has initialized.
VerifyCancel - When user has canceled the verification.
VerifyComplete - When user has successfully completed the verification process and has been verified.
VerifyDone - When the user has completed the verification and closed the verification widget.
VerifyError - If an error occurs. See Error Codes section.
Possible Error Codes:
Error Code | Error Message |
---|---|
10001 | Invalid API Key or access_token |
10002 | Missing site_id parameter |
10003 | Unexpected error |
10100 | Invalid email address |
10101 | Misconfigured verification methods |
412 | Too many attempts |
Method to get status of the current user (can be configured to be blocked after N attempts)
verification.getUserLimits(externalYserId: String) { limits -> }
response: UserLimits - User Limits Information
class UserLimits (
val isOverLimit: Boolean,
val limitType: LimitType,
val retryAfter: Int?,
)
enum class LimitType(val type: String) {
IV("IV"),
Auth("Auth"),
}
Identity Verification Module Example:
data class VerificationResult(val serviceId : String?, val verificationResponse: VerificationResponse)
data class VerificationResponse(
val verified: Boolean,
val requestID: String,
val transactionID: String,
val verificationMethod: VerificationMethodType,
val matchOutcome: VerificationOutcome,
val requestTimestamp: Long,
val locale: String,
val matchCode: String?,
val redirectUrl: String?,
val message: String?,
val partnerDefinedUniqueID: String?,
//Applicable to offline methods only
val identificationNumber: String?,
val attemptId: Int?
)
class VerificationActivity : AppCompatActivity() {
private val dateFormat = SimpleDateFormat("MM/dd/yyyy", Locale.US)
private val sdkDateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.US)
private lateinit var binding: ActivityVerificationBinding
private lateinit var verification: PrivoVerification
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
verification = PrivoVerification(this)
binding = ActivityVerificationBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)
initViews()
}
private fun initViews() {
val eventsAdapter = VerificationEventsAdapter()
binding.eventsRecycler.adapter = eventsAdapter
binding.showButton.setOnClickListener {
val profile = getTestProfile()
verification.showVerification(profile) { events ->
eventsAdapter.addEvents(events)
}
}
}
private fun getTestProfile(): UserVerificationProfile {
val profile = UserVerificationProfile()
profile.firstName = binding.firstNameField.getOptionalText()
profile.lastName = binding.lastNameField.getOptionalText()
profile.email = binding.emailField.getOptionalText()
profile.postalCode = binding.postalCodeField.getOptionalText()
profile.phone = binding.phoneField.getOptionalText()
profile.partnerDefinedUniqueID = binding.partnerIdField.getOptionalText()
binding.birthDateField.getOptionalText()?.let {
val birthDateYYYYMMDD = sdkDateFormat.format(date)
profile.birthDateYYYYMMDD = birthDateYYYYMMDD
}
return profile
}
}