Statement SDK Usage

A step-by-step guide on how to initialize Statement SDK on Android.

👍

Visit our Brankas Collection for Android, to see a sample project of how to integrate the SDK.

📘

Minimum Requirements

  1. Android Studio 3.0 but preferably the latest version
  2. Minimum Android SDK: API 21 or Android 5.0

Installation & Updating

Please refer to the Installation page for Android platform installation and update steps

Initialization

  1. Call the initialize function from the StatementTapSDK and pass the context and API key provided by Brankas.
import as.brank.sdk.tap.statement.StatementTapSDK;

StatementTapSDK.INSTANCE.initialize(context, apiKey, null, false);
import `as`.brank.sdk.tap.statement.StatementTapSDK

StatementTapSDK.initialize(context, apiKey, null, false)

❗️

To use the Sandbox environment, set the optional isDebug option to true

  1. The checkout function can now be called once the initialize function has been called.

Usage

The SDK has a checkout function wherein it responds with a redirect url used to launch the Tap web application. An option is given either to use the url manually via retrieveCheckoutURL() function or let the SDK launch it through its internal WebView.

In order to use the checkout function, an StatementTapRequest is needed to be created and be passed. It has the following details:

  1. country - refers to the country of origin of the bank you wanted to do statement retrieval with. There are three countries currently supported: Philippines (PH), Indonesia (ID) and Thailand (TH).

  2. bankCodes - refers to the list of banks to be shown within the Tap Web Application. If null value is passed, the SDK automatically fills up all the available banks depending on the country passed.

  3. externalId - refers to the identifier passed to track the request.

  4. successURL - refers to the URL where the user will be redirected to after a successful statement retrieval.

  5. failURL - refers to the URL where the user will be redirected to after a failed statement retrieval.

  6. organizationName - refers to the name of the organization that will be displayed while doing statement retrieval.

  7. redirectDuration - refers to the time in seconds when the user should be redirected upon finishing statement retrieval. The default value is 60 seconds.

  8. dismissalDialog - pertains to the showing of alert dialog when closing the WebView. It consists of message, positiveButtonText and negativeButtonText. Just set this value to null to remove the alert dialog when closing the application.

  9. statementRetrievalRequest - pertains to the statement retrieval after Tap Web Session. startDate and endDate can be configured to retrieve transactions within date range.

  10. includeBalance - refers to the inclusion of balance within statement retrieval; default value is false.

Here is a sample on how to use it and call:

import as.brank.sdk.tap.statement.StatementTapSDK;
import as.brank.sdk.core.CoreError;
import as.brank.sdk.tap.CoreListener;
import tap.model.BankCode;
import tap.model.Country;
import tap.request.statement.StatementTapRequest;
import tap.model.statement.StatementResponse;
import tap.model.Reference;

StatementTapRequest.Builder request=new StatementTapRequest.Builder()
        .country(Country.PH)
        .externalId("External ID")
        .successURL("https://google.com")
        .failURL("https://hello.com")
        .organizationName("Organization Name");

        StatementTapSDK.INSTANCE.checkout(this, request.build(),new CoreListener<String>(){
		@Override
		public void onResult(String data,CoreError error){
        		System.out.println("DATA: "+data);
        	}
        }, 3000, false, true);

@Override
public void onActivityResult(int requestCode,int resultCode,Intent data){
        super.onActivityResult(requestCode, resultCode, data);
        if(requestCode == 3000){
        	if(resultCode == RESULT_OK){
        		StatementResponse statementResponse = data.getParcelableExtra.getParcelableExtra<Reference<StatementResponse>>(
                    StatementTapSDK.STATEMENTS)
        		String statementId = statementResponse.get().statementId;
        		Toast.makeText(this, "Statement Retrieval Successful! Here is the statement id: "+statementId,
        		Toast.LENGTH_SHORT).show();
        	}
        	else{
        		String error = data.getStringExtra(StatementTapSDK.ERROR);
        		String errorCode = data.getStringExtra(StatementTapSDK.ERROR_CODE);
        		Toast.makeText(this, error+" "+errorCode, Toast.LENGTH_LONG).show();
        	}
        }
}
import `as`.brank.sdk.tap.statement.StatementTapSDK
import `as`.brank.sdk.core.CoreError
import `as`.brank.sdk.tap.CoreListener
import tap.model.BankCode
import tap.model.Country
import tap.request.statement.StatementTapRequest
import tap.model.statement.StatementResponse
import tap.model.Reference

