production runtime and mock removal

This commit is contained in:
inman committed 2026-08-17 23:44:14 +08:00
1 parent 2ef3da7af5
commit 6480e503eb
55 files changed
+581 -540

No files matched your search

+8 -4
View File
@@ -12,9 +12,10 @@ import (
const CurrencyCNY = "CNY"
var (
ErrAmbiguousPriceRule = errors.New("billing price rules are ambiguous")
ErrPriceRuleNotFound = errors.New("billing price rule not found")
ErrParameterTier = errors.New("billing parameter tier not found")
ErrAmbiguousPriceRule = errors.New("billing price rules are ambiguous")
ErrPriceRuleNotFound = errors.New("billing price rule not found")
ErrParameterTier = errors.New("billing parameter tier not found")
ErrProviderUnavailable = errors.New("billing provider is unavailable")
)
type Unit string
@@ -103,9 +104,12 @@ type Quote struct {
type Catalog struct{ Rules []PriceRule }
func (c Catalog) Quote(input QuoteInput) (*Quote, error) {
if input.BillingDisabled || input.Provider == "mock" {
if input.BillingDisabled {
return nil, nil
}
if input.Provider == "mock" {
return nil, ErrProviderUnavailable
}
type candidate struct {
rule PriceRule
req, conditions, priority int