Skip to content

Commit 7183f3e

Browse files
committed
fix(taxcode): fix review comments
1 parent f095646 commit 7183f3e

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

openmeter/taxcode/service/hooks/planhook.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ func (e *planHook) PreDelete(ctx context.Context, tc *taxcode.TaxCode) error {
5757
productcatalog.PlanStatusArchived,
5858
productcatalog.PlanStatusDraft,
5959
productcatalog.PlanStatusScheduled,
60+
productcatalog.PlanStatusInvalid,
6061
},
6162
TaxCodes: &filter.FilterString{
6263
In: &[]string{

openmeter/taxcode/service/organizationdefaulttaxcodes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (s *Service) UpsertOrganizationDefaultTaxCodes(ctx context.Context, input t
3636
return err
3737
}
3838

39-
if tc.DeletedAt != nil {
39+
if tc.IsDeleted() {
4040
return taxcode.NewTaxCodeNotFoundError(id)
4141
}
4242

openmeter/taxcode/service/taxcode.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (s *Service) UpdateTaxCode(ctx context.Context, input taxcode.UpdateTaxCode
4242
return taxcode.TaxCode{}, err
4343
}
4444

45-
if tc.DeletedAt != nil {
45+
if tc.IsDeleted() {
4646
return taxcode.TaxCode{}, models.NewGenericNotFoundError(taxcode.ErrTaxCodeNotFound)
4747
}
4848

@@ -175,6 +175,10 @@ func (s *Service) DeleteTaxCode(ctx context.Context, input taxcode.DeleteTaxCode
175175
return err
176176
}
177177

178+
if existing.IsDeleted() {
179+
return nil
180+
}
181+
178182
if existing.IsManagedBySystem() && !input.AllowAnnotations {
179183
return models.NewGenericConflictError(taxcode.ErrTaxCodeManagedBySystem)
180184
}

0 commit comments

Comments
 (0)