killbill icon indicating copy to clipboard operation
killbill copied to clipboard

Investigate possible issue with BUNDLE billing alignment and ANNUAL plans

Open reshmabidikar opened this issue 2 years ago • 13 comments

There might be an issue with BUNDLE billing alignment and ANNUAL plans.

Steps to reproduce:

  1. Upload the following catalog:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
  ~ Copyright 2020-2023 Equinix, Inc
  ~ Copyright 2014-2023 The Billing Project, LLC
  ~
  ~ The Billing Project licenses this file to you under the Apache License, version 2.0
  ~ (the "License"); you may not use this file except in compliance with the
  ~ License.  You may obtain a copy of the License at:
  ~
  ~    http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  ~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
  ~ License for the specific language governing permissions and limitations
  ~ under the License.
  -->
<catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="https://docs.killbill.io/latest/catalog.xsd">
    <effectiveDate>2020-01-01T00:00:00+00:00</effectiveDate>
    <catalogName>ExampleCatalog</catalogName>
    <recurringBillingMode>IN_ADVANCE</recurringBillingMode>
    <currencies>
        <currency>USD</currency>
    </currencies>
    <products>
        <product name="Standard">
            <category>BASE</category>
            <available>
                <addonProduct>standard-ao</addonProduct>
            </available>
        </product>
        <product name="standard-ao">
            <category>ADD_ON</category>
        </product>
    </products>
    <rules>
        <changePolicy>
            <changePolicyCase>
                <policy>END_OF_TERM</policy>
            </changePolicyCase>
        </changePolicy>
        <cancelPolicy>
            <cancelPolicyCase>
                <policy>END_OF_TERM</policy>
            </cancelPolicyCase>
        </cancelPolicy>
        <createAlignment>
            <createAlignmentCase>
                <product>standard-ao</product>
                <alignment>START_OF_BUNDLE</alignment>
            </createAlignmentCase>
            <createAlignmentCase>
                <alignment>START_OF_BUNDLE</alignment>
            </createAlignmentCase>
        </createAlignment>
        <billingAlignment>
            <billingAlignmentCase>
                <alignment>BUNDLE</alignment>
            </billingAlignmentCase>
        </billingAlignment>

    </rules>
    <plans>
        <plan name="standard-monthly">
            <product>Standard</product>
            <initialPhases>
            </initialPhases>
            <finalPhase type="EVERGREEN">
                <duration>
                    <unit>UNLIMITED</unit>
                </duration>
                <recurring>
                    <billingPeriod>MONTHLY</billingPeriod>
                    <recurringPrice>
                        <price>
                            <currency>USD</currency>
                            <value>30</value>
                        </price>
                    </recurringPrice>
                </recurring>
            </finalPhase>
        </plan>
        <plan name="standard-ao-monthly">
            <product>standard-ao</product>
            <initialPhases>
            </initialPhases>
            <finalPhase type="EVERGREEN">
                <duration>
                    <unit>UNLIMITED</unit>
                </duration>
                <recurring>
                    <billingPeriod>MONTHLY</billingPeriod>
                    <recurringPrice>
                        <price>
                            <currency>USD</currency>
                            <value>10</value>
                        </price>
                    </recurringPrice>
                </recurring>
            </finalPhase>
        </plan>
        <plan name="standard-annual">
            <product>Standard</product>
            <initialPhases>
            </initialPhases>
            <finalPhase type="EVERGREEN">
                <duration>
                    <unit>UNLIMITED</unit>
                </duration>
                <recurring>
                    <billingPeriod>ANNUAL</billingPeriod>
                    <recurringPrice>
                        <price>
                            <currency>USD</currency>
                            <value>300</value>
                        </price>
                    </recurringPrice>
                </recurring>
            </finalPhase>
        </plan>
        <plan name="standard-ao-annual">
            <product>standard-ao</product>
            <initialPhases>
            </initialPhases>
            <finalPhase type="EVERGREEN">
                <duration>
                    <unit>UNLIMITED</unit>
                </duration>
                <recurring>
                    <billingPeriod>ANNUAL</billingPeriod>
                    <recurringPrice>
                        <price>
                            <currency>USD</currency>
                            <value>120</value>
                        </price>
                    </recurringPrice>
                </recurring>
            </finalPhase>
        </plan>
    </plans>
    <priceLists>
        <defaultPriceList name="DEFAULT">
            <plans>
                <plan>standard-monthly</plan>
                <plan>standard-ao-monthly</plan>
                <plan>standard-annual</plan>
                <plan>standard-ao-annual</plan>
            </plans>
        </defaultPriceList>
    </priceLists>
