async-stripe 0.41.0

API bindings for the Stripe HTTP API
Documentation
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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
// ======================================
// This file was automatically generated.
// ======================================

use crate::ids::{TaxRegistrationId};
use crate::params::{Object, Timestamp};
use serde::{Deserialize, Serialize};

/// The resource representing a Stripe "TaxProductRegistrationsResourceTaxRegistration".
///
/// For more details see <https://stripe.com/docs/api/tax/registrations/object>
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct TaxRegistration {
    /// Unique identifier for the object.
    pub id: TaxRegistrationId,

    /// Time at which the registration becomes active.
    ///
    /// Measured in seconds since the Unix epoch.
    pub active_from: Timestamp,

    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
    pub country: String,

    pub country_options: TaxProductRegistrationsResourceCountryOptions,

    /// Time at which the object was created.
    ///
    /// Measured in seconds since the Unix epoch.
    pub created: Timestamp,

    /// If set, the registration stops being active at this time.
    ///
    /// If not set, the registration will be active indefinitely.
    /// Measured in seconds since the Unix epoch.
    pub expires_at: Option<Timestamp>,

    /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
    pub livemode: bool,

    /// The status of the registration.
    ///
    /// This field is present for convenience and can be deduced from `active_from` and `expires_at`.
    pub status: TaxRegistrationStatus,
}

