Skip to content

Fix invoice state management and validation issues - #987

Open
Johnero542 wants to merge 1 commit into
WHEELBACK:mainfrom
Johnero542:batch-135-features
Open

Johnero542 wants to merge 1 commit into
WHEELBACK:mainfrom
Johnero542:batch-135-features

Conversation

@Johnero542

Copy link
Copy Markdown

Addresses four invoice lifecycle bugs:

All invoice state transitions now validate against current status and expiration.

Closes #871
Closes #872
Closes #873
Closes #875

Pull Request

Summary

  • Describe the purpose of this PR in one or two sentences.

Checklist

  • PR description includes: Closes #[issue_id]
  • Tests added or updated
  • ABI snapshot updated if contract sources changed (abis/ and COMEBACKHERE-contracts/)
  • Screenshots attached if UI changed
  • Documentation updated if needed

Notes

  • For contract changes, verify ABI snapshot hygiene with make check-abi-snapshots.
  • For UI changes, include screenshots or screen recordings to help reviewers.

Addresses four invoice lifecycle bugs:

- Prevent paid invoices from reverting to pending (WHEELBACK#872)
  Add state validation to reject cancel_invoiced action on Paid invoices
  Ensures paid invoices remain in paid/refund states only

- Prevent payment on cancelled invoices (WHEELBACK#871)
  Add validation check to reject request_refund on Cancelled invoices
  Returns 409 error when attempting to pay cancelled invoice

- Prevent payment on expired invoices (WHEELBACK#873)
  Check invoice expiration against due_date before allowing request_refund
  Compares current time to stored due_date from invoice record
  Rejects payment on invoices past their due date

- Include due_date in invoice detail response (WHEELBACK#875)
  Modified GET /invoices/:id to return actual status from contract
  Added due_date field (Unix timestamp) to invoice detail response
  Fetches invoice record from database for complete invoice metadata

All invoice state transitions now validate against current status and expiration.

Closes WHEELBACK#871, WHEELBACK#872, WHEELBACK#873, WHEELBACK#875
@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

@Johnero542 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant