Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,6 @@ import com.mifos.core.data.repository.GroupListRepository
import com.mifos.core.data.repository.GroupLoanAccountRepository
import com.mifos.core.data.repository.GroupsListRepository
import com.mifos.core.data.repository.IndividualCollectionSheetDetailsRepository
import com.mifos.core.data.repository.LoanAccountApprovalRepository
import com.mifos.core.data.repository.LoanAccountDisbursementRepository
import com.mifos.core.data.repository.LoanAccountRepository
import com.mifos.core.data.repository.LoanAccountSummaryRepository
import com.mifos.core.data.repository.LoanChargeFormRepository
import com.mifos.core.data.repository.LoanChargeOffRepository
import com.mifos.core.data.repository.LoanChargeRepository
import com.mifos.core.data.repository.LoanCreateGuarantorRepository
import com.mifos.core.data.repository.LoanRepaymentRepository
import com.mifos.core.data.repository.LoanRepaymentScheduleRepository
import com.mifos.core.data.repository.LoanReschedulesRepository
import com.mifos.core.data.repository.LoanTransactionsRepository
import com.mifos.core.data.repository.LoginRepository
import com.mifos.core.data.repository.NewIndividualCollectionSheetRepository
import com.mifos.core.data.repository.NoteRepository
Expand Down Expand Up @@ -82,6 +70,19 @@ import com.mifos.core.data.repository.SyncGroupsDialogRepository
import com.mifos.core.data.repository.SyncLoanRepaymentTransactionRepository
import com.mifos.core.data.repository.SyncSavingsAccountTransactionRepository
import com.mifos.core.data.repository.UserVerificationRepository
import com.mifos.core.data.repository.loan.LoanAccountApprovalRepository
import com.mifos.core.data.repository.loan.LoanAccountDisbursementRepository
import com.mifos.core.data.repository.loan.LoanAccountRepository
import com.mifos.core.data.repository.loan.LoanAccountSummaryRepository
import com.mifos.core.data.repository.loan.LoanChargeFormRepository
import com.mifos.core.data.repository.loan.LoanChargeOffRepository
import com.mifos.core.data.repository.loan.LoanChargeRepository
import com.mifos.core.data.repository.loan.LoanCreateGuarantorRepository
import com.mifos.core.data.repository.loan.LoanOfficerRepository
import com.mifos.core.data.repository.loan.LoanRepaymentRepository
import com.mifos.core.data.repository.loan.LoanRepaymentScheduleRepository
import com.mifos.core.data.repository.loan.LoanReschedulesRepository
import com.mifos.core.data.repository.loan.LoanTransactionsRepository
import com.mifos.core.data.repositoryImp.ActivateRepositoryImp
import com.mifos.core.data.repositoryImp.AmountTransferRepositoryImp
import com.mifos.core.data.repositoryImp.AppLockRepositoryImpl
Expand Down Expand Up @@ -111,18 +112,6 @@ import com.mifos.core.data.repositoryImp.GroupListRepositoryImp
import com.mifos.core.data.repositoryImp.GroupLoanAccountRepositoryImp
import com.mifos.core.data.repositoryImp.GroupsListRepositoryImpl
import com.mifos.core.data.repositoryImp.IndividualCollectionSheetDetailsRepositoryImp
import com.mifos.core.data.repositoryImp.LoanAccountApprovalRepositoryImp
import com.mifos.core.data.repositoryImp.LoanAccountDisbursementRepositoryImp
import com.mifos.core.data.repositoryImp.LoanAccountRepositoryImp
import com.mifos.core.data.repositoryImp.LoanAccountSummaryRepositoryImp
import com.mifos.core.data.repositoryImp.LoanChargeFormRepositoryImp
import com.mifos.core.data.repositoryImp.LoanChargeOffRepositoryImpl
import com.mifos.core.data.repositoryImp.LoanChargeRepositoryImp
import com.mifos.core.data.repositoryImp.LoanCreateGuarantorRepositoryImp
import com.mifos.core.data.repositoryImp.LoanRepaymentRepositoryImp
import com.mifos.core.data.repositoryImp.LoanRepaymentScheduleRepositoryImp
import com.mifos.core.data.repositoryImp.LoanReschedulesRepositoryImpl
import com.mifos.core.data.repositoryImp.LoanTransactionsRepositoryImp
import com.mifos.core.data.repositoryImp.LoginRepositoryImp
import com.mifos.core.data.repositoryImp.NewIndividualCollectionSheetRepositoryImp
import com.mifos.core.data.repositoryImp.NoteRepositoryImp
Expand Down Expand Up @@ -154,6 +143,19 @@ import com.mifos.core.data.repositoryImp.SyncGroupsDialogRepositoryImp
import com.mifos.core.data.repositoryImp.SyncLoanRepaymentTransactionRepositoryImp
import com.mifos.core.data.repositoryImp.SyncSavingsAccountTransactionRepositoryImp
import com.mifos.core.data.repositoryImp.UserVerificationRepositoryImpl
import com.mifos.core.data.repositoryImp.loan.LoanAccountApprovalRepositoryImp
import com.mifos.core.data.repositoryImp.loan.LoanAccountDisbursementRepositoryImp
import com.mifos.core.data.repositoryImp.loan.LoanAccountRepositoryImp
import com.mifos.core.data.repositoryImp.loan.LoanAccountSummaryRepositoryImp
import com.mifos.core.data.repositoryImp.loan.LoanChargeFormRepositoryImp
import com.mifos.core.data.repositoryImp.loan.LoanChargeOffRepositoryImpl
import com.mifos.core.data.repositoryImp.loan.LoanChargeRepositoryImp
import com.mifos.core.data.repositoryImp.loan.LoanCreateGuarantorRepositoryImp
import com.mifos.core.data.repositoryImp.loan.LoanOfficerRepositoryImpl
import com.mifos.core.data.repositoryImp.loan.LoanRepaymentRepositoryImp
import com.mifos.core.data.repositoryImp.loan.LoanRepaymentScheduleRepositoryImp
import com.mifos.core.data.repositoryImp.loan.LoanReschedulesRepositoryImpl
import com.mifos.core.data.repositoryImp.loan.LoanTransactionsRepositoryImp
import com.mifos.core.data.util.NetworkMonitor
import kotlinx.coroutines.CoroutineDispatcher
import org.koin.core.module.dsl.singleOf
Expand Down Expand Up @@ -203,6 +205,7 @@ val RepositoryModule = module {
singleOf(::LoanReschedulesRepositoryImpl) bind LoanReschedulesRepository::class
singleOf(::LoanChargeOffRepositoryImpl) bind LoanChargeOffRepository::class
singleOf(::LoanCreateGuarantorRepositoryImp) bind LoanCreateGuarantorRepository::class
singleOf(::LoanOfficerRepositoryImpl) bind LoanOfficerRepository::class

// Account Transfer
singleOf(::AmountTransferRepositoryImp) bind AmountTransferRepository::class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
package com.mifos.core.data.mappers.loan

import com.mifos.core.model.objects.account.loan.ChargeOffReasonOption
import com.mifos.core.network.dto.loans.ChargeOffReasonOptionDto
import com.mifos.core.network.dto.loans.template.ChargeOffReasonOptionDto

fun ChargeOffReasonOptionDto.toModel(): ChargeOffReasonOption = ChargeOffReasonOption(
id = id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import com.mifos.core.model.objects.account.loan.guarantor.GuarantorRelationship
import com.mifos.core.model.objects.account.loan.guarantor.GuarantorTemplate
import com.mifos.core.model.objects.account.loan.guarantor.GuarantorType
import com.mifos.core.network.dto.loans.CreateGuarantorResponseDto
import com.mifos.core.network.dto.loans.GuarantorAccountTemplateDto
import com.mifos.core.network.dto.loans.GuarantorRelationshipOptionDto
import com.mifos.core.network.dto.loans.GuarantorRequestDto
import com.mifos.core.network.dto.loans.GuarantorTemplateDto
import com.mifos.core.network.dto.loans.GuarantorTypeDto
import com.mifos.core.network.dto.loans.template.GuarantorAccountTemplateDto
import com.mifos.core.network.dto.loans.template.GuarantorRelationshipOptionDto
import com.mifos.core.network.dto.loans.template.GuarantorTemplateDto
import com.mifos.core.network.dto.loans.template.GuarantorTypeDto

fun GuarantorTemplateDto.toDomain(): GuarantorTemplate =
GuarantorTemplate(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* 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.loan

import com.mifos.core.model.objects.account.loan.assignLoanOfficer.AssignLoanOfficerInput
import com.mifos.core.model.objects.account.loan.assignLoanOfficer.AssignLoanOfficerResponse
import com.mifos.core.model.objects.template.loan.LoanOfficerOption
import com.mifos.core.network.dto.loans.assignLoanOfficer.AssignLoanOfficerRequestDto
import com.mifos.core.network.dto.loans.assignLoanOfficer.AssignLoanOfficerResponseDto
import com.mifos.core.network.dto.loans.template.LoanOfficerOptionDto
import com.mifos.core.network.dto.loans.template.LoanOfficerOptionsTemplateDto

// Unwrap the DTO directly into a List for the Domain
fun LoanOfficerOptionsTemplateDto.toDomain(): List<LoanOfficerOption> =
this.loanOfficerOptions.map { it.toDomain() }

fun LoanOfficerOptionDto.toDomain(): LoanOfficerOption =
LoanOfficerOption(
id = id,
firstname = firstname,
lastname = lastname,
displayName = displayName,
mobileNo = mobileNo,
officeId = officeId,
officeName = officeName,
isLoanOfficer = isLoanOfficer,
isActive = isActive,
)

fun AssignLoanOfficerInput.toDto(): AssignLoanOfficerRequestDto =
AssignLoanOfficerRequestDto(
assignmentDate = assignmentDate,
dateFormat = dateFormat,
locale = locale,
fromLoanOfficerId = fromLoanOfficerId,
toLoanOfficerId = toLoanOfficerId,
)

fun AssignLoanOfficerResponseDto.toDomain(): AssignLoanOfficerResponse =
AssignLoanOfficerResponse(
officeId = officeId,
clientId = clientId,
loanId = loanId,
resourceId = resourceId,
)
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*
* Copyright 2024 Mifos Initiative
* 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
package com.mifos.core.data.repository.loan

import com.mifos.core.common.utils.DataState
import com.mifos.core.model.objects.account.loan.LoanApproval
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.repository
package com.mifos.core.data.repository.loan

import com.mifos.core.common.utils.DataState
import com.mifos.core.model.objects.account.loan.LoanDisbursement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.repository
package com.mifos.core.data.repository.loan

import com.mifos.core.common.utils.DataState
import com.mifos.core.model.objects.account.loan.RepaymentSchedule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.repository
package com.mifos.core.data.repository.loan

import com.mifos.core.common.utils.DataState
import com.mifos.room.entities.accounts.loans.LoanWithAssociationsEntity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.repository
package com.mifos.core.data.repository.loan

import com.mifos.core.model.objects.clients.ChargeCreationResponse
import com.mifos.core.model.objects.payloads.ChargesPayload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.repository
package com.mifos.core.data.repository.loan

import com.mifos.core.common.utils.DataState
import com.mifos.core.model.objects.account.loan.ChargeOffReasonOption
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.repository
package com.mifos.core.data.repository.loan

import com.mifos.core.common.utils.DataState
import com.mifos.room.entities.client.ChargesEntity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.repository
package com.mifos.core.data.repository.loan

import com.mifos.core.common.utils.DataState
import com.mifos.core.model.objects.account.loan.guarantor.CreateGuarantor
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* 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.loan

import com.mifos.core.common.utils.DataState
import com.mifos.core.model.objects.account.loan.assignLoanOfficer.AssignLoanOfficerInput
import com.mifos.core.model.objects.account.loan.assignLoanOfficer.AssignLoanOfficerResponse
import com.mifos.core.model.objects.template.loan.LoanOfficerOption

interface LoanOfficerRepository {
suspend fun getLoanOfficerOptions(loanId: Int): DataState<List<LoanOfficerOption>>

suspend fun assignLoanOfficer(
loanId: Int,
input: AssignLoanOfficerInput,
): DataState<AssignLoanOfficerResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.repository
package com.mifos.core.data.repository.loan

import com.mifos.core.common.utils.DataState
import com.mifos.room.entities.accounts.loans.LoanRepaymentRequestEntity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.repository
package com.mifos.core.data.repository.loan

import com.mifos.core.common.utils.DataState
import com.mifos.room.entities.accounts.loans.LoanWithAssociationsEntity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.repository
package com.mifos.core.data.repository.loan

import com.mifos.core.common.utils.DataState
import com.mifos.core.model.objects.account.loan.reschedules.LoanRescheduleApprovalRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.repository
package com.mifos.core.data.repository.loan

import com.mifos.core.common.utils.DataState
import com.mifos.room.entities.accounts.loans.LoanWithAssociationsEntity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.repositoryImp
package com.mifos.core.data.repositoryImp.loan

import com.mifos.core.common.utils.DataState
import com.mifos.core.common.utils.asDataStateFlow
import com.mifos.core.data.repository.LoanAccountApprovalRepository
import com.mifos.core.data.repository.loan.LoanAccountApprovalRepository
import com.mifos.core.model.objects.account.loan.LoanApproval
import com.mifos.core.network.DataManager
import com.mifos.core.network.GenericResponse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.repositoryImp
package com.mifos.core.data.repositoryImp.loan

import com.mifos.core.common.utils.DataState
import com.mifos.core.common.utils.asDataStateFlow
import com.mifos.core.data.repository.LoanAccountDisbursementRepository
import com.mifos.core.data.repository.loan.LoanAccountDisbursementRepository
import com.mifos.core.model.objects.account.loan.LoanDisbursement
import com.mifos.core.network.GenericResponse
import com.mifos.core.network.datamanager.DataManagerLoan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.repositoryImp
package com.mifos.core.data.repositoryImp.loan

import com.mifos.core.common.utils.DataState
import com.mifos.core.common.utils.asDataStateFlow
import com.mifos.core.data.repository.LoanAccountRepository
import com.mifos.core.data.repository.loan.LoanAccountRepository
import com.mifos.core.model.objects.account.loan.RepaymentSchedule
import com.mifos.core.model.objects.organisations.LoanProducts
import com.mifos.core.network.datamanager.DataManagerLoan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.repositoryImp
package com.mifos.core.data.repositoryImp.loan

import com.mifos.core.common.utils.DataState
import com.mifos.core.common.utils.asDataStateFlow
import com.mifos.core.data.repository.LoanAccountSummaryRepository
import com.mifos.core.data.repository.loan.LoanAccountSummaryRepository
import com.mifos.core.network.datamanager.DataManagerLoan
import com.mifos.room.entities.accounts.loans.LoanWithAssociationsEntity
import kotlinx.coroutines.flow.Flow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.repositoryImp
package com.mifos.core.data.repositoryImp.loan

import com.mifos.core.data.repository.LoanChargeFormRepository
import com.mifos.core.data.repository.loan.LoanChargeFormRepository
import com.mifos.core.model.objects.clients.ChargeCreationResponse
import com.mifos.core.model.objects.payloads.ChargesPayload
import com.mifos.core.model.objects.template.client.ChargeTemplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
*
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
*/
package com.mifos.core.data.repositoryImp
package com.mifos.core.data.repositoryImp.loan

import com.mifos.core.common.utils.DataState
import com.mifos.core.data.mappers.loan.toDto
import com.mifos.core.data.mappers.loan.toModel
import com.mifos.core.data.repository.LoanChargeOffRepository
import com.mifos.core.data.repository.loan.LoanChargeOffRepository
import com.mifos.core.data.util.NetworkMonitor
import com.mifos.core.data.util.runAsDataState
import com.mifos.core.model.objects.account.loan.ChargeOffReasonOption
Expand Down
Loading
Loading