This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"status": "Transaction successfully fetched", | |
"message": "Tx Fetched", | |
"data": { | |
"id": 27272462, | |
"txRef": "ref", | |
"orderRef": "URF_1549621287102_6793935", | |
"flwRef": "FLW117494557", | |
"redirectUrl": "https:\/\/rave-webhook.herokuapp.com\/receivepayment", | |
"device_fingerprint": "358240051111110", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"status": "Transaction successfully fetched", | |
"message": "Tx Fetched", | |
"data": { | |
"id": 427398, | |
"txRef": "my-ref", | |
"orderRef": "URF_1549613005326_2869035", | |
"flwRef": "FLW-MOCK-481dc616a228f87e5b0a5e7166db26bd", | |
"redirectUrl": "https:\/\/rave-webhook.herokuapp.com\/receivepayment", | |
"device_fingerprint": "358240051111110", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class Result<out T>(val status: Status, val data: T?, val message: String?, val code : Int = 0) { | |
companion object { | |
fun <T> success(data: T?): Resource<T> { | |
return Result(Status.SUCCESS, data, null) | |
} | |
fun <T> error(msg: String, data: T?): Resource<T> { | |
return Result(Status.ERROR, data, msg) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun <T : Any> makeCall(call: suspend () -> Response<T>): LiveData<Result<T>> { | |
val result = MutableLiveData<Result<T>>() | |
GlobalScope.launch(Dispatchers.Main) { | |
try { | |
val response = withContext(Dispatchers.IO) { call.invoke() } | |
if (response.isSuccessful) { | |
result.postValue(Result(Status.SUCCESS, response.body(), response.message())) | |
} else { | |
result.postValue(Result(Status.ERROR, response.body(), response.errorBody()?.string(), response.code())) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun <T : Any> makeCall(call: suspend () -> Response<T>): LiveData<Result<T>> { | |
val result = MutableLiveData<Result<T>>() | |
GlobalScope.launch(Dispatchers.Main) { | |
try { | |
val response = withContext(Dispatchers.IO) { call.invoke() } | |
if (response.isSuccessful) { | |
result.postValue(Result(Status.SUCCESS, response.body(), response.message())) | |
} else { | |
result.postValue(Result(Status.ERROR, response.body(), response.errorBody()?.string(), response.code())) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun login(body: LoginBody): LiveData<Result<LoginResponse>> { | |
return makeCall(call = { | |
service.login(body) | |
}) | |
} | |
fun signup(body: SignBody): LiveData<Result<SignUpResponse>> { | |
return makeCall(call = { | |
service.signUp(body) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//retrofit | |
implementation 'com.squareup.retrofit2:retrofit:2.6.0' | |
//kotlin-coroutine | |
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0-M1' | |
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0-M1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implementation "com.jumio.android:core:3.2.1@aar" | |
implementation "com.jumio.android:nv:3.2.1@aar" | |
implementation "com.jumio.android:javadoc:3.2.1" | |
implementation "com.google.android.gms:play-services-vision:17.0.2" | |
implementation "com.jumio.android:nv-mrz:3.2.1@aar" | |
implementation "com.jumio.android:nv-nfc:3.2.1@aar" | |
implementation "org.bouncycastle:bcprov-jdk15on:1.61" | |
implementation "net.sf.scuba:scuba-sc-android:0.0.18" | |
implementation "androidx.room:room-runtime:2.0.0" | |
implementation "com.jumio.android:face:3.2.1@aar" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implementation "com.jumio.android:core:2.13.0@aar" | |
implementation "com.jumio.android:nv:2.13.0@aar" | |
implementation "com.jumio.android:nv-liveness:2.13.0@aar" | |
implementation "com.jumio.android:javadoc:2.13.0" | |
implementation "com.google.android.gms:play-services-vision:17.0.2" | |
implementation "com.jumio.android:nv-mrz:2.13.0@aar" | |
implementation "com.jumio.android:nv-nfc:2.13.0@aar" | |
implementation "com.madgag.spongycastle:prov:1.58.0.0" | |
implementation "net.sf.scuba:scuba-sc-android:0.0.16" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class Result<out T>(val status: Status, val data: T?, val message: String?, val code : Int = 0) { | |
companion object { | |
fun <T> success(data: T?): Result<T> { | |
return Result(Status.SUCCESS, data, null) | |
} | |
fun <T> error(msg: String, data: T?): Result<T> { | |
return Result(Status.ERROR, data, msg) | |
} |
OlderNewer