WEB-959: Prevent zero amount savings transactions#3600
Conversation
|
Note
|
| 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.
Comment @coderabbitai help to get the list of available commands and usage tips.
alberto-art3ch
left a comment
There was a problem hiding this comment.
Thanks for the contribution, Please review my comment
| 0, | ||
| Validators.required | ||
| '', | ||
| [ |
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
@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.
1ff02d1 to
5228c83
Compare
Description
This PR prevents savings deposit and withdrawal transactions from accepting zero-value transaction amounts.
Previously, the frontend form only used
Validators.required, which treated0as a valid value. Users could proceed to the confirmation step, and the backend later rejected the request.This PR adds:
Validators.min(0.001)minValThis 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.
After
Frontend blocks invalid values before submission.
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