Skip to content

Commit

Permalink
Remove old deprecated Account property on the Params resource
Browse files Browse the repository at this point in the history
You now have to use StripeAccount as a property and SetStripeAccount. The
rest has been removed as it was deprecated for a long time.
  • Loading branch information
remi-stripe committed Oct 17, 2017
1 parent 8e6f29f commit 90ef812
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 42 deletions.
10 changes: 0 additions & 10 deletions params.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ const (
// Params is the structure that contains the common properties
// of any *Params structure.
type Params struct {
// Account is deprecated form of StripeAccount that will do the same thing.
// Please use StripeAccount instead.
Account string `form:"-"` // Passed as header

Expand []string `form:"expand"`
Extra *ExtraValues `form:"*"`

Expand Down Expand Up @@ -145,12 +141,6 @@ func NewIdempotencyKey() string {
return fmt.Sprintf("%v_%v", now, base64.URLEncoding.EncodeToString(buf)[:6])
}

// SetAccount sets a value for the Stripe-Account header.
func (p *Params) SetAccount(val string) {
p.Account = val
p.StripeAccount = val
}

// SetStripeAccount sets a value for the Stripe-Account header.
func (p *Params) SetStripeAccount(val string) {
p.StripeAccount = val
Expand Down
18 changes: 0 additions & 18 deletions params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,31 +222,13 @@ func TestListParams_ToParams(t *testing.T) {
}
}

func TestParams_SetAccount(t *testing.T) {
p := &stripe.Params{}
p.SetAccount(TestMerchantID)

if p.Account != TestMerchantID {
t.Fatalf("Expected Account of %v but got %v.", TestMerchantID, p.Account)
}

if p.StripeAccount != TestMerchantID {
t.Fatalf("Expected StripeAccount of %v but got %v.", TestMerchantID, p.StripeAccount)
}
}

func TestParams_SetStripeAccount(t *testing.T) {
p := &stripe.Params{}
p.SetStripeAccount(TestMerchantID)

if p.StripeAccount != TestMerchantID {
t.Fatalf("Expected Account of %v but got %v.", TestMerchantID, p.StripeAccount)
}

// Check that we don't set the deprecated parameter.
if p.Account != "" {
t.Fatalf("Expected empty Account but got %v.", TestMerchantID)
}
}

//
Expand Down
5 changes: 0 additions & 5 deletions stripe.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,6 @@ func (s *BackendConfiguration) NewRequest(method, path, key, contentType string,
req.Header.Add("Idempotency-Key", idempotency)
}

// Support the value of the old Account field for now.
if account := strings.TrimSpace(params.Account); account != "" {
req.Header.Add("Stripe-Account", account)
}

// But prefer StripeAccount.
if stripeAccount := strings.TrimSpace(params.StripeAccount); stripeAccount != "" {
req.Header.Add("Stripe-Account", stripeAccount)
Expand Down
9 changes: 0 additions & 9 deletions stripe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,6 @@ func TestStripeAccount(t *testing.T) {
assert.NoError(t, err)

assert.Equal(t, TestMerchantID, req.Header.Get("Stripe-Account"))

// Also test the deprecated Account field for now as well. This should be
// identical to the exercise above.
p = &stripe.Params{Account: TestMerchantID}

req, err = c.NewRequest("", "", "", "", nil, p)
assert.NoError(t, err)

assert.Equal(t, TestMerchantID, req.Header.Get("Stripe-Account"))
}

func TestUserAgent(t *testing.T) {
Expand Down

0 comments on commit 90ef812

Please sign in to comment.