Skip to content

Commit daa27cd

Browse files
committed
feat(billing): rename WithDeprecatedTaxCodeEnforced
1 parent fee513a commit daa27cd

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

openmeter/billing/profile.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func (c *InvoicingConfig) Validate() error {
110110
return nil
111111
}
112112

113-
// EnforceTaxCodeDeprecation returns a ValidationError when the receiver adds or changes a
113+
// WithDeprecatedTaxCodeEnforced returns a ValidationError when the receiver adds or changes a
114114
// deprecated tax-code field (stripe.code or taxCodeId) relative to stored. stored is the
115115
// zero InvoicingConfig on create. Removal is permitted; behavior is never restricted.
116116
// Call it on the raw API->domain mapped incoming config, BEFORE tax-code resolution.
@@ -120,7 +120,7 @@ func (c *InvoicingConfig) Validate() error {
120120
// too), otherwise tax-code resolution would backfill stripe.code from the referenced tax code
121121
// entity. The reverse (taxCodeId omitted, stripe.code echoed unchanged) is left untouched,
122122
// because legacy clients that predate taxCodeId send exactly that shape on no-op updates.
123-
func (c InvoicingConfig) EnforceTaxCodeDeprecation(stored InvoicingConfig) (InvoicingConfig, error) {
123+
func (c InvoicingConfig) WithDeprecatedTaxCodeEnforced(stored InvoicingConfig) (InvoicingConfig, error) {
124124
if c.DefaultTaxConfig == nil {
125125
return c, nil
126126
}

openmeter/billing/profile_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/openmeterio/openmeter/openmeter/productcatalog"
1111
)
1212

13-
func TestInvoicingConfigEnforceTaxCodeDeprecation(t *testing.T) {
13+
func TestInvoicingConfigWithDeprecatedTaxCodeEnforced(t *testing.T) {
1414
taxConfig := func(behavior *productcatalog.TaxBehavior, stripeCode string, taxCodeID *string) *productcatalog.TaxConfig {
1515
tc := &productcatalog.TaxConfig{
1616
Behavior: behavior,
@@ -208,7 +208,7 @@ func TestInvoicingConfigEnforceTaxCodeDeprecation(t *testing.T) {
208208
}
209209

210210
incoming := InvoicingConfig{DefaultTaxConfig: tt.incoming}
211-
result, err := incoming.EnforceTaxCodeDeprecation(InvoicingConfig{DefaultTaxConfig: tt.stored})
211+
result, err := incoming.WithDeprecatedTaxCodeEnforced(InvoicingConfig{DefaultTaxConfig: tt.stored})
212212
if !tt.wantErr {
213213
require.NoError(t, err)
214214

openmeter/billing/service/profile.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (s *Service) CreateProfile(ctx context.Context, input billing.CreateProfile
8282
}
8383

8484
// billing.InvoicingConfig{} is the zero-value stored state for creates (no prior tax-code to compare against).
85-
normalizedInvoicing, err := input.WorkflowConfig.Invoicing.EnforceTaxCodeDeprecation(billing.InvoicingConfig{})
85+
normalizedInvoicing, err := input.WorkflowConfig.Invoicing.WithDeprecatedTaxCodeEnforced(billing.InvoicingConfig{})
8686
if err != nil {
8787
return nil, err
8888
}
@@ -288,7 +288,7 @@ func (s *Service) UpdateProfile(ctx context.Context, input billing.UpdateProfile
288288

289289
targetState := billing.BaseProfile(input)
290290

291-
normalizedInvoicing, err := targetState.WorkflowConfig.Invoicing.EnforceTaxCodeDeprecation(profile.WorkflowConfig.Invoicing)
291+
normalizedInvoicing, err := targetState.WorkflowConfig.Invoicing.WithDeprecatedTaxCodeEnforced(profile.WorkflowConfig.Invoicing)
292292
if err != nil {
293293
return nil, err
294294
}

0 commit comments

Comments
 (0)