Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.mifos.core.data.repository

import com.mifos.core.common.utils.DataState
import com.mifos.core.network.model.FixedDepositTemplate
import kotlinx.coroutines.flow.Flow

interface FixedDepositRepository {
fun getFixedDepositTemplate(clientId: Int): Flow<DataState<FixedDepositTemplate>>


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.mifos.core.data.repositoryImp


import com.mifos.core.common.utils.DataState
import com.mifos.core.common.utils.asDataStateFlow
import com.mifos.core.data.repository.FixedDepositRepository
import com.mifos.core.network.datamanager.DataManagerFixedDeposit
import com.mifos.core.network.model.FixedDepositTemplate
import kotlinx.coroutines.flow.Flow

class FixedDepositRepositoryImpl (private val dataManagerFixedDeposit: DataManagerFixedDeposit): FixedDepositRepository{

override fun getFixedDepositTemplate(clientId: Int): Flow<DataState<FixedDepositTemplate>> {
return dataManagerFixedDeposit.getFixedDepositTemplate(clientId).asDataStateFlow()
}




}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ object APIEndPoint {
const val DISBURSE = "disburse"
const val NOTES = "notes"
const val MAKER_CHECKER = "makercheckers"

const val FIXED_DEPOSIT ="fixeddepositaccounts"
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ data class SavingAccountDepositTypeEntity(

enum class ServerTypes(val id: Int, val code: String, val endpoint: String) {
SAVINGS(100, "depositAccountType.savingsDeposit", APIEndPoint.SAVINGS_ACCOUNTS),
FIXED(200, "depositAccountType.fixedDeposit", APIEndPoint.SAVINGS_ACCOUNTS),
FIXED(200, "depositAccountType.fixedDeposit", APIEndPoint.FIXED_DEPOSIT),
RECURRING(300, "depositAccountType.recurringDeposit", APIEndPoint.RECURRING_ACCOUNTS),
;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import com.mifos.core.network.services.SavingsAccountService
import com.mifos.core.network.services.SearchService
import com.mifos.core.network.services.StaffService
import com.mifos.core.network.services.SurveyService
import com.mifos.core.network.services.FixedDepositService
import com.mifos.core.network.services.createCenterService
import com.mifos.core.network.services.createChargeService
import com.mifos.core.network.services.createCheckerInboxService
Expand All @@ -58,6 +59,7 @@ import com.mifos.core.network.services.createOfficeService
import com.mifos.core.network.services.createRecurringAccountService
import com.mifos.core.network.services.createRunReportsService
import com.mifos.core.network.services.createSavingsAccountService
import com.mifos.core.network.services.createFixedDepositService
import com.mifos.core.network.services.createSearchService
import com.mifos.core.network.services.createStaffService
import com.mifos.core.network.services.createSurveyService
Expand All @@ -74,6 +76,7 @@ class BaseApiManager(
val dataTableService: DataTableService = ktorfit.createDataTableService()
val loanService: LoanService = ktorfit.createLoanService()
val savingsService: SavingsAccountService = ktorfit.createSavingsAccountService()
val fixedDepositService: FixedDepositService = ktorfit.createFixedDepositService()

val recurringSavingsAccountService: RecurringAccountService = ktorfit.createRecurringAccountService()
val searchService: SearchService = ktorfit.createSearchService()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.mifos.core.network.datamanager

import com.mifos.core.network.BaseApiManager
import com.mifos.core.network.model.FixedDepositTemplate
import kotlinx.coroutines.flow.Flow

class DataManagerFixedDeposit (private val baseApiManager: BaseApiManager){

fun getFixedDepositTemplate(clientId:Int): Flow<FixedDepositTemplate> =
baseApiManager.fixedDepositService.fixedDepositProductTemplate(clientId)

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import com.mifos.core.network.datamanager.DataManagerDataTable
import com.mifos.core.network.datamanager.DataManagerDocument
import com.mifos.core.network.datamanager.DataManagerGroups
import com.mifos.core.network.datamanager.DataManagerIdentifiers
import com.mifos.core.network.datamanager.DataManagerFixedDeposit
import com.mifos.core.network.datamanager.DataManagerLoan
import com.mifos.core.network.datamanager.DataManagerNote
import com.mifos.core.network.datamanager.DataManagerOffices
Expand Down Expand Up @@ -51,4 +52,5 @@ val DataManagerModule = module {
single { DataManagerStaff(get(), get(), get()) }
single { DataManagerSurveys(get(), get(), get()) }
single { DataManagerIdentifiers(get()) }
single { DataManagerFixedDeposit(get()) }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.mifos.core.network.model


import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class FixedDepositProductOption(
@SerialName("id")
val id: Int,

@SerialName("name")
val name: String,

@SerialName("shortName")
val shortName: String,

@SerialName("totalShares")
val totalShares: Int,
Comment on lines +18 to +19
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify the totalShares field naming for Fixed Deposit products.

The field name totalShares seems semantically incorrect for a Fixed Deposit product option. Fixed deposits typically don't have "shares" — that terminology is more common for equity or share products. Please verify that this field name matches the actual API response for fixed deposit product templates.

Run the following script to check if similar models use this field and to look for API documentation:


🏁 Script executed:

#!/bin/bash
# Search for other product option models to compare naming patterns
ast-grep --pattern 'data class $_ ProductOption(
  $$$
)'

# Search for any API documentation or comments about totalShares in fixed deposits
rg -n -C3 'totalShares' --type=kt

Length of output: 26



---

🏁 Script executed:

```shell
#!/bin/bash
# Find all kotlin files in the network model directory
echo "=== Kotlin files in network model directory ==="
fd "\.kt$" "core/network/src/commonMain/kotlin/com/mifos/core/network/model" 2>/dev/null | head -20

# Search for ProductOption data classes
echo -e "\n=== Searching for ProductOption classes ==="
rg -n "data class.*ProductOption" 2>/dev/null

# Search for totalShares references in kotlin files
echo -e "\n=== Searching for totalShares references ==="
rg -n -C3 "totalShares" 2>/dev/null

# Search for FixedDepositProductOption file
echo -e "\n=== FixedDepositProductOption file content ==="
find . -name "FixedDepositProductOption.kt" -exec cat {} \; 2>/dev/null

Length of output: 3610



---

🏁 Script executed:

```shell
#!/bin/bash
# Show the ProductOptions class from loan template
echo "=== ProductOptions from loan template ==="
cat "core/model/src/commonMain/kotlin/com/mifos/core/model/objects/template/loan/ProductOptions.kt" 2>/dev/null | head -50

# Show the ProductOption class from recurring period
echo -e "\n=== ProductOption from recurring period ==="
cat "core/model/src/commonMain/kotlin/com/mifos/core/model/objects/template/recurring/period/ProductOption.kt" 2>/dev/null | head -50

# Show the SavingProductOptionsEntity
echo -e "\n=== SavingProductOptionsEntity ==="
cat "core/database/src/commonMain/kotlin/com/mifos/room/entities/templates/clients/SavingProductOptionsEntity.kt" 2>/dev/null

# Search for any API documentation, README, or comments about FixedDepositProductOption
echo -e "\n=== Search for FixedDeposit API references ==="
rg -i "fixeddeposit.*product" -n --max-count=10 2>/dev/null

Length of output: 5845



---

🌐 Web query:

```web
Mifos fixed deposit product API totalShares field documentation

💡 Result:

There is no totalShares field on the Fixed Deposit Product API — totalShares is a field used by the Share Product / Share Accounts APIs. See the Fixed Deposit product fields (no totalShares shown). [1] For the field totalShares and examples, see the Share Product API documentation (totalShares / totalSharesIssued appear on products/share and related endpoints). [2]

Sources:

  • Fixed Deposit Product Fields — Mifos docs. [1]
  • Share Product / Share API (totalShares example) — Apache Fineract / Mifos API docs. [2]

Remove the totalShares field from FixedDepositProductOption — it does not exist in the Mifos Fixed Deposit Product API.

The totalShares field is specific to Share Product / Share Accounts APIs and is not included in Fixed Deposit product definitions. This field should not be in the FixedDepositProductOption class. Remove line 18-19 entirely.

🤖 Prompt for AI Agents
In
core/network/src/commonMain/kotlin/com/mifos/core/network/model/FixedDepositProductOption.kt
around lines 18-19, remove the unnecessary `@SerialName("totalShares") val
totalShares: Int` property from the FixedDepositProductOption data class; delete
those two lines and any unused imports or references to totalShares in this file
or its usages so the model matches the Mifos Fixed Deposit Product API.

)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.mifos.core.network.model

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable



@Serializable
data class FixedDepositTemplate(
@SerialName("clientId")
val clientId: Int,

@SerialName(value = "clientName")
val clientName: String,

@SerialName("productOptions")
val productOptions: List<FixedDepositProductOption> = emptyList(),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.mifos.core.network.services

import com.mifos.core.network.model.FixedDepositTemplate
import com.mifos.room.basemodel.APIEndPoint
import de.jensklingenberg.ktorfit.http.Query
import de.jensklingenberg.ktorfit.http.GET
import kotlinx.coroutines.flow.Flow






interface FixedDepositService {

@GET( APIEndPoint.FIXED_DEPOSIT + "/template")
fun fixedDepositProductTemplate(
@Query("clientId") clientId: Int,
): Flow<FixedDepositTemplate>
}





Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,12 @@
<string name="client_update_document_title">Update Document</string>
<!-- Screen Title -->
<string name="title_new_fixed_deposit_account">New Fixed Deposit Account</string>
<string name="title_new_recurring_deposit_account">New Recurring Deposit Account</string>
<!-- New Fixed Deposit Account -->
<string name="one_year_fixed_deposit">1 Year Fixed Deposit</string>
<string name="submission_on">Submission On</string>
<string name="Field_officer">Field Officer</string>

Comment on lines +533 to +538
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix invalid resource name for Field Officer label.

Android string resource names must be lowercase. Defining <string name="Field_officer"> will fail the aapt compile step. Please rename it (e.g., field_officer) and update the corresponding usages such as Res.string.Field_officer.

-    <string name="Field_officer">Field Officer</string>
+    <string name="field_officer">Field Officer</string>

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In feature/client/src/commonMain/composeResources/values/strings.xml around
lines 533 to 538, the string resource name "Field_officer" is invalid (contains
uppercase) and will break aapt; rename the resource to all-lowercase (e.g.,
field_officer) in this file and update all call sites/usages (e.g.,
Res.string.Field_officer → Res.string.field_officer) to match the new name.



</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fun NavGraphBuilder.clientApplyNewApplicationRoute(
onNavigateApplySavingsAccount: (Int) -> Unit,
onNavigateApplyShareAccount: () -> Unit,
onNavigateApplyRecurringAccount: () -> Unit,
onNavigateApplyFixedAccount: () -> Unit,
onNavigateApplyFixedAccount: (Int) -> Unit,
navController: NavController,
) {
composable<ClientApplyNewApplicationRoute> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ internal fun ClientApplyNewApplicationsScreen(
onNavigateApplySavingsAccount: (Int) -> Unit,
onNavigateApplyShareAccount: () -> Unit,
onNavigateApplyRecurringAccount: () -> Unit,
onNavigateApplyFixedAccount: () -> Unit,
onNavigateApplyFixedAccount: (Int) -> Unit,
navController: NavController,
viewModel: ClientApplyNewApplicationsViewModel = koinViewModel(),
) {
Expand All @@ -71,7 +71,7 @@ internal fun ClientApplyNewApplicationsScreen(
ClientApplyNewApplicationsEvent.NavigateBack -> onNavigateBack()
is ClientApplyNewApplicationsEvent.OnActionClick -> {
when (event.action) {
ClientApplyNewApplicationsItem.NewFixedAccount -> onNavigateApplyFixedAccount()
ClientApplyNewApplicationsItem.NewFixedAccount -> onNavigateApplyFixedAccount(state.clientId)
ClientApplyNewApplicationsItem.NewLoanAccount -> onNavigateApplyLoanAccount(state.clientId)
ClientApplyNewApplicationsItem.NewRecurringAccount -> onNavigateApplyRecurringAccount()
ClientApplyNewApplicationsItem.NewSavingsAccount -> onNavigateApplySavingsAccount(state.clientId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import com.mifos.feature.client.clientsList.ClientListViewModel
import com.mifos.feature.client.createNewClient.CreateNewClientViewModel
import com.mifos.feature.client.documentPreviewScreen.DocumentPreviewScreenViewModel
import com.mifos.feature.client.fixedDepositAccount.FixedDepositAccountViewModel
import com.mifos.feature.client.newFixedDepositAccount.CreateFixedDepositAccountViewmodel
import com.mifos.feature.client.recurringDepositAccount.RecurringDepositAccountViewModel
import com.mifos.feature.client.savingsAccounts.SavingsAccountsViewModel
import com.mifos.feature.client.shareAccounts.ShareAccountsViewModel
Expand Down Expand Up @@ -81,6 +82,7 @@ val ClientModule = module {
viewModelOf(::ShareAccountsViewModel)
viewModelOf(::ClientIdentifiersListViewModel)
viewModelOf(::ClientIdentifiersAddUpdateViewModel)
viewModelOf(::CreateFixedDepositAccountViewmodel)

singleOf(::DocumentSelectAndUploadRepositoryImpl) {
bind<DocumentSelectAndUploadRepository>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ import com.mifos.feature.client.documentPreviewScreen.createDocumentPreviewRoute
import com.mifos.feature.client.documentPreviewScreen.navigateToDocumentPreviewRoute
import com.mifos.feature.client.fixedDepositAccount.clientFixedDepositAccountDestination
import com.mifos.feature.client.fixedDepositAccount.navigateToFixedDepositAccountRoute
import com.mifos.feature.client.newFixedDepositAccount.fixedAccountDestination
import com.mifos.feature.client.newFixedDepositAccount.navigateToNewFixedDepositRoute
import com.mifos.feature.client.newFixedDepositAccount.createFixedDepositAccountRoute
import com.mifos.feature.client.newFixedDepositAccount.createFixedDepositAccountDestination
import com.mifos.feature.client.newFixedDepositAccount.navigateToCreateFixedDepositRoute
import com.mifos.feature.client.recurringDepositAccount.clientRecurringDepositAccountDestination
import com.mifos.feature.client.recurringDepositAccount.navigateToRecurringDepositAccountRoute
import com.mifos.feature.client.savingsAccounts.navigateToClientSavingsAccountsRoute
Expand Down Expand Up @@ -312,7 +313,7 @@ fun NavGraphBuilder.clientNavGraph(
onNavigateApplyLoanAccount = navController::navigateToNewLoanAccountRoute,
onNavigateApplySavingsAccount = navController::navigateToSavingsAccountRoute,
onNavigateApplyRecurringAccount = navController::navigateToRecurringAccountRoute,
onNavigateApplyFixedAccount = navController::navigateToNewFixedDepositRoute,
onNavigateApplyFixedAccount = navController::navigateToCreateFixedDepositRoute,
navController = navController,
)
clientUpcomingChargesDestination(
Expand Down Expand Up @@ -343,7 +344,7 @@ fun NavGraphBuilder.clientNavGraph(

shareAccountDestination()
recurringAccountDestination()
fixedAccountDestination()
createFixedDepositAccountDestination(navController = navController)
}
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,24 @@ import androidx.navigation.compose.composable
import kotlinx.serialization.Serializable

@Serializable
data object FixedDepositRoute

fun NavGraphBuilder.fixedAccountDestination() {
composable<FixedDepositRoute> {
FixedDepositAccountScreen(
onNavigateBack = {},
data class createFixedDepositAccountRoute(
val clientId: Int,
)



fun NavGraphBuilder.createFixedDepositAccountDestination(navController: NavController) {
composable<createFixedDepositAccountRoute> {
CreateFixedDepositAccountScreen(
onNavigateBack = navController::popBackStack,
onFinish = {},
navController = navController,
)
}
}
fun NavController.navigateToNewFixedDepositRoute() {
fun NavController.navigateToCreateFixedDepositRoute(clientId: Int) {
this.navigate(
FixedDepositRoute,
createFixedDepositAccountRoute(clientId=clientId)
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavController
import com.mifos.core.designsystem.component.MifosScaffold
import com.mifos.core.ui.components.MifosStepper
import com.mifos.core.ui.components.Step
Expand All @@ -34,11 +35,12 @@ import com.mifos.feature.client.newFixedDepositAccount.pages.TermsPage
import org.jetbrains.compose.resources.stringResource

@Composable
internal fun FixedDepositAccountScreen(
internal fun CreateFixedDepositAccountScreen(
onNavigateBack: () -> Unit,
navController: NavController,
onFinish: () -> Unit,
modifier: Modifier = Modifier,
viewModel: NewFixedDepositAccountViewmodel = viewModel(),
viewModel: CreateFixedDepositAccountViewmodel = viewModel(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we have to use koinViewModel() here

) {
val state by viewModel.stateFlow.collectAsStateWithLifecycle()
EventsEffect(viewModel.eventFlow) { event ->
Expand All @@ -64,7 +66,8 @@ private fun FixedDepositAccountScaffold(
listOf(
Step(stringResource(Res.string.step_details)) {
DetailsPage(
onNext = { onAction(NewFixedDepositAccountAction.NextStep) },
state = state,
onAction = onAction,
)
},
Step(name = stringResource(Res.string.step_terms)) {
Expand Down
Loading