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

  1. 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.
  2. 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 mandatory

Client ID provided through offline channels

environment optional

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 and registration_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 optional

Number of records per request (default 10, max 50)

offset optional

Page number to retrieve (0-based, default 0)

statusDelegate mandatory

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

  1. Transaction Initiation: The process begins when a user initiates a transaction.
  2. Validation: The system validates the transaction details.
  3. Authorization: The transaction is sent for authorization.
  4. Processing: Once authorized, the transaction is processed.
  5. Confirmation: A confirmation is sent to the user.

Parameters

Parameter

Description

transactionId mandatory

Unique identifier for the transaction

status mandatory

Transaction status (e.g., "Accepted", "Declined")

statusDelegate mandatory

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:

CodeReason
1Device is jailbroken
2Debugger is attached
3Device is reverse engineered
5Invalid mobile number
7SIM not present or SIM movement detected
8Network unavailable
9Flight mode is on
10Push notifications are disabled
12Customer already registered
15Customer not registered
16Customer ID mismatch
17Invalid parameter details
20SDK not configured