Skip to content

Conversation

@akostadinov
Copy link
Contributor

@akostadinov akostadinov commented Aug 13, 2025

As a follow up on Rails 7.1 upgrade, lets remove this.

The only place I identified us using #to_time is in

Contract#intersect_with_unpaid_period which is used for variable cost calculations.

This is tested from Finance::VariableCostCalculationTest#variable line items are created.

In that instance the period is actually dates. So #to_time returns the dates in the server local timezone regardless of the to_time_preserves_timezone setting. So the behavior shouldn't change.

But there is still a small chance where #to_time is called somewhere internally. And since providers should be billed in their local timezones,
I think we should simulate that - create a provider with a very different timezone from current and ensure it is billed in that specified timezone.

That's why I leave this a WIP. I'm going away for a week so feel free to pick this up 👼

P.S. there is also Finance::BillVariableForPlanChangedTest where we check whether variable billing would happen in certain timezone conditions. But it doesn't seem to test an actual provider being actually billed on a server with a different time zone.

there is also a test Finance::VariableCostCalculationTest##calculate_variable_cost does the calculations in the timezone of the provider but it is also heavily stubbed so I wouldn't call it trustworthy.

Copy link
Contributor

@jlledom jlledom left a comment

Choose a reason for hiding this comment

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

It looks good to me 👍

@github-actions github-actions bot added the Stale label Sep 21, 2025
@github-actions github-actions bot closed this Oct 7, 2025
@akostadinov akostadinov reopened this Oct 7, 2025
@3scale 3scale deleted a comment from github-actions bot Oct 7, 2025
@akostadinov akostadinov removed the Stale label Oct 7, 2025
@github-actions github-actions bot added the Stale label Nov 7, 2025
@3scale 3scale deleted a comment from github-actions bot Nov 11, 2025
@akostadinov akostadinov removed the Stale label Nov 11, 2025
@github-actions github-actions bot added the Stale label Dec 12, 2025
@github-actions github-actions bot closed this Dec 28, 2025
@3scale 3scale deleted a comment from github-actions bot Dec 28, 2025
@akostadinov akostadinov removed the Stale label Dec 28, 2025
@akostadinov akostadinov reopened this Dec 28, 2025
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.

2 participants