Android SDK

Introduction

This Android SDK provides an interface to load Aerosync-UI in native Android application. Securely link your bank account through your bank’s website. Log in with a fast, secure, and tokenized connection. Your information is never shared or sold.

1. Install Bank-Link-Sdk

Add latest verion of _com.aerosync/bank-link-sdk_ library to your project dependencies.

Maven Central: https://central.sonatype.com/artifact/com.aerosync/bank-link-sdk/overview
https://repo1.maven.org/maven2/

<dependency>
    <groupId>com.aerosync</groupId>
    <artifactId>bank-link-sdk</artifactId>
    <version>1.0.9</version>
</dependency>
implementation group: 'com.aerosync', name: 'bank-link-sdk', version: '1.0.9'

2. Minimal example to implement bank-link-sdk

AndroidManifest.xml

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

Homepage.kt

package com.aerosync.test_client_android

import android.content.Context
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.Toast
import com.aerosync.bank_link_sdk.EventListener
import com.aerosync.bank_link_sdk.Widget

class Homepage : AppCompatActivity(), EventListener {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_homepage)
    }

    fun onClick(v: View?) {
        when (v?.id) {
            R.id.button -> {
                // open Aerosync widget
                var config = Widget(this, this);
                config.environment = "PROD"; //DEV, STAGE,PROD
                config.deeplink = "aerosync://bank-link";
                config.token = "<PROD TOKEN>";
                config.open();
            }
        }
    }

    override fun onSuccess(response: String?, context: Context) {
        // perform steps when user have completed the bank link workflow
        // sample code
        Toast.makeText(context, "onSuccess--> $response", Toast.LENGTH_SHORT).show()
        val intent = Intent(context, Homepage::class.java)
        context.startActivity(intent);
    }

    override fun onEvent(type: String?, payload: String?, context: Context) {
        // capture all the Aerosync events
        // sample code
        Toast.makeText(context, "onEvent--> $payload", Toast.LENGTH_SHORT).show()
    }

    override fun onError(error: String?, context: Context) {
        // error handling
        // sample code
        Toast.makeText(context, "onError--> $error", Toast.LENGTH_SHORT).show()
    }

    override fun onClose(context: Context) {
        // when widget is closed by user
        // sample code
        Toast.makeText(context,"widget closed", Toast.LENGTH_SHORT).show()
        val intent = Intent(context, Homepage::class.java)
        context.startActivity(intent);
    }
}

3. Bank Link SDK configuration

ParameterTypeRequiredDescription
tokenstringYesRequest AeroSync Token using GET /aggregatorCredentials endpoint.
Reference:
https://api-aeropay.readme.io/reference/aggregatorcredentials
https://developer.aeropay.com/api/aeropay/doc/
environmentstringYesPermitted values are [STAGE, PROD]
consumerIdstringNoUnique ID that represents the client to apply the customization.

4. Aerosync-UI Response:

Bank-Link-SDK will send response for below events:

4.1 onSuccess event

This event will be triggered when a bank is added successfully and the user clicks on "continue" button in the final AeroSync-UI page. Example of response is shown below:

 {  
    "ClientName": "client3",  
    "FILoginAcctId": "{\"u_guid\":\"USR-701a457e-5b93-4598-b7a1-b968c495ee3f\", \"m_guid\": \"MBR-d699c457-90f7-4b96-96c1-c50a445eabec\", \"a_guid\": \"ACT-9f5549d6-e402-43f4-8351-cd4018de7a80\"}",  
    "user_id": "a2c7f64f-3df9-4090-b3bd-ad6fc3003c90",  
    "user_password": "735e33b9-78ec-4887-99d7-a3056997ceb9"  
  }

4.2 onClose event

This event will be triggered when the user closes the AeroSync-UI window. If the user closes the AeroSync-UI window by tapping the 'X' button on any page, the callback function will be called which can be used to navigate the user to the previous page on parent component.

4.3 onEvent event

AeroSync-UI will trigger event on each page load. The response will contain the follow attributes:

{
  "pageTitle": "Verify Your Identity",
  "onLoadApi": "/token",
 }

4.4 onError event

This event will be triggered if the WebView or AeroSync-UI fails to load. The response will be string describing the error.

{
  "code": "AC-200",
  "message": "We had issues connecting to this banking institution.Please select a different bank or try again later."
}

5. Release configuration:

When building the release version of your app with minify enabled, update your proguard-rules.pro file as follow:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
-keepclassmembers class com.aerosync.bank_link_sdk.EventListener {
   public *;
}