Mauricio Araujo пре 2 година
родитељ
комит
99a4b20c9c
3 измењених фајлова са 13 додато и 13 уклоњено
  1. 1 1
      api/server/handlers/billing/create.go
  2. 3 3
      internal/billing/billing.go
  3. 9 9
      internal/billing/stripe..go

+ 1 - 1
api/server/handlers/billing/create.go

@@ -17,7 +17,7 @@ type CreateBillingHandler struct {
 	handlers.PorterHandlerWriter
 }
 
-// NewCreateBillingCustomerIfNotExists will create a new CreateBillingHandler
+// NewCreateBillingHandler will create a new CreateBillingHandler
 func NewCreateBillingHandler(
 	config *config.Config,
 	decoderValidator shared.RequestDecoderValidator,

+ 3 - 3
internal/billing/billing.go

@@ -35,7 +35,7 @@ type BillingManager interface {
 
 	// ParseProjectUsageFromWebhook parses the project usage from a webhook payload sent
 	// from a billing agent
-	ParseProjectUsageFromWebhook(payload []byte) (*models.ProjectUsage, *types.FeatureFlags, error)
+	ParseProjectUsageFromWebhook(payload []byte) (*models.ProjectUsage, error)
 
 	// VerifySignature verifies the signature for a webhook
 	VerifySignature(signature string, body []byte) bool
@@ -80,8 +80,8 @@ func (n *NoopBillingManager) GetRedirectURI(user *models.User, proj *models.Proj
 }
 
 // ParseProjectUsageFromWebhook is a no-op
-func (n *NoopBillingManager) ParseProjectUsageFromWebhook(payload []byte) (*models.ProjectUsage, *types.FeatureFlags, error) {
-	return nil, nil, nil
+func (n *NoopBillingManager) ParseProjectUsageFromWebhook(payload []byte) (*models.ProjectUsage, error) {
+	return nil, nil
 }
 
 // VerifySignature is a no-op

+ 9 - 9
internal/billing/stripe..go

@@ -11,6 +11,8 @@ import (
 	"github.com/stripe/stripe-go/v76/setupintent"
 )
 
+// StripeBillingManager interacts with the Stripe API to manage payment methods
+// and customers
 type StripeBillingManager struct {
 	StripeSecretKey string
 }
@@ -88,29 +90,27 @@ func (s *StripeBillingManager) DeletePaymentMethod(paymentMethodID string) (err
 	return nil
 }
 
-// TODO: remove these methods when the billing tech-debt is cleaned
-
-// CreateTeam
+// CreateTeam is a no-op
 func (s *StripeBillingManager) CreateTeam(user *models.User, proj *models.Project) (teamID string, err error) {
 	return fmt.Sprintf("%d", proj.ID), nil
 }
 
-// DeleteTeam
+// DeleteTeam is a no-op
 func (s *StripeBillingManager) DeleteTeam(user *models.User, proj *models.Project) (err error) {
 	return nil
 }
 
-// GetRedirectURI
+// GetRedirectURI is a no-op
 func (s *StripeBillingManager) GetRedirectURI(user *models.User, proj *models.Project) (url string, err error) {
 	return "", nil
 }
 
-// ParseProjectUsageFromWebhook
-func (s *StripeBillingManager) ParseProjectUsageFromWebhook(payload []byte) (*models.ProjectUsage, *types.FeatureFlags, error) {
-	return nil, nil, nil
+// ParseProjectUsageFromWebhook is a no-op
+func (s *StripeBillingManager) ParseProjectUsageFromWebhook(payload []byte) (*models.ProjectUsage, error) {
+	return nil, nil
 }
 
-// VerifySignature
+// VerifySignature is a no-op
 func (s *StripeBillingManager) VerifySignature(signature string, body []byte) bool {
 	return false
 }