-
Notifications
You must be signed in to change notification settings - Fork 455
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored the remaining files to kotilin
- Loading branch information
1 parent
47de8b7
commit 93a1006
Showing
18 changed files
with
316 additions
and
518 deletions.
There are no files selected for viewing
74 changes: 0 additions & 74 deletions
74
...n/java/org/mifos/mobilewallet/core/domain/usecase/account/DownloadTransactionReceipt.java
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
...ain/java/org/mifos/mobilewallet/core/domain/usecase/account/DownloadTransactionReceipt.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,38 @@ | ||
package org.mifos.mobilewallet.core.domain.usecase.account | ||
|
||
import okhttp3.ResponseBody | ||
import org.mifos.mobilewallet.core.base.UseCase | ||
import org.mifos.mobilewallet.core.data.fineract.repository.FineractRepository | ||
import org.mifos.mobilewallet.core.util.Constants | ||
import rx.Subscriber | ||
import rx.android.schedulers.AndroidSchedulers | ||
import rx.schedulers.Schedulers | ||
import javax.inject.Inject | ||
|
||
/** | ||
* Created by ankur on 06/June/2018 | ||
*/ | ||
class DownloadTransactionReceipt @Inject constructor(private val mFineractRepository: FineractRepository) : | ||
UseCase<DownloadTransactionReceipt.RequestValues, DownloadTransactionReceipt.ResponseValue>() { | ||
override fun executeUseCase(requestValues: RequestValues) { | ||
requestValues.transactionId?.let { | ||
mFineractRepository.getTransactionReceipt(Constants.PDF, it) | ||
.observeOn(AndroidSchedulers.mainThread()) | ||
.subscribeOn(Schedulers.io()) | ||
.subscribe(object : Subscriber<ResponseBody>() { | ||
override fun onCompleted() {} | ||
override fun onError(e: Throwable) { | ||
useCaseCallback.onError(e.toString()) | ||
} | ||
|
||
override fun onNext(t: ResponseBody) { | ||
val responseBody = t | ||
useCaseCallback.onSuccess(ResponseValue(responseBody)) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
data class RequestValues( val transactionId: String?) : UseCase.RequestValues | ||
data class ResponseValue(val responseBody: ResponseBody) : UseCase.ResponseValue | ||
} |
97 changes: 0 additions & 97 deletions
97
...main/java/org/mifos/mobilewallet/core/domain/usecase/account/FetchAccountTransaction.java
This file was deleted.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
...c/main/java/org/mifos/mobilewallet/core/domain/usecase/account/FetchAccountTransaction.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,59 @@ | ||
package org.mifos.mobilewallet.core.domain.usecase.account | ||
|
||
import com.mifos.mobilewallet.model.domain.Transaction | ||
import com.mifos.mobilewallet.model.entity.accounts.savings.Transactions | ||
import org.mifos.mobilewallet.core.base.UseCase | ||
import org.mifos.mobilewallet.core.data.fineract.entity.mapper.TransactionMapper | ||
import org.mifos.mobilewallet.core.data.fineract.repository.FineractRepository | ||
import org.mifos.mobilewallet.core.util.Constants | ||
import rx.Observer | ||
import rx.android.schedulers.AndroidSchedulers | ||
import rx.schedulers.Schedulers | ||
import javax.inject.Inject | ||
|
||
/** | ||
* Created by Shivansh on 15/6/19. | ||
*/ | ||
class FetchAccountTransaction @Inject constructor( | ||
val fineractRepository: FineractRepository, | ||
val transactionMapper: TransactionMapper | ||
) : | ||
UseCase<FetchAccountTransaction.RequestValues, FetchAccountTransaction.ResponseValue>() { | ||
override fun executeUseCase(requestValues: RequestValues) { | ||
fineractRepository.getSelfAccountTransactionFromId( | ||
requestValues.accountId, | ||
requestValues.transactionId | ||
) | ||
.observeOn(AndroidSchedulers.mainThread()) | ||
.subscribeOn(Schedulers.io()) | ||
.subscribe(object : Observer<Transactions?> { | ||
override fun onCompleted() {} | ||
override fun onError(e: Throwable) { | ||
if (e.message == "HTTP 401 Unauthorized") { | ||
useCaseCallback.onError(Constants.UNAUTHORIZED_ERROR) | ||
} else { | ||
useCaseCallback.onError( | ||
Constants.ERROR_FETCHING_REMOTE_ACCOUNT_TRANSACTIONS | ||
) | ||
} | ||
} | ||
|
||
override fun onNext(transaction: Transactions?) { | ||
useCaseCallback.onSuccess( | ||
ResponseValue( | ||
transactionMapper | ||
.transformInvoice(transaction) | ||
) | ||
) | ||
} | ||
}) | ||
} | ||
|
||
data class RequestValues( | ||
val accountId: Long, | ||
val transactionId: Long | ||
) : UseCase.RequestValues | ||
|
||
|
||
data class ResponseValue(val transaction: Transaction) : UseCase.ResponseValue | ||
} |
89 changes: 0 additions & 89 deletions
89
.../data/src/main/java/org/mifos/mobilewallet/core/domain/usecase/account/FetchAccounts.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.