91ed4e196a
- Added support for tiered billing expressions in the billing system. - Introduced new types and functions for handling billing expressions, including caching and execution. - Updated existing billing logic to accommodate tiered billing scenarios. - Enhanced request handling to support incoming billing expression requests. - Added tests for tiered billing functionality to ensure correctness.
11 lines
329 B
Go
11 lines
329 B
Go
package billingexpr
|
|
|
|
import "math"
|
|
|
|
// QuotaRound converts a float64 quota value to int using half-away-from-zero
|
|
// rounding. Every tiered billing path (pre-consume, settlement, breakdown
|
|
// validation, log fields) MUST use this function to avoid +-1 discrepancies.
|
|
func QuotaRound(f float64) int {
|
|
return int(math.Round(f))
|
|
}
|