Skip to content

Commit b086d50

Browse files
committed
feat: fill savings application
1 parent 3d973e6 commit b086d50

File tree

13 files changed

+1362
-63
lines changed

13 files changed

+1362
-63
lines changed

cmp-navigation/src/commonMain/kotlin/cmp/navigation/authenticated/AuthenticatedNavigation.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ internal fun NavGraphBuilder.authenticatedGraph(
186186

187187
savingsApplicationNavGraph(
188188
navController = navController,
189+
navigateToStatusScreen = navController::navigateToStatusAfterUpdate,
190+
navigateToAuthenticateScreen = navController::navigateToVerifyPasscodeScreen,
189191
)
190192

191193
passcodeDestination(

core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/SavingsAccountApplicationPayload.kt

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,52 @@
99
*/
1010
package org.mifos.mobile.core.model.entity.accounts.savings
1111

12+
import kotlinx.serialization.Serializable
1213
import org.mifos.mobile.core.model.Parcelable
1314
import org.mifos.mobile.core.model.Parcelize
1415

16+
@Serializable
1517
@Parcelize
1618
data class SavingsAccountApplicationPayload(
1719

18-
val submittedOnDate: String? = null,
19-
20+
// Mandatory
2021
val clientId: Int? = null,
21-
2222
val productId: Int? = null,
23+
val submittedOnDate: String? = null,
24+
val locale: String,
25+
val dateFormat: String,
26+
val monthDayFormat: String,
27+
28+
// Optional
29+
val accountNo: String? = null,
30+
val externalId: String? = null,
31+
val fieldOfficerId: Int? = null,
32+
33+
// Override fields (inherited from Product if not provided)
34+
val nominalAnnualInterestRate: Double? = null,
35+
val interestCompoundingPeriodType: Int? = null,
36+
val interestPostingPeriodType: Int? = null,
37+
val interestCalculationType: Int? = null,
38+
val interestCalculationDaysInYearType: Int? = null,
39+
val minRequiredOpeningBalance: Double? = null,
40+
val lockinPeriodFrequency: Int? = null,
41+
val lockinPeriodFrequencyType: Int? = null,
42+
val withdrawalFeeForTransfers: Boolean? = null,
43+
val allowOverdraft: Boolean? = null,
44+
val overdraftLimit: Double? = null,
45+
val nominalAnnualInterestRateOverdraft: Double? = null,
46+
val minOverdraftForInterestCalculation: Double? = null,
47+
val enforceMinRequiredBalance: Boolean? = null,
48+
val withHoldTax: Boolean? = null,
49+
50+
// Charges
51+
val charges: List<SavingsChargePayload>? = null,
2352

24-
val locale: String = "en",
25-
26-
val dateFormat: String = "dd MMMM yyyy",
53+
) : Parcelable
2754

55+
@Serializable
56+
@Parcelize
57+
data class SavingsChargePayload(
58+
val chargeId: Int,
59+
val amount: Double,
2860
) : Parcelable

core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/SavingsAccountTemplate.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ data class SavingsAccountTemplate(
3535
val withHoldTax: Boolean? = null,
3636
val isDormancyTrackingActive: Boolean? = null,
3737
val charges: List<ChargeOptions>? = null,
38-
val productOptions: ArrayList<ProductOptions> = arrayListOf(),
38+
val productOptions: ArrayList<SavingsProduct> = arrayListOf(),
3939
val fieldOfficerOptions: List<FieldOfficerOptions> = emptyList(),
4040
val interestCompoundingPeriodTypeOptions: List<SavingsOptions> = emptyList(),
4141
val interestPostingPeriodTypeOptions: List<SavingsOptions> = emptyList(),
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright 2025 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
9+
*/
10+
package org.mifos.mobile.core.model.entity.templates.savings
11+
12+
import kotlinx.serialization.Serializable
13+
import org.mifos.mobile.core.model.Parcelable
14+
import org.mifos.mobile.core.model.Parcelize
15+
16+
@Serializable
17+
@Parcelize
18+
data class SavingsProduct(
19+
val id: Int,
20+
val name: String,
21+
val withdrawalFeeForTransfers: Boolean = false,
22+
val allowOverdraft: Boolean = false,
23+
val enforceMinRequiredBalance: Boolean = false,
24+
val lienAllowed: Boolean = false,
25+
val withHoldTax: Boolean = false,
26+
) : Parcelable

feature/savings-application/src/commonMain/composeResources/values/strings.xml

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@
2121
<string name="feature_apply_savings_label_savings_product">Product Name</string>
2222
<string name="feature_apply_savings_label_field_officer">Field Officer</string>
2323
<string name="feature_apply_savings_label_submission_date">Submission Date</string>
24+
<string name="feature_apply_savings_label_fill_application_details">Fill Application Details</string>
25+
<string name="feature_apply_savings_label_details">Details</string>
26+
<string name="feature_apply_savings_label_currency">Currency</string>
27+
<string name="feature_apply_savings_label_minimum_opening_balance">Minimum Opening Balance</string>
28+
<string name="feature_apply_savings_label_lock_in_period">Lock-in Period</string>
29+
<string name="feature_apply_savings_label_frequency">Frequency</string>
30+
<string name="feature_apply_savings_label_frequency_type">Frequency Type</string>
31+
<string name="feature_apply_savings_label_overdraft">Overdraft</string>
32+
<string name="feature_apply_savings_label_request_to_allow_overdraft">Request to allow overdraft</string>
2433

2534
<!-- Buttons -->
2635
<string name="feature_apply_savings_button_continue">Continue</string>
@@ -29,27 +38,16 @@
2938
<string name="feature_apply_savings_button_apply">Apply Savings</string>
3039
<string name="feature_button_next">Next</string>
3140

32-
<!-- Applicant Name Validation -->
33-
<string name="feature_apply_savings_error_name_empty">Applicant name is required</string>
34-
<string name="feature_apply_savings_error_name_too_short">Applicant name must be at least 4 characters</string>
35-
<string name="feature_apply_savings_error_name_too_long">Applicant name cannot exceed 100 characters</string>
36-
<string name="feature_apply_savings_error_name_invalid_format">Applicant name contains invalid characters</string>
37-
38-
<!-- Savings Product Validation -->
39-
<string name="feature_apply_savings_error_product_empty">Savings product is required</string>
40-
4141
<!-- Principal Amount Validation -->
4242
<string name="feature_apply_savings_error_amount_empty">Principal amount is required</string>
4343
<string name="feature_apply_savings_error_amount_invalid_format">Please enter a valid amount format</string>
4444
<string name="feature_apply_savings_error_amount_too_small">Principal amount is too small</string>
4545
<string name="feature_apply_savings_error_amount_too_large">Principal amount exceeds maximum limit</string>
4646
<string name="feature_apply_savings_error_amount_invalid_decimal">Amount has too many decimal places for selected currency</string>
4747

48-
<!-- Disbursement Date Validation -->
49-
<string name="feature_apply_savings_error_date_empty">Disbursement date is required</string>
50-
<string name="feature_apply_savings_error_date_invalid_format">Please enter a valid date format (DD/MM/YYYY)</string>
51-
<string name="feature_apply_savings_error_date_future">Disbursement date must be in the future</string>
52-
<string name="feature_apply_savings_error_date_out_of_range">Disbursement date is too far in the future (max 10 years)</string>
48+
49+
<!-- Savings Product Validation -->
50+
<string name="feature_apply_savings_error_product_empty">Savings product is required</string>
5351

5452
<!-- Error Dialogs -->
5553
<string name="feature_apply_savings_error_server">Server issue from our side cannot proceed further, Try again after a moment</string>
@@ -64,16 +62,21 @@
6462
<string name="feature_apply_savings_unsaved_changes_title">Unsaved Changes!</string>
6563
<string name="feature_apply_savings_unsaved_changes_message">You have unsaved changes. Are you sure you want to go back?</string>
6664

67-
<string name="feature_apply_loan_error_server">Server issue from our side cannot proceed further, Try again after a moment</string>
68-
<string name="feature_apply_loan_error_name_empty">Applicant name is required</string>
69-
<string name="feature_apply_loan_error_name_too_short">Applicant name must be at least 4 characters</string>
70-
<string name="feature_apply_loan_error_name_too_long">Applicant name cannot exceed 100 characters</string>
71-
<string name="feature_apply_loan_error_name_invalid_format">Applicant name contains invalid characters</string>
72-
<string name="feature_apply_loan_error_product_empty">Loan product is required</string>
73-
<string name="feature_apply_loan_error_amount_too_small">Principal amount is too small</string>
74-
<string name="feature_apply_loan_error_amount_too_large">Principal amount exceeds maximum limit</string>
75-
<string name="feature_apply_loan_error_date_empty">Disbursement date is required</string>
76-
<string name="feature_apply_loan_error_too_many_attempts">Too many failed attempts. Please try again later.</string>
77-
<string name="feature_apply_loan_error_submit_failed">Failed to submit loan application. Please try again.</string>
78-
<string name="feature_apply_loan_unsaved_changes_message">You have unsaved changes. Are you sure you want to go back?</string>
65+
66+
<string name="feature_apply_savings_label_next">Next</string>
67+
68+
<string name="feature_apply_savings_error_currency_required">Currency is required</string>
69+
<string name="feature_apply_savings_error_minimum_opening_balance_required">Minimum opening balance is required</string>
70+
<string name="feature_apply_savings_error_lock_in_period_required">Lock-in period is required</string>
71+
<string name="feature_apply_savings_error_frequency_required">Frequency is required</string>
72+
<string name="feature_apply_savings_error_frequency_invalid">Enter a valid frequency</string>
73+
74+
<string name="feature_apply_savings_status_success">Applied Successful!</string>
75+
<string name="feature_apply_savings_status_success_tip">You have successfully applied for a saving account under %1$s.</string>
76+
<string name="feature_apply_savings_status_success_action">Back To Home</string>
77+
78+
<string name="feature_apply_savings_status_failure">Application Failed To Submit</string>
79+
<string name="feature_apply_savings_status_failure_tip">Failed to apply for a saving account under %1$s.</string>
80+
<string name="feature_apply_savings_status_failure_action">Try Again</string>
81+
7982
</resources>

feature/savings-application/src/commonMain/kotlin/org/mifos/mobile/feature/savings/application/di/SavingsApplicationModule.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ package org.mifos.mobile.feature.savings.application.di
1111

1212
import org.koin.core.module.dsl.viewModelOf
1313
import org.koin.dsl.module
14+
import org.mifos.mobile.feature.savings.application.fillApplication.SavingsFillApplicationViewModel
1415
import org.mifos.mobile.feature.savings.application.savingsApplication.SavingsApplyViewModel
1516

1617
val savingsApplicationModule = module {
1718
viewModelOf(::SavingsApplyViewModel)
19+
viewModelOf(::SavingsFillApplicationViewModel)
1820
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright 2025 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
9+
*/
10+
11+
@file:Suppress("MatchingDeclarationName")
12+
13+
package org.mifos.mobile.feature.savings.application.fillApplication
14+
15+
import androidx.navigation.NavController
16+
import androidx.navigation.NavGraphBuilder
17+
import androidx.navigation.NavOptions
18+
import kotlinx.serialization.Serializable
19+
import org.mifos.mobile.core.ui.composableWithSlideTransitions
20+
21+
@Serializable
22+
data class SavingsFillApplicationRoute(
23+
val savingsProductId: Long,
24+
val fieldOfficerId: Long,
25+
val fieldOfficerName: String,
26+
)
27+
28+
fun NavController.navigateToSavingsFillApplicationScreen(
29+
savingsProductId: Long,
30+
fieldOfficerId: Long,
31+
fieldOfficerName: String,
32+
navOptions: NavOptions? = null,
33+
) {
34+
this.navigate(SavingsFillApplicationRoute(savingsProductId, fieldOfficerId, fieldOfficerName), navOptions)
35+
}
36+
37+
fun NavGraphBuilder.savingsFillApplicationDestination(
38+
navigateToAuthenticateScreen: () -> Unit,
39+
navigateToStatusScreen: (String, String, String, String, String) -> Unit,
40+
navigateBack: () -> Unit,
41+
) {
42+
composableWithSlideTransitions<SavingsFillApplicationRoute> {
43+
SavingsFillApplicationScreen(
44+
navigateBack = navigateBack,
45+
navigateToAuthenticateScreen = navigateToAuthenticateScreen,
46+
navigateToStatusScreen = navigateToStatusScreen,
47+
)
48+
}
49+
}

0 commit comments

Comments
 (0)