Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor to kotilin of domainUsecase package #1551

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.mifos.mobilewallet.core.domain.usecase.account


import org.mifos.mobilewallet.core.base.UseCase
import org.mifos.mobilewallet.core.data.fineract.repository.FineractRepository
import com.mifos.mobilewallet.model.entity.Page
import com.mifos.mobilewallet.model.entity.accounts.savings.SavingsWithAssociations
import org.mifos.mobilewallet.core.utils.Constants
import rx.android.schedulers.AndroidSchedulers
import rx.schedulers.Schedulers

import javax.inject.Inject

/**
* Created by niranjan on 1/3/2024
*/
class FetchMerchants @Inject constructor(private val mFineractRepository: FineractRepository) :
UseCase<FetchMerchants.RequestValues, FetchMerchants.ResponseValue>() {

override fun executeUseCase(requestValues: RequestValues) {
mFineractRepository.savingsAccounts
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe { savingsWithAssociationsPage ->
val savingsWithAssociationsList =
savingsWithAssociationsPage.pageItems
val merchantsList =savingsWithAssociationsList.filter{
savingsWithAssociations ->
savingsWithAssociations.savingsProductId == Constants.MIFOS_MERCHANT_SAVINGS_PRODUCT_ID
}.toMutableList()

useCaseCallback.onSuccess(ResponseValue(merchantsList))
}
}

class RequestValues : UseCase.RequestValues

class ResponseValue(val savingsWithAssociationsList: List<SavingsWithAssociations>) :
UseCase.ResponseValue
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.mifos.mobilewallet.core.domain.usecase.user


import org.mifos.mobilewallet.core.base.UseCase
import org.mifos.mobilewallet.core.data.fineract.repository.FineractRepository
import com.mifos.mobilewallet.model.entity.Role
import com.mifos.mobilewallet.model.entity.UserWithRole
import org.mifos.mobilewallet.core.utils.Constants
import rx.android.schedulers.AndroidSchedulers
import rx.schedulers.Schedulers

import javax.inject.Inject

/**
* Created by ankur on 11/June/2018
*/
class FetchUsers @Inject constructor(private val mFineractRepository: FineractRepository) :
UseCase<FetchUsers.RequestValues, FetchUsers.ResponseValue>() {

override fun executeUseCase(requestValues: RequestValues) {
mFineractRepository.users
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe { userWithRoles ->
val tbp = userWithRoles.filter { userWithRole ->
userWithRole.selectedRoles!!.any { role ->
role.name == Constants.MERCHANT
}
}
useCaseCallback.onSuccess(ResponseValue(tbp))
}
}

class RequestValues : UseCase.RequestValues

class ResponseValue(val userWithRoleList: List<UserWithRole>) :
UseCase.ResponseValue
}
Loading