-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor #1503: kyc usecase migrated to kotlin
- Loading branch information
1 parent
13c8c64
commit ddc29f8
Showing
9 changed files
with
186 additions
and
300 deletions.
There are no files selected for viewing
78 changes: 0 additions & 78 deletions
78
...a/src/main/java/org/mifos/mobilewallet/core/domain/usecase/kyc/FetchKYCLevel1Details.java
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
...ata/src/main/java/org/mifos/mobilewallet/core/domain/usecase/kyc/FetchKYCLevel1Details.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.mifos.mobilewallet.core.domain.usecase.kyc | ||
|
||
import org.mifos.mobilewallet.core.base.UseCase | ||
import org.mifos.mobilewallet.core.data.fineract.entity.kyc.KYCLevel1Details | ||
import org.mifos.mobilewallet.core.data.fineract.repository.FineractRepository | ||
import rx.Subscriber | ||
import rx.android.schedulers.AndroidSchedulers | ||
import rx.schedulers.Schedulers | ||
import javax.inject.Inject | ||
|
||
/** | ||
* Created by ankur on 24/May/2018 | ||
*/ | ||
class FetchKYCLevel1Details @Inject constructor(private val mFineractRepository: FineractRepository) : | ||
UseCase<FetchKYCLevel1Details.RequestValues, FetchKYCLevel1Details.ResponseValue>() { | ||
|
||
class RequestValues(val clientId: Int) : UseCase.RequestValues | ||
class ResponseValue( | ||
val kycLevel1DetailsList: List<KYCLevel1Details?> | ||
) : UseCase.ResponseValue | ||
|
||
override fun executeUseCase(requestValues: RequestValues) { | ||
mFineractRepository.fetchKYCLevel1Details(requestValues.clientId) | ||
.observeOn(AndroidSchedulers.mainThread()) | ||
.subscribeOn(Schedulers.io()) | ||
.subscribe(object : Subscriber<List<KYCLevel1Details?>>() { | ||
override fun onCompleted() {} | ||
override fun onError(e: Throwable) { | ||
useCaseCallback.onError(e.toString()) | ||
} | ||
|
||
override fun onNext(kycLevel1Details: List<KYCLevel1Details?>) { | ||
useCaseCallback.onSuccess( | ||
ResponseValue(kycLevel1Details) | ||
) | ||
} | ||
}) | ||
|
||
} | ||
} |
68 changes: 0 additions & 68 deletions
68
.../src/main/java/org/mifos/mobilewallet/core/domain/usecase/kyc/UpdateKYCLevel1Details.java
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
...ta/src/main/java/org/mifos/mobilewallet/core/domain/usecase/kyc/UpdateKYCLevel1Details.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.mifos.mobilewallet.core.domain.usecase.kyc | ||
|
||
import org.mifos.mobilewallet.core.base.UseCase | ||
import org.mifos.mobilewallet.core.data.fineract.api.GenericResponse | ||
import org.mifos.mobilewallet.core.data.fineract.entity.kyc.KYCLevel1Details | ||
import org.mifos.mobilewallet.core.data.fineract.repository.FineractRepository | ||
import rx.Subscriber | ||
import rx.android.schedulers.AndroidSchedulers | ||
import rx.schedulers.Schedulers | ||
import javax.inject.Inject | ||
|
||
/** | ||
* Created by ankur on 25/May/2018 | ||
*/ | ||
class UpdateKYCLevel1Details @Inject constructor(private val mFineractRepository: FineractRepository) : | ||
UseCase<UpdateKYCLevel1Details.RequestValues, UpdateKYCLevel1Details.ResponseValue>() { | ||
|
||
class RequestValues( | ||
val clientId: Int, | ||
val kycLevel1Details: KYCLevel1Details | ||
) : UseCase.RequestValues | ||
|
||
class ResponseValue : UseCase.ResponseValue | ||
|
||
override fun executeUseCase(requestValues: RequestValues) { | ||
mFineractRepository.updateKYCLevel1Details( | ||
requestValues.clientId, | ||
requestValues.kycLevel1Details | ||
) | ||
.observeOn(AndroidSchedulers.mainThread()) | ||
.subscribeOn(Schedulers.io()) | ||
.subscribe(object : Subscriber<GenericResponse>() { | ||
override fun onCompleted() {} | ||
override fun onError(e: Throwable) { | ||
useCaseCallback.onError(e.toString()) | ||
} | ||
|
||
override fun onNext(t: GenericResponse) { | ||
useCaseCallback.onSuccess(ResponseValue()) | ||
} | ||
|
||
}) | ||
|
||
} | ||
} |
74 changes: 0 additions & 74 deletions
74
core/data/src/main/java/org/mifos/mobilewallet/core/domain/usecase/kyc/UploadKYCDocs.java
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
core/data/src/main/java/org/mifos/mobilewallet/core/domain/usecase/kyc/UploadKYCDocs.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.mifos.mobilewallet.core.domain.usecase.kyc | ||
|
||
import okhttp3.MultipartBody | ||
import org.mifos.mobilewallet.core.base.UseCase | ||
import org.mifos.mobilewallet.core.data.fineract.api.GenericResponse | ||
import org.mifos.mobilewallet.core.data.fineract.repository.FineractRepository | ||
import rx.Subscriber | ||
import rx.android.schedulers.AndroidSchedulers | ||
import rx.schedulers.Schedulers | ||
import javax.inject.Inject | ||
|
||
/** | ||
* Created by ankur on 16/May/2018 | ||
*/ | ||
class UploadKYCDocs @Inject constructor(private val apiRepository: FineractRepository) : | ||
UseCase<UploadKYCDocs.RequestValues, UploadKYCDocs.ResponseValue>() { | ||
|
||
class RequestValues( | ||
val entitytype: String, val clientId: Long, val docname: String, | ||
val identityType: String, val file: MultipartBody.Part | ||
) : UseCase.RequestValues | ||
|
||
class ResponseValue : UseCase.ResponseValue | ||
|
||
override fun executeUseCase(requestValues: RequestValues) { | ||
apiRepository.uploadKYCDocs( | ||
requestValues.entitytype, requestValues.clientId, | ||
requestValues.docname, requestValues.identityType, requestValues.file | ||
) | ||
.observeOn(AndroidSchedulers.mainThread()) | ||
.subscribeOn(Schedulers.io()) | ||
.subscribe(object : Subscriber<GenericResponse>() { | ||
override fun onCompleted() {} | ||
override fun onError(e: Throwable) { | ||
useCaseCallback.onError(e.toString()) | ||
} | ||
|
||
override fun onNext(t: GenericResponse) { | ||
useCaseCallback.onSuccess(ResponseValue()) | ||
} | ||
}) | ||
|
||
} | ||
} |
Oops, something went wrong.