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(subscription): Make sure terminated invoice always comes with the right boundaries #2561

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

vincent-pochet
Copy link
Collaborator

Context

Some termination invoices failed to refresh or are generated with the wrong boundaries.
This is related to a small mismatch with the time comparison when looking if the subscription was terminated before the invoice timestamp.

Description

This PR fixes the subscription#terminated_at? comparison so that it always compare time with the second precision, to avoid side effects related to rounding when persisting ActiveRecord objects.

A lot of DateTime objects are also converted into proper Time.zone to fix potential issues around time management as DateTime should not be used in Lago's context (see https://docs.datadoghq.com/code_analysis/static_analysis_rules/ruby-best-practices/no-datetime/)

@vincent-pochet vincent-pochet merged commit 5cf42f1 into main Sep 10, 2024
6 checks passed
@vincent-pochet vincent-pochet deleted the fix-terminated-at branch September 10, 2024 13:29
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