Skip to content

Commit

Permalink
cosmetic updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasaron committed Jul 14, 2024
1 parent cca7742 commit fc14075
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions stripe/resource_stripe_promotion_code.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func resourceStripePromotionCodeCreate(ctx context.Context, d *schema.ResourceDa
}
}

if restrictions, restrictions_set := d.GetOk("restrictions"); restrictions_set {
if restrictions, set := d.GetOk("restrictions"); set {
params.Restrictions = &stripe.PromotionCodeRestrictionsParams{}

restrictionsMap := ToMap(restrictions)
Expand All @@ -146,7 +146,7 @@ func resourceStripePromotionCodeCreate(ctx context.Context, d *schema.ResourceDa
params.Restrictions.FirstTimeTransaction = stripe.Bool(ToBool(v))
}

if v, min_amount_set := restrictionsMap["minimum_amount"]; min_amount_set {
if v, set := restrictionsMap["minimum_amount"]; set {
amount := ToInt64(v)
if amount > 0 {
params.Restrictions.MinimumAmount = stripe.Int64(amount)
Expand All @@ -156,7 +156,7 @@ func resourceStripePromotionCodeCreate(ctx context.Context, d *schema.ResourceDa
}
}
}

if meta, set := d.GetOk("metadata"); set {
for k, v := range ToMap(meta) {
params.AddMetadata(k, ToString(v))
Expand Down Expand Up @@ -226,7 +226,7 @@ func resourceStripePromotionCodeRead(_ context.Context, d *schema.ResourceData,
restrictions["minimum_amount"] = minAmount
restrictions["minimum_amount_currency"] = promotionCode.Restrictions.MinimumAmountCurrency
}

if len(restrictions) > 0 {
return d.Set("restrictions", []map[string]interface{}{restrictions})
}
Expand Down

0 comments on commit fc14075

Please sign in to comment.