INNER CODE UNIT · Go
client
franckverrot/terraform-provider-stripe · stripe/resource_stripe_coupon.go:98
client := m.(*client.API)
couponID := d.Get("code").(string)
params := &stripe.CouponParams{
ID: stripe.String(couponID),
}
couponDuration := d.Get("duration").(string)
validDurations := map[string]bool{
"repeating": true,
"once": true,
"forever": true,
}
if !(validDurations)[couponDuration] {
formattedKeys := "( " + strings.Join(getMapKeys(validDurations), " | ") + " )"
return fmt.Errorf("\"%s\" is not a valid value for \"duration\", expected one of %s", couponDuration, formattedKeys)
}
if name, ok := d.GetOk("name"); ok {