</catalog>
  1. Set the date to 2023-05-15
  2. Create a subscription corresponding to the standard-annual plan - An invoice is generated for the duration 2023-05-15 to 2024-05-15 as expected
  3. Set the date to 2023-07-19
  4. Create an ADDON subscription corresponding to the standard-ao-annual plan - An invoice is generated for the duration 2023-07-19 to 2024-07-15.

Since BUNDLE billing alignment is used, one would expect the invoice to be generated for the duration 2023-07-19 to 2024-05-15.

We need to investigate what is the proper semantics and whether this is really a bug.

reshmabidikar avatar Jun 16 '23 04:06 reshmabidikar

The issue is not reproducible when a different set of dates is used:

  1. Set the date to 2023-06-01
  2. Create a subscription corresponding to the standard-annual plan - An invoice is generated for the duration 2023-06-01 to 2024-06-01 as expected.
  3. Set the date to 2023-06-10.
  4. Create an ADDON subscription corresponding to the standard-ao-annual plan - An invoice is generated for the duration 2023-06-10 to 2024-06-01 as expected.

reshmabidikar avatar Jun 16 '23 04:06 reshmabidikar

The issue is also not reproducible with monthly plans.

  1. Set the date to 2023-06-01
  2. Create a subscription corresponding to the standard-monthly plan - An invoice is generated for the duration 2023-06-01 to 2023-07-01 as expected.
  3. Set the date to 2023-06-10.
  4. Create an ADDON subscription corresponding to the standard-ao-monthly plan - An invoice is generated for the duration 2023-06-10 to 2023-07-01 as expected.

reshmabidikar avatar Jun 16 '23 10:06 reshmabidikar

Looks like the issue only occurs for ANNUAL subscriptions when the ADDON is created in a different month than the base subscription.

reshmabidikar avatar Jun 16 '23 10:06 reshmabidikar

Hello @reshmabidikar any update on that?

Rxbsxn avatar Jan 11 '24 09:01 Rxbsxn

Hi @Rxbsxn, nothing so far. We'll update the ticket once the issue is addressed.

reshmabidikar avatar Jan 11 '24 11:01 reshmabidikar

@reshmabidikar Thanks for your quick response

Rxbsxn avatar Jan 11 '24 13:01 Rxbsxn

Adding another related scenario reported here : https://groups.google.com/g/killbilling-users/c/rWvX8TwjrQ0

Scenario 1

  • Use the catalog present at https://github.com/KBbitsP/FileUploads/blob/main/bundle-billing-alignment.xml
  • Set the date to 26th Feb.
  • Create a base annual subscription starting 26th Feb.
  • Create the add on annual subscription starting 26th Feb too.
  • Invoice generated attached in Scenario 1 screenshot.

Since the user has set bundle billing alignment, the expected charged through date for add-on subscription should be 11th march 2025, where as currently it shows as 11th Feb 2025.

Scenario 2

  • Use the catalog present at https://github.com/KBbitsP/FileUploads/blob/main/bundle-billing-alignment.xml
  • Set the date to 1st March.
  • Create a base annual subscription starting 1st March.
  • Create the add on annual subscription starting 1st March too.
  • Invoice generated attached in Scenario 2 screenshot.

Since the user has set bundle billing alignment, the expected charged through date for add-on subscription should be 15th march 2025. This scenario is working fine.

Scenario 2 Scenario 1

KBbitsP avatar Feb 28 '24 16:02 KBbitsP