Skip to content

Commit

Permalink
refactor #1447: history package from java to kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
PratyushSingh07 authored and therajanmaurya committed Jan 12, 2024
1 parent 936f29b commit b362832
Show file tree
Hide file tree
Showing 26 changed files with 1,278 additions and 1,386 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.mifos.mobilewallet.core.data.fineract.entity.beneficary.BeneficiaryUpdatePayload;
import org.mifos.mobilewallet.core.data.fineract.entity.client.Client;
import org.mifos.mobilewallet.core.data.fineract.entity.client.ClientAccounts;
import org.mifos.mobilewallet.core.data.fineract.entity.payload.PayResponse;
import org.mifos.mobilewallet.core.data.fineract.entity.payload.TransferPayload;
import org.mifos.mobilewallet.core.data.fineract.repository.FineractRepository;
import org.mifos.mobilewallet.core.utils.Constants;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package org.mifos.mobilewallet.mifospay.history

import org.mifos.mobilewallet.core.data.fineract.entity.accounts.savings.TransferDetail
import org.mifos.mobilewallet.core.domain.model.Transaction
import org.mifos.mobilewallet.core.domain.model.TransactionType
import org.mifos.mobilewallet.mifospay.base.BasePresenter
import org.mifos.mobilewallet.mifospay.base.BaseView

/**
* Created by naman on 17/8/17.
*/
interface HistoryContract {
interface TransactionsHistoryAsync {
fun onTransactionsFetchCompleted(transactions: List<Transaction>?)
}

interface HistoryView : BaseView<TransactionsHistoryPresenter?> {
fun showRecyclerView()
fun showStateView(drawable: Int, title: Int, subtitle: Int)
fun showTransactions(transactions: List<Transaction>?)
fun showEmptyTransactionTypeStateView(drawable: Int, title: String?, subtitle: String?)
fun showTransactionDetailDialog(transactionIndex: Int, accountNumber: String?)
fun showHistoryFetchingProgress()
fun refreshTransactions(transactions: List<Transaction>?)
}

interface TransactionsHistoryPresenter : BasePresenter {
fun fetchTransactions()
fun filterTransactionType(type: TransactionType?)
fun handleTransactionClick(transactionIndex: Int)
}

interface TransactionDetailView : BaseView<TransactionDetailPresenter?> {
fun showTransferDetail(transferDetail: TransferDetail?)
fun showProgressBar()
fun hideProgressBar()
fun showToast(message: String?)
}

interface TransactionDetailPresenter : BasePresenter {
fun getTransferDetail(transferId: Long)
}

interface SpecificTransactionsView : BaseView<SpecificTransactionsPresenter?> {
fun showSpecificTransactions(specificTransactions: ArrayList<Transaction?>)
fun showProgress()
fun hideProgress()
fun showStateView(drawable: Int, title: Int, subtitle: Int)
}

interface SpecificTransactionsPresenter : BasePresenter {
fun getSpecificTransactions(
transactions: ArrayList<Transaction?>?,
secondAccountNumber: String?
): ArrayList<Transaction?>?
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package org.mifos.mobilewallet.mifospay.history

import org.mifos.mobilewallet.core.base.TaskLooper
import org.mifos.mobilewallet.core.base.UseCase.UseCaseCallback
import org.mifos.mobilewallet.core.base.UseCaseFactory
import org.mifos.mobilewallet.core.base.UseCaseHandler
import org.mifos.mobilewallet.core.domain.model.Transaction
import org.mifos.mobilewallet.core.domain.usecase.account.FetchAccount
import org.mifos.mobilewallet.core.domain.usecase.account.FetchAccountTransactions
import org.mifos.mobilewallet.mifospay.history.HistoryContract.TransactionsHistoryAsync
import javax.inject.Inject

class TransactionsHistory @Inject constructor(private val mUsecaseHandler: UseCaseHandler) {
var delegate: TransactionsHistoryAsync? = null

@JvmField
@Inject
var mFetchAccountUseCase: FetchAccount? = null

@JvmField
@Inject
var fetchAccountTransactionsUseCase: FetchAccountTransactions? = null

@JvmField
@Inject
var mTaskLooper: TaskLooper? = null

@JvmField
@Inject
var mUseCaseFactory: UseCaseFactory? = null
private var transactions: List<Transaction>?

init {
transactions = ArrayList()
}

fun fetchTransactionsHistory(accountId: Long) {
mUsecaseHandler.execute(fetchAccountTransactionsUseCase,
FetchAccountTransactions.RequestValues(accountId),
object : UseCaseCallback<FetchAccountTransactions.ResponseValue?> {
override fun onSuccess(response: FetchAccountTransactions.ResponseValue?) {
transactions = response?.transactions
delegate!!.onTransactionsFetchCompleted(transactions)
}

override fun onError(message: String) {
transactions = null
}
})
}
}
Loading

0 comments on commit b362832

Please sign in to comment.