stripe/resources/generated/
source.rs

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