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

fix: Fix boundaries for full period payed in advance #378

Merged
merged 2 commits into from
Aug 11, 2022

Conversation

vincent-pochet
Copy link
Collaborator

@vincent-pochet vincent-pochet commented Aug 11, 2022

Context

With the new multiple plans feature, the issuing date of the invoice have been updated to be the previous day of the invoice generation.

Description

Before the change, in the case of a plan payed in advance, the issuing date was the invoice creation date and so the first day of the new invoice period.

The issuing date field was used to recompute bounds of the invoice in the case of a trial period.

Before:

issuing_date = DateTime.parse('2022-03-01')
invoiced_from_date = issuing_date // 2022-03-01
invoiced_to_date = issuing_date.end_of_month // 2022-03-31

After:

issuing_date = DateTime.parse('2022-28-02')
invoiced_from_date = issuing_date // 2022-02-28
invoiced_to_date = issuing_date.end_of_month // 2022-02-28

Also, the code was not taking the plan interval into account, it was only working with monthly interval... 🐞

Note: the bounds computation will be delegated to a proper date service with the coming anniversary date feature

How Has This Been Tested?

QA have been performed locally

@vincent-pochet vincent-pochet added Subscription Relation to the Subscriptions Invoice Related to Invoices 🐞 Bug Something isn't working labels Aug 11, 2022
@vincent-pochet vincent-pochet self-assigned this Aug 11, 2022
Copy link
Contributor

@jdenquin jdenquin left a comment

Choose a reason for hiding this comment

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

🐞 🔫

@vincent-pochet vincent-pochet merged commit d3f66cf into main Aug 11, 2022
@vincent-pochet vincent-pochet deleted the fix/pay-in-advance-full-period branch August 11, 2022 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug Something isn't working Invoice Related to Invoices Subscription Relation to the Subscriptions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants