From c23bcdc87759f2b83778014a4db94fbc57687256 Mon Sep 17 00:00:00 2001 From: Danish Jamal Date: Tue, 10 Aug 2021 06:19:18 +0530 Subject: [PATCH] fineract client version updated --- README.md | 2 +- .../main/java/org/mifos/ui/HomeActivity.kt | 39 +++++++++++++++---- build.gradle | 2 +- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b3e4e01..c99c600 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ To add library in your gradle project follow the steps below: 2. Add the dependency ```groovy dependencies { - def sdk_Version = '1.0.0' + def sdk_Version = '1.0.1' implementation "com.github.openMF:mifos-android-sdk-arch:$sdk_Version" } ``` diff --git a/app/src/main/java/org/mifos/ui/HomeActivity.kt b/app/src/main/java/org/mifos/ui/HomeActivity.kt index 37f5aac..27f8fa7 100644 --- a/app/src/main/java/org/mifos/ui/HomeActivity.kt +++ b/app/src/main/java/org/mifos/ui/HomeActivity.kt @@ -6,9 +6,7 @@ import android.util.Log import android.widget.TextView import android.widget.Toast import androidx.appcompat.app.AppCompatActivity -import org.apache.fineract.client.models.GetClientsClientIdAccountsResponse -import org.apache.fineract.client.models.GetClientsClientIdResponse -import org.apache.fineract.client.models.PostAuthenticationResponse +import org.apache.fineract.client.models.* import org.mifos.R import org.mifos.core.apimanager.BaseApiManager import rx.Subscriber @@ -18,7 +16,7 @@ import java.util.* class HomeActivity : AppCompatActivity(){ - val base_url = "https://demo.fineract.dev/fineract-provider/api/v1/" + val base_url = "https://10.0.2.2:8443/fineract-provider/api/v1/" val tenant = "default" lateinit var baseApiManager: BaseApiManager @@ -28,11 +26,15 @@ class HomeActivity : AppCompatActivity(){ baseApiManager = BaseApiManager.getInstance() - baseApiManager.createService("mifos", "password", base_url, tenant) + baseApiManager.createService("mifos", "password", base_url, tenant, false) val body = "{\"username\": \"mifos\", \"password\": \"password\"}" - baseApiManager.getAuthApi().authenticate(true, body) + val req = PostAuthenticationRequest(); + req.username = "mifos" + req.password = "password" + + baseApiManager.getAuthApi().authenticate(req, true) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(object : Subscriber() { @@ -49,7 +51,7 @@ class HomeActivity : AppCompatActivity(){ override fun onNext(t: PostAuthenticationResponse?) { Log.i("subscriber", "next: ${t.toString()}") setText("next: ${t.toString()}") - getClientAccounts(1) + getClientTemplate() } }) @@ -106,4 +108,27 @@ class HomeActivity : AppCompatActivity(){ }) } + fun getClientTemplate() { + baseApiManager.getClientsApi().retrieveTemplate5(null, null, null) + .observeOn(AndroidSchedulers.mainThread()) + .subscribeOn(Schedulers.io()) + .subscribe(object: Subscriber< GetClientsTemplateResponse>() { + override fun onCompleted() { + Log.i("subscriber", "completed") + setText("completed") + } + + override fun onError(e: Throwable?) { + Log.i("subscriber", "error: ${e?.localizedMessage}") + setText("error: ${e?.localizedMessage}") + } + + override fun onNext(t: GetClientsTemplateResponse?) { + Log.i("subscriber", "next: ${t.toString()}") + setText("next: ${t.toString()}") + } + + }) + } + } \ No newline at end of file diff --git a/build.gradle b/build.gradle index 20d8c12..ca1ed0a 100644 --- a/build.gradle +++ b/build.gradle @@ -31,7 +31,7 @@ ext { rxJavaVersion = '1.1.4' rxAndroidVersion = '1.1.0' - fineractClientVersion = '2.0.1' + fineractClientVersion = '2.0.2' } allprojects {