API Reference

Reset ATM Pin Android Native Library

Installation and Usage Guide

Card91 Reset ATM PIN Android Library

Card91 Reset ATM PIN Android Library Integration
with Native Android Apps

Description

Purpose of this document is to illustrate the method to add Card91 ‘resetatmpin’ library to any android native application written in Kotlin invoked either from a fragment or an activity.

Card91 resetatmpin library allows developers to add the custom webview component into their layout as per design.

Developers need to get the view onto their activity and through invoking the init() method with certain required parameters mentioned below and a library for changing the atm pin.

Installation (Gradle and Manifest Configuration)

Android Minimum Requirements :

Gradle Version - 7.3.3
minSdkVersion - 21
compileSdkVersion - 32
targetSdkVersion - 32

Android Permission on Manifest:

<uses-permission android:name="android.permission.INTERNET" />

Update gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip

Gradle dependencies

dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.5.0'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

}



Also enable the binding on the same app gradle file under android tag if the binding has been used

buildFeatures {
       viewBinding true
   }
}

Usage

Below steps is defined to followed to integrate the Library

Add AAR (Android Library Files)

Add the .aar file provided by us at the libs folder on the project eg. resetatmpin.aar
Keep the aar file at location {Client project location}/app/src/main/libs
Add below line on the app gradle

implementation files('../app/src/main/libs/resetatmpin.aar')

or

implementation(name: 'resetatmpin', ext: 'aar' )

📘

Note

Clean and Build the android app to get the dependencies added on to the application

ADD RESET ATM PIN VIEW COMPONENT ON LAYOUT

Library class will be ready to use after their adding on gradle.
Add Card91ResetAtmPin onto the layout where the developer wants to use it .
Make sure not to keep any background colour of the webview since it is supposed to be transparent.

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".RestAtmPinActivity">
    <com.card91.resetatmpin.Card91ResetAtmPin
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/reset_atm_pin"/>

</androidx.constraintlayout.widget.ConstraintLayout>

SETUP CARD VIEW COMPONENT

Get the instance of the added Card91ResetAtmPin onto your activity or fragment.
As shown in the example below .
Set the Listener as given below

   private lateinit var mWebView: Card91ResetAtmPin
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_rest_atm_pin)

        mWebView = findViewById<Card91ResetAtmPin>(R.id.reset_atm_pin)
        mWebView.setListener(this, this)
        val cardId = "" //  Card holder card id for which details needs to be shown
        val token = "" // Authorization token
        val env="PROD" // "PROD" in case of production and "PROD_SANDBOX" on sandbox environment
        val mobile= "" // Card holder mobile number with country code.eg +91-9810581197
      	val templateId= "xoltt"
        mWebView.init(this,cardId, token, env, mobile,templateId)
    }

INPUT PARAMETER DETAILS

Call the init() method of the Card91ResetAtmPin with the below parameter .

NameTypeRequiredDescription
contextContexttrueActivity context or Fragment activity context is passed here
cardIdstringtruecardId which has been received form login token service (Card91 API)
tokenstringtrueAuth Token received from the Card91 APIs
mobilestringtrueMobile number of the card holder ( format +91-88**23 )
envstringtrue"PROD" in case of production and "PROD_SANDBOX" on sandbox environment
templateIdstringfalsetemplateId eg."xoltt"

SUBSCRIBE FOR LISTENING CALLBACK EVENTS

Implement Interface Card91ResetAtmPin.Listener for listening to the call back event from the Reset Atm Pin library .

Interface has below and their usage .

override fun onPageStarted(url: String?) {
        Log.w("Page Started", url.toString())
    }

    override fun onPageFinished(url: String?) {
        Log.w("Page onPageFinished", url.toString())
    }

    override fun onPageError(errorCode: Int, description: String?, failingUrl: String?) {
        Log.w("Page onPageError", description.toString())
    }

    override fun onResetAtmPinEvent(type: String?) {
        Log.w("Page onResetAtmPinEvent", type.toString())
    }

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.
onResetAtmEvent is called when card is initialised, detail is show, CVV is shown or copy card number event has happened.

DIFFERENT CALLBACLK EVENTS

The events are as follows:

Event NameDescription
C91_RESET_PIN_SUCCESSCalled when the server-side APIs load successfully. At this time, ATM pin change is successfully done.
C91_RESET_PIN_AUTHENTICATION_FAILURECall back event type when client is passing incorrect or expired auth token.
C91_RESET_PIN_MISSING_PARAMETERCall back event type when client is not passing any required/blank parameter .
C91_RESET_PIN_SERVER_FAILURECall back event type when there is server service exception with error code 500 to 599
C91_RESET_PIN_OTP_SCREEN_INITIALISEDCalled when the server-side ATM pin changes OTP screen loads successfully.