浏览代码

Delete customer on project deletion

Mauricio Araujo 2 年之前
父节点
当前提交
d6a6afd36f
共有 2 个文件被更改,包括 5 次插入1 次删除
  1. 4 0
      internal/billing/billing.go
  2. 1 1
      internal/billing/stripe.go

+ 4 - 0
internal/billing/billing.go

@@ -32,6 +32,10 @@ func (s *NoopBillingManager) CreateCustomer(userEmail string, proj *models.Proje
 	return "", nil
 }
 
+func (s *NoopBillingManager) DeleteCustomer(proj *models.Project) (err error) {
+	return nil
+}
+
 // ListPaymentMethod is a no-op
 func (s *NoopBillingManager) ListPaymentMethod(proj *models.Project) (paymentMethods []types.PaymentMethod, err error) {
 	return []types.PaymentMethod{}, nil

+ 1 - 1
internal/billing/stripe.go

@@ -45,7 +45,7 @@ func (s *StripeBillingManager) CreateCustomer(userEmail string, proj *models.Pro
 func (s *StripeBillingManager) DeleteCustomer(proj *models.Project) (err error) {
 	stripe.Key = s.StripeSecretKey
 
-	if proj.BillingID == "" {
+	if proj.BillingID != "" {
 		params := &stripe.CustomerParams{}
 		_, err := customer.Del(proj.BillingID, params)
 		if err != nil {