iOS

Connect your iOS app with SingleView SDK

The installation method integrates the provided .xcframework into your Xcode project. Once done, you can easily import the SDK into your Swift files.

Usage with View Controllers

Initialize

Connect

.connect()

Ensure the SingleView SDK is appropriately set up and ready to handle your requests, call SVSDK.shared.connect(clientID:clientId, clientCode: clientcode, version: version, merchantID: merchantID, language: .en, customization: customization, response: @escaping(singleViewSDK.SVSDKStatus)-> Void) during viewDidLoad or before making any calls to the SDK. This will initialize the SDK with the necessary parameters, making it ready to function as expected within your app.

Begin by invoking the .connect() method of SingleViewSDK in the ViewDidLoad. To do this, you must pass the following parameters:

  • clientID
  • clientCode
  • version
  • merchantID
  • language
  • customization

It is mandatory to provide Merchant ID to access all the methods available within SingleView SDK. As for the language parameter, you can choose between English and Arabic using the SVSDKLanguage Enum.

import UIKit
import SingleViewSDK

class ViewController: UIViewController {
  let clientID = "your-client-id"
  let clientSecret = "your-client-secret"
  let version = "version"
  var customisation: SVSDKCustomisation?
    let merchantID = "your-merchant-id"
  
  override func ViewDidLoad() {
    super.viewDidLoad()
    SVSDK.shared.connect(clientID:clientID, clientCode: clientcode,, version: String,  merchantID: String, language: SVSDKLanguage(Optional), customization: SVSDKCustomisation(Optional)) { status in
    }
    }
  }

🪧Note
Make sure to replace the above with the actual values or variables needed for the setup.

Setup Merchant ID

.setupMerchantID()

⚙️Merchant ID can be set up during the initial setup or through the .setupMerchantID method.

SVSDK.shared.setupMerchantID(merchantID: merchantID) ensures that the merchantID is set correctly and ready to be used throughout your interactions with the SVSDK services.

Here's how you can initiate the method to .setupMerchantID:

// ViewController.swift

import UIKit
import SingleViewSDK

