Usage
- In the application layer, in other words, the init function has to be called before the application even gets up.
Init SDK
Warning If you use goToKycActivity() without calling init, you will get the error RuntimeException("Amani not initialised") . This method must be called at least once before other methods are called in same activity. If you in another acitivity you may need to call it twice.
AmaniV1UI.init(
activity = this,
serverURL = TestCredentials.SERVER_URL,
amaniVersion = AmaniVersion.V2,
sharedSecret = null
)
Register for KYC Result
- Registering for result of the KYC process, it is defined as a global variable to listen for the result of the KYC Process. The returned data is of KYCResult type. It contains the connection error and the status of the user.
KYCResult Data Class Params | Types |
---|---|
httpErrorCode | Int? (HTTPS error codes) |
profileStatus | ProfileStatus (Returns the current status of profile) |
generalException | Exception? (Returns if any exception during process) |
Profile Status Key | Profile Status Meaning |
---|---|
REJECTED | Profile status is rejected for some reason |
APPROVED | Profile status is approved |
INCOMPLETE | Profile status is not completed |
private val resultLauncher = this.registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
if (result.resultCode == Activity.RESULT_OK) {
// There are no request codes
val data: Intent? = result.data
data?.let {
//Result of the KYC process
val kycResult: KYCResult? = it.parcelable(AppConstant.KYC_RESULT)
}
}
}
Launch KYC Process
goToKycActivity()
methods launches the KYC Activity to process flow.
Warning If you use goToKycActivity() without calling init, you will get the error RuntimeException("Amani not initialised") . This method must be called at least once before other methods are called in same activity. If you in another acitivity you may need to call it twice.
AmaniV1UI.goToKycActivity(
activity = this, //Activity pointer
resultLauncher = resultLauncher, //Requires for listening the activity result, sample resultLauncher is below
idNumber = ID_CARD_NUMBER,
authToken = AUTH_TOKEN_FOR_SECURITY,
language = "tr",
geoLocation = true, //Giving permission to access SDK user's location data to process that data
birthDate = BIRTH_DATE, //YYMMDD format. (For Example: 20 May 1990 is 900520). If NFC not used not mandatory
expireDate = EXPIRE_DATE, //YYMMDD format. Expire date of SDK user's ID Card, If NFC not used not mandatory
documentNumber = DOCUMENT_NUMBER, // Document number of SDK user's ID Card, If NFC not used not mandatory
userEmail = "test@gmail.com", // Email of the SDK user, non mandatory field
userPhoneNumber = PHONE_NUMBER //Phone number of the SDK user, non mandatory field,
userFullName = FULL_NAME //Full name of the SDK user, non mandatory field
)