Explorar el Código

Remove Stripe customer prefix

Mauricio Araujo hace 2 años
padre
commit
3af6621d52
Se han modificado 1 ficheros con 3 adiciones y 5 borrados
  1. 3 5
      internal/billing/stripe.go

+ 3 - 5
internal/billing/stripe.go

@@ -36,19 +36,17 @@ func (s StripeClient) CreateCustomer(ctx context.Context, userEmail string, proj
 	defer span.End()
 	defer span.End()
 
 
 	if projectID == 0 || projectName == "" {
 	if projectID == 0 || projectName == "" {
-		return "", fmt.Errorf("invalid project id or name")
+		return "", telemetry.Error(ctx, span, err, "invalid project id or name")
 	}
 	}
 
 
 	stripe.Key = s.SecretKey
 	stripe.Key = s.SecretKey
 
 
-	// Create customer if not exists
-	customerName := fmt.Sprintf("project_%s", projectName)
 	projectIDStr := strconv.FormatUint(uint64(projectID), 10)
 	projectIDStr := strconv.FormatUint(uint64(projectID), 10)
 	params := &stripe.CustomerParams{
 	params := &stripe.CustomerParams{
-		Name:  stripe.String(customerName),
+		Name:  stripe.String(projectName),
 		Email: stripe.String(userEmail),
 		Email: stripe.String(userEmail),
 		Metadata: map[string]string{
 		Metadata: map[string]string{
-			"porter_project_id": projectIDStr,
+			"project_id": projectIDStr,
 		},
 		},
 	}
 	}