Skip to content

Commit

Permalink
Hoist Metadata into Param structs
Browse files Browse the repository at this point in the history
  • Loading branch information
richardm-stripe committed Aug 4, 2023
1 parent 870f6eb commit 875b755
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions params.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ type Params struct {
// Headers may be used to provide extra header lines on the HTTP request.
Headers http.Header `form:"-"`

IdempotencyKey *string `form:"-"` // Passed as header
IdempotencyKey *string `form:"-"` // Passed as header

// Deprecated: Please use Metadata in the containing struct instead.
Metadata map[string]string `form:"metadata"`
Metadata map[string]string `form:"metadata"`

// StripeAccount may contain the ID of a connected account. By including
// this field, the request is made as if it originated from the connected
Expand Down
2 changes: 1 addition & 1 deletion stripe.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func extractParams(params ParamsContainer) (*form.Values, *Params, error) {
if reflectValue.Kind() == reflect.Ptr && !reflectValue.IsNil() {
commonParams = params.GetParams()

if reflectValue.Elem().FieldByName("Metadata").IsZero() {
if !reflectValue.Elem().FieldByName("Metadata").IsZero() {
if commonParams.Metadata != nil {
return nil, nil, fmt.Errorf("You cannot specify both the (deprecated) .Params.Metadata and .Metadata in %s", reflectValue.Elem().Type().Name())
}
Expand Down

0 comments on commit 875b755

Please sign in to comment.