Skip to content

Build invoice payment expiry #123

@Kingsman-99

Description

@Kingsman-99

Label: complexity: high
Points: 200

Description

Payers who contribute to a long-running invoice may want their funds returned if the invoice isn't fully funded within their chosen timeframe. This issue adds payer_expiry: u64 per payment — if the invoice is still pending after payer_expiry, that specific payer can call reclaim_expired_payment() to retrieve their contribution.

Technical Context

Involves types.rs (add expiry: u64 to Payment) and lib.rs. Update pay() to accept optional payer_expiry: u64. Add reclaim_expired_payment(env, invoice_id, payer) requiring payer auth, asserting env.ledger().timestamp() > payment.expiry, transferring payer's total back, removing their payments, updating invoice.funded.

Acceptance Criteria

  • pay() accepts optional payer_expiry timestamp
  • reclaim_expired_payment() requires payer auth
  • Panics with "payment not expired" before expiry timestamp
  • Payer receives full contributed amount back after expiry
  • invoice.funded decremented correctly after reclaim
  • All existing cargo tests pass
  • cargo clippy passes with zero warnings

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programcomplexity: highComplex feature requiring deep knowledge - 200 pts

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions