Skip to content

Commit

Permalink
Merge pull request #44 from openMF/development
Browse files Browse the repository at this point in the history
fineract client version updated
  • Loading branch information
danishjamal104 authored Aug 10, 2021
2 parents 09c68df + c23bcdc commit 685c3d2
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
```
Expand Down
39 changes: 32 additions & 7 deletions app/src/main/java/org/mifos/ui/HomeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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<PostAuthenticationResponse>() {
Expand All @@ -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()
}

})
Expand Down Expand Up @@ -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()}")
}

})
}

}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ext {
rxJavaVersion = '1.1.4'
rxAndroidVersion = '1.1.0'

fineractClientVersion = '2.0.1'
fineractClientVersion = '2.0.2'
}

allprojects {
Expand Down

0 comments on commit 685c3d2

Please sign in to comment.