Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: bill on beginning of period & billing period based on start date instead of months #4

Merged
merged 17 commits into from
Sep 14, 2024

Conversation

HenningWendtland
Copy link
Collaborator

contains two new features:

  • added support for billing at the beginning of a period
  • added support for billing periods that are based on start date (e.g. do not follow calendar months)

further details:

  • should be backwards compatbile to version 15.0.0 (without the new select fields)
  • Button "Create invoice for last period" is no "create invoice for current period", acting the same then before but extended to the new cases
  • refactor of the function "get_first_day_of_period": now always returns a period (from_date, to_date), calculation simplified, function name changed to "get_calendar_period" since it is more fitting

@UsamaNaveed9
Copy link
Collaborator

PR is tested.
Some suggestions will be easier to understand for users.

Case 1: Billing Period is based on = "start date" and Billing Time = "at beginning of period"
image

In this case, the Invoice is created based on the frequency current period
image

Case 2: Billing Period is based on = "calendar months" and Billing Time = "at beginning of period"
image

In this case, the Invoice is created based on the frequency current period
image

The subscription period is based on the current frequency in the above two cases.
So, we can change Billing Time "at beginning of period" to "Current"

Case 3: Billing Period is based on = "start date" and Billing Time = "after end of period"
image

In this case, the Invoice is created based on the frequency previous period
image

Case 4: Billing Period is based on = "calendar months" and Billing Time = "after end of period"
image

In this case, the Invoice is created based on the frequency previous period
image

The subscription period is based on the previous frequency in the above two cases.
So, we can change Billing Time "after end of period" to "Previous"

image

Change the button Label to "Create {Frequency} invoice"

Copy link
Member

@barredterra barredterra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please adjust the current tests and add a test for the new method.

@HenningWendtland
Copy link
Collaborator Author

Please adjust the current tests and add a test for the new method.

Done

@HenningWendtland
Copy link
Collaborator Author

@UsamaNaveed9 About your suggestions:
I think changing the values of the fields "Billing Period is based on" (current: "calendar months"/"start date")
and "Billing Time" (current: "at beginning of period" / "after end of period")
or merging them is not a good idea

How it works

  • The "Billing Period is based on" Select triggers if the period is in line with the calendar or with the start date. For example if Start Date = 11-04-2024 in the "calendar month" case the first period will be 01-04-2024 to 30-04-2024
    in "start date" case the first period will be 11-04-2024 to 10-05-2024

  • The "Billing Time" Select triggers when the invoices should be auto generated (via scheduler), which is either at the beginning or after the end of a period, depending on customer preference

  • The button "Create Current Monthly Invoice" is intended for allowing the user to test if the subscription is created correctly, by creating the "current" invoice, e.g. the one that the scheduler would create if running right now. Depending on the above discussed two fields, the dates may vary. In case the scheduler would not create an invoice right now an error message should be displayed

@barredterra barredterra changed the title feat: bill on beginning of period & billing period based on start date instead of months feat!: bill on beginning of period & billing period based on start date instead of months Sep 13, 2024
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@barredterra barredterra merged commit 799d24b into version-15 Sep 14, 2024
4 checks passed
@barredterra barredterra deleted the improve-periods branch September 14, 2024 14:13
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.

3 participants