Skip to content

feat: add invoice group all-or-nothing release#57

Merged
Kingsman-99 merged 2 commits into
Stellar-split:mainfrom
marvs8:feature/33-invoice-group-release
May 29, 2026
Merged

feat: add invoice group all-or-nothing release#57
Kingsman-99 merged 2 commits into
Stellar-split:mainfrom
marvs8:feature/33-invoice-group-release

Conversation

@marvs8

@marvs8 marvs8 commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements grouped invoice all-or-nothing release, as described in issue #33.

Changes

lib.rs:

  • Storage helpers: group_key, invoice_group_key, load_group, group_all_funded
  • create_invoice_group(invoice_ids: Vec<u64>) -> u64 — links invoices and maps each back to the group
  • pay() auto-release now skips if the invoice belongs to a group where not all members are fully funded
  • release() asserts all group members are funded, then releases every Pending member in the group; non-grouped invoices behave identically to before

test.rs:

  • test_group_partial_fund_blocks_release — funds only one member, verifies release() panics with "group members not fully funded"
  • test_group_all_funded_releases_both — funds both members, verifies both are Released and recipients receive correct amounts
  • test_non_grouped_invoice_unaffected — verifies solo invoices still auto-release normally

Acceptance Criteria

  • create_invoice_group() links multiple invoice IDs
  • release() on a group member panics if any other member is not fully funded
  • All group members release successfully once all are funded
  • Non-grouped invoices behave identically to current implementation
  • Test creates group of 2 invoices, funds both, verifies both release
  • All existing cargo test pass (10/10)
  • cargo clippy passes with zero warnings

Closes #33

- Add group_key, invoice_group_key, load_group, group_all_funded helpers
- Add create_invoice_group(invoice_ids) -> group_id
- pay() auto-release skips if invoice is grouped and not all members funded
- release() asserts all group members funded, then releases all Pending members
- Non-grouped invoices behave identically to before
- 3 new tests: partial fund blocks release, all funded releases both, non-grouped unaffected
- All 10 tests pass, clippy clean

Closes Stellar-split#33
@drips-wave

drips-wave Bot commented May 28, 2026

Copy link
Copy Markdown

@marvs8 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

@Kingsman-99 Kingsman-99 merged commit 1ea959a into Stellar-split:main May 29, 2026
1 check failed
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.

Build invoice group all-or-nothing release

2 participants