Seamless Flow - Android

The purpose of this document is to inform developers about the various ways in which they can integrate Tridentity SDK (Seamless Flow) with their applications. Tridentity SDK follows a modular approach, providing the flexibility to the application to handle the UI while the SDK handles the business logic.

1. Gradle changes

Update the build.gradle file to include the following:

android {
    dependencies {
        implementation files('libs/<Tridentity_SDK>.aar') // Tridentity SDK library
        // Other required dependencies for Tridentity SDK
        implementation 'androidx.core:core-ktx:1.6.0'
        implementation 'androidx.appcompat:appcompat:1.6.1'
        implementation 'androidx.biometric:biometric:1.1.0'
        implementation 'org.bouncycastle:bcprov-jdk15+:1.46'
        implementation 'com.nimbusds:nimbus-jose-jwt:7.4'
        implementation 'com.squareup.retrofit2:retrofit:2.6.0'
        implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
        implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'
        implementation 'com.scottyab:rootbeer-lib:0.1.0'
    }
}

2. Manifest changes

Permissions needed for the SDK are based on the authentication mode. Here, it must be updated in AndroidManifest.xml.

Permission

Description

Mandatory for Modes

Post notification conditional

Mandatory for version 13 and above to receive push notification

  1. Push Notification
  2. Push with Biometric

Phone State
mandatory

Mandatory to detect sim swap scenarios

  1. Push Notification
  2. Push with Biometric
  3. Biometric based
  4. Offline OTP

SMS
conditional

For auto send of SMS if SDK is enabled for binding the device

  1. Push Notification
  2. Push with Biometric
  3. Biometric based
  4. Offline OTP

Below permissions are needed for Push Notification, Push with Biometric, Biometric-based and Offline OTP modes of authentication:

<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<!-- Additional permissions may be required based on your implementation -->

3. Configuration of SDK

Configure the SDK by providing required parameters.

ParameterDescriptionMandatory for Modes
contextApplication ContextAll
clientIdClient ID provided by TridentityAll
envEnvironment (PROD/UAT)All
clientJsonConfigClient configuration in JSON formatAll
authTypeAuthentication type (e.g. Biometric)Push with Biometric, Biometric-based
biometricRetryCountNumber of biometric retries (default: 3)Push with Biometric, Biometric-based
BINFirst 6 digits of the cardPush with Biometric, Biometric-based

Invoke the following method of the SDK to configure the client details. All the security checks and mandatory permissions required for the SDK will be validated during this call.  In case if any security check fails or permission not granted, specific error message will be provided in the callback and the calling app should terminate the flow by showing appropriate message to the user.

📘

Note:

From the response event in the onSuccess method check for the message flag to get Configuration status. 

val configObject = JSONObject()
configObject.put("env", "UAT") // UAT or PROD
configObject.put("clientId", "")

HeadlessTridentitySDK.getInstance().configSdk(
    context,
    configObject,
    object : ConfigStatusCallback {
        override fun onSuccess(event: String) {
            // Implementation here
        }

        override fun onError(errorCode: Int, errorDesc: String) {
            // Implementation here
        }
    }
)

4. Initialisation of FCM

This method is used to pass the FCM token to the SDK in order to send push notification. This method should be called before Initiating Registration and when ever there is a new FCM token generated. Applicable only if the authentication mode enabled is

  1. Push notification
  2. Push with Biometric

Parameter & Constraints

Remarks

context mandatory

applicationContext

fcmToken mandatory

Token generated by Firebase Messaging service

For Push Notification and Push with Biometric modes, pass the FCM token to the SDK.

  1. Add Firebase to the Project:

    • Create a Firebase project and download the google-services.json file.
  2. Include the FCM SDK inbuild.gradle:

    implementation 'com.google.firebase:firebase-messaging:<latest_version>'
  3. Initialize Firebase in the Application:

    FirebaseApp.initializeApp(this);
  4. Handle FCM Token Registration:

HeadlessTridentitySDK.getInstance().registerFCM(
    context,
    fcmToken,
    object : FCMRegistrationCallback {
        override fun onSuccess(event: String) {
            Log.d("TAG", "onSuccess: $event")
        }

        override fun onError(code: Int, error: String) {
            // Error handling
        }
    }
)

5. Registering in SDK

Fetch Features (Optional)

Parameter & Constraints

Remarks

Mandatory for Modes

context mandatory

Application Context

All

Fetch the list of features enabled for the SDK.

HeadlessTridentitySDK.getFeatures(
    context,
    object : FetchFeaturesCallBack {
        override fun fetchFeatures(event: String) {
            // Handle feature response
        }
    }
)

Fetch Consent (Optional)

Fetch the Terms and Conditions for user consent.

HeadlessTridentitySDK.getInstance().getConsent(context, object : ConsentCallBack {
    override fun onSuccess(event: String) {
                
    }

    override fun onError(error: String) {

    }
})

Device binding by App / Device binding bypassed

Fetch SMS Token

Parameter

Remarks

context mandatory

Application Context

mobileNumber conditional

Mobile number of the user against which the card is registered prefixed with country code

uid conditional

Any other unique identifier of the user if BIN is passed as part of configuring the SDK

Fetch the SMS token and vendor number for device binding.

val custObject = JSONObject()
custObject.put("mobileNumber", "919876543210")

