How to avoid generating 0 amount USAGE Line items for not applicable tier units

16 views
Skip to first unread message

vivek rao

unread,
Jun 11, 2024, 8:32:38 AMJun 11
to Kill Bill users mailing-list
Hello

In our business case it is possible that unit quantity could be 0 and we also need to generate a 0 invoice line item for the same.

But there could be a case some units are not applicable for some accounts, in this case even though the plan has the usage section for the unit, its line item in the invoice with 0 amount is not needed.

We have tested the case by setting the below mentioned env variable to true and false. But both modes are not meeting our expectation.
KB_org_killbill_invoice_disable_usage_zero_amount

if env set to false:
All the units which are available in the catalog plan will have a USAGE line item. If quantity was 0 then USAGE Line Item exists with 0 amount.

if env set to true:
Only the units for which there are some usage quantity more than 0, there will be USAGE line item with amount = rate * quantity.
All units for which there was no quantity provided will not be available as a Line Item.

Our expectation
  • Only those units for which Usage Plugin provides the quantity need to be considered in Usage Line Items. When the quantity is provided as 0, then there can be a USAGE Line item with amount 0.
  • For those units which are not available in List<RawUsageRecord>  return param of getUsageForAccount or getUsageForSubscription need not add USAGE LIne Item with 0 amount.
Summary:
only the units available in List<RawUsageRecord> from Usage plugin needs to consider for USAGE Line item in invoice. The units which are not included can be ignored.

Please let us know a way how this can be achieved.

A sample invoice is attached where the catalog plan has 8 Units. and only for two units 0 quantity is returned from Usage Plugin which is marked. In the invoice we can see for all 8 units there is a line Item with 0 amount. 
What we want is the invoice has only two line items with 0 amount which is marked and remaining 6 line items should not be generated.

usage1.png

Thanks
Vivek

stephane brossier

unread,
Jun 14, 2024, 5:04:32 AMJun 14
to vivek rao, Kill Bill users mailing-list
Hi Vivek,

Given your requirement: "But there could be a case where some units are not applicable for some accounts", I would suggest either:
1. Generate different Plans to ensure that each usage section of a Plan only contains the units that pertains to your customer, OR
2. Apply some filtering logic on the invoice items generated by the system (you could have a plugin that owns the presentation layer).

Stéphane


There is no 

--
You received this message because you are subscribed to the Google Groups "Kill Bill users mailing-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to killbilling-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/killbilling-users/8ad595bc-5214-4dd3-a518-1097ade45f14n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages