File tree 4 files changed +16
-22
lines changed
core/data/src/main/java/org/mifos/mobilewallet/core
data/fineract/entity/mapper
4 files changed +16
-22
lines changed Original file line number Diff line number Diff line change @@ -10,21 +10,16 @@ class AccountMapper @Inject constructor(private val currencyMapper: CurrencyMapp
10
10
fun transform (clientAccounts : ClientAccounts ? ): List <Account > {
11
11
val accountList = mutableListOf<Account >()
12
12
13
- if (clientAccounts != null
14
- && ! clientAccounts.savingsAccounts.isNullOrEmpty()) {
15
-
16
- for (savingAccount in clientAccounts.savingsAccounts) {
17
- val account = Account ().apply {
18
- name = savingAccount.productName
19
- number = savingAccount.accountNo
20
- id = savingAccount.id
21
- balance = savingAccount.accountBalance
22
- currency = currencyMapper.transform(savingAccount.currency)
23
- productId = savingAccount.productId.toLong()
24
- }
25
-
26
- accountList.add(account)
13
+ clientAccounts?.savingsAccounts?.forEach { savingAccount ->
14
+ val account = Account ().apply {
15
+ name = savingAccount.productName
16
+ number = savingAccount.accountNo
17
+ id = savingAccount.id
18
+ balance = savingAccount.accountBalance
19
+ currency = currencyMapper.transform(savingAccount.currency)
20
+ productId = savingAccount.productId.toLong()
27
21
}
22
+ accountList.add(account)
28
23
}
29
24
return accountList
30
25
}
Original file line number Diff line number Diff line change @@ -2,14 +2,15 @@ package org.mifos.mobilewallet.core.data.fineract.entity.mapper
2
2
3
3
import com.mifos.mobilewallet.model.entity.accounts.savings.Currency
4
4
import javax.inject.Inject
5
+ import com.mifos.mobilewallet.model.domain.Currency as DomainCurrency
5
6
6
7
/* *
7
8
* Created by naman on 17/8/17.
8
9
*/
9
10
class CurrencyMapper @Inject internal constructor() {
10
- fun transform (savingsCurrency : Currency ): com.mifos.mobilewallet.model.domain. Currency {
11
- val currency: com.mifos.mobilewallet.model.domain. Currency =
12
- com.mifos.mobilewallet.model.domain. Currency ()
11
+ fun transform (savingsCurrency : Currency ): DomainCurrency {
12
+ val currency: DomainCurrency =
13
+ DomainCurrency ()
13
14
currency.code = savingsCurrency.code
14
15
currency.displayLabel = savingsCurrency.displayLabel
15
16
currency.displaySymbol = savingsCurrency.displaySymbol
Original file line number Diff line number Diff line change @@ -12,10 +12,8 @@ class TransactionMapper @Inject constructor(private val currencyMapper: Currency
12
12
fun transformTransactionList (savingsWithAssociations : SavingsWithAssociations ? ): List <Transaction > {
13
13
val transactionList = ArrayList <Transaction >()
14
14
15
- if (savingsWithAssociations != null && ! savingsWithAssociations.transactions.isNullOrEmpty()) {
16
- for (transactions in savingsWithAssociations.transactions) {
17
- transactionList.add(transformInvoice(transactions))
18
- }
15
+ savingsWithAssociations?.transactions?.forEach { transaction ->
16
+ transactionList.add(transformInvoice(transaction))
19
17
}
20
18
return transactionList
21
19
}
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ class TransferFunds @Inject constructor( private val apiRepository: FineractRepo
111
111
112
112
override fun onNext (clientAccounts : ClientAccounts ) {
113
113
val accounts = clientAccounts.savingsAccounts
114
- if (accounts != null && accounts.isNotEmpty ()) {
114
+ if (! accounts.isNullOrEmpty ()) {
115
115
var walletAccount: SavingAccount ? = null
116
116
for (account in accounts) {
117
117
if (account.productId == Constants .WALLET_ACCOUNT_SAVINGS_PRODUCT_ID ) {
You can’t perform that action at this time.
0 commit comments