Non-Seamless Flow - iOS
The Tridentity SDK will handle the GUI and business logic. These Integration steps will be applicable for banks who are on Native Framework.
1. SDK Integration
Embed SDK
- Drag the
TridentitySDK.xcframework
into your Xcode project. - Link the framework:
- Select your project target.
- Navigate to General > Framework, Libraries, and Embedded Content.
- Choose Embed & Sign.
- Integrate Firebase if push notifications are required.
Permissions Required
Permission | Description |
---|---|
Location
| For location-based services |
Push Notification
| Required for transaction notifications |
2. Configuration of SDK
Set up the necessary client details within the SDK. The SDK will perform essential security checks, and if any validation fails, a callback will provide specific error codes and messages. In such cases, 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"]
TridentitySDKInterface.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"]
3. Implement TridentSDKDelegate
Ensure that your class adopts the TridentSDKDelegate
protocol to handle callbacks for various SDK interfaces, with the exception of the customer status check. This implementation is crucial for processing SDK responses and updates effectively.
Sample Code
extension YourClass: TridentSDKDelegate {
func fetchStatus(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
}
}
}
func showCustomerStatus(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
}
}
}
func sdkStatusUpdate(data: [String: Any]) {
if let statusCode = data["code"] as? Int,
let dataKey = data["dataKey"] as? String {
switch dataKey {
case "registerFCMData":
if statusCode == 200 {
// Handle successful FCM token registration
}
case "historyData":
if statusCode == 200 {
// Process the successfully retrieved transaction history
}
case "deregistrationData":
if statusCode == 200 {
// Handle successful customer deregistration
}
default:
// Handle other data keys
}
}
}
}
4. Register FCM
To enable push notifications for transaction processing, you need to register the FCM token. This should be done whenever the FCM token is refreshed.
Parameters
Parameter | Description |
---|---|
fcmToken
| Token generated by Firebase Messaging Service |
statusDelegate
| The class implementing TridentSDKDelegate |
Code Example
TridentitySDKInterface.shared.registerFCM(fcmToken: fcmToken, statusDelegate: self)
Sample Response
{
"dataKey": "registerFCMData",
"status": "SUCCESS",
"code": 200,
"message": "Successfully Updated FCM token"
}
5. Handling User Registration
The initiateRegistration
method in the TridentitySDKInterface is used to manage user registration.
Parameters
Parameter | Description |
---|---|
jsonObject
| Dictionary containing registration parameters (e.g., mobileNumber) |
presenter
| UINavigationController to present the registration interface |
completionHandler
| Closure to handle registration result |
Code Example
let userDetails: [String: String] = ["mobileNumber": "user'sMobileNumber"]
TridentitySDKInterface.sharedAuth.initiateRegistration(jsonObject: userDetails, presenter: navigationController) { success, response in
if success {
print("User registered successfully")
} else {
print("Registration failed: \(response)")
}
}
6. Check Customer Status
Use this method to obtain the registration status of a customer within the Tridentity System. Ensure that you prepend the mobile number with "91".
Device Identification
You may need to pass the device identifier to various SDK methods for registration status.
let uid = UIDevice.current.identifierForVendor?.uuidString
Code Example
let json: [String: String] = ["moileNumber": "91*****", "uid": "#######"]
TridentitySDKInterface.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.
7. 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 TridentSDKDelegate |
Sample Code
let param: [String: Any] = ["limit": 5, "offset": 0]
TridentitySDKInterface.shared.fetchTransactionHistory(jsonObject: param, statusDelegate: self)
Sample Response
{
"code": 200,
"subParam": {
"offset": 0,
"totalCount": 21,
"txnHistory": [
{
"amount": 23,
"authType": "PUSH",
"expiryTime": 1721177553000,
"merchant": "Amez standard QA 111306",
"reason": "RazyPay Transaction Request of Rs: 23 at Amez standard QA 111306",
"status": "EXPIRED",
"timeStamp": 1721177493000,
"title": "",
"txnId": "c12b2487-cc65-4c9f-b31a-f60731ece16a"
}
]
},
"status": "SUCCESS",
"message": "Successfully retrieved txn-history",
"dataKey": "historyData"
}
8. Process Transaction
This section provides guidance on handling transaction statuses triggered by FCM (Firebase Cloud Messaging) notifications.
Parameters
Parameter | Description |
---|---|
txnId
| Unique identifier of the transaction |
status
| Transaction status ("Accepted", "Declined", or "Expired") |
clientId
| Client identifier provided offline |
statusDelegate
| The class implementing TridentSDKDelegate |
Code Example
let transactionData: [String: String] = ["txnId": transactionId, "status": PushStatus.accept.rawValue, "clientId": "Shared offline"]
TridentitySDKInterface.shared.processTransaction(jsonObject: transactionData, statusDelegate: self)
Important Notes
- Transactions have a strict expiration time of 60 seconds after receipt. Process them within this timeframe.
9. De-Registration
To remove a customer's registration from the system, use the following method:
Parameters
Parameter | Description |
---|---|
statusDelegate
| The class implementing TridentSDKDelegate |
Code Example
TridentitySDKInterface.shared.deRegisterUser(statusDelegate: self)
Sample Response
["dataKey": "deregistrationData", "message": Device Deregistered Successfully, "status": SUCCESS, "code": 200]
Updated 26 days ago