From e2e745fe199be9a7ee20db129393ab392d0a475b Mon Sep 17 00:00:00 2001 From: Remi Jannel Date: Thu, 24 May 2018 13:08:55 -0400 Subject: [PATCH] Properly move any remaining parameter slices to a slice of pointers --- account.go | 2 +- account/client_test.go | 2 +- event.go | 2 +- order.go | 2 +- paymentsource.go | 6 +++--- paymentsource/client_test.go | 5 ++++- product.go | 14 +++++++------- product/client_test.go | 9 ++++++--- sku.go | 2 +- 9 files changed, 25 insertions(+), 19 deletions(-) diff --git a/account.go b/account.go index 87bdc2eef8..7b2ff4c21a 100644 --- a/account.go +++ b/account.go @@ -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. diff --git a/account/client_test.go b/account/client_test.go index e7a4154889..d3be25a524 100644 --- a/account/client_test.go +++ b/account/client_test.go @@ -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{ diff --git a/event.go b/event.go index d4da569ddb..2608937ee8 100644 --- a/event.go +++ b/event.go @@ -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. diff --git a/order.go b/order.go index dfe0236e2e..a8cc8a0083 100644 --- a/order.go +++ b/order.go @@ -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"` } diff --git a/paymentsource.go b/paymentsource.go index d9247e20b0..010c8251ef 100644 --- a/paymentsource.go +++ b/paymentsource.go @@ -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, diff --git a/paymentsource/client_test.go b/paymentsource/client_test.go index 766d03fe4c..aab9e13a7f 100644 --- a/paymentsource/client_test.go +++ b/paymentsource/client_test.go @@ -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) diff --git a/product.go b/product.go index d5b65f348c..82299736c5 100644 --- a/product.go +++ b/product.go @@ -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"` @@ -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. diff --git a/product/client_test.go b/product/client_test.go index cb1fd30525..74cc641a72 100644 --- a/product/client_test.go +++ b/product/client_test.go @@ -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), diff --git a/sku.go b/sku.go index cfc8abec5c..018bfe7c0d 100644 --- a/sku.go +++ b/sku.go @@ -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"` }