github.com/stripe/stripe-go/v76@v76.25.0/topup/client_test.go (about) 1 package topup 2 3 import ( 4 "testing" 5 6 assert "github.com/stretchr/testify/require" 7 stripe "github.com/stripe/stripe-go/v76" 8 _ "github.com/stripe/stripe-go/v76/testing" 9 ) 10 11 func TestTopupCancel(t *testing.T) { 12 topup, err := Cancel("tu_123", &stripe.TopupParams{}) 13 assert.Nil(t, err) 14 assert.NotNil(t, topup) 15 } 16 17 func TestTopupGet(t *testing.T) { 18 topup, err := Get("tu_123", nil) 19 assert.Nil(t, err) 20 assert.NotNil(t, topup) 21 } 22 23 func TestTopupNew(t *testing.T) { 24 topup, err := New(&stripe.TopupParams{ 25 Amount: stripe.Int64(123), 26 Currency: stripe.String(string(stripe.CurrencyUSD)), 27 Source: stripe.String("src_123"), 28 Description: stripe.String("creating a topup"), 29 StatementDescriptor: stripe.String("topup"), 30 }) 31 assert.Nil(t, err) 32 assert.NotNil(t, topup) 33 } 34 35 func TestTopupUpdate(t *testing.T) { 36 params := &stripe.TopupParams{} 37 params.AddMetadata("key", "value") 38 topup, err := Update("tu_123", params) 39 assert.Nil(t, err) 40 assert.NotNil(t, topup) 41 }