Card91 NSDL MIN KYC iOS Framework Integration with Native iOS Apps
Card91 Min KYC NSDL iOS Framework
Card91 Min KYC NSDL Android Library Integration with Native iOS Apps
Description
Purpose of this document is to illustrate the method to add Card91 ‘Min KYC NSDL’ library to any ios native application written in swift invoked either from a ViewController or an UIView..
Card91 Card91WalletBalance (Same framework used for wallet addition) Framework allows developers to add the webview component into their layout as per design..
Developers need to get the view onto their UIView and through invoking the viewDidLoad method with certain required parameters mentioned below and a library for viewing the card details can be utilised.
Installation
iOS Minimum Requirements :
Deployment Target - 14.0 or above
Usage
Below steps followed to integrate the Framework
Adding the framework
Add the xcframework file provided by us by drag and drop into the project "Frameworks,Libraries, and Embedded Content’ to “Embed & Sign".
Importing the framework
Framework will be ready to use after their adding on ViewController.
Create an IBOutlet of View(xib) and assign the “Card91MinKYC” class to the view in the storyboard
Use this Card91WalletBalance framework by importing.
Make sure not to keep any background colour of the webview since it is supposed to be transparent.
Initialising the Card91MinKYC Instance
Get the instance of the added Card91MinKYC onto your ViewController.
As shown in the example below .
Set the Listener as given below
@available(iOS 14.5, *)
class ViewController: UIViewController, Card91MinKYCListener{
func onCard91MinKYCEvent(message: String) {
print(message)
}
func onPageFinished(message: String) {
print(message)
}
func onPageStarted(message: String) {
print(message)
}
func onPageError(message: String) {
print(message)
}
@IBOutlet weak var card91View: Card91MinKYC?
override func viewDidLoad() {
super.viewDidLoad()
let popView = Card91MinKYC.instanceFromNib(self,
phoneNumber: "7708134620",
env: "QA",
templateId: "xoltt",
height: Double(self.card91View?.frame.height ?? 0.0),
width: Double(self.card91View?.frame.width ?? 0),
xAxis: UIScreen.main.bounds.origin.x,
yAxis: UIScreen.main.bounds.origin.y)
popView.delegate = self
self.card91View?.addSubview(popView)
}
}
Input parameters
Call the init() method of the Card91MinKYC with the below parameter .
Name | Type | Required | Description |
---|---|---|---|
phoneNumber | string | true | phone number of the user which has been received form login token service (Card91 API) |
templateId | string | true | Template id by default its "xoltt" or "default" |
env | string | true | "PROD" in case of production and "PROD_SANDBOX" on sandbox environment |
height | double | true | Enter the Outlet frame height |
width | double | true | Enter the Outlet frame width |
xAxis | double | true | Enter the origin X-coordinates |
yAxis | double | true | Enter the origin Y-coordinates |
Call Back methods
Extend the protocol WebViewListener for listening to the call back event from the webview.
Interface has below and their usage.
func onCard91MinKYCEvent(message: String) {
print(message)
}
func onPageFinished(message: String) {
print(message)
}
func onPageStarted(message: String) {
print(message)
}
func onPageError(message: String) {
print(message)
}
onPageStarted is called when the webpage is loaded.
onPageFinished is called when webpage loading is finished .
onPageError is called when there is any error while loading the page.
onCard91MinKYCEvent is called when wallet Card91MinKYC is initialised, detail is show, error or success event has happened.
DIFFERENT CALLBACLK EVENTS
The events are as follows:
Event Name | Description |
---|---|
C91_MIN_KYC_INITIALISED | The NSDL MIN KYC screen has been initialised. |
C91_MIN_KYC_SUCCESS | The API request related to the NSDL MIN KYC screen was successful. |
C91_MIN_KYC_API_FAILURE | The API request related to theNSDL MIN KYC screen has failed. |
C91_MIN_KYC_AUTHENTICATION_FAILURE | Authentication for the NSDL MIN KYC screen has failed. |
C91_MIN_KYC_SERVER_FAILURE | The server encountered an error while processing the NSDL MIN KYC request. |
C91_MIN_KYC_MISSING_PARAMETER | A required parameter is missing in the NSDL MIN KYC request. |
C91_MIN_KYC_OTP_SEND_FAIL | The API request for generating the OTP for the NSDL MIN KYC has failed. |
C91_MIN_KYC_OTP_VERIFICATION_FAIL | The API request for validating the OTP has failed for the NSDL MIN KYC |
C91_MIN_KYC_MOBILE_ALREADY_EXIST_OR_INVALID | KYC for this mobile number is already done or the mobile number is not valid. Payload of both these event will be different. |