forked from stripe/stripe-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbillingportal_configuration.go
291 lines (251 loc) · 17.4 KB
/
billingportal_configuration.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
//
//
// File generated from our OpenAPI spec
//
//
package stripe
import "encoding/json"
// BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdate describes a
// type of customer updates that may be supported on a portal configuration
type BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdate string
// List of values that BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdate can take.
const (
BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdateAddress BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdate = "address"
BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdateEmail BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdate = "email"
BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdatePhone BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdate = "phone"
BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdateShipping BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdate = "shipping"
BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdateTaxID BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdate = "tax_id"
)
// Which cancellation reasons will be given as options to the customer.
type BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOption string
// List of values that BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOption can take
const (
BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptionCustomerService BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOption = "customer_service"
BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptionLowQuality BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOption = "low_quality"
BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptionMissingFeatures BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOption = "missing_features"
BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptionOther BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOption = "other"
BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptionSwitchedService BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOption = "switched_service"
BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptionTooComplex BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOption = "too_complex"
BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptionTooExpensive BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOption = "too_expensive"
BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOptionUnused BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOption = "unused"
)
// BillingPortalConfigurationFeaturesSubscriptionCancelMode describes whether
// to cancel subscriptions immediately or at the end of the billing period.
type BillingPortalConfigurationFeaturesSubscriptionCancelMode string
// List of values that BillingPortalConfigurationFeaturesSubscriptionCancelMode can take.
const (
BillingPortalConfigurationFeaturesSubscriptionCancelModeAtPeriodEnd BillingPortalConfigurationFeaturesSubscriptionCancelMode = "at_period_end"
BillingPortalConfigurationFeaturesSubscriptionCancelModeImmediately BillingPortalConfigurationFeaturesSubscriptionCancelMode = "immediately"
)
// BillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior describes
// whether to create prorations when canceling subscriptions.
type BillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior string
// List of values that BillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior can take.
const (
BillingPortalConfigurationFeaturesSubscriptionCancelProrationBehaviorAlwaysInvoice BillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior = "always_invoice"
BillingPortalConfigurationFeaturesSubscriptionCancelProrationBehaviorCreateProrations BillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior = "create_prorations"
BillingPortalConfigurationFeaturesSubscriptionCancelProrationBehaviorNone BillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior = "none"
)
// BillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdate describes
// a type of subscription update that may be supported on a portal configuration.
type BillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdate string
// List of values that BillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdate can take.
const (
BillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdatePrice BillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdate = "price"
BillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdatePromotionCode BillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdate = "promotion_code"
BillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdateQuantity BillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdate = "quantity"
)
// BillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior determines
// how to handle prorations resulting from subscription updates.
type BillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior string
// List of values that BillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior can take.
const (
BillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehaviorAlwaysInvoice BillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior = "always_invoice"
BillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehaviorCreateProrations BillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior = "create_prorations"
BillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehaviorNone BillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior = "none"
)
// BillingPortalConfigurationListParams is the set of parameters that can be
// used when listing portal configurations.
type BillingPortalConfigurationListParams struct {
ListParams `form:"*" json:"*"`
Active *bool `form:"active" json:"active"`
IsDefault *bool `form:"is_default" json:"is_default"`
}
// BillingPortalConfigurationBusinessProfileParams lets you pass the business
// profile details associated with a portal configuration.
type BillingPortalConfigurationBusinessProfileParams struct {
Headline *string `form:"headline" json:"headline"`
PrivacyPolicyURL *string `form:"privacy_policy_url" json:"privacy_policy_url"`
TermsOfServiceURL *string `form:"terms_of_service_url" json:"terms_of_service_url"`
}
// BillingPortalConfigurationFeaturesCustomerUpdateParams lets you pass the
// customer update details on a portal configuration.
type BillingPortalConfigurationFeaturesCustomerUpdateParams struct {
AllowedUpdates []*string `form:"allowed_updates" json:"allowed_updates"`
Enabled *bool `form:"enabled" json:"enabled"`
}
// BillingPortalConfigurationFeaturesInvoiceHistoryParams lets you pass the
// invoice history details on a portal configuration.
type BillingPortalConfigurationFeaturesInvoiceHistoryParams struct {
Enabled *bool `form:"enabled" json:"enabled"`
}
// BillingPortalConfigurationFeaturesPaymentMethodUpdateParams lets you pass
// the payment method update details on a portal configuration.
type BillingPortalConfigurationFeaturesPaymentMethodUpdateParams struct {
Enabled *bool `form:"enabled" json:"enabled"`
}
// Whether the cancellation reasons will be collected in the portal and which options are exposed to the customer
type BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonParams struct {
Enabled *bool `form:"enabled" json:"enabled"`
Options []*string `form:"options" json:"options"`
}
// BillingPortalConfigurationFeaturesSubscriptionCancelParams lets you pass the
// subscription cancel deetails on a portal configuration.
type BillingPortalConfigurationFeaturesSubscriptionCancelParams struct {
CancellationReason *BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonParams `form:"cancellation_reason" json:"cancellation_reason"`
Enabled *bool `form:"enabled" json:"enabled"`
Mode *string `form:"mode" json:"mode"`
ProrationBehavior *string `form:"proration_behavior" json:"proration_behavior"`
}
// BillingPortalConfigurationFeaturesSubscriptionPauseParams lets you pass details on the
// subscription pause on a portal configuration.
type BillingPortalConfigurationFeaturesSubscriptionPauseParams struct {
Enabled *bool `form:"enabled" json:"enabled"`
}
// BillingPortalConfigurationFeaturesSubscriptionUpdateProductParams lets you
// pass product details on the subscription update on a portal configuration.
type BillingPortalConfigurationFeaturesSubscriptionUpdateProductParams struct {
Prices []*string `form:"prices" json:"prices"`
Product *string `form:"product" json:"product"`
}
// BillingPortalConfigurationFeaturesSubscriptionUpdateParams lets you pass
// subscription update details on a portal configuration.
type BillingPortalConfigurationFeaturesSubscriptionUpdateParams struct {
DefaultAllowedUpdates []*string `form:"default_allowed_updates" json:"default_allowed_updates"`
Enabled *bool `form:"enabled" json:"enabled"`
Products []*BillingPortalConfigurationFeaturesSubscriptionUpdateProductParams `form:"products" json:"products"`
ProrationBehavior *string `form:"proration_behavior" json:"proration_behavior"`
}
// BillingPortalConfigurationFeaturesParams lets you pass details about the
// features available in the portal.
type BillingPortalConfigurationFeaturesParams struct {
CustomerUpdate *BillingPortalConfigurationFeaturesCustomerUpdateParams `form:"customer_update" json:"customer_update"`
InvoiceHistory *BillingPortalConfigurationFeaturesInvoiceHistoryParams `form:"invoice_history" json:"invoice_history"`
PaymentMethodUpdate *BillingPortalConfigurationFeaturesPaymentMethodUpdateParams `form:"payment_method_update" json:"payment_method_update"`
SubscriptionCancel *BillingPortalConfigurationFeaturesSubscriptionCancelParams `form:"subscription_cancel" json:"subscription_cancel"`
SubscriptionPause *BillingPortalConfigurationFeaturesSubscriptionPauseParams `form:"subscription_pause" json:"subscription_pause"`
SubscriptionUpdate *BillingPortalConfigurationFeaturesSubscriptionUpdateParams `form:"subscription_update" json:"subscription_update"`
}
// BillingPortalConfigurationParams is the set of parameters that can be passed
// when creating or updating a portal configuration.
type BillingPortalConfigurationParams struct {
Params `form:"*" json:"*"`
Active *bool `form:"active" json:"active"`
BusinessProfile *BillingPortalConfigurationBusinessProfileParams `form:"business_profile" json:"business_profile"`
DefaultReturnURL *string `form:"default_return_url" json:"default_return_url"`
Features *BillingPortalConfigurationFeaturesParams `form:"features" json:"features"`
}
// BillingPortalConfiguration is a configuration that describes the
// functionality and behavior of a PortalSession. For more details see
// https://stripe.com/docs/api/customer_portal.
type BillingPortalConfiguration struct {
APIResource
Active bool `json:"active"`
Application string `json:"application"`
BusinessProfile *BillingPortalConfigurationBusinessProfile `json:"business_profile"`
Created int64 `json:"created"`
DefaultReturnURL string `json:"default_return_url"`
Features *BillingPortalConfigurationFeatures `json:"features"`
ID string `json:"id"`
IsDefault bool `json:"is_default"`
Livemode bool `json:"livemode"`
Object string `json:"object"`
Updated int64 `json:"updated"`
}
// BillingPortalConfigurationBusinessProfile represents the business profile
// details on a portal configuration.
type BillingPortalConfigurationBusinessProfile struct {
Headline string `json:"headline"`
PrivacyPolicyURL string `json:"privacy_policy_url"`
TermsOfServiceURL string `json:"terms_of_service_url"`
}
// BillingPortalConfigurationFeaturesCustomerUpdate represents the customer
// update details on a portal configuration.
type BillingPortalConfigurationFeaturesCustomerUpdate struct {
AllowedUpdates []BillingPortalConfigurationFeaturesCustomerUpdateAllowedUpdate `json:"allowed_updates"`
Enabled bool `json:"enabled"`
}
// BillingPortalConfigurationFeaturesInvoiceHistory represents the invoice
// history details on a portal configuration.
type BillingPortalConfigurationFeaturesInvoiceHistory struct {
Enabled bool `json:"enabled"`
}
// BillingPortalConfigurationFeaturesPaymentMethodUpdate represents the payment
// method update details on a portal configuration.
type BillingPortalConfigurationFeaturesPaymentMethodUpdate struct {
Enabled bool `json:"enabled"`
}
type BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReason struct {
Enabled bool `json:"enabled"`
Options []BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReasonOption `json:"options"`
}
// BillingPortalConfigurationFeaturesSubscriptionCancel represents the
// subscription cancel details on a portal configuration.
type BillingPortalConfigurationFeaturesSubscriptionCancel struct {
CancellationReason *BillingPortalConfigurationFeaturesSubscriptionCancelCancellationReason `json:"cancellation_reason"`
Enabled bool `json:"enabled"`
Mode BillingPortalConfigurationFeaturesSubscriptionCancelMode `json:"mode"`
ProrationBehavior BillingPortalConfigurationFeaturesSubscriptionCancelProrationBehavior `json:"proration_behavior"`
}
// BillingPortalConfigurationFeaturesSubscriptionPause lets you pass pause details
// on the subscription update on a portal configuration.
type BillingPortalConfigurationFeaturesSubscriptionPause struct {
Enabled bool `json:"enabled"`
}
// BillingPortalConfigurationFeaturesSubscriptionUpdateProduct represents the
// subscription update details on a portal configuration.
type BillingPortalConfigurationFeaturesSubscriptionUpdateProduct struct {
Prices []string `json:"prices"`
Product string `json:"product"`
}
// BillingPortalConfigurationFeaturesSubscriptionUpdate represents the
// subscription update details on a portal configuration.
type BillingPortalConfigurationFeaturesSubscriptionUpdate struct {
DefaultAllowedUpdates []BillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdate `json:"default_allowed_updates"`
Enabled bool `json:"enabled"`
Products []*BillingPortalConfigurationFeaturesSubscriptionUpdateProduct `json:"products"`
ProrationBehavior BillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior `json:"proration_behavior"`
}
// BillingPortalConfigurationFeatures represents details about the features
// enabled in the portal configuration.
type BillingPortalConfigurationFeatures struct {
CustomerUpdate *BillingPortalConfigurationFeaturesCustomerUpdate `json:"customer_update"`
InvoiceHistory *BillingPortalConfigurationFeaturesInvoiceHistory `json:"invoice_history"`
PaymentMethodUpdate *BillingPortalConfigurationFeaturesPaymentMethodUpdate `json:"payment_method_update"`
SubscriptionCancel *BillingPortalConfigurationFeaturesSubscriptionCancel `json:"subscription_cancel"`
SubscriptionPause *BillingPortalConfigurationFeaturesSubscriptionPause `json:"subscription_pause"`
SubscriptionUpdate *BillingPortalConfigurationFeaturesSubscriptionUpdate `json:"subscription_update"`
}
// BillingPortalConfigurationList is a list of portal configurations as
// returned from a list endpoint.
type BillingPortalConfigurationList struct {
APIResource
ListMeta
Data []*BillingPortalConfiguration `json:"data"`
}
// UnmarshalJSON handles deserialization of a BillingPortalConfiguration.
// This custom unmarshaling is needed because the resulting
// property may be an id or the full struct if it was expanded.
func (b *BillingPortalConfiguration) UnmarshalJSON(data []byte) error {
if id, ok := ParseID(data); ok {
b.ID = id
return nil
}
type billingPortalConfiguration BillingPortalConfiguration
var v billingPortalConfiguration
if err := json.Unmarshal(data, &v); err != nil {
return err
}
*b = BillingPortalConfiguration(v)
return nil
}