|
|
@@ -15,6 +15,7 @@ type StripeBillingManager struct {
|
|
|
StripeSecretKey string
|
|
|
}
|
|
|
|
|
|
+// CreateCustomer will create a customer in Stripe only if the project doesn't have a BillingID
|
|
|
func (s *StripeBillingManager) CreateCustomer(userEmail string, proj *models.Project) (customerID string, err error) {
|
|
|
stripe.Key = s.StripeSecretKey
|
|
|
|
|
|
@@ -38,6 +39,7 @@ func (s *StripeBillingManager) CreateCustomer(userEmail string, proj *models.Pro
|
|
|
return customerID, nil
|
|
|
}
|
|
|
|
|
|
+// ListPaymentMethod will return all payment methods for the project
|
|
|
func (s *StripeBillingManager) ListPaymentMethod(proj *models.Project) (paymentMethods []types.PaymentMethod, err error) {
|
|
|
stripe.Key = s.StripeSecretKey
|
|
|
|
|
|
@@ -54,6 +56,7 @@ func (s *StripeBillingManager) ListPaymentMethod(proj *models.Project) (paymentM
|
|
|
return paymentMethods, nil
|
|
|
}
|
|
|
|
|
|
+// CreatePaymentMethod will add a new payment method to the project in Stripe
|
|
|
func (s *StripeBillingManager) CreatePaymentMethod(proj *models.Project) (clientSecret string, err error) {
|
|
|
stripe.Key = s.StripeSecretKey
|
|
|
|
|
|
@@ -73,6 +76,7 @@ func (s *StripeBillingManager) CreatePaymentMethod(proj *models.Project) (client
|
|
|
return intent.ClientSecret, nil
|
|
|
}
|
|
|
|
|
|
+// DeletePaymentMethod will remove a payment method for the project in Stripe
|
|
|
func (s *StripeBillingManager) DeletePaymentMethod(paymentMethodID string) (err error) {
|
|
|
stripe.Key = s.StripeSecretKey
|
|
|
|
|
|
@@ -85,22 +89,31 @@ func (s *StripeBillingManager) DeletePaymentMethod(paymentMethodID string) (err
|
|
|
}
|
|
|
|
|
|
// TODO: remove these methods when the billing tech-debt is cleaned
|
|
|
+// CreateTeam
|
|
|
func (s *StripeBillingManager) CreateTeam(user *models.User, proj *models.Project) (teamID string, err error) {
|
|
|
return fmt.Sprintf("%d", proj.ID), nil
|
|
|
}
|
|
|
|
|
|
+// TODO: remove these methods when the billing tech-debt is cleaned
|
|
|
+// DeleteTeam
|
|
|
func (s *StripeBillingManager) DeleteTeam(user *models.User, proj *models.Project) (err error) {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
+// TODO: remove these methods when the billing tech-debt is cleaned
|
|
|
+// GetRedirectURI
|
|
|
func (s *StripeBillingManager) GetRedirectURI(user *models.User, proj *models.Project) (url string, err error) {
|
|
|
return "", nil
|
|
|
}
|
|
|
|
|
|
+// TODO: remove these methods when the billing tech-debt is cleaned
|
|
|
+// ParseProjectUsageFromWebhook
|
|
|
func (s *StripeBillingManager) ParseProjectUsageFromWebhook(payload []byte) (*models.ProjectUsage, *types.FeatureFlags, error) {
|
|
|
return nil, nil, nil
|
|
|
}
|
|
|
|
|
|
+// TODO: remove these methods when the billing tech-debt is cleaned
|
|
|
+// VerifySignature
|
|
|
func (s *StripeBillingManager) VerifySignature(signature string, body []byte) bool {
|
|
|
return false
|
|
|
}
|