-
Notifications
You must be signed in to change notification settings - Fork 448
/
issuing_cardholder.go
295 lines (263 loc) · 14.7 KB
/
issuing_cardholder.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
292
293
294
295
//
//
// File generated from our OpenAPI spec
//
//
package stripe
import "encoding/json"
// If `disabled_reason` is present, all cards will decline authorizations with `cardholder_verification_required` reason.
type IssuingCardholderRequirementsDisabledReason string
// List of values that IssuingCardholderRequirementsDisabledReason can take
const (
IssuingCardholderRequirementsDisabledReasonListed IssuingCardholderRequirementsDisabledReason = "listed"
IssuingCardholderRequirementsDisabledReasonRejectedListed IssuingCardholderRequirementsDisabledReason = "rejected.listed"
IssuingCardholderRequirementsDisabledReasonUnderReview IssuingCardholderRequirementsDisabledReason = "under_review"
)
// Interval (or event) to which the amount applies.
type IssuingCardholderSpendingControlsSpendingLimitInterval string
// List of values that IssuingCardholderSpendingControlsSpendingLimitInterval can take
const (
IssuingCardholderSpendingControlsSpendingLimitIntervalAllTime IssuingCardholderSpendingControlsSpendingLimitInterval = "all_time"
IssuingCardholderSpendingControlsSpendingLimitIntervalDaily IssuingCardholderSpendingControlsSpendingLimitInterval = "daily"
IssuingCardholderSpendingControlsSpendingLimitIntervalMonthly IssuingCardholderSpendingControlsSpendingLimitInterval = "monthly"
IssuingCardholderSpendingControlsSpendingLimitIntervalPerAuthorization IssuingCardholderSpendingControlsSpendingLimitInterval = "per_authorization"
IssuingCardholderSpendingControlsSpendingLimitIntervalWeekly IssuingCardholderSpendingControlsSpendingLimitInterval = "weekly"
IssuingCardholderSpendingControlsSpendingLimitIntervalYearly IssuingCardholderSpendingControlsSpendingLimitInterval = "yearly"
)
// Specifies whether to permit authorizations on this cardholder's cards.
type IssuingCardholderStatus string
// List of values that IssuingCardholderStatus can take
const (
IssuingCardholderStatusActive IssuingCardholderStatus = "active"
IssuingCardholderStatusBlocked IssuingCardholderStatus = "blocked"
IssuingCardholderStatusInactive IssuingCardholderStatus = "inactive"
)
// One of `individual` or `company`.
type IssuingCardholderType string
// List of values that IssuingCardholderType can take
const (
IssuingCardholderTypeCompany IssuingCardholderType = "company"
IssuingCardholderTypeIndividual IssuingCardholderType = "individual"
)
// Returns a list of Issuing Cardholder objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
type IssuingCardholderListParams struct {
ListParams `form:"*"`
// Only return cardholders that were created during the given date interval.
Created *int64 `form:"created"`
// Only return cardholders that were created during the given date interval.
CreatedRange *RangeQueryParams `form:"created"`
// Only return cardholders that have the given email address.
Email *string `form:"email"`
// Only return cardholders that have the given phone number.
PhoneNumber *string `form:"phone_number"`
// Only return cardholders that have the given status. One of `active`, `inactive`, or `blocked`.
Status *string `form:"status"`
// Only return cardholders that have the given type. One of `individual` or `company`.
Type *string `form:"type"`
}
// The cardholder's billing address.
type IssuingCardholderBillingParams struct {
// The cardholder's billing address.
Address *AddressParams `form:"address"`
}
// Additional information about a `company` cardholder.
type IssuingCardholderCompanyParams struct {
// The entity's business ID number.
TaxID *string `form:"tax_id"`
}
// The date of birth of this cardholder.
type IssuingCardholderIndividualDOBParams struct {
// The day of birth, between 1 and 31.
Day *int64 `form:"day"`
// The month of birth, between 1 and 12.
Month *int64 `form:"month"`
// The four-digit year of birth.
Year *int64 `form:"year"`
}
// An identifying document, either a passport or local ID card.
type IssuingCardholderIndividualVerificationDocumentParams struct {
// The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`.
Back *string `form:"back"`
// The front of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`.
Front *string `form:"front"`
}
// Government-issued ID document for this cardholder.
type IssuingCardholderIndividualVerificationParams struct {
// An identifying document, either a passport or local ID card.
Document *IssuingCardholderIndividualVerificationDocumentParams `form:"document"`
}
// Additional information about an `individual` cardholder.
type IssuingCardholderIndividualParams struct {
// The date of birth of this cardholder.
DOB *IssuingCardholderIndividualDOBParams `form:"dob"`
// The first name of this cardholder.
FirstName *string `form:"first_name"`
// The last name of this cardholder.
LastName *string `form:"last_name"`
// Government-issued ID document for this cardholder.
Verification *IssuingCardholderIndividualVerificationParams `form:"verification"`
}
// Limit spending with amount-based rules that apply across this cardholder's cards.
type IssuingCardholderSpendingControlsSpendingLimitParams struct {
// Maximum amount allowed to spend per interval.
Amount *int64 `form:"amount"`
// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) this limit applies to. Omitting this field will apply the limit to all categories.
Categories []*string `form:"categories"`
// Interval (or event) to which the amount applies.
Interval *string `form:"interval"`
}
// Rules that control spending across this cardholder's cards. Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details.
type IssuingCardholderSpendingControlsParams struct {
// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to allow. All other categories will be blocked. Cannot be set with `blocked_categories`.
AllowedCategories []*string `form:"allowed_categories"`
// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to decline. All other categories will be allowed. Cannot be set with `allowed_categories`.
BlockedCategories []*string `form:"blocked_categories"`
// Limit spending with amount-based rules that apply across this cardholder's cards.
SpendingLimits []*IssuingCardholderSpendingControlsSpendingLimitParams `form:"spending_limits"`
// Currency of amounts within `spending_limits`. Defaults to your merchant country's currency.
SpendingLimitsCurrency *string `form:"spending_limits_currency"`
}
// Creates a new Issuing Cardholder object that can be issued cards.
type IssuingCardholderParams struct {
Params `form:"*"`
// The cardholder's billing address.
Billing *IssuingCardholderBillingParams `form:"billing"`
// Additional information about a `company` cardholder.
Company *IssuingCardholderCompanyParams `form:"company"`
// The cardholder's email address.
Email *string `form:"email"`
// Additional information about an `individual` cardholder.
Individual *IssuingCardholderIndividualParams `form:"individual"`
// The cardholder's name. This will be printed on cards issued to them. The maximum length of this field is 24 characters.
Name *string `form:"name"`
// The cardholder's phone number. This is required for all cardholders who will be creating EU cards. See the [3D Secure documentation](https://stripe.com/docs/issuing/3d-secure) for more details.
PhoneNumber *string `form:"phone_number"`
// Rules that control spending across this cardholder's cards. Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details.
SpendingControls *IssuingCardholderSpendingControlsParams `form:"spending_controls"`
// Specifies whether to permit authorizations on this cardholder's cards.
Status *string `form:"status"`
// One of `individual` or `company`.
Type *string `form:"type"`
}
type IssuingCardholderBilling struct {
Address *Address `json:"address"`
}
// Additional information about a `company` cardholder.
type IssuingCardholderCompany struct {
// Whether the company's business ID number was provided.
TaxIDProvided bool `json:"tax_id_provided"`
}
// The date of birth of this cardholder.
type IssuingCardholderIndividualDOB struct {
// The day of birth, between 1 and 31.
Day int64 `json:"day"`
// The month of birth, between 1 and 12.
Month int64 `json:"month"`
// The four-digit year of birth.
Year int64 `json:"year"`
}
// An identifying document, either a passport or local ID card.
type IssuingCardholderIndividualVerificationDocument struct {
// The back of a document returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`.
Back *File `json:"back"`
// The front of a document returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`.
Front *File `json:"front"`
}
// Government-issued ID document for this cardholder.
type IssuingCardholderIndividualVerification struct {
// An identifying document, either a passport or local ID card.
Document *IssuingCardholderIndividualVerificationDocument `json:"document"`
}
// Additional information about an `individual` cardholder.
type IssuingCardholderIndividual struct {
// The date of birth of this cardholder.
DOB *IssuingCardholderIndividualDOB `json:"dob"`
// The first name of this cardholder.
FirstName string `json:"first_name"`
// The last name of this cardholder.
LastName string `json:"last_name"`
// Government-issued ID document for this cardholder.
Verification *IssuingCardholderIndividualVerification `json:"verification"`
}
type IssuingCardholderRequirements struct {
// If `disabled_reason` is present, all cards will decline authorizations with `cardholder_verification_required` reason.
DisabledReason IssuingCardholderRequirementsDisabledReason `json:"disabled_reason"`
// Array of fields that need to be collected in order to verify and re-enable the cardholder.
PastDue []string `json:"past_due"`
}
// Limit spending with amount-based rules that apply across this cardholder's cards.
type IssuingCardholderSpendingControlsSpendingLimit struct {
// Maximum amount allowed to spend per interval.
Amount int64 `json:"amount"`
// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) this limit applies to. Omitting this field will apply the limit to all categories.
Categories []string `json:"categories"`
// Interval (or event) to which the amount applies.
Interval IssuingCardholderSpendingControlsSpendingLimitInterval `json:"interval"`
}
// Rules that control spending across this cardholder's cards. Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details.
type IssuingCardholderSpendingControls struct {
// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to allow. All other categories will be blocked. Cannot be set with `blocked_categories`.
AllowedCategories []string `json:"allowed_categories"`
// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to decline. All other categories will be allowed. Cannot be set with `allowed_categories`.
BlockedCategories []string `json:"blocked_categories"`
// Limit spending with amount-based rules that apply across this cardholder's cards.
SpendingLimits []*IssuingCardholderSpendingControlsSpendingLimit `json:"spending_limits"`
// Currency of the amounts within `spending_limits`.
SpendingLimitsCurrency Currency `json:"spending_limits_currency"`
}
// An Issuing `Cardholder` object represents an individual or business entity who is [issued](https://stripe.com/docs/issuing) cards.
//
// Related guide: [How to create a Cardholder](https://stripe.com/docs/issuing/cards#create-cardholder)
type IssuingCardholder struct {
APIResource
Billing *IssuingCardholderBilling `json:"billing"`
// Additional information about a `company` cardholder.
Company *IssuingCardholderCompany `json:"company"`
// Time at which the object was created. Measured in seconds since the Unix epoch.
Created int64 `json:"created"`
// The cardholder's email address.
Email string `json:"email"`
// Unique identifier for the object.
ID string `json:"id"`
// Additional information about an `individual` cardholder.
Individual *IssuingCardholderIndividual `json:"individual"`
// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
Livemode bool `json:"livemode"`
// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
Metadata map[string]string `json:"metadata"`
// The cardholder's name. This will be printed on cards issued to them.
Name string `json:"name"`
// String representing the object's type. Objects of the same type share the same value.
Object string `json:"object"`
// The cardholder's phone number. This is required for all cardholders who will be creating EU cards. See the [3D Secure documentation](https://stripe.com/docs/issuing/3d-secure#when-is-3d-secure-applied) for more details.
PhoneNumber string `json:"phone_number"`
Requirements *IssuingCardholderRequirements `json:"requirements"`
// Rules that control spending across this cardholder's cards. Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details.
SpendingControls *IssuingCardholderSpendingControls `json:"spending_controls"`
// Specifies whether to permit authorizations on this cardholder's cards.
Status IssuingCardholderStatus `json:"status"`
// One of `individual` or `company`.
Type IssuingCardholderType `json:"type"`
}
// IssuingCardholderList is a list of Cardholders as retrieved from a list endpoint.
type IssuingCardholderList struct {
APIResource
ListMeta
Data []*IssuingCardholder `json:"data"`
}
// UnmarshalJSON handles deserialization of an IssuingCardholder.
// This custom unmarshaling is needed because the resulting
// property may be an id or the full struct if it was expanded.
func (i *IssuingCardholder) UnmarshalJSON(data []byte) error {
if id, ok := ParseID(data); ok {
i.ID = id
return nil
}
type issuingCardholder IssuingCardholder
var v issuingCardholder
if err := json.Unmarshal(data, &v); err != nil {
return err
}
*i = IssuingCardholder(v)
return nil
}