diff --git a/main.go b/main.go index e7e45b2..091b219 100644 --- a/main.go +++ b/main.go @@ -43,8 +43,6 @@ func main() { flag.StringP("dbType", "t", db.TypePebble, fmt.Sprintf("key-value db type [%s,%s,%s]", db.TypePebble, db.TypeLevelDB, db.TypeMongo)) flag.String("stripeKey", "", "stripe secret key") flag.String("stripeProductID", "", "stripe price id") - flag.Int64("stripeMinQuantity", 100, "stripe min number of tokens") - flag.Int64("stripeMaxQuantity", 100000, "stripe max number of tokens") flag.String("stripeWebhookSecret", "", "stripe webhook secret key") flag.Parse() @@ -101,12 +99,6 @@ func main() { if err := viper.BindPFlag("stripeProductID", flag.Lookup("stripeProductID")); err != nil { panic(err) } - if err := viper.BindPFlag("stripeMinQuantity", flag.Lookup("stripeMinQuantity")); err != nil { - panic(err) - } - if err := viper.BindPFlag("stripeMaxQuantity", flag.Lookup("stripeMaxQuantity")); err != nil { - panic(err) - } if err := viper.BindPFlag("stripeWebhookSecret", flag.Lookup("stripeWebhookSecret")); err != nil { panic(err) } @@ -150,8 +142,6 @@ func main() { dbType := viper.GetString("dbType") stripeKey := viper.GetString("stripeKey") stripeProductID := viper.GetString("stripeProductID") - stripeMinQuantity := viper.GetInt64("stripeMinQuantity") - stripeMaxQuantity := viper.GetInt64("stripeMaxQuantity") stripeWebhookSecret := viper.GetString("stripeWebhookSecret") // parse auth types and amounts @@ -217,8 +207,6 @@ func main() { stripeKey, stripeProductID, stripeWebhookSecret, - stripeMinQuantity, - stripeMaxQuantity, int64(amount), &f, storage, diff --git a/stripehandler/stripe.go b/stripehandler/stripe.go index 69ca6d9..4463e0d 100644 --- a/stripehandler/stripe.go +++ b/stripehandler/stripe.go @@ -21,8 +21,6 @@ import ( type StripeHandler struct { Key string // The API key for the Stripe account. ProductID string // The ID of the price associated with the product. - MinQuantity int64 // The minimum quantity allowed for the product. - MaxQuantity int64 // The maximum quantity allowed for the product. DefaultAmount int64 // The default amount for the product. WebhookSecret string // The secret used to verify Stripe webhook events. Storage *storage.Storage // The storage instance for the faucet. @@ -42,15 +40,13 @@ type ReturnStatus struct { // NewStripeClient creates a new instance of the StripeHandler struct with the provided parameters. // It sets the Stripe API key, price ID, webhook secret, minimum quantity, maximum quantity, and default amount. // Returns a pointer to the created StripeHandler. -func NewStripeClient(key, productID, webhookSecret string, minQuantity, maxQuantity, defaultAmount int64, faucet *faucet.Faucet, storage *storage.Storage) (*StripeHandler, error) { +func NewStripeClient(key, productID, webhookSecret string, defaultAmount int64, faucet *faucet.Faucet, storage *storage.Storage) (*StripeHandler, error) { if key == "" || productID == "" || webhookSecret == "" || storage == nil { return nil, errors.New("missing required parameters") } stripe.Key = key return &StripeHandler{ ProductID: productID, - MinQuantity: minQuantity, - MaxQuantity: maxQuantity, DefaultAmount: defaultAmount, WebhookSecret: webhookSecret, Storage: storage,