Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

okraHQ/okra-android-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Okra Widget Android SDK

alt text

Android SDK for implementing the Okra widget - Okra is a safe and secure web drop-in module and this library provides a front-end web (also available in iOS and JavaScript) SDK for account authentication and payment initiation for each bank that Okra supports.

Try the demo

Checkout the widget flow to view how the Okra Widget works. Click "See How it Works"

Before getting started

  • Checkout our get started guide to create your developer account and retrieve your Client Token, API Keys, and Private Keys.
  • Create a sandbox customer, so you can get connecting immediately.

Bonus Points

  • Setup Slack Notifications so you can see your API call statuses and re-run calls in real-time!

Get Started

This library would help you add the Okra Widget to you native android app in no time. All you need to do is ...

Install

gradle
  1. Add it in your root build.gradle at the end of repositories:
allprojects {
  repositories {
   ...
   maven { url 'https://jitpack.io' }
  }
}
  1. Add the dependency:
dependencies {
  implementation 'com.github.okraHQ:okra-android-sdk:v2.57'
 }

Usage versions v2.1-beta and below

ArrayList products = new ArrayList<Enums.Product>();
products.add(Enums.Product.auth);
products.add(Enums.Product.transactions);
OkraOptions okraOptions = new OkraOptions(true, "c81f3e05-7a5c-5727-8d33-1113a3c7a5e4","5d8a35224d8113507c7521ac", products, Enums.Environment.sandbox,"Bassey");
Okra.create(MainActivity.this, okraOptions);

Usage versions v2.2-beta and above

final Map<String, Object> guarantor = new HashMap<>();
        guarantor.put("status", true);
        guarantor.put("message","hello nurse");
        guarantor.put("number",3);

        Map<String, Object> dataMap  = new HashMap<String, Object>() {{
            put("products", new String[]{"auth", "balance", "identity", "transactions"});
            put("key", "public key");
            put("token", "client token");
            put("env", Enums.Environment.production_sandbox.toString());
            put("clientName", "Chris");
            put("color", "#953ab7");
            put("limit", "24");
            put("corporate", false);
            put("connectMessage", "Which account do you want to connect with?");
            put("guarantors", guarantor);
            put("callback_url", "");
            put("redirect_url", "");
            put("logo", "https://cdn.okra.ng/images/icon.svg");
            //put("filter", new Filter(Enums.IndustryType.all.toString(), banks));
            put("widget_success", "Your account was successfully linked to Okra, Inc");
            put("widget_failed", "Which account do you want to connect with?");
            put("currency", "NGN");
            put("exp", "2020-08-06");
            put("manual", false);
            put("success_title", "it has entered success");
            put("success_message", "this is the success message");
        }};

        Okra.create(MainActivity.this, dataMap);

OkraOptions

Name Type Required Default Value Description
isWebview Boolean true true
key String true undefined Your public key from Okra.
token String true undefined Your client token from okra.
ussd Boolean false undefined Allow customer's to connect via USSD (https://docs.okra.ng/docs/ussd-beta)
products ArrayList<Enums.Product> true undefined The Okra products you want to use with the widget.
payment Booelan false Whether you want to initiate a payment (https://docs.okra.ng/docs/payments)
charge Object false Payment charge opject (https://docs.okra.ng/docs/creating-a-charge)
env Enums.Environment true undefined
clientName String true undefined Name of the customer using the widget on the application
webhook String true undefined The Url that Okra send the client's data to.

View a complete list of customizable options here

Getting the okra onSuccess and onError response.

Okra gives provision to access the response data on the mobile device. Okra wraps the response in the OkraHandler object and passes it back to the View which called it.

  @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == 1) {
            if(resultCode == Activity.RESULT_OK){
                OkraHandler okraHandler = (OkraHandler) data.getSerializableExtra("okraHandler");
                String rr = okraHandler.getData();
                Log.i("okra okraHandler ", okraHandler != null ? okraHandler.getData() : "nothing");
            }
            if (resultCode == Activity.RESULT_CANCELED) {
                //Write your code if there's no result
            }
        }
    }

OkraHandler

Name Type Default Value Description
isDone boolean false flag indicates if the okra process has finished
isSuccessful boolean false flag indicates if the okra process was successful.
hasError boolean false flag indicates if the okra process has an error.
Data Json null this is the response that okra provides.

Data Dictionary

Auth

Field Required Description
id
ObjectID
Yes Unique Auth ID (Unique Okra Identifier)
validated
Boolean
Yes Customer authentication status
bank
ObjectID
Yes Unique Bank ID (Unique Okra Identifier)
customer
ObjectID
Yes Unique Customer ID (Unique Okra Identifier)
record
ObjectID
Yes Unique Record ID (Unique Okra Identifier)
owner
ObjectID
Yes Unique Company ID (Unique Okra Identifier) (Your Client Token)
created_at
Object
Yes Date Auth was fetched
last_updated
Object
Yes Last Date Auth was fetched