HeadlessTridentitySDK.getInstance().getSMSToken(
    context,
    custObject,
    object : BindingTokenCallBack {
        override fun onSuccess(event: String) {
            // Handle success response
        }

        override fun onError(error: String) {
            // Handle error response
        }
    }
)

Set SIM Info

Parameter

Remarks

context mandatory

Application Context

simSlotIndex mandatory

SIM slot index of the device

subscriptionId mandatory

Subscription ID of the subscriber.

Provide SIM information to detect SIM swap scenarios.

val simObject = JsonObject()
simObject.addProperty("simSlotIndex", 0) // example value has given
simObject.addProperty("subscriptionId", 1) // example value has given

HeadlessTridentitySDK.getInstance().setSimInfo(
    context,
    simObject,
    object : SimInfoCallBack {
        override fun onSuccess(event: String) {
            Log.d("TAG", "onSuccess: $event")
        }

        override fun onError(code: Int, error: String) {
            // Handle error response
        }
    }
)

Sample JSON for SIM Info:

{
  "simSlotIndex": 0,
  "subscriptionId": 123456789,
  "mobileNumber": "9876543210"
}

Device Binding by SDK

Parameter & Constraints

Remarks

context mandatory

Application Context

simSlotIndex mandatory

SIM slot index of the device

subscriptionId mandatory

Subscription ID of the subscriber

mobileNumber conditional

Mobile number of the user against which the card is registered prefixed with country code

uid conditional

Any other unique identifier of the user if BIN is passed as part of configuring the SDK

Let the SDK handle SMS sending and device binding.

val simObject = JsonObject()
simObject.addProperty("simSlotIndex", 0) // example value has given
simObject.addProperty("subscriptionId", 1) // example value has given
simObject.addProperty("mobileNumber", "919876543210")

HeadlessTridentitySDK.getInstance().initiateSIMBindingProcess(
    context,
    simObject,
    object : SimBindingResponseCallBack {
        override fun onSuccess(event: String) {
            Log.d("TAG", "onSuccess: $event")
            // On success, do initiate the below method to check the registration status
        }
        
        override fun onError(code: Int, error: String) {
            // Handle error response
        }
    }
)

Check Registration Status

Parameter

Description

context mandatory

Application Context

clientId mandatory

Client ID provided by Tridentity

mobileNumber conditional

Mobile number of the user against which the card is registered prefixed with country code

uid conditional

Any other unique identifier of the user if BIN is passed as part of configuring the SDK

Check the current registration status of the customer.

val custObject = JSONObject()
custObject.put("mobileNumber", "919876543210")

HeadlessTridentitySDK.getInstance().checkRegistrationStatus(
    context,
    custObject,
    object : RegistrationStatusCallBack {
        override fun onSuccess(event: String) {
            // Note: customerStatus : registration_comm_success is only considered as successful Registration.
        }
        
        override fun onError(code: Int, error: String) {
            // Handle error response
        }
    }
)

6. Transaction History

Parameter

Remarks

activity

mandatory

Transaction activity description

limit

optional

No of transaction record fetched per single request. Default of 10 records per request

offset

optional

Page index. Default 0-4

Retrieve transaction data authenticated via the SDK.

val historyObject = JsonObject()
historyObject.addProperty("limit", 10)
historyObject.addProperty("offset", 0)

TridentitySDK.getTransactionHistory(
    activity as AppCompatActivity,
    historyObject,
    object : transactionHistoryCallback {
        override fun onSuccess(event: String) {
            // Note: customerStatus : registration_comm_success is only considered as successful Registration.
        }
        
        override fun onError(code: Int, error: String) {
            // Handle error
        }
    }
)

7. View Offline OTP

Generate and view an offline OTP for authentication.

TridentitySDK.showofflineOTP(
    requireActivity() as HomeActivity,
    object : ResponseCallbackInterface {
        override fun fetchStatus(event: String) {
            // Perform necessary actions based on callback received
        }
    }
)

8. Process Transaction

Parameter

Remarks

Mandatory for Modes

context mandatory

Application context

All

remoteMessage conditional

Message received from push notification

  1. Push notification
  2. Push with Biometric

buildNotification
conditional

To be passed as True if SDK needs to render the Push notification
The default value is False.

  1. Push notification
  2. Push with Biometric

jsonObject
conditional

Refer to jsonObject fields description

Biometric

jsonObject fields description

Parameter

Remarks

txnId mandatory

Transaction ID of the transaction

clientID mandatory

Client ID provided by Wibmo

amount optional

Transaction amount

merchantName optional

Merchant name

Authenticate transactions using the SDK.

TridentitySDK.getInstance().processTransaction(
    context = applicationContext,
    remoteMessage = remoteMessage.data,
    buildNotification = false,
    object : UpdateTransactionCallback {
        override fun onSuccess(event: JSONObject) {
            Log.v("processTransaction", "onSuccess")
        }
        
        override fun onError(error: String) {
            Log.e("processTransaction", "onError: $error")
        }
    }
)

Sample JSON for transaction data:

{
  "amount": "1000.00",
  "currency": "INR",
  "merchantName": "Example Merchant",
  "transactionId": "TX123456789"
}

9. De-Registration

Remove a customer from the Tridentity system.

TridentitySDK.getInstance().deRegistration(
    context,
    object : DeregisterCallBack {
        override fun onSuccess(event: JSONObject) {
            // Success handling
        }

        override fun onError(code: Int, error: String) {
            // Error handling
        }
    }
)

Is there anything specific you'd like me to modify or enhance in this markdown version?