Feature Recurring Deposit Account Charges Step
Fixes - Jira-#Issue_Number
Didn't create a Jira ticket, click here to create new.
Please Add Screenshots If there are any UI changes.
| Before | After |
|---|---|
Please make sure these boxes are checked before submitting your pull request - thanks!
-
[ ] Run the static analysis check
./gradlew checkorci-prepush.shto make sure you didn't break anything -
[ ] If you have multiple commits please combine them into one commit by squashing them.
Summary by CodeRabbit
-
New Features
- Added dialog-driven charge management for recurring deposits, enabling users to add, edit, view, and delete charges with dedicated UI workflows.
-
Refactor
- Enhanced input validation with automatic whitespace trimming for improved data consistency.
-
Chores
- Updated internal UI labels and formatting to support new charge management features.
βοΈ Tip: You can customize this high-level summary in your review settings.
Walkthrough
This PR adds charge management functionality to the recurring deposit feature by introducing state-driven UI dialogs, action handlers, new string resources, and validators for adding, editing, and deleting charges within the account creation workflow.
Changes
| Cohort / File(s) | Summary |
|---|---|
String Resources feature/recurringDeposit/src/commonMain/composeResources/values/feature_recurring_deposit_string.xml, core/ui/src/commonMain/composeResources/values/strings.xml |
Added six new UI labels for charge workflow (edit, add new, add, view, active, submit); adjusted formatting/whitespace in core UI strings. |
Input Validation core/ui/src/commonMain/kotlin/com/mifos/core/ui/util/TextFieldsValidator.kt |
Refactored doubleNumberValidator to trim input before performing validation checks on blank, decimal, numeric, and zero-value conditions. |
Charge Management State & Actions feature/recurringDeposit/src/commonMain/kotlin/com/mifos/feature/recurringDeposit/newRecurringDepositAccount/RecurringAccountViewModel.kt |
Introduced comprehensive charge lifecycle handlers, extended RecurringAccountState with charge-related fields (chargeAmount, chargeDate, addedCharges, dialogState), added CreatedCharges and DialogState data structures, and implemented RecurringAccountChargesAction sealed class. |
Charge UI Implementation feature/recurringDeposit/src/commonMain/kotlin/com/mifos/feature/recurringDeposit/newRecurringDepositAccount/RecurringAccountScreen.kt |
Added new dialogs (NewRecurringAccountDialog, AddNewChargeDialog, ShowChargesDialog) with state-driven flows; replaced simple callback-based ChargesPage call with composite state and action callback; wired charge operations to success snackbar and dismissal logic. |
Charges Page Refactor feature/recurringDeposit/src/commonMain/kotlin/com/mifos/feature/recurringDeposit/newRecurringDepositAccount/pages/ChargesPage.kt |
Replaced minimal callback-based UI with scrollable, state-driven layout supporting add-charge action row, dynamic charge summary, and back/submit navigation via explicit action handlers. |
Sequence Diagram
sequenceDiagram
participant User
participant RecurringAccountScreen
participant RecurringAccountViewModel
participant DialogState
User->>RecurringAccountScreen: Opens Charges section
RecurringAccountScreen->>RecurringAccountViewModel: Route ShowAddChargeDialog action
RecurringAccountViewModel->>DialogState: Update to AddNewCharge state
DialogState-->>RecurringAccountScreen: Render AddNewChargeDialog
User->>AddNewChargeDialog: Enter charge details (date, amount, type)
AddNewChargeDialog->>RecurringAccountViewModel: Dispatch OnChargesAmountChange / OnChargesDateChange
RecurringAccountViewModel->>RecurringAccountViewModel: Validate inputs
alt Validation Success
User->>AddNewChargeDialog: Confirm charge
AddNewChargeDialog->>RecurringAccountViewModel: Dispatch AddChargeToList action
RecurringAccountViewModel->>RecurringAccountViewModel: Append to addedCharges list
RecurringAccountViewModel->>DialogState: Update to SuccessResponseStatus
DialogState-->>RecurringAccountScreen: Show success snackbar + dismiss dialog
else Validation Error
RecurringAccountViewModel->>DialogState: Set chargeAmountError
DialogState-->>AddNewChargeDialog: Display error feedback
end
User->>RecurringAccountScreen: Submit charges
RecurringAccountScreen->>RecurringAccountViewModel: Dispatch Finish action
RecurringAccountViewModel-->>User: Navigate forward
Estimated code review effort
π― 4 (Complex) | β±οΈ ~45 minutes
- Charge state management: New
DialogState,RecurringAccountChargesState, andCreatedChargesdata structures require validation of correctness and consistency with broader state flow. - Handler proliferation: Twelve new private handlers in ViewModel with interdependent state mutations (date validation, amount validation, charge list mutations, dialog dismissal) demand careful logic review.
- UI signature changes:
ChargesPageandRecurringAccountScreenAPI shifts from callback-based to state-driven; verify all action routing is correctly wired and state transitions are consistent. - Dialog orchestration: Multiple new dialogs (
AddNewChargeDialog,ShowChargesDialog) with complex parameter binding and state-driven visibility logic require end-to-end flow verification.
Possibly related PRs
- openMF/android-client#2539: Modifies the same recurring-deposit UI and ViewModel code, including RecurringAccountScreen and ChargesPage signature changes, indicating direct code-level overlap.
- openMF/android-client#2528: Converts Charges and Settings pages to state-driven signatures using
onAction, aligning with the state management refactor pattern introduced here.
Suggested reviewers
- Arinyadav1
- sam-arth07
- biplab1
Poem
π° Hops and charges now align,
Dialogs dance in state design,
Trim the inputs, clean and bright,
Deposits bloom through UI flight! β¨
Pre-merge checks and finishing touches
β Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | β οΈ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
β Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | β Passed | Check skipped - CodeRabbitβs high-level summary is enabled. |
| Title check | β Passed | The title 'Feature Recurring Deposit Account Charges Step' directly reflects the main changes, which implement a comprehensive charge management workflow for the recurring deposit account creation process, including new UI dialogs, state management, and charges page updates. |
β¨ Finishing touches
- [ ] π Generate docstrings
π§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
[!TIP]
π Customizable high-level summaries are now available in beta!
You can now customize how CodeRabbit generates the high-level summary in your pull requests β including its content, structure, tone, and formatting.
- Provide your own instructions using the
high_level_summary_instructionssetting.- Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
- Use
high_level_summary_in_walkthroughto move the summary from the description to the walkthrough section.Example instruction:
"Divide the high-level summary into five sections:
- π Description β Summarize the main change in 50β60 words, explaining what was done.
- π References β List relevant issues, discussions, documentation, or related PRs.
- π¦ Dependencies & Requirements β Mention any new/updated dependencies, environment variable changes, or configuration updates.
- π Contributor Summary β Include a Markdown table showing contributions:
| Contributor | Lines Added | Lines Removed | Files Changed |- βοΈ Additional Notes β Add any extra reviewer context. Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.