Skip to content

Fix invoice lifecycle and pagination issues - #989

Open
Joel234-png wants to merge 1 commit into
WHEELBACK:mainfrom
Joel234-png:batch-138-features
Open

Joel234-png wants to merge 1 commit into
WHEELBACK:mainfrom
Joel234-png:batch-138-features

Conversation

@Joel234-png

Copy link
Copy Markdown

Addresses four invoice management bugs:

All invoice operations now maintain data consistency and proper constraints.

Closes #874
Closes #876
Closes #877
Closes #879

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 management bugs:

- Invoice list ordering inconsistency between paginated requests (WHEELBACK#876)
  Add _id field as stable tiebreaker in sort order to ensure consistent
  pagination across multiple requests. Sort by created_at, invoice_id, _id.

- Invoice status does not update after successful settlement (WHEELBACK#874)
  Add syncInvoiceStatus function that queries contract status on GET /:id
  and updates MongoDB with the current state from Soroban smart contract.
  Ensures invoice detail response always reflects settlement changes.

- Repeated invoice creation produces conflicting invoice identifier (WHEELBACK#877)
  Add duplicate invoice ID check before insertion. If ID already exists,
  return 409 Conflict error and ask client to retry to generate new ID.

- Invoice creation accepts due date outside supported range (WHEELBACK#879)
  Add upper bound validation to futureTimestamp schema. Due date must be
  within 10 years from now (315,360,000 seconds). Prevents invalid dates.

All invoice operations now maintain data consistency and proper constraints.

Closes WHEELBACK#874, WHEELBACK#876, WHEELBACK#877, WHEELBACK#879
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