stripe/resources/generated/
source.rs

1// ======================================
2// This file was automatically generated.
3// ======================================
4
5use crate::client::{Client, Response};
6use crate::ids::{CustomerId, SourceId, TokenId};
7use crate::params::{Expand, List, Metadata, Object, Paginable, Timestamp};
8use crate::resources::{
9    Address, BillingDetails, Currency, Shipping, SourceRedirectFlowFailureReason,
10    SourceRedirectFlowStatus, SourceStatus, SourceUsage,
11};
12use serde::{Deserialize, Serialize};
13
14/// The resource representing a Stripe "Source".
15///
16/// For more details see <https://stripe.com/docs/api/sources/object>
17#[derive(Clone, Debug, Default, Deserialize, Serialize)]
18pub struct Source {
19    /// Unique identifier for the object.
20    pub id: SourceId,
21
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub ach_credit_transfer: Option<SourceTypeAchCreditTransfer>,
24
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub ach_debit: Option<SourceTypeAchDebit>,
27
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub acss_debit: Option<SourceTypeAcssDebit>,
30
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub alipay: Option<SourceTypeAlipay>,
33
34    /// A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount associated with the source.
35    ///
36    /// This is the amount for which the source will be chargeable once ready.
37    /// Required for `single_use` sources.
38    pub amount: Option<i64>,
39
40    #[serde(skip_serializing_if = "Option::is_none")]
41    pub au_becs_debit: Option<SourceTypeAuBecsDebit>,
42
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub bancontact: Option<SourceTypeBancontact>,
45
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub card: Option<SourceTypeCard>,
48
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub card_present: Option<SourceTypeCardPresent>,
51
52    /// The client secret of the source.
53    ///
54    /// Used for client-side retrieval using a publishable key.
55    pub client_secret: String,
56
57    #[serde(skip_serializing_if = "Option::is_none")]
58    pub code_verification: Option<SourceCodeVerificationFlow>,
59
60    /// Time at which the object was created.
61    ///
62    /// Measured in seconds since the Unix epoch.
63    pub created: Timestamp,
64
65    /// Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) associated with the source.
66    ///
67    /// This is the currency for which the source will be chargeable once ready.
68    /// Required for `single_use` sources.
69    pub currency: Option<Currency>,
70
71    /// The ID of the customer to which this source is attached.
72    ///
73    /// This will not be present when the source has not been attached to a customer.
74    #[serde(skip_serializing_if = "Option::is_none")]
75    pub customer: Option<String>,
76
77    #[serde(skip_serializing_if = "Option::is_none")]
78    pub eps: Option<SourceTypeEps>,
79
80    /// The authentication `flow` of the source.
81    ///
82    /// `flow` is one of `redirect`, `receiver`, `code_verification`, `none`.
83    pub flow: SourceFlow,
84
85    #[serde(skip_serializing_if = "Option::is_none")]
86    pub giropay: Option<SourceTypeGiropay>,
87
88    #[serde(skip_serializing_if = "Option::is_none")]
89    pub ideal: Option<SourceTypeIdeal>,
90
91    #[serde(skip_serializing_if = "Option::is_none")]
92    pub klarna: Option<SourceTypeKlarna>,
93
94    /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
95    pub livemode: bool,
96
97    /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
98    ///
99    /// This can be useful for storing additional information about the object in a structured format.
100    pub metadata: Option<Metadata>,
101
102    #[serde(skip_serializing_if = "Option::is_none")]
103    pub multibanco: Option<SourceTypeMultibanco>,
104
105    /// Information about the owner of the payment instrument that may be used or required by particular source types.
106    pub owner: Option<SourceOwner>,
107
108    #[serde(skip_serializing_if = "Option::is_none")]
109    pub p24: Option<SourceTypeP24>,
110
111    #[serde(skip_serializing_if = "Option::is_none")]
112    pub receiver: Option<SourceReceiverFlow>,
113
114    #[serde(skip_serializing_if = "Option::is_none")]
115    pub redirect: Option<SourceRedirectFlow>,
116
117    #[serde(skip_serializing_if = "Option::is_none")]
118    pub sepa_credit_transfer: Option<SourceTypeSepaCreditTransfer>,
119
120    #[serde(skip_serializing_if = "Option::is_none")]
121    pub sepa_debit: Option<SourceTypeSepaDebit>,
122
123    #[serde(skip_serializing_if = "Option::is_none")]
124    pub sofort: Option<SourceTypeSofort>,
125
126    #[serde(skip_serializing_if = "Option::is_none")]
127    pub source_order: Option<SourceOrder>,
128
129    /// Extra information about a source.
130    ///
131    /// This will appear on your customer's statement every time you charge the source.
132    pub statement_descriptor: Option<String>,
133
134    /// The status of the source, one of `canceled`, `chargeable`, `consumed`, `failed`, or `pending`.
135    ///
136    /// Only `chargeable` sources can be used to create a charge.
137    pub status: SourceStatus,
138
139    #[serde(skip_serializing_if = "Option::is_none")]
140    pub three_d_secure: Option<SourceTypeThreeDSecure>,
141
142    /// The `type` of the source.
143    ///
144    /// The `type` is a payment method, one of `ach_credit_transfer`, `ach_debit`, `alipay`, `bancontact`, `card`, `card_present`, `eps`, `giropay`, `ideal`, `multibanco`, `klarna`, `p24`, `sepa_debit`, `sofort`, `three_d_secure`, or `wechat`.
145    /// An additional hash is included on the source with a name matching this value.
146    /// It contains additional information specific to the [payment method](https://stripe.com/docs/sources) used.
147    #[serde(rename = "type")]
148    pub type_: SourceType,
149
150    /// Either `reusable` or `single_use`.
151    ///
152    /// Whether this source should be reusable or not.
153    /// Some source types may or may not be reusable by construction, while others may leave the option at creation.
154    /// If an incompatible value is passed, an error will be returned.
155    pub usage: Option<SourceUsage>,
156
157    #[serde(skip_serializing_if = "Option::is_none")]
158    pub wechat: Option<SourceTypeWechat>,
159}
160
161impl Source {
162    /// List source transactions for a given source.
163    pub fn list(client: &Client, params: &ListSources<'_>) -> Response<List<Source>> {
164        client.get_query("/sources/{source}/source_transactions", params)
165    }
166
167    /// Creates a new source object.
168    pub fn create(client: &Client, params: CreateSource<'_>) -> Response<Source> {
169        #[allow(clippy::needless_borrows_for_generic_args)]
170        client.post_form("/sources", &params)
171    }
172
173    /// Retrieves an existing source object.
174    ///
175    /// Supply the unique source ID from a source creation request and Stripe will return the corresponding up-to-date source object information.
176    pub fn retrieve(client: &Client, id: &SourceId, expand: &[&str]) -> Response<Source> {
177        client.get_query(&format!("/sources/{}", id), Expand { expand })
178    }
179
180    /// Updates the specified source by setting the values of the parameters passed.
181    ///
182    /// Any parameters not provided will be left unchanged.  This request accepts the `metadata` and `owner` as arguments.
183    /// It is also possible to update type specific information for selected payment methods.
184    /// Please refer to our [payment method guides](https://stripe.com/docs/sources) for more detail.
185    pub fn update(client: &Client, id: &SourceId, params: UpdateSource<'_>) -> Response<Source> {
186        #[allow(clippy::needless_borrows_for_generic_args)]
187        client.post_form(&format!("/sources/{}", id), &params)
188    }
189}
190
191impl Object for Source {
192    type Id = SourceId;
193    fn id(&self) -> Self::Id {
194        self.id.clone()
195    }
196    fn object(&self) -> &'static str {
197        "source"
198    }
199}
200
201#[derive(Clone, Debug, Default, Deserialize, Serialize)]
202pub struct SourceCodeVerificationFlow {
203    /// The number of attempts remaining to authenticate the source object with a verification code.
204    pub attempts_remaining: i64,
205
206    /// The status of the code verification, either `pending` (awaiting verification, `attempts_remaining` should be greater than 0), `succeeded` (successful verification) or `failed` (failed verification, cannot be verified anymore as `attempts_remaining` should be 0).
207    pub status: String,
208}
209
210#[derive(Clone, Debug, Default, Deserialize, Serialize)]
211pub struct SourceOrder {
212    /// A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the order.
213    pub amount: i64,
214
215    /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
216    ///
217    /// Must be a [supported currency](https://stripe.com/docs/currencies).
218    pub currency: Currency,
219
220    /// The email address of the customer placing the order.
221    #[serde(skip_serializing_if = "Option::is_none")]
222    pub email: Option<String>,
223
224    /// List of items constituting the order.
225    pub items: Option<Vec<SourceOrderItem>>,
226
227    #[serde(skip_serializing_if = "Option::is_none")]
228    pub shipping: Option<Shipping>,
229}
230
231#[derive(Clone, Debug, Default, Deserialize, Serialize)]
232pub struct SourceOrderItem {
233    /// The amount (price) for this order item.
234    pub amount: Option<i64>,
235
236    /// This currency of this order item.
237    ///
238    /// Required when `amount` is present.
239    pub currency: Option<Currency>,
240
241    /// Human-readable description for this order item.
242    pub description: Option<String>,
243
244    /// The ID of the associated object for this line item.
245    ///
246    /// Expandable if not null (e.g., expandable to a SKU).
247    pub parent: Option<String>,
248
249    /// The quantity of this order item.
250    ///
251    /// When type is `sku`, this is the number of instances of the SKU to be ordered.
252    #[serde(skip_serializing_if = "Option::is_none")]
253    pub quantity: Option<u64>,
254
255    /// The type of this order item.
256    ///
257    /// Must be `sku`, `tax`, or `shipping`.
258    #[serde(rename = "type")]
259    pub type_: Option<String>,
260}
261
262#[derive(Clone, Debug, Default, Deserialize, Serialize)]
263pub struct SourceOwner {
264    /// Owner's address.
265    pub address: Option<Address>,
266
267    /// Owner's email address.
268    pub email: Option<String>,
269
270    /// Owner's full name.
271    pub name: Option<String>,
272
273    /// Owner's phone number (including extension).
274    pub phone: Option<String>,
275
276    /// Verified owner's address.
277    ///
278    /// Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement.
279    /// They cannot be set or mutated.
280    pub verified_address: Option<Address>,
281
282    /// Verified owner's email address.
283    ///
284    /// Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement.
285    /// They cannot be set or mutated.
286    pub verified_email: Option<String>,
287
288    /// Verified owner's full name.
289    ///
290    /// Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement.
291    /// They cannot be set or mutated.
292    pub verified_name: Option<String>,
293
294    /// Verified owner's phone number (including extension).
295    ///
296    /// Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement.
297    /// They cannot be set or mutated.
298    pub verified_phone: Option<String>,
299}
300
301#[derive(Clone, Debug, Default, Deserialize, Serialize)]
302pub struct SourceReceiverFlow {
303    /// The address of the receiver source.
304    ///
305    /// This is the value that should be communicated to the customer to send their funds to.
306    pub address: Option<String>,
307
308    /// The total amount that was moved to your balance.
309    ///
310    /// This is almost always equal to the amount charged.
311    /// In rare cases when customers deposit excess funds and we are unable to refund those, those funds get moved to your balance and show up in amount_charged as well.
312    /// The amount charged is expressed in the source's currency.
313    pub amount_charged: i64,
314
315    /// The total amount received by the receiver source.
316    ///
317    /// `amount_received = amount_returned + amount_charged` should be true for consumed sources unless customers deposit excess funds.
318    /// The amount received is expressed in the source's currency.
319    pub amount_received: i64,
320
321    /// The total amount that was returned to the customer.
322    ///
323    /// The amount returned is expressed in the source's currency.
324    pub amount_returned: i64,
325
326    /// Type of refund attribute method, one of `email`, `manual`, or `none`.
327    pub refund_attributes_method: String,
328
329    /// Type of refund attribute status, one of `missing`, `requested`, or `available`.
330    pub refund_attributes_status: String,
331}
332
333#[derive(Clone, Debug, Default, Deserialize, Serialize)]
334pub struct SourceRedirectFlow {
335    /// The failure reason for the redirect, either `user_abort` (the customer aborted or dropped out of the redirect flow), `declined` (the authentication failed or the transaction was declined), or `processing_error` (the redirect failed due to a technical error).
336    ///
337    /// Present only if the redirect status is `failed`.
338    pub failure_reason: Option<SourceRedirectFlowFailureReason>,
339
340    /// The URL you provide to redirect the customer to after they authenticated their payment.
341    pub return_url: String,
342
343    /// The status of the redirect, either `pending` (ready to be used by your customer to authenticate the transaction), `succeeded` (succesful authentication, cannot be reused) or `not_required` (redirect should not be used) or `failed` (failed authentication, cannot be reused).
344    pub status: SourceRedirectFlowStatus,
345
346    /// The URL provided to you to redirect a customer to as part of a `redirect` authentication flow.
347    pub url: String,
348}
349
350#[derive(Clone, Debug, Default, Deserialize, Serialize)]
351pub struct SourceTypeAchCreditTransfer {
352    #[serde(skip_serializing_if = "Option::is_none")]
353    pub account_number: Option<String>,
354
355    #[serde(skip_serializing_if = "Option::is_none")]
356    pub bank_name: Option<String>,
357
358    #[serde(skip_serializing_if = "Option::is_none")]
359    pub fingerprint: Option<String>,
360
361    #[serde(skip_serializing_if = "Option::is_none")]
362    pub refund_account_holder_name: Option<String>,
363
364    #[serde(skip_serializing_if = "Option::is_none")]
365    pub refund_account_holder_type: Option<String>,
366
367    #[serde(skip_serializing_if = "Option::is_none")]
368    pub refund_routing_number: Option<String>,
369
370    #[serde(skip_serializing_if = "Option::is_none")]
371    pub routing_number: Option<String>,
372
373    #[serde(skip_serializing_if = "Option::is_none")]
374    pub swift_code: Option<String>,
375}
376
377#[derive(Clone, Debug, Default, Deserialize, Serialize)]
378pub struct SourceTypeAchDebit {
379    #[serde(skip_serializing_if = "Option::is_none")]
380    pub bank_name: Option<String>,
381
382    #[serde(skip_serializing_if = "Option::is_none")]
383    pub country: Option<String>,
384
385    #[serde(skip_serializing_if = "Option::is_none")]
386    pub fingerprint: Option<String>,
387
388    #[serde(skip_serializing_if = "Option::is_none")]
389    pub last4: Option<String>,
390
391    #[serde(skip_serializing_if = "Option::is_none")]
392    pub routing_number: Option<String>,
393
394    #[serde(rename = "type")]
395    #[serde(skip_serializing_if = "Option::is_none")]
396    pub type_: Option<String>,
397}
398
399#[derive(Clone, Debug, Default, Deserialize, Serialize)]
400pub struct SourceTypeAcssDebit {
401    #[serde(skip_serializing_if = "Option::is_none")]
402    pub bank_address_city: Option<String>,
403
404    #[serde(skip_serializing_if = "Option::is_none")]
405    pub bank_address_line_1: Option<String>,
406
407    #[serde(skip_serializing_if = "Option::is_none")]
408    pub bank_address_line_2: Option<String>,
409
410    #[serde(skip_serializing_if = "Option::is_none")]
411    pub bank_address_postal_code: Option<String>,
412
413    #[serde(skip_serializing_if = "Option::is_none")]
414    pub bank_name: Option<String>,
415
416    #[serde(skip_serializing_if = "Option::is_none")]
417    pub category: Option<String>,
418
419    #[serde(skip_serializing_if = "Option::is_none")]
420    pub country: Option<String>,
421
422    #[serde(skip_serializing_if = "Option::is_none")]
423    pub fingerprint: Option<String>,
424
425    #[serde(skip_serializing_if = "Option::is_none")]
426    pub last4: Option<String>,
427
428    #[serde(skip_serializing_if = "Option::is_none")]
429    pub routing_number: Option<String>,
430}
431
432#[derive(Clone, Debug, Default, Deserialize, Serialize)]
433pub struct SourceTypeAlipay {
434    #[serde(skip_serializing_if = "Option::is_none")]
435    pub data_string: Option<String>,
436
437    #[serde(skip_serializing_if = "Option::is_none")]
438    pub native_url: Option<String>,
439
440    #[serde(skip_serializing_if = "Option::is_none")]
441    pub statement_descriptor: Option<String>,
442}
443
444#[derive(Clone, Debug, Default, Deserialize, Serialize)]
445pub struct SourceTypeAuBecsDebit {
446    #[serde(skip_serializing_if = "Option::is_none")]
447    pub bsb_number: Option<String>,
448
449    #[serde(skip_serializing_if = "Option::is_none")]
450    pub fingerprint: Option<String>,
451
452    #[serde(skip_serializing_if = "Option::is_none")]
453    pub last4: Option<String>,
454}
455
456#[derive(Clone, Debug, Default, Deserialize, Serialize)]
457pub struct SourceTypeBancontact {
458    #[serde(skip_serializing_if = "Option::is_none")]
459    pub bank_code: Option<String>,
460
461    #[serde(skip_serializing_if = "Option::is_none")]
462    pub bank_name: Option<String>,
463
464    #[serde(skip_serializing_if = "Option::is_none")]
465    pub bic: Option<String>,
466
467    #[serde(skip_serializing_if = "Option::is_none")]
468    pub iban_last4: Option<String>,
469
470    #[serde(skip_serializing_if = "Option::is_none")]
471    pub preferred_language: Option<String>,
472
473    #[serde(skip_serializing_if = "Option::is_none")]
474    pub statement_descriptor: Option<String>,
475}
476
477#[derive(Clone, Debug, Default, Deserialize, Serialize)]
478pub struct SourceTypeCard {
479    #[serde(skip_serializing_if = "Option::is_none")]
480    pub address_line1_check: Option<String>,
481
482    #[serde(skip_serializing_if = "Option::is_none")]
483    pub address_zip_check: Option<String>,
484
485    #[serde(skip_serializing_if = "Option::is_none")]
486    pub brand: Option<String>,
487
488    #[serde(skip_serializing_if = "Option::is_none")]
489    pub country: Option<String>,
490
491    #[serde(skip_serializing_if = "Option::is_none")]
492    pub cvc_check: Option<String>,
493
494    #[serde(skip_serializing_if = "Option::is_none")]
495    pub description: Option<String>,
496
497    #[serde(skip_serializing_if = "Option::is_none")]
498    pub dynamic_last4: Option<String>,
499
500    #[serde(skip_serializing_if = "Option::is_none")]
501    pub exp_month: Option<i64>,
502
503    #[serde(skip_serializing_if = "Option::is_none")]
504    pub exp_year: Option<i64>,
505
506    #[serde(skip_serializing_if = "Option::is_none")]
507    pub fingerprint: Option<String>,
508
509    #[serde(skip_serializing_if = "Option::is_none")]
510    pub funding: Option<String>,
511
512    #[serde(skip_serializing_if = "Option::is_none")]
513    pub iin: Option<String>,
514
515    #[serde(skip_serializing_if = "Option::is_none")]
516    pub issuer: Option<String>,
517
518    #[serde(skip_serializing_if = "Option::is_none")]
519    pub last4: Option<String>,
520
521    #[serde(skip_serializing_if = "Option::is_none")]
522    pub name: Option<String>,
523
524    #[serde(skip_serializing_if = "Option::is_none")]
525    pub three_d_secure: Option<String>,
526
527    #[serde(skip_serializing_if = "Option::is_none")]
528    pub tokenization_method: Option<String>,
529}
530
531#[derive(Clone, Debug, Default, Deserialize, Serialize)]
532pub struct SourceTypeCardPresent {
533    #[serde(skip_serializing_if = "Option::is_none")]
534    pub application_cryptogram: Option<String>,
535
536    #[serde(skip_serializing_if = "Option::is_none")]
537    pub application_preferred_name: Option<String>,
538
539    #[serde(skip_serializing_if = "Option::is_none")]
540    pub authorization_code: Option<String>,
541
542    #[serde(skip_serializing_if = "Option::is_none")]
543    pub authorization_response_code: Option<String>,
544
545    #[serde(skip_serializing_if = "Option::is_none")]
546    pub brand: Option<String>,
547
548    #[serde(skip_serializing_if = "Option::is_none")]
549    pub country: Option<String>,
550
551    #[serde(skip_serializing_if = "Option::is_none")]
552    pub cvm_type: Option<String>,
553
554    #[serde(skip_serializing_if = "Option::is_none")]
555    pub data_type: Option<String>,
556
557    #[serde(skip_serializing_if = "Option::is_none")]
558    pub dedicated_file_name: Option<String>,
559
560    #[serde(skip_serializing_if = "Option::is_none")]
561    pub description: Option<String>,
562
563    #[serde(skip_serializing_if = "Option::is_none")]
564    pub emv_auth_data: Option<String>,
565
566    #[serde(skip_serializing_if = "Option::is_none")]
567    pub evidence_customer_signature: Option<String>,
568
569    #[serde(skip_serializing_if = "Option::is_none")]
570    pub evidence_transaction_certificate: Option<String>,
571
572    #[serde(skip_serializing_if = "Option::is_none")]
573    pub exp_month: Option<i64>,
574
575    #[serde(skip_serializing_if = "Option::is_none")]
576    pub exp_year: Option<i64>,
577
578    #[serde(skip_serializing_if = "Option::is_none")]
579    pub fingerprint: Option<String>,
580
581    #[serde(skip_serializing_if = "Option::is_none")]
582    pub funding: Option<String>,
583
584    #[serde(skip_serializing_if = "Option::is_none")]
585    pub iin: Option<String>,
586
587    #[serde(skip_serializing_if = "Option::is_none")]
588    pub issuer: Option<String>,
589
590    #[serde(skip_serializing_if = "Option::is_none")]
591    pub last4: Option<String>,
592
593    #[serde(skip_serializing_if = "Option::is_none")]
594    pub pos_device_id: Option<String>,
595
596    #[serde(skip_serializing_if = "Option::is_none")]
597    pub pos_entry_mode: Option<String>,
598
599    #[serde(skip_serializing_if = "Option::is_none")]
600    pub read_method: Option<String>,
601
602    #[serde(skip_serializing_if = "Option::is_none")]
603    pub reader: Option<String>,
604
605    #[serde(skip_serializing_if = "Option::is_none")]
606    pub terminal_verification_results: Option<String>,
607
608    #[serde(skip_serializing_if = "Option::is_none")]
609    pub transaction_status_information: Option<String>,
610}
611
612#[derive(Clone, Debug, Default, Deserialize, Serialize)]
613pub struct SourceTypeEps {
614    #[serde(skip_serializing_if = "Option::is_none")]
615    pub reference: Option<String>,
616
617    #[serde(skip_serializing_if = "Option::is_none")]
618    pub statement_descriptor: Option<String>,
619}
620
621#[derive(Clone, Debug, Default, Deserialize, Serialize)]
622pub struct SourceTypeGiropay {
623    #[serde(skip_serializing_if = "Option::is_none")]
624    pub bank_code: Option<String>,
625
626    #[serde(skip_serializing_if = "Option::is_none")]
627    pub bank_name: Option<String>,
628
629    #[serde(skip_serializing_if = "Option::is_none")]
630    pub bic: Option<String>,
631
632    #[serde(skip_serializing_if = "Option::is_none")]
633    pub statement_descriptor: Option<String>,
634}
635
636#[derive(Clone, Debug, Default, Deserialize, Serialize)]
637pub struct SourceTypeIdeal {
638    #[serde(skip_serializing_if = "Option::is_none")]
639    pub bank: Option<String>,
640
641    #[serde(skip_serializing_if = "Option::is_none")]
642    pub bic: Option<String>,
643
644    #[serde(skip_serializing_if = "Option::is_none")]
645    pub iban_last4: Option<String>,
646
647    #[serde(skip_serializing_if = "Option::is_none")]
648    pub statement_descriptor: Option<String>,
649}
650
651#[derive(Clone, Debug, Default, Deserialize, Serialize)]
652pub struct SourceTypeKlarna {
653    #[serde(skip_serializing_if = "Option::is_none")]
654    pub background_image_url: Option<String>,
655
656    #[serde(skip_serializing_if = "Option::is_none")]
657    pub client_token: Option<String>,
658
659    #[serde(skip_serializing_if = "Option::is_none")]
660    pub first_name: Option<String>,
661
662    #[serde(skip_serializing_if = "Option::is_none")]
663    pub last_name: Option<String>,
664
665    #[serde(skip_serializing_if = "Option::is_none")]
666    pub locale: Option<String>,
667
668    #[serde(skip_serializing_if = "Option::is_none")]
669    pub logo_url: Option<String>,
670
671    #[serde(skip_serializing_if = "Option::is_none")]
672    pub page_title: Option<String>,
673
674    #[serde(skip_serializing_if = "Option::is_none")]
675    pub pay_later_asset_urls_descriptive: Option<String>,
676
677    #[serde(skip_serializing_if = "Option::is_none")]
678    pub pay_later_asset_urls_standard: Option<String>,
679
680    #[serde(skip_serializing_if = "Option::is_none")]
681    pub pay_later_name: Option<String>,
682
683    #[serde(skip_serializing_if = "Option::is_none")]
684    pub pay_later_redirect_url: Option<String>,
685
686    #[serde(skip_serializing_if = "Option::is_none")]
687    pub pay_now_asset_urls_descriptive: Option<String>,
688
689    #[serde(skip_serializing_if = "Option::is_none")]
690    pub pay_now_asset_urls_standard: Option<String>,
691
692    #[serde(skip_serializing_if = "Option::is_none")]
693    pub pay_now_name: Option<String>,
694
695    #[serde(skip_serializing_if = "Option::is_none")]
696    pub pay_now_redirect_url: Option<String>,
697
698    #[serde(skip_serializing_if = "Option::is_none")]
699    pub pay_over_time_asset_urls_descriptive: Option<String>,
700
701    #[serde(skip_serializing_if = "Option::is_none")]
702    pub pay_over_time_asset_urls_standard: Option<String>,
703
704    #[serde(skip_serializing_if = "Option::is_none")]
705    pub pay_over_time_name: Option<String>,
706
707    #[serde(skip_serializing_if = "Option::is_none")]
708    pub pay_over_time_redirect_url: Option<String>,
709
710    #[serde(skip_serializing_if = "Option::is_none")]
711    pub payment_method_categories: Option<String>,
712
713    #[serde(skip_serializing_if = "Option::is_none")]
714    pub purchase_country: Option<String>,
715
716    #[serde(skip_serializing_if = "Option::is_none")]
717    pub purchase_type: Option<String>,
718
719    #[serde(skip_serializing_if = "Option::is_none")]
720    pub redirect_url: Option<String>,
721
722    #[serde(skip_serializing_if = "Option::is_none")]
723    pub shipping_delay: Option<i64>,
724
725    #[serde(skip_serializing_if = "Option::is_none")]
726    pub shipping_first_name: Option<String>,
727
728    #[serde(skip_serializing_if = "Option::is_none")]
729    pub shipping_last_name: Option<String>,
730}
731
732#[derive(Clone, Debug, Default, Deserialize, Serialize)]
733pub struct SourceTypeMultibanco {
734    #[serde(skip_serializing_if = "Option::is_none")]
735    pub entity: Option<String>,
736
737    #[serde(skip_serializing_if = "Option::is_none")]
738    pub reference: Option<String>,
739
740    #[serde(skip_serializing_if = "Option::is_none")]
741    pub refund_account_holder_address_city: Option<String>,
742
743    #[serde(skip_serializing_if = "Option::is_none")]
744    pub refund_account_holder_address_country: Option<String>,
745
746    #[serde(skip_serializing_if = "Option::is_none")]
747    pub refund_account_holder_address_line1: Option<String>,
748
749    #[serde(skip_serializing_if = "Option::is_none")]
750    pub refund_account_holder_address_line2: Option<String>,
751
752    #[serde(skip_serializing_if = "Option::is_none")]
753    pub refund_account_holder_address_postal_code: Option<String>,
754
755    #[serde(skip_serializing_if = "Option::is_none")]
756    pub refund_account_holder_address_state: Option<String>,
757
758    #[serde(skip_serializing_if = "Option::is_none")]
759    pub refund_account_holder_name: Option<String>,
760
761    #[serde(skip_serializing_if = "Option::is_none")]
762    pub refund_iban: Option<String>,
763}
764
765#[derive(Clone, Debug, Default, Deserialize, Serialize)]
766pub struct SourceTypeP24 {
767    #[serde(skip_serializing_if = "Option::is_none")]
768    pub reference: Option<String>,
769}
770
771#[derive(Clone, Debug, Default, Deserialize, Serialize)]
772pub struct SourceTypeSepaCreditTransfer {
773    #[serde(skip_serializing_if = "Option::is_none")]
774    pub bank_name: Option<String>,
775
776    #[serde(skip_serializing_if = "Option::is_none")]
777    pub bic: Option<String>,
778
779    #[serde(skip_serializing_if = "Option::is_none")]
780    pub iban: Option<String>,
781
782    #[serde(skip_serializing_if = "Option::is_none")]
783    pub refund_account_holder_address_city: Option<String>,
784
785    #[serde(skip_serializing_if = "Option::is_none")]
786    pub refund_account_holder_address_country: Option<String>,
787
788    #[serde(skip_serializing_if = "Option::is_none")]
789    pub refund_account_holder_address_line1: Option<String>,
790
791    #[serde(skip_serializing_if = "Option::is_none")]
792    pub refund_account_holder_address_line2: Option<String>,
793
794    #[serde(skip_serializing_if = "Option::is_none")]
795    pub refund_account_holder_address_postal_code: Option<String>,
796
797    #[serde(skip_serializing_if = "Option::is_none")]
798    pub refund_account_holder_address_state: Option<String>,
799
800    #[serde(skip_serializing_if = "Option::is_none")]
801    pub refund_account_holder_name: Option<String>,
802
803    #[serde(skip_serializing_if = "Option::is_none")]
804    pub refund_iban: Option<String>,
805}
806
807#[derive(Clone, Debug, Default, Deserialize, Serialize)]
808pub struct SourceTypeSepaDebit {
809    #[serde(skip_serializing_if = "Option::is_none")]
810    pub bank_code: Option<String>,
811
812    #[serde(skip_serializing_if = "Option::is_none")]
813    pub branch_code: Option<String>,
814
815    #[serde(skip_serializing_if = "Option::is_none")]
816    pub country: Option<String>,
817
818    #[serde(skip_serializing_if = "Option::is_none")]
819    pub fingerprint: Option<String>,
820
821    #[serde(skip_serializing_if = "Option::is_none")]
822    pub last4: Option<String>,
823
824    #[serde(skip_serializing_if = "Option::is_none")]
825    pub mandate_reference: Option<String>,
826
827    #[serde(skip_serializing_if = "Option::is_none")]
828    pub mandate_url: Option<String>,
829}
830
831#[derive(Clone, Debug, Default, Deserialize, Serialize)]
832pub struct SourceTypeSofort {
833    #[serde(skip_serializing_if = "Option::is_none")]
834    pub bank_code: Option<String>,
835
836    #[serde(skip_serializing_if = "Option::is_none")]
837    pub bank_name: Option<String>,
838
839    #[serde(skip_serializing_if = "Option::is_none")]
840    pub bic: Option<String>,
841
842    #[serde(skip_serializing_if = "Option::is_none")]
843    pub country: Option<String>,
844
845    #[serde(skip_serializing_if = "Option::is_none")]
846    pub iban_last4: Option<String>,
847
848    #[serde(skip_serializing_if = "Option::is_none")]
849    pub preferred_language: Option<String>,
850
851    #[serde(skip_serializing_if = "Option::is_none")]
852    pub statement_descriptor: Option<String>,
853}
854
855#[derive(Clone, Debug, Default, Deserialize, Serialize)]
856pub struct SourceTypeThreeDSecure {
857    #[serde(skip_serializing_if = "Option::is_none")]
858    pub address_line1_check: Option<String>,
859
860    #[serde(skip_serializing_if = "Option::is_none")]
861    pub address_zip_check: Option<String>,
862
863    #[serde(skip_serializing_if = "Option::is_none")]
864    pub authenticated: Option<bool>,
865
866    #[serde(skip_serializing_if = "Option::is_none")]
867    pub brand: Option<String>,
868
869    #[serde(skip_serializing_if = "Option::is_none")]
870    pub card: Option<String>,
871
872    #[serde(skip_serializing_if = "Option::is_none")]
873    pub country: Option<String>,
874
875    #[serde(skip_serializing_if = "Option::is_none")]
876    pub customer: Option<String>,
877
878    #[serde(skip_serializing_if = "Option::is_none")]
879    pub cvc_check: Option<String>,
880
881    #[serde(skip_serializing_if = "Option::is_none")]
882    pub description: Option<String>,
883
884    #[serde(skip_serializing_if = "Option::is_none")]
885    pub dynamic_last4: Option<String>,
886
887    #[serde(skip_serializing_if = "Option::is_none")]
888    pub exp_month: Option<i64>,
889
890    #[serde(skip_serializing_if = "Option::is_none")]
891    pub exp_year: Option<i64>,
892
893    #[serde(skip_serializing_if = "Option::is_none")]
894    pub fingerprint: Option<String>,
895
896    #[serde(skip_serializing_if = "Option::is_none")]
897    pub funding: Option<String>,
898
899    #[serde(skip_serializing_if = "Option::is_none")]
900    pub iin: Option<String>,
901
902    #[serde(skip_serializing_if = "Option::is_none")]
903    pub issuer: Option<String>,
904
905    #[serde(skip_serializing_if = "Option::is_none")]
906    pub last4: Option<String>,
907
908    #[serde(skip_serializing_if = "Option::is_none")]
909    pub name: Option<String>,
910
911    #[serde(skip_serializing_if = "Option::is_none")]
912    pub three_d_secure: Option<String>,
913
914    #[serde(skip_serializing_if = "Option::is_none")]
915    pub tokenization_method: Option<String>,
916}
917
918#[derive(Clone, Debug, Default, Deserialize, Serialize)]
919pub struct SourceTypeWechat {
920    #[serde(skip_serializing_if = "Option::is_none")]
921    pub prepay_id: Option<String>,
922
923    #[serde(skip_serializing_if = "Option::is_none")]
924    pub qr_code_url: Option<String>,
925
926    #[serde(skip_serializing_if = "Option::is_none")]
927    pub statement_descriptor: Option<String>,
928}
929
930/// The parameters for `Source::create`.
931#[derive(Clone, Debug, Serialize, Default)]
932pub struct CreateSource<'a> {
933    /// Amount associated with the source.
934    ///
935    /// This is the amount for which the source will be chargeable once ready.
936    /// Required for `single_use` sources.
937    /// Not supported for `receiver` type sources, where charge amount may not be specified until funds land.
938    #[serde(skip_serializing_if = "Option::is_none")]
939    pub amount: Option<i64>,
940
941    /// Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) associated with the source.
942    ///
943    /// This is the currency for which the source will be chargeable once ready.
944    #[serde(skip_serializing_if = "Option::is_none")]
945    pub currency: Option<Currency>,
946
947    /// The `Customer` to whom the original source is attached to.
948    ///
949    /// Must be set when the original source is not a `Source` (e.g., `Card`).
950    #[serde(skip_serializing_if = "Option::is_none")]
951    pub customer: Option<CustomerId>,
952
953    /// Specifies which fields in the response should be expanded.
954    #[serde(skip_serializing_if = "Expand::is_empty")]
955    pub expand: &'a [&'a str],
956
957    /// The authentication `flow` of the source to create.
958    ///
959    /// `flow` is one of `redirect`, `receiver`, `code_verification`, `none`.
960    /// It is generally inferred unless a type supports multiple flows.
961    #[serde(skip_serializing_if = "Option::is_none")]
962    pub flow: Option<SourceFlow>,
963
964    /// Information about a mandate possibility attached to a source object (generally for bank debits) as well as its acceptance status.
965    #[serde(skip_serializing_if = "Option::is_none")]
966    pub mandate: Option<SourceMandateParams>,
967
968    #[serde(skip_serializing_if = "Option::is_none")]
969    pub metadata: Option<Metadata>,
970
971    /// The source to share.
972    #[serde(skip_serializing_if = "Option::is_none")]
973    pub original_source: Option<&'a str>,
974
975    /// Information about the owner of the payment instrument that may be used or required by particular source types.
976    #[serde(skip_serializing_if = "Option::is_none")]
977    pub owner: Option<BillingDetails>,
978
979    /// Optional parameters for the receiver flow.
980    ///
981    /// Can be set only if the source is a receiver (`flow` is `receiver`).
982    #[serde(skip_serializing_if = "Option::is_none")]
983    pub receiver: Option<CreateSourceReceiver>,
984
985    /// Parameters required for the redirect flow.
986    ///
987    /// Required if the source is authenticated by a redirect (`flow` is `redirect`).
988    #[serde(skip_serializing_if = "Option::is_none")]
989    pub redirect: Option<CreateSourceRedirect>,
990
991    /// Information about the items and shipping associated with the source.
992    ///
993    /// Required for transactional credit (for example Klarna) sources before you can charge it.
994    #[serde(skip_serializing_if = "Option::is_none")]
995    pub source_order: Option<CreateSourceSourceOrder>,
996
997    /// An arbitrary string to be displayed on your customer's statement.
998    ///
999    /// As an example, if your website is `RunClub` and the item you're charging for is a race ticket, you may want to specify a `statement_descriptor` of `RunClub 5K race ticket.` While many payment types will display this information, some may not display it at all.
1000    #[serde(skip_serializing_if = "Option::is_none")]
1001    pub statement_descriptor: Option<&'a str>,
1002
1003    /// An optional token used to create the source.
1004    ///
1005    /// When passed, token properties will override source parameters.
1006    #[serde(skip_serializing_if = "Option::is_none")]
1007    pub token: Option<TokenId>,
1008
1009    /// The `type` of the source to create.
1010    ///
1011    /// Required unless `customer` and `original_source` are specified (see the [Cloning card Sources](https://stripe.com/docs/sources/connect#cloning-card-sources) guide).
1012    #[serde(rename = "type")]
1013    #[serde(skip_serializing_if = "Option::is_none")]
1014    pub type_: Option<&'a str>,
1015}
1016
1017impl<'a> CreateSource<'a> {
1018    pub fn new() -> Self {
1019        CreateSource {
1020            amount: Default::default(),
1021            currency: Default::default(),
1022            customer: Default::default(),
1023            expand: Default::default(),
1024            flow: Default::default(),
1025            mandate: Default::default(),
1026            metadata: Default::default(),
1027            original_source: Default::default(),
1028            owner: Default::default(),
1029            receiver: Default::default(),
1030            redirect: Default::default(),
1031            source_order: Default::default(),
1032            statement_descriptor: Default::default(),
1033            token: Default::default(),
1034            type_: Default::default(),
1035        }
1036    }
1037}
1038
1039/// The parameters for `Source::list`.
1040#[derive(Clone, Debug, Serialize)]
1041pub struct ListSources<'a> {
1042    /// A cursor for use in pagination.
1043    ///
1044    /// `ending_before` is an object ID that defines your place in the list.
1045    /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
1046    #[serde(skip_serializing_if = "Option::is_none")]
1047    pub ending_before: Option<SourceId>,
1048
1049    /// Specifies which fields in the response should be expanded.
1050    #[serde(skip_serializing_if = "Expand::is_empty")]
1051    pub expand: &'a [&'a str],
1052
1053    /// A limit on the number of objects to be returned.
1054    ///
1055    /// Limit can range between 1 and 100, and the default is 10.
1056    #[serde(skip_serializing_if = "Option::is_none")]
1057    pub limit: Option<u64>,
1058
1059    /// A cursor for use in pagination.
1060    ///
1061    /// `starting_after` is an object ID that defines your place in the list.
1062    /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
1063    #[serde(skip_serializing_if = "Option::is_none")]
1064    pub starting_after: Option<SourceId>,
1065}
1066
1067impl<'a> ListSources<'a> {
1068    pub fn new() -> Self {
1069        ListSources {
1070            ending_before: Default::default(),
1071            expand: Default::default(),
1072            limit: Default::default(),
1073            starting_after: Default::default(),
1074        }
1075    }
1076}
1077impl Paginable for ListSources<'_> {
1078    type O = Source;
1079    fn set_last(&mut self, item: Self::O) {
1080        self.starting_after = Some(item.id());
1081    }
1082}
1083/// The parameters for `Source::update`.
1084#[derive(Clone, Debug, Serialize, Default)]
1085pub struct UpdateSource<'a> {
1086    /// Amount associated with the source.
1087    #[serde(skip_serializing_if = "Option::is_none")]
1088    pub amount: Option<i64>,
1089
1090    /// Specifies which fields in the response should be expanded.
1091    #[serde(skip_serializing_if = "Expand::is_empty")]
1092    pub expand: &'a [&'a str],
1093
1094    /// Information about a mandate possibility attached to a source object (generally for bank debits) as well as its acceptance status.
1095    #[serde(skip_serializing_if = "Option::is_none")]
1096    pub mandate: Option<SourceMandateParams>,
1097
1098    /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
1099    ///
1100    /// This can be useful for storing additional information about the object in a structured format.
1101    /// Individual keys can be unset by posting an empty value to them.
1102    /// All keys can be unset by posting an empty value to `metadata`.
1103    #[serde(skip_serializing_if = "Option::is_none")]
1104    pub metadata: Option<Metadata>,
1105
1106    /// Information about the owner of the payment instrument that may be used or required by particular source types.
1107    #[serde(skip_serializing_if = "Option::is_none")]
1108    pub owner: Option<BillingDetails>,
1109
1110    /// Information about the items and shipping associated with the source.
1111    ///
1112    /// Required for transactional credit (for example Klarna) sources before you can charge it.
1113    #[serde(skip_serializing_if = "Option::is_none")]
1114    pub source_order: Option<UpdateSourceSourceOrder>,
1115}
1116
1117impl<'a> UpdateSource<'a> {
1118    pub fn new() -> Self {
1119        UpdateSource {
1120            amount: Default::default(),
1121            expand: Default::default(),
1122            mandate: Default::default(),
1123            metadata: Default::default(),
1124            owner: Default::default(),
1125            source_order: Default::default(),
1126        }
1127    }
1128}
1129
1130#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1131pub struct CreateSourceReceiver {
1132    /// The method Stripe should use to request information needed to process a refund or mispayment.
1133    ///
1134    /// Either `email` (an email is sent directly to the customer) or `manual` (a `source.refund_attributes_required` event is sent to your webhooks endpoint).
1135    /// Refer to each payment method's documentation to learn which refund attributes may be required.
1136    #[serde(skip_serializing_if = "Option::is_none")]
1137    pub refund_attributes_method: Option<SourceRefundNotificationMethod>,
1138}
1139
1140#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1141pub struct CreateSourceRedirect {
1142    /// The URL you provide to redirect the customer back to you after they authenticated their payment.
1143    ///
1144    /// It can use your application URI scheme in the context of a mobile application.
1145    pub return_url: String,
1146}
1147
1148#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1149pub struct CreateSourceSourceOrder {
1150    /// List of items constituting the order.
1151    #[serde(skip_serializing_if = "Option::is_none")]
1152    pub items: Option<Vec<CreateSourceSourceOrderItems>>,
1153
1154    /// Shipping address for the order.
1155    ///
1156    /// Required if any of the SKUs are for products that have `shippable` set to true.
1157    #[serde(skip_serializing_if = "Option::is_none")]
1158    pub shipping: Option<CreateSourceSourceOrderShipping>,
1159}
1160
1161#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1162pub struct SourceMandateParams {
1163    /// The parameters required to notify Stripe of a mandate acceptance or refusal by the customer.
1164    #[serde(skip_serializing_if = "Option::is_none")]
1165    pub acceptance: Option<SourceAcceptanceParams>,
1166
1167    /// The amount specified by the mandate.
1168    ///
1169    /// (Leave null for a mandate covering all amounts).
1170    #[serde(skip_serializing_if = "Option::is_none")]
1171    pub amount: Option<i64>,
1172
1173    /// The currency specified by the mandate.
1174    ///
1175    /// (Must match `currency` of the source).
1176    #[serde(skip_serializing_if = "Option::is_none")]
1177    pub currency: Option<Currency>,
1178
1179    /// The interval of debits permitted by the mandate.
1180    ///
1181    /// Either `one_time` (just permitting a single debit), `scheduled` (with debits on an agreed schedule or for clearly-defined events), or `variable`(for debits with any frequency).
1182    #[serde(skip_serializing_if = "Option::is_none")]
1183    pub interval: Option<SourceMandateInterval>,
1184
1185    /// The method Stripe should use to notify the customer of upcoming debit instructions and/or mandate confirmation as required by the underlying debit network.
1186    ///
1187    /// Either `email` (an email is sent directly to the customer), `manual` (a `source.mandate_notification` event is sent to your webhooks endpoint and you should handle the notification) or `none` (the underlying debit network does not require any notification).
1188    #[serde(skip_serializing_if = "Option::is_none")]
1189    pub notification_method: Option<SourceMandateNotificationMethod>,
1190}
1191
1192#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1193pub struct UpdateSourceSourceOrder {
1194    /// List of items constituting the order.
1195    #[serde(skip_serializing_if = "Option::is_none")]
1196    pub items: Option<Vec<UpdateSourceSourceOrderItems>>,
1197
1198    /// Shipping address for the order.
1199    ///
1200    /// Required if any of the SKUs are for products that have `shippable` set to true.
1201    #[serde(skip_serializing_if = "Option::is_none")]
1202    pub shipping: Option<UpdateSourceSourceOrderShipping>,
1203}
1204
1205#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1206pub struct CreateSourceSourceOrderItems {
1207    #[serde(skip_serializing_if = "Option::is_none")]
1208    pub amount: Option<i64>,
1209
1210    #[serde(skip_serializing_if = "Option::is_none")]
1211    pub currency: Option<Currency>,
1212
1213    #[serde(skip_serializing_if = "Option::is_none")]
1214    pub description: Option<String>,
1215
1216    /// The ID of the SKU being ordered.
1217    #[serde(skip_serializing_if = "Option::is_none")]
1218    pub parent: Option<String>,
1219
1220    /// The quantity of this order item.
1221    ///
1222    /// When type is `sku`, this is the number of instances of the SKU to be ordered.
1223    #[serde(skip_serializing_if = "Option::is_none")]
1224    pub quantity: Option<u64>,
1225
1226    #[serde(rename = "type")]
1227    #[serde(skip_serializing_if = "Option::is_none")]
1228    pub type_: Option<CreateSourceSourceOrderItemsType>,
1229}
1230
1231#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1232pub struct CreateSourceSourceOrderShipping {
1233    /// Shipping address.
1234    pub address: CreateSourceSourceOrderShippingAddress,
1235
1236    /// The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc.
1237    #[serde(skip_serializing_if = "Option::is_none")]
1238    pub carrier: Option<String>,
1239
1240    /// Recipient name.
1241    #[serde(skip_serializing_if = "Option::is_none")]
1242    pub name: Option<String>,
1243
1244    /// Recipient phone (including extension).
1245    #[serde(skip_serializing_if = "Option::is_none")]
1246    pub phone: Option<String>,
1247
1248    /// The tracking number for a physical product, obtained from the delivery service.
1249    ///
1250    /// If multiple tracking numbers were generated for this purchase, please separate them with commas.
1251    #[serde(skip_serializing_if = "Option::is_none")]
1252    pub tracking_number: Option<String>,
1253}
1254
1255#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1256pub struct SourceAcceptanceParams {
1257    /// The Unix timestamp (in seconds) when the mandate was accepted or refused by the customer.
1258    #[serde(skip_serializing_if = "Option::is_none")]
1259    pub date: Option<Timestamp>,
1260
1261    /// The IP address from which the mandate was accepted or refused by the customer.
1262    #[serde(skip_serializing_if = "Option::is_none")]
1263    pub ip: Option<String>,
1264
1265    /// The parameters required to store a mandate accepted offline.
1266    ///
1267    /// Should only be set if `mandate[type]` is `offline`.
1268    #[serde(skip_serializing_if = "Option::is_none")]
1269    pub offline: Option<SourceAcceptanceOfflineParams>,
1270
1271    /// The parameters required to store a mandate accepted online.
1272    ///
1273    /// Should only be set if `mandate[type]` is `online`.
1274    #[serde(skip_serializing_if = "Option::is_none")]
1275    pub online: Option<SourceAcceptanceOnlineParams>,
1276
1277    /// The status of the mandate acceptance.
1278    ///
1279    /// Either `accepted` (the mandate was accepted) or `refused` (the mandate was refused).
1280    pub status: SourceAcceptanceParamsStatus,
1281
1282    /// The type of acceptance information included with the mandate.
1283    ///
1284    /// Either `online` or `offline`.
1285    #[serde(rename = "type")]
1286    #[serde(skip_serializing_if = "Option::is_none")]
1287    pub type_: Option<SourceAcceptanceParamsType>,
1288
1289    /// The user agent of the browser from which the mandate was accepted or refused by the customer.
1290    #[serde(skip_serializing_if = "Option::is_none")]
1291    pub user_agent: Option<String>,
1292}
1293
1294#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1295pub struct UpdateSourceSourceOrderItems {
1296    #[serde(skip_serializing_if = "Option::is_none")]
1297    pub amount: Option<i64>,
1298
1299    #[serde(skip_serializing_if = "Option::is_none")]
1300    pub currency: Option<Currency>,
1301
1302    #[serde(skip_serializing_if = "Option::is_none")]
1303    pub description: Option<String>,
1304
1305    /// The ID of the SKU being ordered.
1306    #[serde(skip_serializing_if = "Option::is_none")]
1307    pub parent: Option<String>,
1308
1309    /// The quantity of this order item.
1310    ///
1311    /// When type is `sku`, this is the number of instances of the SKU to be ordered.
1312    #[serde(skip_serializing_if = "Option::is_none")]
1313    pub quantity: Option<u64>,
1314
1315    #[serde(rename = "type")]
1316    #[serde(skip_serializing_if = "Option::is_none")]
1317    pub type_: Option<UpdateSourceSourceOrderItemsType>,
1318}
1319
1320#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1321pub struct UpdateSourceSourceOrderShipping {
1322    /// Shipping address.
1323    pub address: UpdateSourceSourceOrderShippingAddress,
1324
1325    /// The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc.
1326    #[serde(skip_serializing_if = "Option::is_none")]
1327    pub carrier: Option<String>,
1328
1329    /// Recipient name.
1330    #[serde(skip_serializing_if = "Option::is_none")]
1331    pub name: Option<String>,
1332
1333    /// Recipient phone (including extension).
1334    #[serde(skip_serializing_if = "Option::is_none")]
1335    pub phone: Option<String>,
1336
1337    /// The tracking number for a physical product, obtained from the delivery service.
1338    ///
1339    /// If multiple tracking numbers were generated for this purchase, please separate them with commas.
1340    #[serde(skip_serializing_if = "Option::is_none")]
1341    pub tracking_number: Option<String>,
1342}
1343
1344#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1345pub struct CreateSourceSourceOrderShippingAddress {
1346    /// City, district, suburb, town, or village.
1347    #[serde(skip_serializing_if = "Option::is_none")]
1348    pub city: Option<String>,
1349
1350    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
1351    #[serde(skip_serializing_if = "Option::is_none")]
1352    pub country: Option<String>,
1353
1354    /// Address line 1 (e.g., street, PO Box, or company name).
1355    pub line1: String,
1356
1357    /// Address line 2 (e.g., apartment, suite, unit, or building).
1358    #[serde(skip_serializing_if = "Option::is_none")]
1359    pub line2: Option<String>,
1360
1361    /// ZIP or postal code.
1362    #[serde(skip_serializing_if = "Option::is_none")]
1363    pub postal_code: Option<String>,
1364
1365    /// State, county, province, or region.
1366    #[serde(skip_serializing_if = "Option::is_none")]
1367    pub state: Option<String>,
1368}
1369
1370#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1371pub struct SourceAcceptanceOfflineParams {
1372    /// An email to contact you with if a copy of the mandate is requested, required if `type` is `offline`.
1373    pub contact_email: String,
1374}
1375
1376#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1377pub struct SourceAcceptanceOnlineParams {
1378    /// The Unix timestamp (in seconds) when the mandate was accepted or refused by the customer.
1379    #[serde(skip_serializing_if = "Option::is_none")]
1380    pub date: Option<Timestamp>,
1381
1382    /// The IP address from which the mandate was accepted or refused by the customer.
1383    #[serde(skip_serializing_if = "Option::is_none")]
1384    pub ip: Option<String>,
1385
1386    /// The user agent of the browser from which the mandate was accepted or refused by the customer.
1387    #[serde(skip_serializing_if = "Option::is_none")]
1388    pub user_agent: Option<String>,
1389}
1390
1391#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1392pub struct UpdateSourceSourceOrderShippingAddress {
1393    /// City, district, suburb, town, or village.
1394    #[serde(skip_serializing_if = "Option::is_none")]
1395    pub city: Option<String>,
1396
1397    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
1398    #[serde(skip_serializing_if = "Option::is_none")]
1399    pub country: Option<String>,
1400
1401    /// Address line 1 (e.g., street, PO Box, or company name).
1402    pub line1: String,
1403
1404    /// Address line 2 (e.g., apartment, suite, unit, or building).
1405    #[serde(skip_serializing_if = "Option::is_none")]
1406    pub line2: Option<String>,
1407
1408    /// ZIP or postal code.
1409    #[serde(skip_serializing_if = "Option::is_none")]
1410    pub postal_code: Option<String>,
1411
1412    /// State, county, province, or region.
1413    #[serde(skip_serializing_if = "Option::is_none")]
1414    pub state: Option<String>,
1415}
1416
1417/// An enum representing the possible values of an `CreateSourceSourceOrderItems`'s `type` field.
1418#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1419#[serde(rename_all = "snake_case")]
1420pub enum CreateSourceSourceOrderItemsType {
1421    Discount,
1422    Shipping,
1423    Sku,
1424    Tax,
1425}
1426
1427impl CreateSourceSourceOrderItemsType {
1428    pub fn as_str(self) -> &'static str {
1429        match self {
1430            CreateSourceSourceOrderItemsType::Discount => "discount",
1431            CreateSourceSourceOrderItemsType::Shipping => "shipping",
1432            CreateSourceSourceOrderItemsType::Sku => "sku",
1433            CreateSourceSourceOrderItemsType::Tax => "tax",
1434        }
1435    }
1436}
1437
1438impl AsRef<str> for CreateSourceSourceOrderItemsType {
1439    fn as_ref(&self) -> &str {
1440        self.as_str()
1441    }
1442}
1443
1444impl std::fmt::Display for CreateSourceSourceOrderItemsType {
1445    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1446        self.as_str().fmt(f)
1447    }
1448}
1449impl std::default::Default for CreateSourceSourceOrderItemsType {
1450    fn default() -> Self {
1451        Self::Discount
1452    }
1453}
1454
1455/// An enum representing the possible values of an `SourceAcceptanceParams`'s `status` field.
1456#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1457#[serde(rename_all = "snake_case")]
1458pub enum SourceAcceptanceParamsStatus {
1459    Accepted,
1460    Pending,
1461    Refused,
1462    Revoked,
1463}
1464
1465impl SourceAcceptanceParamsStatus {
1466    pub fn as_str(self) -> &'static str {
1467        match self {
1468            SourceAcceptanceParamsStatus::Accepted => "accepted",
1469            SourceAcceptanceParamsStatus::Pending => "pending",
1470            SourceAcceptanceParamsStatus::Refused => "refused",
1471            SourceAcceptanceParamsStatus::Revoked => "revoked",
1472        }
1473    }
1474}
1475
1476impl AsRef<str> for SourceAcceptanceParamsStatus {
1477    fn as_ref(&self) -> &str {
1478        self.as_str()
1479    }
1480}
1481
1482impl std::fmt::Display for SourceAcceptanceParamsStatus {
1483    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1484        self.as_str().fmt(f)
1485    }
1486}
1487impl std::default::Default for SourceAcceptanceParamsStatus {
1488    fn default() -> Self {
1489        Self::Accepted
1490    }
1491}
1492
1493/// An enum representing the possible values of an `SourceAcceptanceParams`'s `type` field.
1494#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1495#[serde(rename_all = "snake_case")]
1496pub enum SourceAcceptanceParamsType {
1497    Offline,
1498    Online,
1499}
1500
1501impl SourceAcceptanceParamsType {
1502    pub fn as_str(self) -> &'static str {
1503        match self {
1504            SourceAcceptanceParamsType::Offline => "offline",
1505            SourceAcceptanceParamsType::Online => "online",
1506        }
1507    }
1508}
1509
1510impl AsRef<str> for SourceAcceptanceParamsType {
1511    fn as_ref(&self) -> &str {
1512        self.as_str()
1513    }
1514}
1515
1516impl std::fmt::Display for SourceAcceptanceParamsType {
1517    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1518        self.as_str().fmt(f)
1519    }
1520}
1521impl std::default::Default for SourceAcceptanceParamsType {
1522    fn default() -> Self {
1523        Self::Offline
1524    }
1525}
1526
1527/// An enum representing the possible values of an `CreateSource`'s `flow` field.
1528#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1529#[serde(rename_all = "snake_case")]
1530pub enum SourceFlow {
1531    CodeVerification,
1532    None,
1533    Receiver,
1534    Redirect,
1535}
1536
1537impl SourceFlow {
1538    pub fn as_str(self) -> &'static str {
1539        match self {
1540            SourceFlow::CodeVerification => "code_verification",
1541            SourceFlow::None => "none",
1542            SourceFlow::Receiver => "receiver",
1543            SourceFlow::Redirect => "redirect",
1544        }
1545    }
1546}
1547
1548impl AsRef<str> for SourceFlow {
1549    fn as_ref(&self) -> &str {
1550        self.as_str()
1551    }
1552}
1553
1554impl std::fmt::Display for SourceFlow {
1555    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1556        self.as_str().fmt(f)
1557    }
1558}
1559impl std::default::Default for SourceFlow {
1560    fn default() -> Self {
1561        Self::CodeVerification
1562    }
1563}
1564
1565/// An enum representing the possible values of an `SourceMandateParams`'s `interval` field.
1566#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1567#[serde(rename_all = "snake_case")]
1568pub enum SourceMandateInterval {
1569    OneTime,
1570    Scheduled,
1571    Variable,
1572}
1573
1574impl SourceMandateInterval {
1575    pub fn as_str(self) -> &'static str {
1576        match self {
1577            SourceMandateInterval::OneTime => "one_time",
1578            SourceMandateInterval::Scheduled => "scheduled",
1579            SourceMandateInterval::Variable => "variable",
1580        }
1581    }
1582}
1583
1584impl AsRef<str> for SourceMandateInterval {
1585    fn as_ref(&self) -> &str {
1586        self.as_str()
1587    }
1588}
1589
1590impl std::fmt::Display for SourceMandateInterval {
1591    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1592        self.as_str().fmt(f)
1593    }
1594}
1595impl std::default::Default for SourceMandateInterval {
1596    fn default() -> Self {
1597        Self::OneTime
1598    }
1599}
1600
1601/// An enum representing the possible values of an `SourceMandateParams`'s `notification_method` field.
1602#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1603#[serde(rename_all = "snake_case")]
1604pub enum SourceMandateNotificationMethod {
1605    DeprecatedNone,
1606    Email,
1607    Manual,
1608    None,
1609    StripeEmail,
1610}
1611
1612impl SourceMandateNotificationMethod {
1613    pub fn as_str(self) -> &'static str {
1614        match self {
1615            SourceMandateNotificationMethod::DeprecatedNone => "deprecated_none",
1616            SourceMandateNotificationMethod::Email => "email",
1617            SourceMandateNotificationMethod::Manual => "manual",
1618            SourceMandateNotificationMethod::None => "none",
1619            SourceMandateNotificationMethod::StripeEmail => "stripe_email",
1620        }
1621    }
1622}
1623
1624impl AsRef<str> for SourceMandateNotificationMethod {
1625    fn as_ref(&self) -> &str {
1626        self.as_str()
1627    }
1628}
1629
1630impl std::fmt::Display for SourceMandateNotificationMethod {
1631    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1632        self.as_str().fmt(f)
1633    }
1634}
1635impl std::default::Default for SourceMandateNotificationMethod {
1636    fn default() -> Self {
1637        Self::DeprecatedNone
1638    }
1639}
1640
1641/// An enum representing the possible values of an `CreateSourceReceiver`'s `refund_attributes_method` field.
1642#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1643#[serde(rename_all = "snake_case")]
1644pub enum SourceRefundNotificationMethod {
1645    Email,
1646    Manual,
1647    None,
1648}
1649
1650impl SourceRefundNotificationMethod {
1651    pub fn as_str(self) -> &'static str {
1652        match self {
1653            SourceRefundNotificationMethod::Email => "email",
1654            SourceRefundNotificationMethod::Manual => "manual",
1655            SourceRefundNotificationMethod::None => "none",
1656        }
1657    }
1658}
1659
1660impl AsRef<str> for SourceRefundNotificationMethod {
1661    fn as_ref(&self) -> &str {
1662        self.as_str()
1663    }
1664}
1665
1666impl std::fmt::Display for SourceRefundNotificationMethod {
1667    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1668        self.as_str().fmt(f)
1669    }
1670}
1671impl std::default::Default for SourceRefundNotificationMethod {
1672    fn default() -> Self {
1673        Self::Email
1674    }
1675}
1676
1677/// An enum representing the possible values of an `Source`'s `type` field.
1678#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1679#[serde(rename_all = "snake_case")]
1680pub enum SourceType {
1681    AchCreditTransfer,
1682    AchDebit,
1683    AcssDebit,
1684    Alipay,
1685    AuBecsDebit,
1686    Bancontact,
1687    Card,
1688    CardPresent,
1689    Eps,
1690    Giropay,
1691    Ideal,
1692    Klarna,
1693    Multibanco,
1694    P24,
1695    SepaCreditTransfer,
1696    SepaDebit,
1697    Sofort,
1698    ThreeDSecure,
1699    Wechat,
1700}
1701
1702impl SourceType {
1703    pub fn as_str(self) -> &'static str {
1704        match self {
1705            SourceType::AchCreditTransfer => "ach_credit_transfer",
1706            SourceType::AchDebit => "ach_debit",
1707            SourceType::AcssDebit => "acss_debit",
1708            SourceType::Alipay => "alipay",
1709            SourceType::AuBecsDebit => "au_becs_debit",
1710            SourceType::Bancontact => "bancontact",
1711            SourceType::Card => "card",
1712            SourceType::CardPresent => "card_present",
1713            SourceType::Eps => "eps",
1714            SourceType::Giropay => "giropay",
1715            SourceType::Ideal => "ideal",
1716            SourceType::Klarna => "klarna",
1717            SourceType::Multibanco => "multibanco",
1718            SourceType::P24 => "p24",
1719            SourceType::SepaCreditTransfer => "sepa_credit_transfer",
1720            SourceType::SepaDebit => "sepa_debit",
1721            SourceType::Sofort => "sofort",
1722            SourceType::ThreeDSecure => "three_d_secure",
1723            SourceType::Wechat => "wechat",
1724        }
1725    }
1726}
1727
1728impl AsRef<str> for SourceType {
1729    fn as_ref(&self) -> &str {
1730        self.as_str()
1731    }
1732}
1733
1734impl std::fmt::Display for SourceType {
1735    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1736        self.as_str().fmt(f)
1737    }
1738}
1739impl std::default::Default for SourceType {
1740    fn default() -> Self {
1741        Self::AchCreditTransfer
1742    }
1743}
1744
1745/// An enum representing the possible values of an `UpdateSourceSourceOrderItems`'s `type` field.
1746#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1747#[serde(rename_all = "snake_case")]
1748pub enum UpdateSourceSourceOrderItemsType {
1749    Discount,
1750    Shipping,
1751    Sku,
1752    Tax,
1753}
1754
1755impl UpdateSourceSourceOrderItemsType {
1756    pub fn as_str(self) -> &'static str {
1757        match self {
1758            UpdateSourceSourceOrderItemsType::Discount => "discount",
1759            UpdateSourceSourceOrderItemsType::Shipping => "shipping",
1760            UpdateSourceSourceOrderItemsType::Sku => "sku",
1761            UpdateSourceSourceOrderItemsType::Tax => "tax",
1762        }
1763    }
1764}
1765
1766impl AsRef<str> for UpdateSourceSourceOrderItemsType {
1767    fn as_ref(&self) -> &str {
1768        self.as_str()
1769    }
1770}
1771
1772impl std::fmt::Display for UpdateSourceSourceOrderItemsType {
1773    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1774        self.as_str().fmt(f)
1775    }
1776}
1777impl std::default::Default for UpdateSourceSourceOrderItemsType {
1778    fn default() -> Self {
1779        Self::Discount
1780    }
1781}