Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following strategies are available. Bundle values should be the smallest meaningful units so rounding is performed only on the first decimal, by rounding half up, e.g. a calculated value of 20.5 will result in 21 while a value 20.49 will be rounded to 20.

The date being calculated against is taken from the subscription_campaign.from_date and occurs upon campaign activation, in the same way that the old ProrateActivation method was invoked by the campaign framework.

Strategy NameDescriptionCalculationExample
ProrateDayOfMonthUsing30DayMonth

This strategy will prorate based on remaining days of a fixed month length of 30.
This means that prorating done on the 5th of any month will result in the same outcome.

bundleValue * ((30-dayOfMonth) + 1) / 30).For the 5th the calculation would always be bundleValue * (26/30) irrespective of the actual month length.
ProrateRemainingCalendarDaysUsing30DayMonth

This strategy calculates actual remaining days of the month (including the date itself) but uses a
30-day month length as divisor regardless of actual month length.

bundleValue * ((monthLength - dayOfMonth + 1)/30)

Example 1: January 5th would be calculated by bundleValue * (27/30).


Example 2: February 5th would be calculated by bundleValue * (24/30).

ProrateRemainingDaysOfMonth

This strategy will prorate a bundle based on the actual remaining days of the month (including the date itself), using the calendar month length.
This implies that the prorated result will differ for the same day of month, in different months.

bundleValue * (remainingDays / lengthOfMonth)

Example 1: February 27, 2018 would be bundleValue * (2 / 28).


Example 2: February 27, 2016 (leap year) would be bundleValue * (3 / 29).


Example 3: January 10, 2018 would be bundleValue * (22 / 31).

ProrateRemainingDaysOnInvoiceSchedule

This strategy will prorate a bundle based on the remaining days of the current invoice schedule, compared to the associated billing cycle length.

bundleValue * (remainingDays / billing_cycle.length)

Let the billing_cycle have a length of 14 and the current invoice_schedule be from 1st-14th January.
Let the date the bundle is activated be the 8th of January.


The prorated value will be bundleValue * (7 / 14).

...

3 - Implementation Details

The implemented available strategies are identified using the implementation finder framework.

Thus, new strategies that are implemented and implementing the ProrateBundleStrategy interface and subsequently added in the service resource file (i.e., resources/META-INF/services/com.CDRator.billing.campaign.bundle.strategy.ProrateBundleStrategy) will be automatically discovered and available in the GUI for configuration.