Skip to content

Commit

Permalink
Properly move any remaining parameter slices to a slice of pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-stripe committed May 24, 2018
1 parent 4a92cbb commit e2e745f
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion account.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ type AccountParams struct {

// LegalEntityParams represents a legal_entity during account creation/updates.
type LegalEntityParams struct {
AdditionalOwners []AdditionalOwnerParams `form:"additional_owners,indexed"`
AdditionalOwners []*AdditionalOwnerParams `form:"additional_owners,indexed"`

// AdditionalOwnersEmpty can be set to clear a legal entity's additional
// owners.
Expand Down
2 changes: 1 addition & 1 deletion account/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestAccountNew(t *testing.T) {
LegalEntity: &stripe.LegalEntityParams{
Type: stripe.String(string(stripe.LegalEntityTypeIndividual)),
BusinessName: stripe.String("Stripe Go"),
AdditionalOwners: []stripe.AdditionalOwnerParams{
AdditionalOwners: []*stripe.AdditionalOwnerParams{
{
FirstName: stripe.String("Jane"),
Verification: &stripe.IdentityVerificationParams{
Expand Down
2 changes: 1 addition & 1 deletion event.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type EventListParams struct {
Created *int64 `form:"created"`
CreatedRange *RangeQueryParams `form:"created"`
Type *string `form:"type"`
Types []string `form:"types"`
Types []*string `form:"types"`
}

// GetObjectValue returns the value from the e.Data.Object bag based on the keys hierarchy.
Expand Down
2 changes: 1 addition & 1 deletion order.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ type OrderListParams struct {
Created *int64 `form:"created"`
CreatedRange *RangeQueryParams `form:"created"`
Customer *string `form:"customer"`
IDs []string `form:"ids"`
IDs []*string `form:"ids"`
Status *string `form:"status"`
}

Expand Down
6 changes: 3 additions & 3 deletions paymentsource.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ type CustomerSourceParams struct {
// For more details see https://stripe.com/docs/guides/ach-beta
type SourceVerifyParams struct {
Params `form:"*"`
Amounts [2]int64 `form:"amounts"` // Amounts is used when verifying bank accounts
Customer *string `form:"-"` // Goes in the URL
Values []string `form:"values"` // Values is used when verifying sources
Amounts [2]int64 `form:"amounts"` // Amounts is used when verifying bank accounts
Customer *string `form:"-"` // Goes in the URL
Values []*string `form:"values"` // Values is used when verifying sources
}

// SetSource adds valid sources to a CustomerSourceParams object,
Expand Down
5 changes: 4 additions & 1 deletion paymentsource/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ func TestSourceVerify(t *testing.T) {

func TestSourceObjectVerify(t *testing.T) {
source, err := Verify("src_123", &stripe.SourceVerifyParams{
Values: []string{"32", "45"},
Values: []*string{
stripe.String("32"),
stripe.String("45"),
},
})
assert.Nil(t, err)
assert.NotNil(t, source)
Expand Down
14 changes: 7 additions & 7 deletions product.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ type PackageDimensionsParams struct {
type ProductParams struct {
Params `form:"*"`
Active *bool `form:"active"`
Attributes []string `form:"attributes"`
Attributes []*string `form:"attributes"`
Caption *string `form:"caption"`
DeactivateOn []string `form:"deactivate_on"`
DeactivateOn []*string `form:"deactivate_on"`
Description *string `form:"description"`
ID *string `form:"id"`
Images []string `form:"images"`
Images []*string `form:"images"`
Name *string `form:"name"`
PackageDimensions *PackageDimensionsParams `form:"package_dimensions"`
Shippable *bool `form:"shippable"`
Expand Down Expand Up @@ -83,10 +83,10 @@ type ProductList struct {
// https://stripe.com/docs/api#list_products.
type ProductListParams struct {
ListParams `form:"*"`
Active *bool `form:"active"`
IDs []string `form:"ids"`
Shippable *bool `form:"shippable"`
URL *string `form:"url"`
Active *bool `form:"active"`
IDs []*string `form:"ids"`
Shippable *bool `form:"shippable"`
URL *string `form:"url"`
}

// UnmarshalJSON handles deserialization of a Product.
Expand Down
9 changes: 6 additions & 3 deletions product/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ func TestProductNew(t *testing.T) {
Name: stripe.String("Test Name"),
Description: stripe.String("This is a description"),
Caption: stripe.String("This is a caption"),
Attributes: []string{"attr1", "attr2"},
URL: stripe.String("http://example.com"),
Shippable: stripe.Bool(true),
Attributes: []*string{
stripe.String("Attr1"),
stripe.String("Attr2"),
},
URL: stripe.String("http://example.com"),
Shippable: stripe.Bool(true),
PackageDimensions: &stripe.PackageDimensionsParams{
Height: stripe.Float64(2.234),
Length: stripe.Float64(5.10),
Expand Down
2 changes: 1 addition & 1 deletion sku.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type SKUListParams struct {
ListParams `form:"*"`
Active *bool `form:"active"`
Attributes map[string]string `form:"attributes"`
IDs []string `form:"ids"`
IDs []*string `form:"ids"`
InStock *bool `form:"in_stock"`
Product *string `form:"product"`
}
Expand Down

0 comments on commit e2e745f

Please sign in to comment.