[NU-498] Stepped billing: consider discounts and minimum cost - #6444
Open
joaquinco wants to merge 10 commits into
Open
[NU-498] Stepped billing: consider discounts and minimum cost#6444joaquinco wants to merge 10 commits into
joaquinco wants to merge 10 commits into
Conversation
joaquinco
force-pushed
the
nu-498/stepped-billing-fixes
branch
from
August 27, 2026 19:17
ebe905b to
4e7d3e9
Compare
joaquinco
force-pushed
the
nu-498/stepped-billing-fixes
branch
2 times, most recently
from
August 28, 2026 18:45
b6265e3 to
8bc3cd9
Compare
joaquinco
marked this pull request as ready for review
August 31, 2026 12:15
diebas
approved these changes
Sep 1, 2026
|
|
||
| # Charge usage per minute with a stepped (or tiered) rate | ||
| # | ||
| # If price policy does not have rates then it's equivalen to PerMinute |
| subsidy: subsidy || 0, | ||
| cost: duration_days * usage_rate_daily, | ||
| cost: duration * usage_rate_daily, | ||
| subsidy: duration * price_policy.usage_subsidy_daily.to_f, |
Collaborator
There was a problem hiding this comment.
NIT: I think you can remove the explicit call to price_policy here as usage_subsidy_daily is already delegated to it
| @duration = duration | ||
| @raw_duration = duration | ||
|
|
||
| if [start_at, end_at, duration].all?(&:nil?) |
Collaborator
There was a problem hiding this comment.
I think this is already checked before calling this class.
Maybe leave it here and remove the check from time_based_price_calculator.rb?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Notes
Consider discounts and minimum cost when calculating stepped billing.
Changes:
PricePolicies::Strategy::PerMinutelogic is included inPricePolicies::Strategy::SteppedRate, might be worth just keeping the latter down the roadNU-498 | Stepped billing fixes