Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.Lenddo:android-lenddo-onboarding:v2.3.0'
}
dependencies {
implementation("com.github.Lenddo:android-lenddo-onboarding:v2.3.0")
}
<dependency>
<groupId>com.github.Lenddo</groupId>
<artifactId>android-lenddo-onboarding</artifactId>
<version>v2.3.0</version>
</dependency>
libraryDependencies += "com.github.Lenddo" % "android-lenddo-onboarding" % "v2.3.0"
:dependencies [[com.github.Lenddo/android-lenddo-onboarding "v2.3.0"]]
Note: This sdk is deprecated, please use the new Lenddo SDK from https://github.com/Lenddo/android-lenddo . For existing users, you might need to follow th migration guide.
This is the Lenddo Onboarding SDK for Android based devices, if you are developing for other platforms like IOS and web, please refer to the [online documentation] (http://www.lenddo.com/documentation/lenddo_button.html)
The Lenddo SDK for Android allows you to integrate the Lenddo Verification and/or Scoring workflow seamlessly into your Android app.
Before you start on integrating the Lenddo SDK, please make sure you have the following
Download the Lenddo SDK and extract the archive into your local drive. After extracting the archive, the Lenddo SDK folder structure should look like this:
The LenddoSDK folder contains the actual Lenddo SDK library project that you can include in your app. The simple_loan folder contains the sample app called Simple Loan which illustrates how to integrate the Lenddo Button into your existing app.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Lenddo Partner Script ID -->
<string name="lenddo_app_id">PLACE_YOUR_PARTNER_SCRIPT_ID_HERE</string>
<!-- Google Web OAuth2.0 Client ID -->
<string name="google_client_id">PLACE_YOUR_GOOGLE_WEB_CLIENT_ID_HERE</string>
</resources>
https://authorize-api.partner-service.link
If you would like more information on how this works you can view The file SampleActivity.java in the simple_loan/src/main/java/lenddo.com.lenddoconnect folder
Inside the extracted directory, copy the LenddoSDK subfolder and place it inside the root of your Application's Android Studio project folder. If you encounter an error copy the LenddoSDK subfolder in the Folder with the name of your Application in your computer.
include ':LenddoSDK'
Open and edit the build.gradle file of your app (not the one in the project root). You should see a section for dependencies.:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
Add compile project(':LenddoSDK')
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':LenddoSDK')
}
If you have the e-mail onboarding step included with your Authorize onboarding experience, follow the next two steps. Ignore these otherwise.
1. In your application module build.gradle file:
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile project(':LenddoSDK') compile 'com.google.android.gms:play-services-auth:9.8.0' } apply plugin: 'com.google.gms.google-services'
2. In your project root build.gradle file:
dependencies { classpath 'com.android.tools.build:gradle:2.3.1' classpath 'com.google.gms:google-services:3.0.0' }
Android Studio should tell you to resync, the SDK classes should now be available after that.
For applications that have an Email Onboarding process, a native Google Email signin helper class is provided. Simply create a new package in your application: com.lenddo.nativeonboarding and copy the signin helper class. GoogleSignInHelper
In addition to the required permissions defined from within the SDK, which are automatically incorporated into your app, you must ensure the following permissions are also required:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
In order for the application to have login access and use Gmail onboarding for scoring, the Gmail API must be enabled in the Google API Console.
Edit your apps' AndroidManifest.xml (located in your src/main folder for gradle projects), and then add the following meta tag under the application tag:
<meta-data android:name="partnerScriptId" android:value="partner_script_id" />
where partner_script_id is the partner script id provided to you by Lenddo.
If the application have an email onboarding process, a Google Web Client Id is required. Get or configure a the Google web client id from the Google API Manager for your application and add the following meta-data to the AndroidManifest.xml file.
<meta-data android:name="googleClientId" android:value="google_web_client_id" />
Normally, an application will only need a single partner script id. The Onboarding SDK allows changing of partner script id dynamically by setting it using the FormDataCollector object. Simply call the setPartnerScriptId() method before calling the UIHelper.showAuthorize() method or before clicking the Lenddo button.
Probe data or user information are gathered from the application to be used for verification purposes. Probe may come from an application form that the user will need to fill up. Once the user fill's up the application form fields, the data is then passed to the Onboarding SDK as probe data. See code below on how to pass the probe data.
// Get the user information from your application form's EditText widgets and pass them here
private FormDataCollector getProbeData(FormDataCollector formData) {
// Place partner defined application id if not yet defined
formData.setApplicationId("YOUR_APPLICATION_ID_STRING_HERE");
formData.setLastName("LASTNAME STRING");
formData.setFirstName("FIRSTNAME STRING");
formData.setEmail("EMAIL STRING");
formData.setDateOfBirth("01/01/2000"); // FORMAT: dd/MM/yyyy
// Add additional fields such as EmployerName, MobilePhone, University, Address, etc
// Configure the partner script dynamically if needed
String partnerscript_id = "YOUR NEW PARTNER SCRIPT ID";
formData.setPartnerScriptId(partnerscript_id);
// Adding Government IDs
governmentIds.add(new GovernmentId("DEMO-TYPE", "DEMO-VALUE"));
governmentIds.add(new GovernmentId("passport", "PAS018218ASVR"));
governmentIds.add(new GovernmentId("sss", "0-390128411-1274"));
governmentIds.add(new GovernmentId("tin", "3023749103"));
formData.setGovernmentIds(governmentIds);
// send custom fields
formData.putField("Loan_Amount", loanAmmount.getText().toString());
formData.validate();
return formData;
}
The Lenddo button greatly simplifies integrating the Lenddo workflow to your app.
Create your form (if you don't have an existing one already)
The Lenddo verification process requires at the minimum, the following fields:
However the exact fields that is required for your App may be different depending on your requirements or use cases, please talk to your Lenddo Representative regarding this.
Open up your Forms' layout xml and add the following to include the Lenddo Button onto your Layout:
<com.lenddo.sdk.widget.LenddoButton
android:id="@+id/verifyButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center" />
Note that you can also use your own custom button. (See section on customization for more information)
Create an Instance of the UIHelper class inside the onCreate block of your activity. Note that the class constructor requires a LenddoEventListener. For the sample app, it implements the current activity as a LenddoEventListener.
private UIHelper helper;
protected void onCreate(Bundle savedInstanceState) {
....
helper = new UIHelper(this, this);
helper.addGoogleSignIn(new GoogleSignInHelper()); // Add this line only if your application has an email onboarding process.
}
Setup your activity to implement the LenddoEventListener in your class or you can define your own class:
public class SampleActivity extends Activity implements LenddoEventListener {
....
private UIHelper helper;
protected void onCreate(Bundle savedInstanceState) {
....
helper = new UIHelper(this, this);
helper.addGoogleSignIn(new GoogleSignInHelper()); // Add this line only if your application has an email onboarding process.
String applicationId = "your application id";
LenddoCoreInfo.setCoreInfo(getApplicationContext(), LenddoCoreInfo.COREINFO_APPLICATION_ID, applicationId);
LenddoCoreInfo.initCoreInfo(getApplicationContext());
}
@Override
public boolean onButtonClicked(FormDataCollector collector) {
return true;
}
@Override
public void onAuthorizeComplete(FormDataCollector collector) {
}
@Override
public void onAuthorizeCanceled(FormDataCollector collector) {
}
@Override
public void onBackPressed() {
if (helper.onBackPressed()) {
super.onBackPressed();
}
}
....
}
Note: These methods allow you to hook into the Lenddo Authorize process.
Still on the onCreate method, Link the button to the UIHelper:
LenddoButton button = (LenddoButton) findViewById(R.id.verifyButton);
button.setUiHelper(helper);
Pass the content of the form using the form collector. On the onButtonClicked method, you can set the required information using the formData object passed to you. You can also send additional custom fields (To be discussed with your Lenddo representative)
@Override
public boolean onButtonClicked(FormDataCollector formData) {
formData = getProbeData(formData);
// Place partner defined application id (if not yet defined)
formData.setApplicationId("YOUR_APPLICATION_ID_STRING_HERE");
// Configure the partner script dynamically (if needed only)
formData.setPartnerScriptId("YOUR NEW PARTNER SCRIPT ID");
return true;
}
Important Note: It is important here that you must pass a unique identifier to formData.setApplicationId, this will be used if you want to match your transaction records later on.
Clicking on the Lenddo Button should trigger the Lenddo Authorization/Verification process and your app will be notified via onAuthorizeComplete when the process is done.
You may customize the Look and Feel of the Lenddo Button in a couple of ways:
You may create or use any of your existing Button. However you need to manually handle the onClick event with UIHelper.showAuthorize like this:
helper = new UIHelper(this, this);
helper.addGoogleSignIn(new GoogleSignInHelper()); // Add this line only if your application has an email onboarding process.
LenddoCoreInfo.initCoreInfo(getApplicationContext());
Button sampleButton = (Button) findViewById(R.id.sample_button);
sampleButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
UIHelper.showAuthorize(SampleActivity.this, helper);
}
});
Pressing the back key during the onboarding process will return the user to the previous screen. While on the initial screen, pressing the back key will display a popup dialog that will confirm if the user wants to cancel the onboarding process.
To customize the popup dialog's strings, simply add the following method after initializing the helper object:
helper = new UIHelper(this, this);
helper.addGoogleSignIn(new GoogleSignInHelper()); // Add this line only if your application has an email onboarding process.
helper.customizeBackPopup("Custom Back Title", "Custom Back Popup Message", "CUSTOM YES", "CUSTOM NO");
Also, overwrite the onBackPressed method of the calling Activity:
@Override
public void onBackPressed() {
if (helper.onBackPressed()) {
super.onBackPressed();
}
}
To use Lenddo's AutoComplete view. Refer to this link
To configure the Lenddo Onboarding SDK to use a specific API region. Refer to this link
To configure the Lenddo Onboarding SDK to add native Facebook Integration. Refer to this link
The application form data used as probe information are passed in the FormDataCollector object inside the onButtonClicked method. It is possible to not pass any other information aside from the application ID. See snippet below.
@Override
public boolean onButtonClicked(FormDataCollector formData) {
// Place partner defined application id if not yet defined
formData.setApplicationId("123456789");
return true;
}
While the google-services.json already contains the Google Android and Web OAuth2.0 Client IDs, it is still important to include the Google Web Client ID as a meta-data in the AndroidManifest.xml file. This data is then passed to the GoogleSignInHelper.java class and is part of the OAuth2.0 Native login process. The Web Client ID will be used by Lenddo's backend server to communicate callbacks for the login results. More information from Google documentations
The INVALID_AUDIENCE error is caused by using the incorrect SHA1 signing certificate in the google-services.json file. Get your correct signing certificate hash for both debug and release using the gradle task "signingReport" and view the result in the Gradle console. Update your SHA1 certificate in the Firebase Console and download the latest google-services.json file.