Card91 Wallet List iOS Framework Integration with Native iOS Apps
Card91 Wallet Balance iOS Framework
Card91 Wallet List iOS Framework Integration with Native iOS Apps
Description
Purpose of this document is to illustrate the method to add Card91 ‘Card91WalletBalance’ library to any iOS native application written in swift invoked either from a ViewController or an UIView.
Card91 Card91WalletBalance 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 “CardWalletBalance” 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 Card91WalletBalance Instance
Get the instance of the added Card91WalletBalance onto your ViewController.
As shown in the example below .
Set the Listener as given below
import UIKit
import Card91WalletBalance
@available(iOS 14.5, *)
class ViewController: UIViewController, CardWalletBalanceListener {
func onPageFinished(message: String) {
print(message)
}
func onPageStarted(message: String) {
print(message)
}
func onPageError(message: String) {
print(message)
}
func onWalletBalance(message: String) {
print(message)
}
@IBOutlet weak var walletView: CardWalletBalance!
override func viewDidLoad() {
super.viewDidLoad()
let popView = CardWalletBalance.instanceFromNib(self,
cardId: "221010085745614ID1CARD0566110", //Enter the cardId
token: "C91CHiHrDSo4TbJHAAzLOMx1nZTyfGL+mEEozXxu644wrgvU=", //Enter the sdkAuthToken
env: "PROD_SANDBOX", //Enter the env
height: self.walletView.frame.height, //Enter the height of the outlet
width: self.walletView.frame.width, //Enter the width of the outlet
xAxis: UIScreen.main.bounds.origin.x, //Enter the origin x-Coordinates
yAxis: UIScreen.main.bounds.origin.y, //Enter the origin y-coordinates
templateId: "xoltt")
//Enter the template Id
popView.delegate = self
self.walletView.addSubview(popView)
}
}
Input parameters
Call the init() method of the Card91WalletBalance with the below parameter .
Name | Type | Required | Description |
---|---|---|---|
cardId | string | true | cardId which has been received form login token service (Card91 API) |
token | string | true | Auth Token received from the Card91 APIs |
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 onPageFinished(message: String) {
print(message)
}
func onPageStarted(message: String) {
print(message)
}
func onPageError(message: String) {
print(message)
}
func onWalletBalance(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.
onWalletBalance is called when wallet Balance is initialised, detail is show, error or success event has happened.
DIFFERENT CALLBACLK EVENTS
The events are as follows:
Event Name | Description |
---|---|
c91_WALLET_SCREEN_SUCCESS | Called when the server-side APIs load successfully and Card balance is show without any error |
C91_WALLET_AUTHENTICATION_FAILURE | Call back event type when client is passing incorrect or expired auth token. |
C91_WALLET_API_FAILURE | Call back event type when wallet api fails to get the successfully response |
C91_WALLET_MISSING_PARAMETER | Call back event type when client is not passing any required/blank parameter . |
C91_WALLET_SERVER_FAILURE | Call back event type when there is server service exception with error code 500 to 599 |
C91_WALLET_SCREEN_INITIALISED | Called when the server-side card view SDK loads successfully. |