Labels: complexity: high
Add getForwardChain(invoiceId) that resolves the forward_invoice_id chain for an invoice, returning the full list of invoices that leftover funds would cascade through at release.
Acceptance criteria:
- Returns
{ id, status, forwardTo }[] in cascade order
- Detects and errors on circular forward chains
- Returns single-element array when no forwarding is configured
- Max chain depth of 10 before throwing
ForwardChainTooDeepError
Labels: complexity: high
Add
getForwardChain(invoiceId)that resolves theforward_invoice_idchain for an invoice, returning the full list of invoices that leftover funds would cascade through at release.Acceptance criteria:
{ id, status, forwardTo }[]in cascade orderForwardChainTooDeepError