/fineract-client

Mifos Fineract Client is a Java based library that provides a simple interface to interact with the Apache Fineract 1.x Platform APIs

Primary LanguageJavaMozilla Public License 2.0MPL-2.0

Fineract API Client Library Build Status Jitpack License: MPL 2.0

A Java and Retrofit2 based Fineract Client Library that you can use to interact with the Apache Fineract 1.x Platform. This library is autogenerated using Swagger Codegen. It can be used in Android or any Java and Kotlin Project.

Add Dependency

Gradle

To use library in your gradle project follow the steps below:

  1. Add this in your root build.gradle at the end of repositories:
    allprojects {
        repositories {
            ...
            maven { url 'https://jitpack.io' }
        }
    }
  2. Add the dependency
    dependencies {
        implementation 'com.github.openMF:fineract-client:1.0.1'
    }

Maven

To use the library in your Maven project, follow the steps below:

  1. Add the JitPack repository to your build file:
    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>
  2. Add the dependency
    <dependency>
        <groupId>com.github.openMF</groupId>
        <artifactId>fineract-client</artifactId>
        <version>1.0.1</version>
    </dependency>

Usage

Example code to use the Authentication API:

import org.mifos.fineract.models.PostAuthenticationResponse;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class Main {

    public static void main(String[] args) {

        new FineractApiClient().getAuthApi().authenticate("mifos", "password").enqueue(
                new Callback<PostAuthenticationResponse>() {
                    @Override
                    public void onResponse(Call<PostAuthenticationResponse> call, Response<PostAuthenticationResponse> response) {
                        System.out.println(response.toString());
                        PostAuthenticationResponse body = response.body();
                        if (body != null) {
                            System.out.println(body.toString());
                        }
                    }

                    @Override
                    public void onFailure(Call<PostAuthenticationResponse> call, Throwable t) {
                        System.out.println(t.toString());
                    }
                }
        );
    }
}

Refer Main.java for full example.

Build Project

Clone the repository and import as Maven project in IntelliJ IDEA or Eclipse

Before building the project, make sure you have the following things installed.

  • Maven
  • Java 11

To install the API client library to your local Maven repository, simply execute:

mvn install

To build the library using Gradle, execute the following command

./gradlew build

Refer to the official documentation for more information.