impl Object for TaxRegistration {
    type Id = TaxRegistrationId;
    fn id(&self) -> Self::Id {
        self.id.clone()
    }
    fn object(&self) -> &'static str {
        "tax.registration"
    }
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct TaxProductRegistrationsResourceCountryOptions {

    #[serde(skip_serializing_if = "Option::is_none")]
    pub ae: Option<TaxProductRegistrationsResourceCountryOptionsDefault>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub at: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub au: Option<TaxProductRegistrationsResourceCountryOptionsDefault>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub be: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub bg: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub ca: Option<TaxProductRegistrationsResourceCountryOptionsCanada>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub ch: Option<TaxProductRegistrationsResourceCountryOptionsDefault>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub cl: Option<TaxProductRegistrationsResourceCountryOptionsSimplified>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub co: Option<TaxProductRegistrationsResourceCountryOptionsSimplified>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub cy: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub cz: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub de: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub dk: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub ee: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub es: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub fi: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub fr: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub gb: Option<TaxProductRegistrationsResourceCountryOptionsDefault>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub gr: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub hr: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub hu: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub id: Option<TaxProductRegistrationsResourceCountryOptionsSimplified>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub ie: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub is: Option<TaxProductRegistrationsResourceCountryOptionsDefault>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub it: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub jp: Option<TaxProductRegistrationsResourceCountryOptionsDefault>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub kr: Option<TaxProductRegistrationsResourceCountryOptionsSimplified>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub lt: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub lu: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub lv: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub mt: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub mx: Option<TaxProductRegistrationsResourceCountryOptionsSimplified>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub my: Option<TaxProductRegistrationsResourceCountryOptionsSimplified>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub nl: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub no: Option<TaxProductRegistrationsResourceCountryOptionsDefault>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub nz: Option<TaxProductRegistrationsResourceCountryOptionsDefault>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub pl: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub pt: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub ro: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub sa: Option<TaxProductRegistrationsResourceCountryOptionsSimplified>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub se: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub sg: Option<TaxProductRegistrationsResourceCountryOptionsDefault>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub si: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub sk: Option<TaxProductRegistrationsResourceCountryOptionsEurope>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub th: Option<TaxProductRegistrationsResourceCountryOptionsSimplified>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub tr: Option<TaxProductRegistrationsResourceCountryOptionsSimplified>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub us: Option<TaxProductRegistrationsResourceCountryOptionsUnitedStates>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub vn: Option<TaxProductRegistrationsResourceCountryOptionsSimplified>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub za: Option<TaxProductRegistrationsResourceCountryOptionsDefault>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct TaxProductRegistrationsResourceCountryOptionsCanada {

    #[serde(skip_serializing_if = "Option::is_none")]
    pub province_standard: Option<TaxProductRegistrationsResourceCountryOptionsCaProvinceStandard>,

    /// Type of registration in Canada.
    #[serde(rename = "type")]
    pub type_: TaxProductRegistrationsResourceCountryOptionsCanadaType,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct TaxProductRegistrationsResourceCountryOptionsCaProvinceStandard {

    /// Two-letter CA province code ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
    pub province: String,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct TaxProductRegistrationsResourceCountryOptionsDefault {

    /// Type of registration in `country`.
    #[serde(rename = "type")]
    pub type_: TaxProductRegistrationsResourceCountryOptionsDefaultType,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct TaxProductRegistrationsResourceCountryOptionsEurope {

    #[serde(skip_serializing_if = "Option::is_none")]
    pub standard: Option<TaxProductRegistrationsResourceCountryOptionsEuStandard>,

    /// Type of registration in an EU country.
    #[serde(rename = "type")]
    pub type_: TaxProductRegistrationsResourceCountryOptionsEuropeType,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct TaxProductRegistrationsResourceCountryOptionsEuStandard {

    /// Place of supply scheme used in an EU standard registration.
    pub place_of_supply_scheme: TaxProductRegistrationsResourceCountryOptionsEuStandardPlaceOfSupplyScheme,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct TaxProductRegistrationsResourceCountryOptionsSimplified {

    /// Type of registration in `country`.
    #[serde(rename = "type")]
    pub type_: TaxProductRegistrationsResourceCountryOptionsSimplifiedType,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct TaxProductRegistrationsResourceCountryOptionsUnitedStates {

    #[serde(skip_serializing_if = "Option::is_none")]
    pub local_amusement_tax: Option<TaxProductRegistrationsResourceCountryOptionsUsLocalAmusementTax>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub local_lease_tax: Option<TaxProductRegistrationsResourceCountryOptionsUsLocalLeaseTax>,

    /// Two-letter US state code ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
    pub state: String,

    /// Type of registration in the US.
    #[serde(rename = "type")]
    pub type_: TaxProductRegistrationsResourceCountryOptionsUnitedStatesType,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct TaxProductRegistrationsResourceCountryOptionsUsLocalAmusementTax {

    /// A [FIPS code](https://www.census.gov/library/reference/code-lists/ansi.html) representing the local jurisdiction.
    pub jurisdiction: String,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct TaxProductRegistrationsResourceCountryOptionsUsLocalLeaseTax {

    /// A [FIPS code](https://www.census.gov/library/reference/code-lists/ansi.html) representing the local jurisdiction.
    pub jurisdiction: String,
}

/// An enum representing the possible values of an `TaxProductRegistrationsResourceCountryOptionsCanada`'s `type` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum TaxProductRegistrationsResourceCountryOptionsCanadaType {
    ProvinceStandard,
    Simplified,
    Standard,
}

impl TaxProductRegistrationsResourceCountryOptionsCanadaType {
    pub fn as_str(self) -> &'static str {
        match self {
            TaxProductRegistrationsResourceCountryOptionsCanadaType::ProvinceStandard => "province_standard",
            TaxProductRegistrationsResourceCountryOptionsCanadaType::Simplified => "simplified",
            TaxProductRegistrationsResourceCountryOptionsCanadaType::Standard => "standard",
        }
    }
}

impl AsRef<str> for TaxProductRegistrationsResourceCountryOptionsCanadaType {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl std::fmt::Display for TaxProductRegistrationsResourceCountryOptionsCanadaType {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.as_str().fmt(f)
    }
}
impl std::default::Default for TaxProductRegistrationsResourceCountryOptionsCanadaType {
    fn default() -> Self {
        Self::ProvinceStandard
    }
}

/// An enum representing the possible values of an `TaxProductRegistrationsResourceCountryOptionsDefault`'s `type` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum TaxProductRegistrationsResourceCountryOptionsDefaultType {
    Standard,
}

impl TaxProductRegistrationsResourceCountryOptionsDefaultType {
    pub fn as_str(self) -> &'static str {
        match self {
            TaxProductRegistrationsResourceCountryOptionsDefaultType::Standard => "standard",
        }
    }
}

impl AsRef<str> for TaxProductRegistrationsResourceCountryOptionsDefaultType {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl std::fmt::Display for TaxProductRegistrationsResourceCountryOptionsDefaultType {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.as_str().fmt(f)
    }
}
impl std::default::Default for TaxProductRegistrationsResourceCountryOptionsDefaultType {
    fn default() -> Self {
        Self::Standard
    }
}

/// An enum representing the possible values of an `TaxProductRegistrationsResourceCountryOptionsEuStandard`'s `place_of_supply_scheme` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum TaxProductRegistrationsResourceCountryOptionsEuStandardPlaceOfSupplyScheme {
    SmallSeller,
    Standard,
}

impl TaxProductRegistrationsResourceCountryOptionsEuStandardPlaceOfSupplyScheme {
    pub fn as_str(self) -> &'static str {
        match self {
            TaxProductRegistrationsResourceCountryOptionsEuStandardPlaceOfSupplyScheme::SmallSeller => "small_seller",
            TaxProductRegistrationsResourceCountryOptionsEuStandardPlaceOfSupplyScheme::Standard => "standard",
        }
    }
}

impl AsRef<str> for TaxProductRegistrationsResourceCountryOptionsEuStandardPlaceOfSupplyScheme {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl std::fmt::Display for TaxProductRegistrationsResourceCountryOptionsEuStandardPlaceOfSupplyScheme {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.as_str().fmt(f)
    }
}
impl std::default::Default for TaxProductRegistrationsResourceCountryOptionsEuStandardPlaceOfSupplyScheme {
    fn default() -> Self {
        Self::SmallSeller
    }
}

/// An enum representing the possible values of an `TaxProductRegistrationsResourceCountryOptionsEurope`'s `type` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum TaxProductRegistrationsResourceCountryOptionsEuropeType {
    Ioss,
    OssNonUnion,
    OssUnion,
    Standard,
}

impl TaxProductRegistrationsResourceCountryOptionsEuropeType {
    pub fn as_str(self) -> &'static str {
        match self {
            TaxProductRegistrationsResourceCountryOptionsEuropeType::Ioss => "ioss",
            TaxProductRegistrationsResourceCountryOptionsEuropeType::OssNonUnion => "oss_non_union",
            TaxProductRegistrationsResourceCountryOptionsEuropeType::OssUnion => "oss_union",
            TaxProductRegistrationsResourceCountryOptionsEuropeType::Standard => "standard",
        }
    }
}

impl AsRef<str> for TaxProductRegistrationsResourceCountryOptionsEuropeType {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl std::fmt::Display for TaxProductRegistrationsResourceCountryOptionsEuropeType {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.as_str().fmt(f)
    }
}
impl std::default::Default for TaxProductRegistrationsResourceCountryOptionsEuropeType {
    fn default() -> Self {
        Self::Ioss
    }
}

/// An enum representing the possible values of an `TaxProductRegistrationsResourceCountryOptionsSimplified`'s `type` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum TaxProductRegistrationsResourceCountryOptionsSimplifiedType {
    Simplified,
}

