fix(billing): validate Record Payment Amount and Invoice ID fields #221

Merged
nrupard merged 3 commits from fix/mapps-215-record-payment-field-validation into main 2026-06-16 16:40:55 +02:00
Owner

The Record Payment modal accepted a negative or zero Amount (creating a negative payment), inherited the browser's default step=1 so it rejected cents, and silently dropped a malformed Invoice ID (recording an unintended unapplied payment). Reference Number and Notes had no client length cap.

Amount now carries min="0.01" and step="0.01" so the browser rejects non-positive and sub-cent values, and submit-time validation re-checks for a positive, at-most-two-decimal, in-range number with a field-level message. Invoice ID is validated as a UUID (blank still means an unapplied payment) and its existence is confirmed via GET /invoices/{id} before recording, surfacing a field message instead of an opaque server FK error. Reference Number and Notes gain maxlength caps mirroring the server columns.

Payment Date is already bounded by the shared DateField (2000-01-01..2100-12-31, MAPPS-204), so it needs no change.

#MAPPS-215

The Record Payment modal accepted a negative or zero Amount (creating a negative payment), inherited the browser's default step=1 so it rejected cents, and silently dropped a malformed Invoice ID (recording an unintended unapplied payment). Reference Number and Notes had no client length cap. Amount now carries min="0.01" and step="0.01" so the browser rejects non-positive and sub-cent values, and submit-time validation re-checks for a positive, at-most-two-decimal, in-range number with a field-level message. Invoice ID is validated as a UUID (blank still means an unapplied payment) and its existence is confirmed via GET /invoices/{id} before recording, surfacing a field message instead of an opaque server FK error. Reference Number and Notes gain maxlength caps mirroring the server columns. Payment Date is already bounded by the shared DateField (2000-01-01..2100-12-31, MAPPS-204), so it needs no change. #MAPPS-215
fix(billing): validate Record Payment Amount and Invoice ID fields
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 57s
980f153753
The Record Payment modal accepted a negative or zero Amount (creating a negative payment), inherited the browser's default step=1 so it rejected cents, and silently dropped a malformed Invoice ID (recording an unintended unapplied payment). Reference Number and Notes had no client length cap.

Amount now carries min="0.01" and step="0.01" so the browser rejects non-positive and sub-cent values, and submit-time validation re-checks for a positive, at-most-two-decimal, in-range number with a field-level message. Invoice ID is validated as a UUID (blank still means an unapplied payment) and its existence is confirmed via GET /invoices/{id} before recording, surfacing a field message instead of an opaque server FK error. Reference Number and Notes gain maxlength caps mirroring the server columns.

Payment Date is already bounded by the shared DateField (2000-01-01..2100-12-31, MAPPS-204), so it needs no change.

#MAPPS-215
Merge remote-tracking branch 'origin/main' into fix/mapps-215-record-payment-field-validation
Some checks failed
Check / clippy + fmt + tests (pull_request) Failing after 22s
009325d2f0
fix(billing): pass payment Notes maxlength as i64 after the Textarea unify
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 58s
Create release / Create release from merged PR (pull_request) Has been skipped
045ccb4483
This branch predated MAPPS-219, which unified `Textarea::maxlength` to `Option<i64>`. The Record Payment Notes field still passed `PAYMENT_NOTES_MAX.to_string()`, which no longer matches the prop type after merging main. Pass the cap as `i64` like every other maxlength call site.

#MAPPS-215
nrupard deleted branch fix/mapps-215-record-payment-field-validation 2026-06-16 16:40:56 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-apps!221
No description provided.