Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 11, 2025

Addresses missing validation for payment amounts in the work order completion flow. Without validation, users could submit invalid payment requests (zero, negative, or non-numeric values).

Changes:

  • Added MIN_PAYMENT_AMOUNT constant (0.01) for consistent validation threshold
  • Implemented isValidAmount() helper to validate numeric input ≥ minimum
  • Added HTML5 min attribute to prevent invalid input at the browser level
  • Display validation error message when submission is attempted with invalid amount

Example:

const isValidAmount = (amount: string): boolean => {
  const parsed = parseFloat(amount)
  return !isNaN(parsed) && parsed >= MIN_PAYMENT_AMOUNT
}

// In completeWorkOrder()
if (requestPayment && !isValidAmount(requestedAmount)) {
  setValidationError(`Payment amount must be at least $${MIN_PAYMENT_AMOUNT.toFixed(2)}`)
  return
}

Validation blocks form submission and shows "Payment amount must be at least $0.01" for empty strings, non-numeric input, or amounts below threshold.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI mentioned this pull request Dec 11, 2025
@vercel
Copy link

vercel bot commented Dec 11, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
biotech-maintenance-platform Ready Ready Preview Comment Dec 11, 2025 11:54pm

Copy link
Contributor Author

Copilot AI commented Dec 11, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.googleapis.com
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/Biotech-Maintenance-Platform/Biotech-Maintenance-Platform/my-app/node_modules/next/dist/compiled/jest-worker/processChild.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Address feedback from review on Payment pull request Add input validation for payment amount in WorkOrderCompletion Dec 11, 2025
Copilot AI requested a review from yushinj December 11, 2025 23:56
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