From 63d5c586d96ff9b956d9c1992bee94f2cf28ef05 Mon Sep 17 00:00:00 2001 From: Remi Jannel Date: Fri, 25 May 2018 17:01:11 -0400 Subject: [PATCH] Address review comments --- README.md | 2 +- order.go | 8 ++++---- plan.go | 8 ++++---- plan_test.go | 4 ++-- recipient.go | 4 ++-- recipienttransfer.go | 4 ++-- stripe.go | 24 ++++++++++++------------ 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 257151a20d..721e529644 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,7 @@ func handler(w http.ResponseWriter, r *http.Request) { chargeParams := &stripe.ChargeParams{ Amount: stripe.Int64(2000), Currency: stripe.String(string(stripe.CurrencyUSD)), - Desc: stripe.String("Charge from Google App Engine"), + Description: stripe.String("Charge from Google App Engine"), } chargeParams.SetSource("tok_amex") // obtained with Stripe.js charge, err := sc.Charges.New(chargeParams) diff --git a/order.go b/order.go index a8cc8a0083..59f74f87af 100644 --- a/order.go +++ b/order.go @@ -27,10 +27,10 @@ const ( type OrderItemType string const ( - OrderItemTeypeDiscount OrderItemType = "discount" - OrderItemTeypeShipping OrderItemType = "shipping" - OrderItemTeypeSKU OrderItemType = "sku" - OrderItemTeypeTax OrderItemType = "tax" + OrderItemTypeDiscount OrderItemType = "discount" + OrderItemTypeShipping OrderItemType = "shipping" + OrderItemTypeSKU OrderItemType = "sku" + OrderItemTypeTax OrderItemType = "tax" ) type OrderParams struct { diff --git a/plan.go b/plan.go index be02f5fe2d..0f98a37871 100644 --- a/plan.go +++ b/plan.go @@ -104,14 +104,14 @@ type PlanTier struct { // PlanTransformUsage represents the bucket billing configuration. type PlanTransformUsage struct { - DivideBy int64 `json:"bucket_size"` - Round PlanTransformUsageRound `json:"round"` + BucketSize int64 `json:"bucket_size"` + Round PlanTransformUsageRound `json:"round"` } // PlanTransformUsageParams represents the bucket billing configuration. type PlanTransformUsageParams struct { - DivideBy *int64 `form:"bucket_size"` - Round *string `form:"round"` + BucketSize *int64 `form:"bucket_size"` + Round *string `form:"round"` } // PlanTierParams configures tiered pricing diff --git a/plan_test.go b/plan_test.go index 187d01256d..12b887425d 100644 --- a/plan_test.go +++ b/plan_test.go @@ -67,8 +67,8 @@ func TestPlanParams_AppendTo(t *testing.T) { {"tiers[0][up_to]", &PlanParams{Tiers: tiers}, strconv.FormatUint(321, 10)}, {"tiers[1][amount]", &PlanParams{Tiers: tiers}, strconv.FormatUint(123, 10)}, {"tiers[1][up_to]", &PlanParams{Tiers: tiers}, "inf"}, - {"transform_usage[bucket_size]", &PlanParams{TransformUsage: &PlanTransformUsageParams{DivideBy: Int64(123), Round: String("round_up")}}, strconv.FormatUint(123, 10)}, - {"transform_usage[round]", &PlanParams{TransformUsage: &PlanTransformUsageParams{DivideBy: Int64(123), Round: String("round_up")}}, "round_up"}, + {"transform_usage[bucket_size]", &PlanParams{TransformUsage: &PlanTransformUsageParams{BucketSize: Int64(123), Round: String("round_up")}}, strconv.FormatUint(123, 10)}, + {"transform_usage[round]", &PlanParams{TransformUsage: &PlanTransformUsageParams{BucketSize: Int64(123), Round: String("round_up")}}, "round_up"}, {"trial_period_days", &PlanParams{TrialPeriodDays: Int64(123)}, strconv.FormatUint(123, 10)}, {"usage_type", &PlanParams{UsageType: String("metered")}, "metered"}, } diff --git a/recipient.go b/recipient.go index 5aecaa8f3d..8857bb30ff 100644 --- a/recipient.go +++ b/recipient.go @@ -10,8 +10,8 @@ import ( type RecipientType string const ( - RecipientTypeIndividual RecipientType = "individual" - RecipientTypeCorp RecipientType = "corporation" + RecipientTypeIndividual RecipientType = "individual" + RecipientTypeCorporation RecipientType = "corporation" ) // RecipientParams is the set of parameters that can be used when creating or updating recipients. diff --git a/recipienttransfer.go b/recipienttransfer.go index d76a11f84c..fffa1fb272 100644 --- a/recipienttransfer.go +++ b/recipienttransfer.go @@ -50,8 +50,8 @@ const ( type RecipientTransferType string const ( - RecipientTransferTypeBank RecipientTransferType = "bank_account" - RecipientTransferTypeCard RecipientTransferType = "card" + RecipientTransferTypeBankAccount RecipientTransferType = "bank_account" + RecipientTransferTypeCard RecipientTransferType = "card" ) // RecipientTransferMethodType represents the type of recipient_transfer diff --git a/stripe.go b/stripe.go index b47fc549b2..d81255bdbd 100644 --- a/stripe.go +++ b/stripe.go @@ -495,18 +495,18 @@ func BoolValue(v *bool) bool { return false } -// String returns a pointer to the string value passed in. -func String(v string) *string { +// Float64 returns a pointer to the float64 value passed in. +func Float64(v float64) *float64 { return &v } -// StringValue returns the value of the string pointer passed in or -// "" if the pointer is nil. -func StringValue(v *string) string { +// Float64Value returns the value of the float64 pointer passed in or +// 0 if the pointer is nil. +func Float64Value(v *float64) float64 { if v != nil { return *v } - return "" + return 0 } // Int64 returns a pointer to the int64 value passed in. @@ -523,16 +523,16 @@ func Int64Value(v *int64) int64 { return 0 } -// Float64 returns a pointer to the float64 value passed in. -func Float64(v float64) *float64 { +// String returns a pointer to the string value passed in. +func String(v string) *string { return &v } -// Float64Value returns the value of the float64 pointer passed in or -// 0 if the pointer is nil. -func Float64Value(v *float64) float64 { +// StringValue returns the value of the string pointer passed in or +// "" if the pointer is nil. +func StringValue(v *string) string { if v != nil { return *v } - return 0 + return "" }