Skip to content

Commit

Permalink
Do not use AccessToken parameter to specify key for connect
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-stripe committed Sep 5, 2014
1 parent bc2a5f8 commit dec5f79
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 49 deletions.
4 changes: 2 additions & 2 deletions charge.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ type ChargeListParams struct {
// For more details see https://stripe.com/docs/api#charge_capture.
type CaptureParams struct {
Params
Amount, Fee uint64
Email, AccessToken string
Amount, Fee uint64
Email string
}

// Charge is the resource representing a Stripe charge.
Expand Down
12 changes: 0 additions & 12 deletions charge/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,7 @@ func (c Client) Create(params *ChargeParams) (*Charge, error) {

token := c.Tok
if params.Fee > 0 {
if len(params.AccessToken) == 0 {
err := errors.New("Invalid charge params: an access token is required for application fees")
return nil, err
}

body.Add("application_fee", strconv.FormatUint(params.Fee, 10))
token = params.AccessToken
}

params.AppendTo(body)
Expand Down Expand Up @@ -168,13 +162,7 @@ func (c Client) Capture(id string, params *CaptureParams) (*Charge, error) {
}

if params.Fee > 0 {
if len(params.AccessToken) == 0 {
err := errors.New("Invalid charge params: an access token is required for application fees")
return nil, err
}

body.Add("application_fee", strconv.FormatUint(params.Fee, 10))
token = params.AccessToken
}

params.AppendTo(body)
Expand Down
13 changes: 0 additions & 13 deletions invoice/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
package invoice

import (
"errors"
"fmt"
"net/url"
"strconv"
Expand Down Expand Up @@ -43,13 +42,7 @@ func (c Client) Create(params *InvoiceParams) (*Invoice, error) {

token := c.Tok
if params.Fee > 0 {
if len(params.AccessToken) == 0 {
err := errors.New("Invalid invoice params: an access token is required for application fees")
return nil, err
}

body.Add("application_fee", strconv.FormatUint(params.Fee, 10))
token = params.AccessToken
}

invoice := &Invoice{}
Expand Down Expand Up @@ -132,13 +125,7 @@ func (c Client) Update(id string, params *InvoiceParams) (*Invoice, error) {
}

if params.Fee > 0 {
if len(params.AccessToken) == 0 {
err := errors.New("Invalid invoice params: an access token is required for application fees")
return nil, err
}

body.Add("application_fee", strconv.FormatUint(params.Fee, 10))
token = params.AccessToken
}

params.AppendTo(body)
Expand Down
5 changes: 2 additions & 3 deletions params.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import (
// Params is the structure that contains the common properties
// of any *Params structure.
type Params struct {
Exp []string
Meta map[string]string
AccessToken string
Exp []string
Meta map[string]string
}

// ListParams is the structure that contains the common properties
Expand Down
13 changes: 0 additions & 13 deletions sub/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
package sub

import (
"errors"
"fmt"
"net/url"
"strconv"
Expand Down Expand Up @@ -47,13 +46,7 @@ func (c Client) Create(params *SubParams) (*Subscription, error) {

token := c.Tok
if params.FeePercent > 0 {
if len(params.AccessToken) == 0 {
err := errors.New("Invalid sub params: an access token is required for application fees")
return nil, err
}

body.Add("application_fee_percent", strconv.FormatFloat(params.FeePercent, 'f', 2, 64))
token = params.AccessToken
}

params.AppendTo(body)
Expand Down Expand Up @@ -122,13 +115,7 @@ func (c Client) Update(id string, params *SubParams) (*Subscription, error) {

token := c.Tok
if params.FeePercent > 0 {
if len(params.AccessToken) == 0 {
err := errors.New("Invalid sub params: an access token is required for application fees")
return nil, err
}

body.Add("application_fee_percent", strconv.FormatFloat(params.FeePercent, 'f', 2, 64))
token = params.AccessToken
}

params.AppendTo(body)
Expand Down
6 changes: 0 additions & 6 deletions token/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,7 @@ func (c Client) Create(params *TokenParams) (*Token, error) {
token := c.Tok

if len(params.Customer) > 0 {
if len(params.AccessToken) == 0 {
err := errors.New("Invalid Token params: an access token is required for customer")
return nil, err
}

body.Add("customer", params.Customer)
token = params.AccessToken
}

if params.Card != nil {
Expand Down

0 comments on commit dec5f79

Please sign in to comment.