val request = StatementTapRequest.Builder()
            .country(Country.PH)
            .externalId("External ID")
            .successURL("https://google.com")
            .failURL("https://hello.com")
            .organizationName("Organization Name")

StatementTapSDK.checkout(this, request.build(), object: CoreListener<String>() {

        override fun onResult(data: String?, error: CoreError?) {
                println("DATA: "+data)
        }

}, 3000, false, true);3.1.23.1.2

    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        if(requestCode == 2000) {
            if(resultCode == RESULT_OK) {
                val statementResponse = data?.getParcelableExtra<Reference<StatementResponse>>(
                    StatementTapSDK.STATEMENTS)
                val statementId = statementResponse?.get?.statementId
                Toast.makeText(this,
                    "Statement Retrieval Successful! Here is the statement id: $statementId",
                    Toast.LENGTH_SHORT).show()
            }
            else {
                val error = data?.getStringExtra(StatementTapSDK.ERROR)
                val errorCode = data?.getStringExtra(StatementTapSDK.ERROR_CODE)
                Toast.makeText(this, "$error ($errorCode)", Toast.LENGTH_LONG).show()
            }
        }
	}

📘

Settings in the Checkout Function

AutoConsent is set to false by default. To enable, set the 2nd to the last parameter to true.

useRememberMe is set to false by default. To enable, just pass false to the last parameter.

actionBarText is set to null by default so the ActionBar gets hidden. To show it, just pass a String to it.

showBackButton is set to true by default. To hide the button, just set the value to false.

Statement List Download

  1. Call the initDownload() function inside the onCreate() function of the Activity.
```java
import as.brank.sdk.tap.statement.StatementTapSDK;

@Override
public void onCreate(Bundle savedInstanceState) {
	StatementTapSDK.INSTANCE.initDownload(this);
}

```
```kotlin
import `as`.brank.sdk.tap.statement.StatementTapSDK

override fun onCreate(savedInstanceState: Bundle?) {
	StatementTapSDK.initDownload(this)
}

```

📘

To avoid crash pertaining to register

Call the initDownload() function in onCreate() ONLY

  1. Call downloadStatement() function to initiate the downloading of the list of statements in CSV format. Remember to pass the Statement ID returned from the previous section Usage.
import as.brank.sdk.tap.statement.StatementTapSDK;
import as.brank.sdk.core.CoreError;
import as.brank.sdk.core.CoreListener;

StatementTapSDK.INSTANCE.downloadStatement(this, "STATEMENT_ID", new CoreListener<Pair<String, byte[]>>() {
	@Override
	public void onResult(Pair<String, byte[]> data, CoreError error) {
		if(data != null)
        		System.out.println("STATEMENT PATH: "+data.getFirst());
        }
}, true);
import `as`.brank.sdk.tap.statement.StatementTapSDK
import `as`.brank.sdk.core.CoreError
import `as`.brank.sdk.core.CoreListener

StatementTapSDK.downloadStatement(this, "STATEMENT_ID", object: CoreListener<Pair<String?, ByteArray>> {
	override fun onResult(data: String?, error: CoreError?) {
		data?.let {
			println("STATEMENT PATH: "+data.first)	
		}
        }
}, true)

📘

NOTE:

Data returned in the onResult() function pertains to the directory or URI path where the file has been saved and the statement data in byte array.

  • If it is null, an error occurred.
  • If first in pair is null, the file is not saved to any directory in the mobile phone.

There is an option to save the CSV or not; just update enableSaving parameter.

App Tracking and Privacy Changes

Logging of Tap Web Flow

A new feature has been added internally, starting v4.0 of Statement Tap SDK. Brankas can track the flow of a transaction while performing a Statement Retrieval within Tap Web App. This will aid in pointing out some errors within transactions and eventually improve the overall experience.

How to turn off the logging feature

The logging feature is enabled by default. To turn off the feature, you can change the value of isLoggingEnabled within the initialize() function as the below samples;

import as.brank.sdk.tap.statement.StatementTapSDK;

StatementTapSDK.INSTANCE.initialize(context, apiKey, null, false, false);
import `as`.brank.sdk.tap.statement.StatementTapSDK

StatementTapSDK.initialize(context, apiKey, null, false, false)