Balance

Field Required Description
id
ObjectID
Yes Unique Balance ID (Unique Okra Identifier)
available_balance
Integer
Yes Amount of available funds in account
ledger_balance
Integer
Yes Closing balance of account
currency
String
Yes The currency of the account
connected
Boolean
Yes Customer connection status (Did they choose to connect this account to you)
env
String
Yes Okra API Env the transaction was pulled from production or production-sandbox
bank
ObjectID
Yes Unique Bank ID (Unique Okra Identifier)
accounts
ObjectID
Yes Unique Account ID (Unique Okra Identifier)
customer
ObjectID
Yes Unique Customer ID (Unique Okra Identifier)
record
Array of ObjectID
Yes Unique Record ID (Unique Okra Identifier)
created_at
Object
Yes Date Balance was fetched
last_updated
Object
Yes Last Date Balance was fetched

Identity

Field Required Description
id
ObjectID
Yes Unique Identifier ID (Unique Okra Identifier)
firstname
String
Yes Customer First Name
middlename
String
Yes Customer Middle Name
lastname
String
Yes Customer Last Name
next_of_kins
Identity Object
Yes Customer Next of Kins
dob
Date
Yes Customer Date of Birth
verified
String
Yes BVN Validation status
score
String
Yes Unique Okra Score
dti
String
Yes Customer Debt to Income Score
fullname
String
Yes Customer Fullname
company_name
String
**Yes Company Name if Corporate Identity
nin
String
Yes Customer NIN Number
national_id
String
Yes Customer National ID Number
drivers_lisence
String
Yes Customer Driver's License Number
nimc
String
Yes Customer National Identity Management Commission (NIMC) Number
voters_id
String
Yes Customer Voter's ID Number
rc_number
String
Yes Company's Registered Company Number if Corporate Identity
phone
Array of String
Yes Customer Phone Number
last_login
String
Yes Customer Last Login via Okra
email
Array of String
Yes Customer Email address
address
Array of String
Yes Customer
mothers_maiden
String
Yes Customer Mother's Maiden Name
photo_ids
Array of Object
Yes Customer's photo ID
env
String
Yes Okra API Env the transaction was pulled from production or production-sandbox
bank
ObjectID
Yes Unique Bank ID (Unique Okra Identifier)
accounts
ObjectID
Yes Unique Account ID (Unique Okra Identifier)
customer
ObjectID
Yes Unique Customer ID (Unique Okra Identifier)
record
Array of ObjectID
Yes Unique Record ID (Unique Okra Identifier)
created_at
Object
Yes Date Balance was fetched
last_updated
Object
Yes Last Date Balance was fetched

Transaction

Field Required Description
id
ObjectID
Yes Unique Transaction ID (Unique Okra Identifier)
debit
Integer
No Amount deducted from account
credit
Integer
No Amount credited to account
trans_date
Date
Yes Date transaction occurred
cleared_date
Date
Yes Date transaction cleared at bank
unformatted_trans_date
String
Yes Date transaction occurred (from bank)
unformatted_cleared_date
String
Yes Date transaction cleared (from bank)
branch
String
No Branch transactions occurred
ref
String
No Bank reference ID (from bank)
env
String
Yes Okra API Env the transaction was pulled from production or production-sandbox
code
String
No Bank Code (from bank)
benefactor
ObjectID
No Customer ID of sender (within Okra)
code
String
No Bank Code (from bank)
notes
Object
Yes Breakdown of Narrative from bank
bank
ObjectID
Yes Unique Bank ID (Unique Okra Identifier)
account
ObjectID
Yes Unique Account ID (Unique Okra Identifier)
record
Array of ObjectID
Yes Unique Record ID (Unique Okra Identifier)
created_at
Object
Yes Date transactions was fetched
last_updated
Object
Yes Last Date transactions was fetched

Notes Data Dictionary

Field Required Description
desc
String
Yes Narrative / Description of transaction (combination of bank and user entered information)
topics
Array of String
Yes Topics within the desc
places
Array of String
Yes Places mentioned within the desc
people
Array of String
Yes People mentioned within the desc
actions
Array of String
Yes Actions mentioned within the desc
subject
Array of String
Yes Subject of the desc
preposition
Array of String
Yes Prepositions within desc to understand intent

Done connecting?

Checkout our API Overiview and see how to use the data you've received and other products you can use to create more personalized experiences for your customers!

Not a developer?

Get started without writing a single line of code, Try our App Builder! Click here to get started