Skip to content

WEB-959: Prevent zero amount savings transactions#3600

Open
Mahesh-Gite-28 wants to merge 1 commit into
openMF:devfrom
Mahesh-Gite-28:WEB-959-prevent-zero-amount-savings-transactions
Open

WEB-959: Prevent zero amount savings transactions#3600
Mahesh-Gite-28 wants to merge 1 commit into
openMF:devfrom
Mahesh-Gite-28:WEB-959-prevent-zero-amount-savings-transactions

Conversation

@Mahesh-Gite-28
Copy link
Copy Markdown
Contributor

@Mahesh-Gite-28 Mahesh-Gite-28 commented May 22, 2026

Description

This PR prevents savings deposit and withdrawal transactions from accepting zero-value transaction amounts.

Previously, the frontend form only used Validators.required, which treated 0 as a valid value. Users could proceed to the confirmation step, and the backend later rejected the request.

This PR adds:

  • Validators.min(0.001)
  • minimum validation UI using minVal

This aligns savings transaction validation behavior with existing repayment validation patterns already used in the application.

Related issues and discussion

WEB-959

Screenshots, if any

Before

Frontend allowed zero-value transaction and backend rejected request later.

Before bug

After

Frontend blocks invalid values before submission.

After fix

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • If you have multiple commits please combine them into one commit by squashing them.

  • Read and understood the contribution guidelines at web-app/.github/CONTRIBUTING.md.

Summary by CodeRabbit

  • Bug Fixes
    • Enforced a minimum savings transaction amount of 0.001 to prevent zero-value submissions.
    • Amount field now initializes empty so validations consistently run on entry.
    • Improved input validation and user feedback in the transaction form to reduce invalid submissions and clarify errors.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'pre_merge_checks'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bb757848-9090-4704-8e95-fcabf38eaaef

📥 Commits

Reviewing files that changed from the base of the PR and between 1ff02d1 and 5228c83.

📒 Files selected for processing (2)
  • src/app/savings/saving-account-actions/savings-account-transactions/savings-account-transactions.component.html
  • src/app/savings/saving-account-actions/savings-account-transactions/savings-account-transactions.component.ts

Walkthrough

The PR enforces a minimum transaction amount of 0.001 in the savings account transactions form by importing amountValueValidator, updating the transactionAmount FormControl to use Validators.required, amountValueValidator(), and Validators.min(0.001) with an initial '' value, and adding [minVal]="0.001" to the template input.

Changes

Transaction Amount Minimum Validation

Layer / File(s) Summary
Enforce minimum transaction amount validation
src/app/savings/saving-account-actions/savings-account-transactions/savings-account-transactions.component.ts, src/app/savings/saving-account-actions/savings-account-transactions/savings-account-transactions.component.html
Adds an import for amountValueValidator, changes transactionAmount FormControl initial value to '' and validators to Validators.required, amountValueValidator(), and Validators.min(0.001), and sets [minVal]="0.001" on the mifosx-input-amount template field.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • IOhacker
  • alberto-art3ch
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: preventing zero amount savings transactions, which directly matches the changeset that adds minimum value validation to transaction amounts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Collaborator

@alberto-art3ch alberto-art3ch left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution, Please review my comment

0,
Validators.required
'',
[
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Currently there is a custom validator for that amountValueValidator

ie:

        principalAmount: [
          '',
          [
            Validators.required,
            amountValueValidator()
          ]
        ],

Plus consider to use in the html field the custom component for Amounts:

      <mifosx-input-amount
        class="flex-48"
        [currency]="currency"
        [isRequired]="true"
        [inputFormControl]="loansAccountTermsForm.controls.principalAmount"
        [inputLabel]="'Principal'"
      >
      </mifosx-input-amount>

Copy link
Copy Markdown
Contributor Author

@Mahesh-Gite-28 Mahesh-Gite-28 May 23, 2026

Choose a reason for hiding this comment

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

@alberto-art3ch Updated transactionAmount validation to use amountValueValidator() following the shared validation pattern already used in other amount fields/components.

Kept Validators.min(0.001) to prevent zero-value savings transactions from passing frontend validation.

Also retained the existing mifosx-input-amount component with [minVal]="0.001" for consistent amount validation UI behavior.

Thanks for the review.

@Mahesh-Gite-28 Mahesh-Gite-28 force-pushed the WEB-959-prevent-zero-amount-savings-transactions branch from 1ff02d1 to 5228c83 Compare May 23, 2026 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants