Skip to content

feat: add freeze_invoice / unfreeze_invoice admin functions - #134

Open
MarcusDavidG wants to merge 1 commit into
mainfrom
feat/freeze-unfreeze-invoice
Open

feat: add freeze_invoice / unfreeze_invoice admin functions#134
MarcusDavidG wants to merge 1 commit into
mainfrom
feat/freeze-unfreeze-invoice

Conversation

@MarcusDavidG

Copy link
Copy Markdown
Contributor

Activates the existing invoice.frozen field (previously always false) with two new admin-only functions.

Changes

  • freeze_invoice(invoice_id) — sets frozen=true, writes freeze audit entry
  • unfreeze_invoice(invoice_id) — sets frozen=false, writes unfreeze audit entry
  • pay() now asserts !invoice.frozen before any state change — panics with "invoice is frozen"
  • Both require admin auth via require_admin()

Guards

  • Double-freeze → "invoice is already frozen"
  • Unfreeze when not frozen → "invoice is not frozen"

Closes #111

Admin-only functions to temporarily block payments on a specific
invoice using the existing invoice.frozen field (previously always
false). pay() now asserts !invoice.frozen before processing.

- freeze_invoice(id): sets frozen=true, appends 'freeze' audit entry
- unfreeze_invoice(id): sets frozen=false, appends 'unfreeze' audit entry
- pay() now panics with 'invoice is frozen' when frozen=true
- Double-freeze panics: 'invoice is already frozen'
- Unfreeze non-frozen panics: 'invoice is not frozen'

Closes #111
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.

feat: invoice.frozen field — implement freeze_invoice and unfreeze_invoice admin functions

1 participant