diff --git a/env.go b/env.go deleted file mode 100644 index bbeac3d..0000000 --- a/env.go +++ /dev/null @@ -1,9 +0,0 @@ -package stripego - -import "github.com/joho/godotenv" - -// Env - load the configurations from .env -func Env() error { - // load environment variables - return godotenv.Load() -} diff --git a/go.mod b/go.mod index 3db6183..5dfc71e 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,4 @@ module github.com/pilinux/stripego go 1.19 -require ( - github.com/joho/godotenv v1.4.0 - github.com/stripe/stripe-go/v74 v74.4.0 -) +require github.com/stripe/stripe-go/v74 v74.4.0 diff --git a/go.sum b/go.sum index d1ec79a..60379a2 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,5 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg= -github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/paymentintent_test.go b/paymentintent_test.go index 288aa05..93b78f3 100644 --- a/paymentintent_test.go +++ b/paymentintent_test.go @@ -18,20 +18,8 @@ var PaymentIntentID string var PaymentIntentAmount int64 func TestCreatePaymentIntent(t *testing.T) { - stripeSK, ok := os.LookupEnv("STRIPE_SK") - if !ok { - err := stripego.Env() - if err != nil { - t.Errorf("failed to load .env: %v", err) - return - } - - StripeSK = strings.TrimSpace(os.Getenv("STRIPE_SK")) - Currency = strings.TrimSpace(os.Getenv("CURRENCY")) - } else { - StripeSK = strings.TrimSpace(stripeSK) - Currency = strings.TrimSpace(os.Getenv("CURRENCY")) - } + StripeSK = strings.TrimSpace(os.Getenv("STRIPE_SK")) + Currency = strings.TrimSpace(os.Getenv("CURRENCY")) PaymentIntentObject = "payment_intent" PaymentIntentAmount = 1000 diff --git a/transfer_test.go b/transfer_test.go index e5f6cdf..702e65f 100644 --- a/transfer_test.go +++ b/transfer_test.go @@ -15,22 +15,9 @@ var TransferObject string var TransferAmount int64 func TestTransferBalance(t *testing.T) { - stripeSK, ok := os.LookupEnv("STRIPE_SK") - if !ok { - err := stripego.Env() - if err != nil { - t.Errorf("failed to load .env: %v", err) - return - } - - StripeSK = strings.TrimSpace(os.Getenv("STRIPE_SK")) - Currency = strings.TrimSpace(os.Getenv("CURRENCY")) - Destination = strings.TrimSpace(os.Getenv("DESTINATION")) - } else { - StripeSK = strings.TrimSpace(stripeSK) - Currency = strings.TrimSpace(os.Getenv("CURRENCY")) - Destination = strings.TrimSpace(os.Getenv("DESTINATION")) - } + StripeSK = strings.TrimSpace(os.Getenv("STRIPE_SK")) + Currency = strings.TrimSpace(os.Getenv("CURRENCY")) + Destination = strings.TrimSpace(os.Getenv("DESTINATION")) TransferObject = "transfer" TransferAmount = 100