class ViewController: UIViewController {
  override func ViewDidLoad() {
    super.viewDidLoad()
    SVSDK.shared.setupMerchantID(merchantID: self.merchnatID) { result in
    print(result)
    }
  }

Manage Merchant

Create New Merchant

.createNewMerchant()

.createNewMerchant() is a method to create a new merchant in the SingleView SDK that requires the name, email, and mobile parameters.

@IBAction func toCreateNewMerchant() {
  SVSDK.shared.createNewMerchant(name : name, email: email, mobile: mobile) { result in
  print(result)
  }
}

View Merchants

.getAllMerchants()

The .getAllMerchants() method retrieves the list of all the Merchants' information mapped with a particular clientID and clientCode.

@IBAction func getAllMerchantsInfo() {
  SVSDK.shared.getAllMerchants(pageNo:string, pageSize:string) {
    result in
    print(result)
    }
}

Consent Management

Create Consent

.createConsent()

The .createConsent() method facilitates the addition or creation of consent for a bank account, allowing the retrieval of balance and transaction information. For the use case parameter, you can select one of the use cases available in our SDK's use cases Enum.

@IBAction func createConsent() {
  SVSDK.shared.createConsent(presentingViewController: UIViewController, txnFromDate: transactionFromDate, txtToDate: transactionTo, consentExpDate: consentExpiryDate, useCase: SingleViewSDK.UseCase) { result in
  print(result)
  }
}

Revoke Consent

.revokeConsent()

The revokeConsent() method is designed to invalidate a consent that has been previously created and is active. To execute this method, you must provide the bank object with bankCode and ConsentID as parameters. The bank object is of type SVRequestBank, which contains the code to which the Consent ID is mapped. Consent ID represents the unique identifier the Bank authorized for a specific account(s).

@IBAction func revokeConsent() {
  SVSDK.shared.revokeConsent(bank : [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

Use Case Methods

Accounts

.allAccountsCheck()

The .allAccountsCheck() method is used to retrieve a list of accounts that are linked with a specific consent. For this method, you must provide the bank object with bankCode and ConsentID as parameters. The bank object is of type SVRequestBank, which contains the code to which the consent ID is mapped.

Consent ID represents the unique identifier the Bank authorizes for the specific account(s). Using this information, the method will return a list of connected accounts associated with the provided consent.

@IBAction func getAllConnectedAccounts() {
  SVSDK.shared.getAllConnectedAccounts(bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

Balance

.getAllAccountsBalance()

The .getAllAccountsBalance() method obtains a list of balances for accounts associated with a specific consent. For this method, you must provide the bank object with bankCode and ConsentID parameters. The bank object is of type SVRequestBank, which contains the code to which the consent ID is mapped.

Consent ID represents the unique identifier the Bank authorized for the specific consent. Using this information, the method will return a list of balances for all accounts linked to the provided consent.

@IBAction func getAllAccountsBalance() {
  SVSDK.shared.getAllAccountsBalance(bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

.getAccountsBalanceByAccount()

The getAccountsBalanceByAccount() method is designed to provide the balance of a specific account. For this method, you must give the bank object with bankCode, ConsentID, and AccountID as parameters.

The bank object is of type SVRequestBank, which contains the code to which the consent ID is mapped. Consent ID represents the unique identifier the Bank authorized for the specific consent. Account ID identifies the account for which the balance is required.

Using this information, the method will fetch and return the balance for the specified account associated with the given consent and bank.

@IBAction func getAccountsBalanceByAccount() {
  SVSDK.shared.getAccountsBalanceByAccount(bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

Transactions

.getAllAccountsTransactions()

The getAllAccountsTransactions() method is designed to provide a list of transactions for all accounts associated with a specific consent. For this method, you must give the bank object with bankCode and ConsentID parameters.

The bank object is of type SVRequestBank, which contains the code to which the consent ID is mapped. Consent ID represents the unique identifier the Bank authorized for the specific consent. By providing this information, the method will retrieve and return a list of transactions for all accounts linked to the offered consent and bank. These transactions will include transaction amount, date, description, and other relevant information related to each transaction for all the connected accounts.

@IBAction func getAllAccountsTransactions() {
  SVSDK.shared.getAllAccountsTransactions(formDate:string, toDate: string,  bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

.getTransactionsByAccount()

The getTransactionsByAccount() method is intended to provide specific account transactions for a given account. To utilize this method, you need to provide the bank object with bankCode, ConsentID, and also Account ID parameters.

@IBAction func getTransactionsByAccount() {
  SVSDK.shared.getTransactionsByAccount(bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

Direct Debits

.getAllAccountsDirectDebits()

The getAllAccountsDirectDebits() method retrieves a list of direct debits for all accounts associated with a specific consent. For this method, you must provide the bank object with bankCode and ConsentID parameters.

The bank object is of type SVRequestBank, which contains the code to which the consent ID is mapped. Consent ID represents the unique identifier the Bank authorized for the specific consent. By providing this information, the method will fetch and return a list of direct debits for all accounts linked to the offered consent and bank.

@IBAction func getAllAccountsDirectDebits() {
  SVSDK.shared.getAllAccountsDirectDebits(bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

.getDirectDebitsByAccount()

The getDirectDebitsByAccount() function retrieves information on the Direct Debits associated with a particular account. For this method, you must provide the bank object with the bankCode, ConsentID, and the Account ID parameters.

@IBAction func getDirectByAccount() {
  SVSDK.shared.getDirectDebitsByAccount(bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

Standing Orders

.getAllAccountsStandingOrders()

The getAllAccountsStandingOrders() provides a list of standing orders for all accounts associated with a specific consent. For this method, you must provide the bank object with bankCode and ConsentID parameters.

The method will retrieve and return a list of standing orders for all accounts linked to the provided consent and bank.

@IBAction func getAllAccountsStandingOrders() {
  SVSDK.shared.getAllAccountsStandingOrders(bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

.getStandingOrdersByAccount()

The getTransactionsByAccount() retrieves information on the Standing Orders associated with a particular account. For this method, you must provide the bank object with the bankCode, ConsentID, and the Account ID parameters.

@IBAction func getStandingOrdersByAccount() {
  SVSDK.shared.getStandingOrdersByAccount(bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

Scheduled Payments

.getAllAccountsSchedulePayments()

The getAllAccountsSchedulePayments() method is used to retrieve a list of scheduled payments for all accounts associated with a specific consent. To use this method, you must provide the bank object with bankCode and ConsentID as parameters.

By providing this information, the method will fetch and return a list of scheduled payments for all accounts linked to the provided consent and bank.

@IBAction func getAllAccountsSchedulePayments() {
  SVSDK.shared.getAllAccountsSchedulePayments(bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

.getSchedulePaymentsByAccount()

The getSchedulePaymentsByAccount() method is designed to retrieve specific account schedule payments. It requires the bank object containing bankCode and ConsentID and the AccountID to fetch the schedule payments for the specified account.

@IBAction func getSchedulePaymentsByAccount() {
  SVSDK.shared.getSchedulePaymentsByAccount(bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

Use cases

Account Aggregation

.getAccountAggregationData()

The getAccountAggregationData() method will fetch the account data like balance and transactions. For this method you need to provide the bank object with bankCode and ConsentID and also formDate and toDate as a param. Here the bank is the SVRequestBank object which contains for which the Consent ID is mapped to, and ConsentID is the identification that is authorised by the Bank. And formDate param is used to get the statement from, toDate to get the statement to, and Date should be in ISO format Ex: 2022-07-12T11:11:29.245Z.

@IBAction func getAccountAggregationData() {
  SVSDK.shared.getAccountAggregationData(fromDate: string, toDate: string, bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

E-Statement

.getEStatementData()

The getEStatementData() method will fetch account transactions for the specified date range. For this method you need to provide the bank object with bankCode and ConsentID and also formDate and toDate as a param. Here the bank is the SVRequestBank object which contains for which the Consent ID is mapped to, and ConsentID is the identification that is authorised by the Bank. And formDate param is used to get the statement from, toDate to get the statement to, and Date should be in ISO format Ex: 2022-07-12T11:11:29.245Z.

@IBAction func getEStatementData() {
  SVSDK.shared.getEStatementData(fromDate: string, toDate: string, bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

Income Check

.getIncomeCheckData()

The getIncomeCheckData() method will give you the Income check data of the account(s) for a specific date range. For this method you need to provide the bank object with bankCode and ConsentID and also formDate and toDate as parameters.

@IBAction func getIncomeCheckData() {
  SVSDK.shared.getIncomeCheckData(fromDate: string, toDate: string, bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

Expense Check

.getExpenseCheckData()

The getExpenseCheckData() method gives you the expenses data for a specific date range. For this method you need to provide the bank object with bankCode and ConsentID and also formDate and toDate as parameter.

@IBAction func getExpenseCheckData() {
  SVSDK.shared.getExpenseCheckData(fromDate: string, toDate: string, bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

KYC Info

.getKYCInfoData()

The getKYCInfoData() method fetches the KYC info data from the bank for the specified bank account for a specific date range. For this method you need to provide the bank object with bankCode and ConsentID and also formDate and toDate as parameters.

@IBAction func getKYCInfoData() {
  SVSDK.shared.getKYCInfoData(fromDate: string, toDate: string, bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

Credit Check

.getCreditCheckData()

The getCreditCheckData() method fetches the account info and data needed to perform credit check from the bank for the specified bank account and date range. For this method you need to provide the bank object with bankCode and ConsentID and also formDate and toDate as parameters.

@IBAction func getExpenseCheckData() {
  SVSDK.shared.getExpenseCheckData(fromDate: string, toDate: string, bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

IBAN Verification

.getIBANVerificationForAllAccountsResponse()

The .getIBANVerificationForAllAccountsResponse() method fetches validates the given IBANs. For this method you need to provide the bank object with bankCode and ConsentID and also formDate and toDate as parameters.

Here the bank is the SVRequestBank object which contains code for which the consentid is mapped to, and ConsentID is the ID which is authorised from the Bank. And iban number which needs to be validated.

@IBAction func getIBANVerificationForAllAccountsResponse() {
  SVSDK.shared.getIBANVerificationForAllAccountsResponse( bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

.getIBANVerificationByAccountResponse()

The .getIBANVerificationByAccountResponse() method fetches validates the given IBAN for an account. This method requires you need to provide the bank object with bankCode and ConsentID and also formDate and toDate as parameters.

Here the bank is the SVRequestBank object which contains code for which the consentid is mapped to, and ConsentID is the ID which is authorised from the Bank. And iban number which needs to be validated.

@IBAction func getIBANVerificationByAccountResponse() {
  SVSDK.shared.getIBANVerificationByAccountResponse( bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

Customer Verification

.getCustomerVerificationResponse()

The getCustomerVerificationResponse() method will give you the customer verification response. For this method you need to provide the bank object with bankCode as a parameter. Here the bank is the SVRequestBank object which contains code for which the consentid is mapped and authorized by the Bank.

@IBAction func getCustomerVerificationResponse() {
  SVSDK.shared.getCustomerVerificationResponse( bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

Tax Filing

.getTaxFilingData()

The getTaxFilingData() method will give you the Tax filing report data for a specific date range and mentioned Consent ID. For this method you need to provide the bank object with bankCode and ConsentID and also formDate and toDate as a parameters. Here the bank is the SVRequestBank object which contains code for which the consentid mapped to an account authorized by the Bank. formDate parameter is used to get the Tax filing report from till the toDate mentioned in the ISO format Ex: 2022-07-12T11:11:29.245Z.

@IBAction func getTaxFilingData() {
  SVSDK.shared.getTaxFilingData(fromDate: string, toDate: string, bank: [SingleViewSDK.SVRequestBank]) { result in
  print(result)
  }
}

Customization

Client can customize the colours of the SDK by using the below information:

navigationBarColorUIColor
appBackGroundColorUIColor
textPrimaryColorUIColor
textSecondaryColorUIColor
textTertiaryColorUIColor
btnPrimaryTextColorUIColor
btnPrimaryBGColorUIColor
btnSecondaryTextColorUIColor
btnSecondaryBGColorUIColor
btnBorderColorUIColor
separatorColorUIColor
regularFontNameString
mediumFontNameString
boldFontNameString

Language

arArabic
enEnglish

SVSDK Status Datatype

TagType
StatusBool
MessageString