Skip to content

Preserve fixed charges when refreshing drafts - #6199

Draft
lago-claude-ai-agent[bot] wants to merge 2 commits into
mainfrom
fix/claude-preserve-refreshed-fixed-charges
Draft

Preserve fixed charges when refreshing drafts#6199
lago-claude-ai-agent[bot] wants to merge 2 commits into
mainfrom
fix/claude-preserve-refreshed-fixed-charges

Conversation

@lago-claude-ai-agent

Copy link
Copy Markdown
Contributor

Draft refresh now rebuilds pay-in-advance fixed charges from their full event history and deducts same-period amounts invoiced separately, preserving the original full-period charge after an immediate units increase.

The refresh adds one indexed aggregate fee query per pay-in-advance fixed charge and does not add event loops or jobs.

## Context

Refreshing a draft could remove its pay-in-advance fixed charge after an immediate units increase.

## Description

Rebuild the full-period fee from fixed charge events and deduct amounts already invoiced for the period.

Signed-off-by: lago-claude-ai-agent[bot] <297187938+lago-claude-ai-agent[bot]@users.noreply.github.com>
@lago-claude-ai-agent

Copy link
Copy Markdown
Contributor Author

HOLD: The refreshed fee double-counts paid units after an immediate increase.

  • Keep the rebuilt fee's paid-unit ledger from including units already represented by the separate delta fee; after 10 → 12 and refresh, the retained fees currently sum to 14 paid units, so a subsequent increase to 13 is not billed.
  • Add a regression covering another immediate increase after refresh and assert that its delta is invoiced.

Signed-off-by: lago-claude-ai-agent[bot] <297187938+lago-claude-ai-agent[bot]@users.noreply.github.com>
@lago-claude-ai-agent

Copy link
Copy Markdown
Contributor Author
  • Proration and reconciliation: pinned the day-nine two-unit increase while refresh rebuilds from fixed-charge events and deducts the separately invoiced amount.

@lago-claude-ai-agent

Copy link
Copy Markdown
Contributor Author

HOLD: Refresh double-counts paid units after an immediate fixed-charge increase.

  • Keep the refreshed draft fee's billed units from including the units represented by the separate delta fee; after 10 → 12, the persisted fees total 14 units, so a later increase to 13 is incorrectly billed as zero.
  • Add a regression for another immediate increase after refresh and assert that the new delta is invoiced.

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.

0 participants