impl TaxProductRegistrationsResourceCountryOptionsSimplifiedType {
    pub fn as_str(self) -> &'static str {
        match self {
            TaxProductRegistrationsResourceCountryOptionsSimplifiedType::Simplified => "simplified",
        }
    }
}

impl AsRef<str> for TaxProductRegistrationsResourceCountryOptionsSimplifiedType {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl std::fmt::Display for TaxProductRegistrationsResourceCountryOptionsSimplifiedType {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.as_str().fmt(f)
    }
}
impl std::default::Default for TaxProductRegistrationsResourceCountryOptionsSimplifiedType {
    fn default() -> Self {
        Self::Simplified
    }
}

/// An enum representing the possible values of an `TaxProductRegistrationsResourceCountryOptionsUnitedStates`'s `type` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum TaxProductRegistrationsResourceCountryOptionsUnitedStatesType {
    LocalAmusementTax,
    LocalLeaseTax,
    StateCommunicationsTax,
    StateSalesTax,
}

impl TaxProductRegistrationsResourceCountryOptionsUnitedStatesType {
    pub fn as_str(self) -> &'static str {
        match self {
            TaxProductRegistrationsResourceCountryOptionsUnitedStatesType::LocalAmusementTax => "local_amusement_tax",
            TaxProductRegistrationsResourceCountryOptionsUnitedStatesType::LocalLeaseTax => "local_lease_tax",
            TaxProductRegistrationsResourceCountryOptionsUnitedStatesType::StateCommunicationsTax => "state_communications_tax",
            TaxProductRegistrationsResourceCountryOptionsUnitedStatesType::StateSalesTax => "state_sales_tax",
        }
    }
}

impl AsRef<str> for TaxProductRegistrationsResourceCountryOptionsUnitedStatesType {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl std::fmt::Display for TaxProductRegistrationsResourceCountryOptionsUnitedStatesType {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.as_str().fmt(f)
    }
}
impl std::default::Default for TaxProductRegistrationsResourceCountryOptionsUnitedStatesType {
    fn default() -> Self {
        Self::LocalAmusementTax
    }
}

/// An enum representing the possible values of an `TaxRegistration`'s `status` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum TaxRegistrationStatus {
    Active,
    Expired,
    Scheduled,
}

impl TaxRegistrationStatus {
    pub fn as_str(self) -> &'static str {
        match self {
            TaxRegistrationStatus::Active => "active",
            TaxRegistrationStatus::Expired => "expired",
            TaxRegistrationStatus::Scheduled => "scheduled",
        }
    }
}

impl AsRef<str> for TaxRegistrationStatus {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl std::fmt::Display for TaxRegistrationStatus {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.as_str().fmt(f)
    }
}
impl std::default::Default for TaxRegistrationStatus {
    fn default() -> Self {
        Self::Active
    }
}