Seamless Flow - iOS
In Seamless Integration , the Bank Application will handle the UI and SDK will only process the business logic. These Integration steps will be applicable for Banks who are on Native Framework.
1. SDK Integration
-
Embed SDK
- Drag
TridentityHeadlessSDK.framework
into the Xcode project. - Link it by selecting your project target, navigating to General > Framework, Libraries, and Embedded content, and choosing Embed & Sign.
- Integrate Firebase if push notifications are necessary.
- Drag
-
Permissions Required
Permission
Description
Location
optional
For location-based services
Push Notification
mandatory
Required for transaction notifications
2.Initializate SDK
Integrate the SDK initialization within your AppDelegate. Specifically, invoke the initialization from the application(_:didFinishLaunchingWithOptions:)
method:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Initialize the TridentityHeadlessSDK
TridentityHeadlessSDKInterface.shared.initializeSDK()
// Additional setup if needed
return true
}
Note: Ensure that this SDK method is invoked each time the application is launched.
3. Configure SDK
The SDK requires necessary client details to be set up. It performs essential security checks during the configuration process. If any security validation fails, a callback will provide specific error codes and messages. In case of validation failure, it is recommended to terminate the enrollment flow to ensure security compliance.
Parameters
Parameter | Description |
---|---|
clientId
| Client ID provided through offline channels |
environment
| Can be set to "UAT" (default) or "PROD" |
Code Example
let configData: [String: String] = ["clientId": "yourClientId", "environment": "UAT"]
TridentityHeadlessSDKInterface.shared.configureSDK(jsonObject: configData) { success, response in
if success {
print("SDK configured successfully: \(response)")
} else {
print("Configuration error: \(response)")
// Terminate the enrollment flow
}
}
Sample Responses
Success Response:
["code": 200, "message": "SDK configured successfully"]
Failure Response:
["code": 10, "message": "Push notifications are disabled"]
4. SDK Interface and Handling
Implement HeadlessSDKProtocol
To implement the HeadlessSDKProtocol
, ensure that your class adopts this protocol to handle callbacks for various SDK interfaces, excluding the customer status check. This implementation is essential for effectively processing SDK responses and updates.
extension YourClass: HeadlessSDKProtocol {
func sdkStatusUpdate(data: [String: Any]) {
if let statusCode = data["code"] as? Int {
switch statusCode {
case 200:
// Handle success
case 400:
// Handle API/network failure
default:
// Handle other errors
}
}
}
}
Fetch Features
To retrieve the list of features enabled for the Tridentity Headless SDK, you can use the getFeatures
method. Make sure to set the statusDelegate
to self
so that the response can be processed within the delegate method.
Code Example
TridentityHeadlessSDKInterface.shared.getFeatures(statusDelegate: self)
Delegate Implementation Example
extension YourClass: HeadlessSDKProtocol {
func sdkStatusUpdate(data: [String: Any]) {
if let statusCode = data["code"] as? Int,
let dataKey = data["dataKey"] as? String {
if statusCode == 200 && dataKey == "featureData" {
// Process the successfully retrieved feature data
} else {
// Handle other cases as necessary
}
}
}
}
Sample Response
{
"message": "Successfully retrieved client features",
"subParam": {
"features": [
{
"id": 2,
"pushEnabled": 1,
"value": "PUSH"
}
]
},
"status": "SUCCESS",
"dataKey": "featureData",
"code": 200
}
Register FCM
To enable push notifications for transaction processing, you need to register the FCM (Firebase Cloud Messaging) token. This should be done whenever the FCM token is refreshed.
Code Example
TridentityHeadlessSDKInterface.shared.registerFCM(fcmToken: fcmToken, statusDelegate: self)
Delegate Implementation Example
extension YourClass: HeadlessSDKProtocol {
func sdkStatusUpdate(data: [String: Any]) {
if let statusCode = data["code"] as? Int,
let dataKey = data["dataKey"] as? String {
if statusCode == 200 && dataKey == "registerFCMData" {
// Handle successful FCM token registration
} else {
// Handle other responses as needed
}
}
}
}
Sample Response
["dataKey": "registerFCMData", "status": "SUCCESS", "code": 200, "message": "Successfully Updated FCM token"]
Check Customer Status
Use the following method to obtain the registration status of a customer within the Tridentity System. Ensure that you prepend the mobile number with "91".
Code Example
let json: [String: String] = ["moileNumber": "91*****"]
TridentityHeadlessSDKInterface.shared.checkRegistrationStatus(jsonObject: json, completionHandler: {})
Sample Response
["subParam": {
customerStatus = "registration_comm_success";
}, "message": Customer status retrieved, "status": SUCCESS, "code": 200]
Registration Status Handling
- Successful Registration: The status
customerStatus : registration_comm_success
indicates a successful registration. - Pending Registration: Status codes
registration_comm_l1_fail
andregistration_comm_l2_fail
, with codes 206 and 207 respectively, signify that the enrollment is pending. This process will be automatically completed within 24 hours. During this period, the user will be unable to access any functionalities provided by the Tridentity SDK.
Transaction History
To retrieve transaction data, invoke the method with optional parameters for limit
and offset
.
Parameters
Parameter | Description |
---|---|
limit
| Number of records per request (default 10, max 50) |
offset
| Page number to retrieve (0-based, default 0) |
statusDelegate
| The class implementing HeadlessSDKProtocol |
Code Example
let param: [String: Any] = ["limit": 5, "offset": 0]
TridentityHeadlessSDKInterface.shared.fetchTransactionHistory(jsonObject: param, statusDelegate: self)
Delegate Implementation Example
extension YourClass: HeadlessSDKProtocol {
func sdkStatusUpdate(data: [String: Any]) {
if let statusCode = data["code"] as? Int,
let dataKey = data["dataKey"] as? String {
if statusCode == 200 && dataKey == "historyData" {
// Process the successfully retrieved transaction history
} else {
// Handle other possible responses
}
}
}
}
Sample Response
["code": 200, "subParam": {
offset = 0;
totalCount = 21;
txnHistory = (
{
amount = 23;
authType = PUSH;
expiryTime = 1721177553000;
merchant = ...
Process Transaction
This section outlines the steps and details involved in handling a transaction:
Transaction Handling Flow
- Transaction Initiation: The process begins when a user initiates a transaction.
- Validation: The system validates the transaction details.
- Authorization: The transaction is sent for authorization.
- Processing: Once authorized, the transaction is processed.
- Confirmation: A confirmation is sent to the user.
Parameters
Parameter | Description |
---|---|
transactionId
| Unique identifier for the transaction |
status
| Transaction status (e.g., "Accepted", "Declined") |
statusDelegate
| The class implementing HeadlessSDKProtocol |
Code Example
let transactionData: [String: String] = ["txnId": transactionId, "status": "Accepted"]
TridentityHeadlessSDKInterface.shared.processTransaction(jsonObject: transactionData, statusDelegate: self)
Important Notes
- Transactions have a limited time window for processing. Handle them promptly to avoid expiration.
- Ensure proper error handling for network issues or validation failures.
7. De-Registration
To remove a customer's registration from the system, use the following method:
Code Example
TridentityHeadlessSDKInterface.shared.deRegisterUser(statusDelegate: self)
Delegate Implementation Example
extension YourClass: HeadlessSDKProtocol {
func sdkStatusUpdate(data: [String: Any]) {
if let statusCode = data["code"] as? Int,
let dataKey = data["dataKey"] as? String {
if statusCode == 200 && dataKey == "deregistrationData" {
// Handle successful customer deregistration
} else {
// Handle other responses as needed
}
}
}
}
Sample Response
["dataKey": "deregistrationData", "message": "Device Deregistered Successfully", "status": "SUCCESS", "code": 200]
8. Callback Success/Error Codes
The following table lists the possible callback success and error codes, along with their corresponding reasons:
Code | Reason |
---|---|
1 | Device is jailbroken |
2 | Debugger is attached |
3 | Device is reverse engineered |
5 | Invalid mobile number |
7 | SIM not present or SIM movement detected |
8 | Network unavailable |
9 | Flight mode is on |
10 | Push notifications are disabled |
12 | Customer already registered |
15 | Customer not registered |
16 | Customer ID mismatch |
17 | Invalid parameter details |
20 | SDK not configured |
Updated 26 days ago