Skip to content

usage: expose transition times as a typed accessor on UsageContext#40

Open
jutur wants to merge 1 commit into
killbill:masterfrom
jutur:usage-transitions-in-context
Open

usage: expose transition times as a typed accessor on UsageContext#40
jutur wants to merge 1 commit into
killbill:masterfrom
jutur:usage-transitions-in-context

Conversation

@jutur

@jutur jutur commented Jun 17, 2026

Copy link
Copy Markdown

Adds a default method to UsageContext:

default Map<Map.Entry<UUID, String>, Set> getUsageTransitions()

Previously, the invoice engine passed billing transition times to usage plugins via an untyped PluginProperty keyed USAGE_TRANSITIONS. Plugin authors had to know the internal property name and cast the raw Object value — a fragile, undiscoverable contract.

The new accessor exposes the same data in a type-safe way. The default returns null so all existing UsageContext implementations remain binary-compatible.

A companion PR to killbill/killbill populates this field in DefaultUsageContext.

Fixes killbill/killbill#2257

The invoice engine previously passed billing transition times to usage
plugins via an untyped PluginProperty keyed USAGE_TRANSITIONS
(a Map<Map.Entry<UUID,String>, Set<DateTime>>). Plugin authors had to
know the internal property name and cast the raw Object value, making
the contract fragile and undiscoverable.

Add a default getUsageTransitions() method to UsageContext that returns
the same map in a type-safe way. The default returns null so all
existing UsageContext implementations remain binary-compatible.

Kill Bill core will populate this in UsageInvoiceItemGenerator instead
of (or alongside) the plugin property so plugins can migrate to the new
accessor at their own pace.

Fixes killbill/killbill#2257
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.

Enhance usage plugin Api to pass all transitions

1 participant