Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions cmp-navigation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ kotlin {
implementation(projects.feature.settings)
implementation(projects.feature.search)
implementation(projects.feature.searchRecord)
implementation(projects.feature.standingInstruction)
implementation(projects.feature.passcode)

implementation(compose.material3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import com.mifos.feature.savings.di.SavingsModule
import com.mifos.feature.search.di.SearchModule
import com.mifos.feature.searchrecord.di.SearchRecordModule
import com.mifos.feature.settings.di.SettingsModule
import com.mifos.feature.standingInstructions.di.StandingInstructionsModule
import com.mifos.room.di.DaoModule
import com.mifos.room.di.HelperModule
import com.mifos.room.di.PlatformSpecificDatabaseModule
Expand Down Expand Up @@ -94,6 +95,7 @@ object KoinModules {
SettingsModule,
SearchRecordModule,
MifosAuthenticatorModule,
StandingInstructionsModule,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import com.mifos.core.data.repository.SearchRecordRepository
import com.mifos.core.data.repository.SearchRepository
import com.mifos.core.data.repository.ShareAccountRepository
import com.mifos.core.data.repository.SignatureRepository
import com.mifos.core.data.repository.StandingInstructionsRepository
import com.mifos.core.data.repository.SurveyListRepository
import com.mifos.core.data.repository.SurveySubmitRepository
import com.mifos.core.data.repository.SyncCenterPayloadsRepository
Expand Down Expand Up @@ -139,6 +140,7 @@ import com.mifos.core.data.repositoryImp.SearchRecordRepositoryImpl
import com.mifos.core.data.repositoryImp.SearchRepositoryImp
import com.mifos.core.data.repositoryImp.ShareAccountRepositoryImpl
import com.mifos.core.data.repositoryImp.SignatureRepositoryImp
import com.mifos.core.data.repositoryImp.StandingInstructionsRepositoryImp
import com.mifos.core.data.repositoryImp.SurveyListRepositoryImp
import com.mifos.core.data.repositoryImp.SurveySubmitRepositoryImp
import com.mifos.core.data.repositoryImp.SyncCenterPayloadsRepositoryImp
Expand Down Expand Up @@ -209,6 +211,9 @@ val RepositoryModule = module {
singleOf(::SavingsAccountTransactionRepositoryImp) bind SavingsAccountTransactionRepository::class
singleOf(::SavingsAccountTransactionReceiptRepositoryImpl) bind SavingsAccountTransactionReceiptRepository::class

// Standing Instructions
singleOf(::StandingInstructionsRepositoryImp) bind StandingInstructionsRepository::class

// Sync
singleOf(::SyncCenterPayloadsRepositoryImp) bind SyncCenterPayloadsRepository::class
singleOf(::SyncCentersDialogRepositoryImp) bind SyncCentersDialogRepository::class
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright 2026 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.mappers.standingInstructions

import com.mifos.core.model.objects.standingInstructions.StandingInstruction
import com.mifos.core.model.objects.standingInstructions.StandingInstructionAccount
import com.mifos.core.model.objects.standingInstructions.StandingInstructionClient
import com.mifos.core.network.dto.standingInstruction.StandingInstructionDto
import com.mifos.room.entities.standingInstructions.StandingInstructionAccountEntity
import com.mifos.room.entities.standingInstructions.StandingInstructionClientEntity
import com.mifos.room.entities.standingInstructions.StandingInstructionEntity

fun StandingInstructionDto.toEntity(): StandingInstructionEntity {
return StandingInstructionEntity(
id = this.id,
amount = this.amount,
validFrom = this.validFrom,
fromClient = this.fromClient?.let { StandingInstructionClientEntity(it.id, it.displayName) },
toClient = this.toClient?.let { StandingInstructionClientEntity(it.id, it.displayName) },
fromAccount = this.fromAccount?.let { StandingInstructionAccountEntity(it.id, it.accountNo, it.productName) },
toAccount = this.toAccount?.let {
StandingInstructionAccountEntity(
it.id,
it.accountNo,
it.productName,
)
},
)
}

fun StandingInstructionEntity.toDomain(): StandingInstruction {
return StandingInstruction(
id = this.id,
amount = this.amount,
validFrom = this.validFrom,
fromClient = this.fromClient?.toDomain(),
toClient = this.toClient?.toDomain(),
fromAccount = this.fromAccount?.toDomain(),
toAccount = this.toAccount?.toDomain(),
)
}

fun StandingInstructionClientEntity.toDomain(): StandingInstructionClient {
return StandingInstructionClient(
id = this.id,
displayName = this.displayName,
)
}

fun StandingInstructionAccountEntity.toDomain(): StandingInstructionAccount {
return StandingInstructionAccount(
id = this.id,
accountNo = this.accountNo,
productName = this.productName,
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2026 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.mappers.standingInstructions

import com.mifos.core.model.objects.standingInstructions.StandingInstruction
import com.mifos.core.model.objects.standingInstructions.StandingInstructionAccount
import com.mifos.core.model.objects.standingInstructions.StandingInstructionClient
import com.mifos.core.network.dto.standingInstruction.ClientDto
import com.mifos.core.network.dto.standingInstruction.StandingInstructionAccountDto
import com.mifos.core.network.dto.standingInstruction.StandingInstructionDto

fun StandingInstructionDto.toDomain(): StandingInstruction {
return StandingInstruction(
id = this.id,
amount = this.amount,
validFrom = this.validFrom,
fromClient = this.fromClient?.toDomain(),
toClient = this.toClient?.toDomain(),
fromAccount = this.fromAccount?.toDomain(),
toAccount = this.toAccount?.toDomain(),
)
}

fun ClientDto.toDomain(): StandingInstructionClient {
return StandingInstructionClient(
id = this.id,
displayName = this.displayName,
)
}

fun StandingInstructionAccountDto.toDomain(): StandingInstructionAccount {
return StandingInstructionAccount(
id = this.id,
accountNo = this.accountNo,
productName = this.productName,
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright 2026 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.repository

import com.mifos.core.common.utils.DataState
import com.mifos.core.common.utils.Page
import com.mifos.core.model.objects.standingInstructions.StandingInstruction
import kotlinx.coroutines.flow.Flow

interface StandingInstructionsRepository {
fun getStandingInstructionList(
clientId: Long,
clientName: String,
fromAccountType: Int,
fromAccountId: Long,
limit: Int,
offset: Int,
): Flow<DataState<Page<StandingInstruction>>>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright 2026 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.repositoryImp

import com.mifos.core.common.utils.DataState
import com.mifos.core.common.utils.Page
import com.mifos.core.common.utils.asDataStateFlow
import com.mifos.core.data.mappers.standingInstructions.toDomain
import com.mifos.core.data.repository.StandingInstructionsRepository
import com.mifos.core.data.util.NetworkMonitor
import com.mifos.core.data.util.withNetworkCheck
import com.mifos.core.model.objects.standingInstructions.StandingInstruction
import com.mifos.core.network.datamanager.DataManagerStandingInstructions
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import template.core.base.common.manager.DispatcherManager

class StandingInstructionsRepositoryImp(
private val dataManagerStandingInstructions: DataManagerStandingInstructions,
private val networkMonitor: NetworkMonitor,
private val dispatcher: DispatcherManager,
) : StandingInstructionsRepository {

override fun getStandingInstructionList(
clientId: Long,
clientName: String,
fromAccountType: Int,
fromAccountId: Long,
limit: Int,
offset: Int,
): Flow<DataState<Page<StandingInstruction>>> {
return networkMonitor.withNetworkCheck(
dataManagerStandingInstructions
.retrieveListStandingInstructions(
clientId = clientId,
clientName = clientName,
fromAccountType = fromAccountType,
fromAccountId = fromAccountId,
limit = limit,
offset = offset,
)
.map { pageDto ->
Page(
totalFilteredRecords = pageDto.totalFilteredRecords,
pageItems = pageDto.pageItems.map { it.toDomain() },
)
}
.asDataStateFlow(),
).flowOn(dispatcher.io)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ object APIEndPoint {
const val FIXED_DEPOSIT = "fixeddepositaccounts"
const val ACCOUNT_TRANSFERS = "accounttransfers"
const val RESCHEDULE_LOANS = "rescheduleloans"
const val STANDING_INSTRUCTIONS = "standinginstructions"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2026 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.room.entities.standingInstructions

import com.mifos.core.model.utils.Parcelable
import com.mifos.core.model.utils.Parcelize
import kotlinx.serialization.Serializable

@Serializable
@Parcelize
data class StandingInstructionAccountEntity(
val id: Int? = null,
val accountNo: String? = null,
val productName: String? = null,
) : Parcelable
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright 2026 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.room.entities.standingInstructions

import com.mifos.core.model.utils.Parcelable
import com.mifos.core.model.utils.Parcelize
import kotlinx.serialization.Serializable

@Serializable
@Parcelize
data class StandingInstructionClientEntity(
val id: Int? = null,
val displayName: String? = null,
) : Parcelable
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.room.entities.standingInstructions

import com.mifos.core.model.utils.Parcelable
import com.mifos.core.model.utils.Parcelize
import kotlinx.serialization.Serializable
import template.core.base.database.Entity
import template.core.base.database.PrimaryKey

@Entity(
tableName = "StandingInstruction",
indices = [],
inheritSuperIndices = false,
primaryKeys = [],
ignoredColumns = [],
foreignKeys = [],
)
@Serializable
@Parcelize
data class StandingInstructionEntity(
@PrimaryKey(autoGenerate = false)
val id: Int,

val amount: Double? = null,

val validFrom: String? = null,

val fromClient: StandingInstructionClientEntity? = null,

val toClient: StandingInstructionClientEntity? = null,

val fromAccount: StandingInstructionAccountEntity? = null,

val toAccount: StandingInstructionAccountEntity? = null,
) : Parcelable
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2026 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.model.objects.standingInstructions

import kotlinx.serialization.Serializable

@Serializable
data class StandingInstruction(
Comment thread
techsavvy185 marked this conversation as resolved.
val id: Int,
val amount: Double? = null,
val validFrom: String? = null,
val fromClient: StandingInstructionClient? = null,
val toClient: StandingInstructionClient? = null,
val fromAccount: StandingInstructionAccount? = null,
val toAccount: StandingInstructionAccount? = null,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright 2026 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.model.objects.standingInstructions

import kotlinx.serialization.Serializable

@Serializable
data class StandingInstructionAccount(
val id: Int? = null,
val accountNo: String? = null,
val productName: String? = null,
)
Loading
Loading