Skip to main content

stripe_terminal/terminal_reader/
requests.rs

1use stripe_client_core::{
2    RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5/// Deletes a `Reader` object.
6#[derive(Clone)]
7#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
8#[derive(serde::Serialize)]
9pub struct DeleteTerminalReader {
10    reader: stripe_terminal::TerminalReaderId,
11}
12#[cfg(feature = "redact-generated-debug")]
13impl std::fmt::Debug for DeleteTerminalReader {
14    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
15        f.debug_struct("DeleteTerminalReader").finish_non_exhaustive()
16    }
17}
18impl DeleteTerminalReader {
19    /// Construct a new `DeleteTerminalReader`.
20    pub fn new(reader: impl Into<stripe_terminal::TerminalReaderId>) -> Self {
21        Self { reader: reader.into() }
22    }
23}
24impl DeleteTerminalReader {
25    /// Send the request and return the deserialized response.
26    pub async fn send<C: StripeClient>(
27        &self,
28        client: &C,
29    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
30        self.customize().send(client).await
31    }
32
33    /// Send the request and return the deserialized response, blocking until completion.
34    pub fn send_blocking<C: StripeBlockingClient>(
35        &self,
36        client: &C,
37    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
38        self.customize().send_blocking(client)
39    }
40}
41
42impl StripeRequest for DeleteTerminalReader {
43    type Output = stripe_terminal::DeletedTerminalReader;
44
45    fn build(&self) -> RequestBuilder {
46        let reader = &self.reader;
47        RequestBuilder::new(StripeMethod::Delete, format!("/terminal/readers/{reader}"))
48    }
49}
50#[derive(Clone, Eq, PartialEq)]
51#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
52#[derive(serde::Serialize)]
53struct ListTerminalReaderBuilder {
54    #[serde(skip_serializing_if = "Option::is_none")]
55    device_type: Option<stripe_terminal::TerminalReaderDeviceType>,
56    #[serde(skip_serializing_if = "Option::is_none")]
57    ending_before: Option<String>,
58    #[serde(skip_serializing_if = "Option::is_none")]
59    expand: Option<Vec<String>>,
60    #[serde(skip_serializing_if = "Option::is_none")]
61    limit: Option<i64>,
62    #[serde(skip_serializing_if = "Option::is_none")]
63    location: Option<String>,
64    #[serde(skip_serializing_if = "Option::is_none")]
65    serial_number: Option<String>,
66    #[serde(skip_serializing_if = "Option::is_none")]
67    starting_after: Option<String>,
68    #[serde(skip_serializing_if = "Option::is_none")]
69    status: Option<stripe_terminal::TerminalReaderStatus>,
70}
71#[cfg(feature = "redact-generated-debug")]
72impl std::fmt::Debug for ListTerminalReaderBuilder {
73    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
74        f.debug_struct("ListTerminalReaderBuilder").finish_non_exhaustive()
75    }
76}
77impl ListTerminalReaderBuilder {
78    fn new() -> Self {
79        Self {
80            device_type: None,
81            ending_before: None,
82            expand: None,
83            limit: None,
84            location: None,
85            serial_number: None,
86            starting_after: None,
87            status: None,
88        }
89    }
90}
91/// Returns a list of `Reader` objects.
92#[derive(Clone)]
93#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
94#[derive(serde::Serialize)]
95pub struct ListTerminalReader {
96    inner: ListTerminalReaderBuilder,
97}
98#[cfg(feature = "redact-generated-debug")]
99impl std::fmt::Debug for ListTerminalReader {
100    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
101        f.debug_struct("ListTerminalReader").finish_non_exhaustive()
102    }
103}
104impl ListTerminalReader {
105    /// Construct a new `ListTerminalReader`.
106    pub fn new() -> Self {
107        Self { inner: ListTerminalReaderBuilder::new() }
108    }
109    /// Filters readers by device type
110    pub fn device_type(
111        mut self,
112        device_type: impl Into<stripe_terminal::TerminalReaderDeviceType>,
113    ) -> Self {
114        self.inner.device_type = Some(device_type.into());
115        self
116    }
117    /// A cursor for use in pagination.
118    /// `ending_before` is an object ID that defines your place in the list.
119    /// 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.
120    pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
121        self.inner.ending_before = Some(ending_before.into());
122        self
123    }
124    /// Specifies which fields in the response should be expanded.
125    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
126        self.inner.expand = Some(expand.into());
127        self
128    }
129    /// A limit on the number of objects to be returned.
130    /// Limit can range between 1 and 100, and the default is 10.
131    pub fn limit(mut self, limit: impl Into<i64>) -> Self {
132        self.inner.limit = Some(limit.into());
133        self
134    }
135    /// A location ID to filter the response list to only readers at the specific location
136    pub fn location(mut self, location: impl Into<String>) -> Self {
137        self.inner.location = Some(location.into());
138        self
139    }
140    /// Filters readers by serial number
141    pub fn serial_number(mut self, serial_number: impl Into<String>) -> Self {
142        self.inner.serial_number = Some(serial_number.into());
143        self
144    }
145    /// A cursor for use in pagination.
146    /// `starting_after` is an object ID that defines your place in the list.
147    /// 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.
148    pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
149        self.inner.starting_after = Some(starting_after.into());
150        self
151    }
152    /// A status filter to filter readers to only offline or online readers
153    pub fn status(mut self, status: impl Into<stripe_terminal::TerminalReaderStatus>) -> Self {
154        self.inner.status = Some(status.into());
155        self
156    }
157}
158impl Default for ListTerminalReader {
159    fn default() -> Self {
160        Self::new()
161    }
162}
163impl ListTerminalReader {
164    /// Send the request and return the deserialized response.
165    pub async fn send<C: StripeClient>(
166        &self,
167        client: &C,
168    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
169        self.customize().send(client).await
170    }
171
172    /// Send the request and return the deserialized response, blocking until completion.
173    pub fn send_blocking<C: StripeBlockingClient>(
174        &self,
175        client: &C,
176    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
177        self.customize().send_blocking(client)
178    }
179
180    pub fn paginate(
181        &self,
182    ) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_terminal::TerminalReader>>
183    {
184        stripe_client_core::ListPaginator::new_list("/terminal/readers", &self.inner)
185    }
186}
187
188impl StripeRequest for ListTerminalReader {
189    type Output = stripe_types::List<stripe_terminal::TerminalReader>;
190
191    fn build(&self) -> RequestBuilder {
192        RequestBuilder::new(StripeMethod::Get, "/terminal/readers").query(&self.inner)
193    }
194}
195#[derive(Clone, Eq, PartialEq)]
196#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
197#[derive(serde::Serialize)]
198struct RetrieveTerminalReaderBuilder {
199    #[serde(skip_serializing_if = "Option::is_none")]
200    expand: Option<Vec<String>>,
201}
202#[cfg(feature = "redact-generated-debug")]
203impl std::fmt::Debug for RetrieveTerminalReaderBuilder {
204    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
205        f.debug_struct("RetrieveTerminalReaderBuilder").finish_non_exhaustive()
206    }
207}
208impl RetrieveTerminalReaderBuilder {
209    fn new() -> Self {
210        Self { expand: None }
211    }
212}
213/// Retrieves a `Reader` object.
214#[derive(Clone)]
215#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
216#[derive(serde::Serialize)]
217pub struct RetrieveTerminalReader {
218    inner: RetrieveTerminalReaderBuilder,
219    reader: stripe_terminal::TerminalReaderId,
220}
221#[cfg(feature = "redact-generated-debug")]
222impl std::fmt::Debug for RetrieveTerminalReader {
223    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
224        f.debug_struct("RetrieveTerminalReader").finish_non_exhaustive()
225    }
226}
227impl RetrieveTerminalReader {
228    /// Construct a new `RetrieveTerminalReader`.
229    pub fn new(reader: impl Into<stripe_terminal::TerminalReaderId>) -> Self {
230        Self { reader: reader.into(), inner: RetrieveTerminalReaderBuilder::new() }
231    }
232    /// Specifies which fields in the response should be expanded.
233    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
234        self.inner.expand = Some(expand.into());
235        self
236    }
237}
238impl RetrieveTerminalReader {
239    /// Send the request and return the deserialized response.
240    pub async fn send<C: StripeClient>(
241        &self,
242        client: &C,
243    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
244        self.customize().send(client).await
245    }
246
247    /// Send the request and return the deserialized response, blocking until completion.
248    pub fn send_blocking<C: StripeBlockingClient>(
249        &self,
250        client: &C,
251    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
252        self.customize().send_blocking(client)
253    }
254}
255
256impl StripeRequest for RetrieveTerminalReader {
257    type Output = RetrieveTerminalReaderReturned;
258
259    fn build(&self) -> RequestBuilder {
260        let reader = &self.reader;
261        RequestBuilder::new(StripeMethod::Get, format!("/terminal/readers/{reader}"))
262            .query(&self.inner)
263    }
264}
265#[derive(Clone)]
266#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
267#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
268#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
269#[cfg_attr(any(feature = "deserialize", feature = "serialize"), serde(untagged))]
270pub enum RetrieveTerminalReaderReturned {
271    TerminalReader(stripe_terminal::TerminalReader),
272    DeletedTerminalReader(stripe_terminal::DeletedTerminalReader),
273}
274
275#[derive(Default)]
276pub struct RetrieveTerminalReaderReturnedBuilder {
277    inner: stripe_types::miniserde_helpers::MaybeDeletedBuilderInner,
278}
279
280const _: () = {
281    use miniserde::de::{Map, Visitor};
282    use miniserde::json::Value;
283    use miniserde::{Deserialize, Result, make_place};
284    use stripe_types::MapBuilder;
285    use stripe_types::miniserde_helpers::FromValueOpt;
286
287    use super::*;
288
289    make_place!(Place);
290
291    struct Builder<'a> {
292        out: &'a mut Option<RetrieveTerminalReaderReturned>,
293        builder: RetrieveTerminalReaderReturnedBuilder,
294    }
295
296    impl Deserialize for RetrieveTerminalReaderReturned {
297        fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
298            Place::new(out)
299        }
300    }
301
302    impl Visitor for Place<RetrieveTerminalReaderReturned> {
303        fn map(&mut self) -> Result<Box<dyn Map + '_>> {
304            Ok(Box::new(Builder { out: &mut self.out, builder: Default::default() }))
305        }
306    }
307
308    impl Map for Builder<'_> {
309        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
310            self.builder.key(k)
311        }
312
313        fn finish(&mut self) -> Result<()> {
314            *self.out = self.builder.take_out();
315            Ok(())
316        }
317    }
318
319    impl MapBuilder for RetrieveTerminalReaderReturnedBuilder {
320        type Out = RetrieveTerminalReaderReturned;
321        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
322            self.inner.key_inner(k)
323        }
324
325        fn deser_default() -> Self {
326            Self::default()
327        }
328
329        fn take_out(&mut self) -> Option<Self::Out> {
330            let (deleted, o) = self.inner.finish_inner()?;
331            Some(if deleted {
332                RetrieveTerminalReaderReturned::DeletedTerminalReader(FromValueOpt::from_value(
333                    Value::Object(o),
334                )?)
335            } else {
336                RetrieveTerminalReaderReturned::TerminalReader(FromValueOpt::from_value(
337                    Value::Object(o),
338                )?)
339            })
340        }
341    }
342
343    impl stripe_types::ObjectDeser for RetrieveTerminalReaderReturned {
344        type Builder = RetrieveTerminalReaderReturnedBuilder;
345    }
346};
347
348#[cfg(feature = "redact-generated-debug")]
349impl std::fmt::Debug for RetrieveTerminalReaderReturned {
350    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
351        f.debug_struct("RetrieveTerminalReaderReturned").finish_non_exhaustive()
352    }
353}
354#[derive(Clone)]
355#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
356#[derive(serde::Serialize)]
357struct CreateTerminalReaderBuilder {
358    #[serde(skip_serializing_if = "Option::is_none")]
359    expand: Option<Vec<String>>,
360    #[serde(skip_serializing_if = "Option::is_none")]
361    label: Option<String>,
362    #[serde(skip_serializing_if = "Option::is_none")]
363    location: Option<String>,
364    #[serde(skip_serializing_if = "Option::is_none")]
365    metadata: Option<std::collections::HashMap<String, String>>,
366    registration_code: String,
367}
368#[cfg(feature = "redact-generated-debug")]
369impl std::fmt::Debug for CreateTerminalReaderBuilder {
370    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
371        f.debug_struct("CreateTerminalReaderBuilder").finish_non_exhaustive()
372    }
373}
374impl CreateTerminalReaderBuilder {
375    fn new(registration_code: impl Into<String>) -> Self {
376        Self {
377            expand: None,
378            label: None,
379            location: None,
380            metadata: None,
381            registration_code: registration_code.into(),
382        }
383    }
384}
385/// Creates a new `Reader` object.
386#[derive(Clone)]
387#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
388#[derive(serde::Serialize)]
389pub struct CreateTerminalReader {
390    inner: CreateTerminalReaderBuilder,
391}
392#[cfg(feature = "redact-generated-debug")]
393impl std::fmt::Debug for CreateTerminalReader {
394    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
395        f.debug_struct("CreateTerminalReader").finish_non_exhaustive()
396    }
397}
398impl CreateTerminalReader {
399    /// Construct a new `CreateTerminalReader`.
400    pub fn new(registration_code: impl Into<String>) -> Self {
401        Self { inner: CreateTerminalReaderBuilder::new(registration_code.into()) }
402    }
403    /// Specifies which fields in the response should be expanded.
404    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
405        self.inner.expand = Some(expand.into());
406        self
407    }
408    /// Custom label given to the reader for easier identification.
409    /// If no label is specified, the registration code will be used.
410    pub fn label(mut self, label: impl Into<String>) -> Self {
411        self.inner.label = Some(label.into());
412        self
413    }
414    /// The location to assign the reader to.
415    pub fn location(mut self, location: impl Into<String>) -> Self {
416        self.inner.location = Some(location.into());
417        self
418    }
419    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
420    /// This can be useful for storing additional information about the object in a structured format.
421    /// Individual keys can be unset by posting an empty value to them.
422    /// All keys can be unset by posting an empty value to `metadata`.
423    pub fn metadata(
424        mut self,
425        metadata: impl Into<std::collections::HashMap<String, String>>,
426    ) -> Self {
427        self.inner.metadata = Some(metadata.into());
428        self
429    }
430}
431impl CreateTerminalReader {
432    /// Send the request and return the deserialized response.
433    pub async fn send<C: StripeClient>(
434        &self,
435        client: &C,
436    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
437        self.customize().send(client).await
438    }
439
440    /// Send the request and return the deserialized response, blocking until completion.
441    pub fn send_blocking<C: StripeBlockingClient>(
442        &self,
443        client: &C,
444    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
445        self.customize().send_blocking(client)
446    }
447}
448
449impl StripeRequest for CreateTerminalReader {
450    type Output = stripe_terminal::TerminalReader;
451
452    fn build(&self) -> RequestBuilder {
453        RequestBuilder::new(StripeMethod::Post, "/terminal/readers").form(&self.inner)
454    }
455}
456#[derive(Clone)]
457#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
458#[derive(serde::Serialize)]
459struct UpdateTerminalReaderBuilder {
460    #[serde(skip_serializing_if = "Option::is_none")]
461    expand: Option<Vec<String>>,
462    #[serde(skip_serializing_if = "Option::is_none")]
463    label: Option<String>,
464    #[serde(skip_serializing_if = "Option::is_none")]
465    metadata: Option<std::collections::HashMap<String, String>>,
466}
467#[cfg(feature = "redact-generated-debug")]
468impl std::fmt::Debug for UpdateTerminalReaderBuilder {
469    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
470        f.debug_struct("UpdateTerminalReaderBuilder").finish_non_exhaustive()
471    }
472}
473impl UpdateTerminalReaderBuilder {
474    fn new() -> Self {
475        Self { expand: None, label: None, metadata: None }
476    }
477}
478/// Updates a `Reader` object by setting the values of the parameters passed.
479/// Any parameters not provided will be left unchanged.
480#[derive(Clone)]
481#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
482#[derive(serde::Serialize)]
483pub struct UpdateTerminalReader {
484    inner: UpdateTerminalReaderBuilder,
485    reader: stripe_terminal::TerminalReaderId,
486}
487#[cfg(feature = "redact-generated-debug")]
488impl std::fmt::Debug for UpdateTerminalReader {
489    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
490        f.debug_struct("UpdateTerminalReader").finish_non_exhaustive()
491    }
492}
493impl UpdateTerminalReader {
494    /// Construct a new `UpdateTerminalReader`.
495    pub fn new(reader: impl Into<stripe_terminal::TerminalReaderId>) -> Self {
496        Self { reader: reader.into(), inner: UpdateTerminalReaderBuilder::new() }
497    }
498    /// Specifies which fields in the response should be expanded.
499    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
500        self.inner.expand = Some(expand.into());
501        self
502    }
503    /// The new label of the reader.
504    pub fn label(mut self, label: impl Into<String>) -> Self {
505        self.inner.label = Some(label.into());
506        self
507    }
508    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
509    /// This can be useful for storing additional information about the object in a structured format.
510    /// Individual keys can be unset by posting an empty value to them.
511    /// All keys can be unset by posting an empty value to `metadata`.
512    pub fn metadata(
513        mut self,
514        metadata: impl Into<std::collections::HashMap<String, String>>,
515    ) -> Self {
516        self.inner.metadata = Some(metadata.into());
517        self
518    }
519}
520impl UpdateTerminalReader {
521    /// Send the request and return the deserialized response.
522    pub async fn send<C: StripeClient>(
523        &self,
524        client: &C,
525    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
526        self.customize().send(client).await
527    }
528
529    /// Send the request and return the deserialized response, blocking until completion.
530    pub fn send_blocking<C: StripeBlockingClient>(
531        &self,
532        client: &C,
533    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
534        self.customize().send_blocking(client)
535    }
536}
537
538impl StripeRequest for UpdateTerminalReader {
539    type Output = UpdateTerminalReaderReturned;
540
541    fn build(&self) -> RequestBuilder {
542        let reader = &self.reader;
543        RequestBuilder::new(StripeMethod::Post, format!("/terminal/readers/{reader}"))
544            .form(&self.inner)
545    }
546}
547#[derive(Clone)]
548#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
549#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
550#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
551#[cfg_attr(any(feature = "deserialize", feature = "serialize"), serde(untagged))]
552pub enum UpdateTerminalReaderReturned {
553    TerminalReader(stripe_terminal::TerminalReader),
554    DeletedTerminalReader(stripe_terminal::DeletedTerminalReader),
555}
556
557#[derive(Default)]
558pub struct UpdateTerminalReaderReturnedBuilder {
559    inner: stripe_types::miniserde_helpers::MaybeDeletedBuilderInner,
560}
561
562const _: () = {
563    use miniserde::de::{Map, Visitor};
564    use miniserde::json::Value;
565    use miniserde::{Deserialize, Result, make_place};
566    use stripe_types::MapBuilder;
567    use stripe_types::miniserde_helpers::FromValueOpt;
568
569    use super::*;
570
571    make_place!(Place);
572
573    struct Builder<'a> {
574        out: &'a mut Option<UpdateTerminalReaderReturned>,
575        builder: UpdateTerminalReaderReturnedBuilder,
576    }
577
578    impl Deserialize for UpdateTerminalReaderReturned {
579        fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
580            Place::new(out)
581        }
582    }
583
584    impl Visitor for Place<UpdateTerminalReaderReturned> {
585        fn map(&mut self) -> Result<Box<dyn Map + '_>> {
586            Ok(Box::new(Builder { out: &mut self.out, builder: Default::default() }))
587        }
588    }
589
590    impl Map for Builder<'_> {
591        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
592            self.builder.key(k)
593        }
594
595        fn finish(&mut self) -> Result<()> {
596            *self.out = self.builder.take_out();
597            Ok(())
598        }
599    }
600
601    impl MapBuilder for UpdateTerminalReaderReturnedBuilder {
602        type Out = UpdateTerminalReaderReturned;
603        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
604            self.inner.key_inner(k)
605        }
606
607        fn deser_default() -> Self {
608            Self::default()
609        }
610
611        fn take_out(&mut self) -> Option<Self::Out> {
612            let (deleted, o) = self.inner.finish_inner()?;
613            Some(if deleted {
614                UpdateTerminalReaderReturned::DeletedTerminalReader(FromValueOpt::from_value(
615                    Value::Object(o),
616                )?)
617            } else {
618                UpdateTerminalReaderReturned::TerminalReader(FromValueOpt::from_value(
619                    Value::Object(o),
620                )?)
621            })
622        }
623    }
624
625    impl stripe_types::ObjectDeser for UpdateTerminalReaderReturned {
626        type Builder = UpdateTerminalReaderReturnedBuilder;
627    }
628};
629
630#[cfg(feature = "redact-generated-debug")]
631impl std::fmt::Debug for UpdateTerminalReaderReturned {
632    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
633        f.debug_struct("UpdateTerminalReaderReturned").finish_non_exhaustive()
634    }
635}
636#[derive(Clone, Eq, PartialEq)]
637#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
638#[derive(serde::Serialize)]
639struct CancelActionTerminalReaderBuilder {
640    #[serde(skip_serializing_if = "Option::is_none")]
641    expand: Option<Vec<String>>,
642}
643#[cfg(feature = "redact-generated-debug")]
644impl std::fmt::Debug for CancelActionTerminalReaderBuilder {
645    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
646        f.debug_struct("CancelActionTerminalReaderBuilder").finish_non_exhaustive()
647    }
648}
649impl CancelActionTerminalReaderBuilder {
650    fn new() -> Self {
651        Self { expand: None }
652    }
653}
654/// Cancels the current reader action.
655/// See [Programmatic Cancellation](https://stripe.com/docs/terminal/payments/collect-card-payment?terminal-sdk-platform=server-driven#programmatic-cancellation) for more details.
656#[derive(Clone)]
657#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
658#[derive(serde::Serialize)]
659pub struct CancelActionTerminalReader {
660    inner: CancelActionTerminalReaderBuilder,
661    reader: stripe_terminal::TerminalReaderId,
662}
663#[cfg(feature = "redact-generated-debug")]
664impl std::fmt::Debug for CancelActionTerminalReader {
665    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
666        f.debug_struct("CancelActionTerminalReader").finish_non_exhaustive()
667    }
668}
669impl CancelActionTerminalReader {
670    /// Construct a new `CancelActionTerminalReader`.
671    pub fn new(reader: impl Into<stripe_terminal::TerminalReaderId>) -> Self {
672        Self { reader: reader.into(), inner: CancelActionTerminalReaderBuilder::new() }
673    }
674    /// Specifies which fields in the response should be expanded.
675    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
676        self.inner.expand = Some(expand.into());
677        self
678    }
679}
680impl CancelActionTerminalReader {
681    /// Send the request and return the deserialized response.
682    pub async fn send<C: StripeClient>(
683        &self,
684        client: &C,
685    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
686        self.customize().send(client).await
687    }
688
689    /// Send the request and return the deserialized response, blocking until completion.
690    pub fn send_blocking<C: StripeBlockingClient>(
691        &self,
692        client: &C,
693    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
694        self.customize().send_blocking(client)
695    }
696}
697
698impl StripeRequest for CancelActionTerminalReader {
699    type Output = stripe_terminal::TerminalReader;
700
701    fn build(&self) -> RequestBuilder {
702        let reader = &self.reader;
703        RequestBuilder::new(StripeMethod::Post, format!("/terminal/readers/{reader}/cancel_action"))
704            .form(&self.inner)
705    }
706}
707#[derive(Clone)]
708#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
709#[derive(serde::Serialize)]
710struct CollectInputsTerminalReaderBuilder {
711    #[serde(skip_serializing_if = "Option::is_none")]
712    expand: Option<Vec<String>>,
713    inputs: Vec<CollectInputsTerminalReaderInputs>,
714    #[serde(skip_serializing_if = "Option::is_none")]
715    metadata: Option<std::collections::HashMap<String, String>>,
716}
717#[cfg(feature = "redact-generated-debug")]
718impl std::fmt::Debug for CollectInputsTerminalReaderBuilder {
719    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
720        f.debug_struct("CollectInputsTerminalReaderBuilder").finish_non_exhaustive()
721    }
722}
723impl CollectInputsTerminalReaderBuilder {
724    fn new(inputs: impl Into<Vec<CollectInputsTerminalReaderInputs>>) -> Self {
725        Self { expand: None, inputs: inputs.into(), metadata: None }
726    }
727}
728/// List of inputs to be collected from the customer using the Reader. Maximum 5 inputs.
729#[derive(Clone, Eq, PartialEq)]
730#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
731#[derive(serde::Serialize)]
732pub struct CollectInputsTerminalReaderInputs {
733    /// Customize the text which will be displayed while collecting this input
734    pub custom_text: CollectInputsTerminalReaderInputsCustomText,
735    /// Indicate that this input is required, disabling the skip button
736    #[serde(skip_serializing_if = "Option::is_none")]
737    pub required: Option<bool>,
738    /// Options for the `selection` input
739    #[serde(skip_serializing_if = "Option::is_none")]
740    pub selection: Option<CollectInputsTerminalReaderInputsSelection>,
741    /// List of toggles to be displayed and customization for the toggles
742    #[serde(skip_serializing_if = "Option::is_none")]
743    pub toggles: Option<Vec<CollectInputsTerminalReaderInputsToggles>>,
744    /// The type of input to collect
745    #[serde(rename = "type")]
746    pub type_: CollectInputsTerminalReaderInputsType,
747}
748#[cfg(feature = "redact-generated-debug")]
749impl std::fmt::Debug for CollectInputsTerminalReaderInputs {
750    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
751        f.debug_struct("CollectInputsTerminalReaderInputs").finish_non_exhaustive()
752    }
753}
754impl CollectInputsTerminalReaderInputs {
755    pub fn new(
756        custom_text: impl Into<CollectInputsTerminalReaderInputsCustomText>,
757        type_: impl Into<CollectInputsTerminalReaderInputsType>,
758    ) -> Self {
759        Self {
760            custom_text: custom_text.into(),
761            required: None,
762            selection: None,
763            toggles: None,
764            type_: type_.into(),
765        }
766    }
767}
768/// Customize the text which will be displayed while collecting this input
769#[derive(Clone, Eq, PartialEq)]
770#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
771#[derive(serde::Serialize)]
772pub struct CollectInputsTerminalReaderInputsCustomText {
773    /// The description which will be displayed when collecting this input
774    #[serde(skip_serializing_if = "Option::is_none")]
775    pub description: Option<String>,
776    /// Custom text for the skip button. Maximum 14 characters.
777    #[serde(skip_serializing_if = "Option::is_none")]
778    pub skip_button: Option<String>,
779    /// Custom text for the submit button. Maximum 30 characters.
780    #[serde(skip_serializing_if = "Option::is_none")]
781    pub submit_button: Option<String>,
782    /// The title which will be displayed when collecting this input
783    pub title: String,
784}
785#[cfg(feature = "redact-generated-debug")]
786impl std::fmt::Debug for CollectInputsTerminalReaderInputsCustomText {
787    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
788        f.debug_struct("CollectInputsTerminalReaderInputsCustomText").finish_non_exhaustive()
789    }
790}
791impl CollectInputsTerminalReaderInputsCustomText {
792    pub fn new(title: impl Into<String>) -> Self {
793        Self { description: None, skip_button: None, submit_button: None, title: title.into() }
794    }
795}
796/// Options for the `selection` input
797#[derive(Clone, Eq, PartialEq)]
798#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
799#[derive(serde::Serialize)]
800pub struct CollectInputsTerminalReaderInputsSelection {
801    /// List of choices for the `selection` input
802    pub choices: Vec<CollectInputsTerminalReaderInputsSelectionChoices>,
803}
804#[cfg(feature = "redact-generated-debug")]
805impl std::fmt::Debug for CollectInputsTerminalReaderInputsSelection {
806    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
807        f.debug_struct("CollectInputsTerminalReaderInputsSelection").finish_non_exhaustive()
808    }
809}
810impl CollectInputsTerminalReaderInputsSelection {
811    pub fn new(choices: impl Into<Vec<CollectInputsTerminalReaderInputsSelectionChoices>>) -> Self {
812        Self { choices: choices.into() }
813    }
814}
815/// List of choices for the `selection` input
816#[derive(Clone, Eq, PartialEq)]
817#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
818#[derive(serde::Serialize)]
819pub struct CollectInputsTerminalReaderInputsSelectionChoices {
820    /// The unique identifier for this choice
821    pub id: String,
822    /// The style of the button which will be shown for this choice. Can be `primary` or `secondary`.
823    #[serde(skip_serializing_if = "Option::is_none")]
824    pub style: Option<CollectInputsTerminalReaderInputsSelectionChoicesStyle>,
825    /// The text which will be shown on the button for this choice
826    pub text: String,
827}
828#[cfg(feature = "redact-generated-debug")]
829impl std::fmt::Debug for CollectInputsTerminalReaderInputsSelectionChoices {
830    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
831        f.debug_struct("CollectInputsTerminalReaderInputsSelectionChoices").finish_non_exhaustive()
832    }
833}
834impl CollectInputsTerminalReaderInputsSelectionChoices {
835    pub fn new(id: impl Into<String>, text: impl Into<String>) -> Self {
836        Self { id: id.into(), style: None, text: text.into() }
837    }
838}
839/// The style of the button which will be shown for this choice. Can be `primary` or `secondary`.
840#[derive(Clone, Eq, PartialEq)]
841#[non_exhaustive]
842pub enum CollectInputsTerminalReaderInputsSelectionChoicesStyle {
843    Primary,
844    Secondary,
845    /// An unrecognized value from Stripe. Should not be used as a request parameter.
846    Unknown(String),
847}
848impl CollectInputsTerminalReaderInputsSelectionChoicesStyle {
849    pub fn as_str(&self) -> &str {
850        use CollectInputsTerminalReaderInputsSelectionChoicesStyle::*;
851        match self {
852            Primary => "primary",
853            Secondary => "secondary",
854            Unknown(v) => v,
855        }
856    }
857}
858
859impl std::str::FromStr for CollectInputsTerminalReaderInputsSelectionChoicesStyle {
860    type Err = std::convert::Infallible;
861    fn from_str(s: &str) -> Result<Self, Self::Err> {
862        use CollectInputsTerminalReaderInputsSelectionChoicesStyle::*;
863        match s {
864            "primary" => Ok(Primary),
865            "secondary" => Ok(Secondary),
866            v => {
867                tracing::warn!(
868                    "Unknown value '{}' for enum '{}'",
869                    v,
870                    "CollectInputsTerminalReaderInputsSelectionChoicesStyle"
871                );
872                Ok(Unknown(v.to_owned()))
873            }
874        }
875    }
876}
877impl std::fmt::Display for CollectInputsTerminalReaderInputsSelectionChoicesStyle {
878    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
879        f.write_str(self.as_str())
880    }
881}
882
883#[cfg(not(feature = "redact-generated-debug"))]
884impl std::fmt::Debug for CollectInputsTerminalReaderInputsSelectionChoicesStyle {
885    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
886        f.write_str(self.as_str())
887    }
888}
889#[cfg(feature = "redact-generated-debug")]
890impl std::fmt::Debug for CollectInputsTerminalReaderInputsSelectionChoicesStyle {
891    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
892        f.debug_struct(stringify!(CollectInputsTerminalReaderInputsSelectionChoicesStyle))
893            .finish_non_exhaustive()
894    }
895}
896impl serde::Serialize for CollectInputsTerminalReaderInputsSelectionChoicesStyle {
897    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
898    where
899        S: serde::Serializer,
900    {
901        serializer.serialize_str(self.as_str())
902    }
903}
904#[cfg(feature = "deserialize")]
905impl<'de> serde::Deserialize<'de> for CollectInputsTerminalReaderInputsSelectionChoicesStyle {
906    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
907        use std::str::FromStr;
908        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
909        Ok(Self::from_str(&s).expect("infallible"))
910    }
911}
912/// List of toggles to be displayed and customization for the toggles
913#[derive(Clone, Eq, PartialEq)]
914#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
915#[derive(serde::Serialize)]
916pub struct CollectInputsTerminalReaderInputsToggles {
917    /// The default value of the toggle. Can be `enabled` or `disabled`.
918    #[serde(skip_serializing_if = "Option::is_none")]
919    pub default_value: Option<CollectInputsTerminalReaderInputsTogglesDefaultValue>,
920    /// The description which will be displayed for the toggle.
921    /// Maximum 50 characters.
922    /// At least one of title or description must be provided.
923    #[serde(skip_serializing_if = "Option::is_none")]
924    pub description: Option<String>,
925    /// The title which will be displayed for the toggle.
926    /// Maximum 50 characters.
927    /// At least one of title or description must be provided.
928    #[serde(skip_serializing_if = "Option::is_none")]
929    pub title: Option<String>,
930}
931#[cfg(feature = "redact-generated-debug")]
932impl std::fmt::Debug for CollectInputsTerminalReaderInputsToggles {
933    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
934        f.debug_struct("CollectInputsTerminalReaderInputsToggles").finish_non_exhaustive()
935    }
936}
937impl CollectInputsTerminalReaderInputsToggles {
938    pub fn new() -> Self {
939        Self { default_value: None, description: None, title: None }
940    }
941}
942impl Default for CollectInputsTerminalReaderInputsToggles {
943    fn default() -> Self {
944        Self::new()
945    }
946}
947/// The default value of the toggle. Can be `enabled` or `disabled`.
948#[derive(Clone, Eq, PartialEq)]
949#[non_exhaustive]
950pub enum CollectInputsTerminalReaderInputsTogglesDefaultValue {
951    Disabled,
952    Enabled,
953    /// An unrecognized value from Stripe. Should not be used as a request parameter.
954    Unknown(String),
955}
956impl CollectInputsTerminalReaderInputsTogglesDefaultValue {
957    pub fn as_str(&self) -> &str {
958        use CollectInputsTerminalReaderInputsTogglesDefaultValue::*;
959        match self {
960            Disabled => "disabled",
961            Enabled => "enabled",
962            Unknown(v) => v,
963        }
964    }
965}
966
967impl std::str::FromStr for CollectInputsTerminalReaderInputsTogglesDefaultValue {
968    type Err = std::convert::Infallible;
969    fn from_str(s: &str) -> Result<Self, Self::Err> {
970        use CollectInputsTerminalReaderInputsTogglesDefaultValue::*;
971        match s {
972            "disabled" => Ok(Disabled),
973            "enabled" => Ok(Enabled),
974            v => {
975                tracing::warn!(
976                    "Unknown value '{}' for enum '{}'",
977                    v,
978                    "CollectInputsTerminalReaderInputsTogglesDefaultValue"
979                );
980                Ok(Unknown(v.to_owned()))
981            }
982        }
983    }
984}
985impl std::fmt::Display for CollectInputsTerminalReaderInputsTogglesDefaultValue {
986    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
987        f.write_str(self.as_str())
988    }
989}
990
991#[cfg(not(feature = "redact-generated-debug"))]
992impl std::fmt::Debug for CollectInputsTerminalReaderInputsTogglesDefaultValue {
993    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
994        f.write_str(self.as_str())
995    }
996}
997#[cfg(feature = "redact-generated-debug")]
998impl std::fmt::Debug for CollectInputsTerminalReaderInputsTogglesDefaultValue {
999    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1000        f.debug_struct(stringify!(CollectInputsTerminalReaderInputsTogglesDefaultValue))
1001            .finish_non_exhaustive()
1002    }
1003}
1004impl serde::Serialize for CollectInputsTerminalReaderInputsTogglesDefaultValue {
1005    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1006    where
1007        S: serde::Serializer,
1008    {
1009        serializer.serialize_str(self.as_str())
1010    }
1011}
1012#[cfg(feature = "deserialize")]
1013impl<'de> serde::Deserialize<'de> for CollectInputsTerminalReaderInputsTogglesDefaultValue {
1014    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1015        use std::str::FromStr;
1016        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1017        Ok(Self::from_str(&s).expect("infallible"))
1018    }
1019}
1020/// The type of input to collect
1021#[derive(Clone, Eq, PartialEq)]
1022#[non_exhaustive]
1023pub enum CollectInputsTerminalReaderInputsType {
1024    Email,
1025    Numeric,
1026    Phone,
1027    Selection,
1028    Signature,
1029    Text,
1030    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1031    Unknown(String),
1032}
1033impl CollectInputsTerminalReaderInputsType {
1034    pub fn as_str(&self) -> &str {
1035        use CollectInputsTerminalReaderInputsType::*;
1036        match self {
1037            Email => "email",
1038            Numeric => "numeric",
1039            Phone => "phone",
1040            Selection => "selection",
1041            Signature => "signature",
1042            Text => "text",
1043            Unknown(v) => v,
1044        }
1045    }
1046}
1047
1048impl std::str::FromStr for CollectInputsTerminalReaderInputsType {
1049    type Err = std::convert::Infallible;
1050    fn from_str(s: &str) -> Result<Self, Self::Err> {
1051        use CollectInputsTerminalReaderInputsType::*;
1052        match s {
1053            "email" => Ok(Email),
1054            "numeric" => Ok(Numeric),
1055            "phone" => Ok(Phone),
1056            "selection" => Ok(Selection),
1057            "signature" => Ok(Signature),
1058            "text" => Ok(Text),
1059            v => {
1060                tracing::warn!(
1061                    "Unknown value '{}' for enum '{}'",
1062                    v,
1063                    "CollectInputsTerminalReaderInputsType"
1064                );
1065                Ok(Unknown(v.to_owned()))
1066            }
1067        }
1068    }
1069}
1070impl std::fmt::Display for CollectInputsTerminalReaderInputsType {
1071    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1072        f.write_str(self.as_str())
1073    }
1074}
1075
1076#[cfg(not(feature = "redact-generated-debug"))]
1077impl std::fmt::Debug for CollectInputsTerminalReaderInputsType {
1078    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1079        f.write_str(self.as_str())
1080    }
1081}
1082#[cfg(feature = "redact-generated-debug")]
1083impl std::fmt::Debug for CollectInputsTerminalReaderInputsType {
1084    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1085        f.debug_struct(stringify!(CollectInputsTerminalReaderInputsType)).finish_non_exhaustive()
1086    }
1087}
1088impl serde::Serialize for CollectInputsTerminalReaderInputsType {
1089    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1090    where
1091        S: serde::Serializer,
1092    {
1093        serializer.serialize_str(self.as_str())
1094    }
1095}
1096#[cfg(feature = "deserialize")]
1097impl<'de> serde::Deserialize<'de> for CollectInputsTerminalReaderInputsType {
1098    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1099        use std::str::FromStr;
1100        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1101        Ok(Self::from_str(&s).expect("infallible"))
1102    }
1103}
1104/// Initiates an [input collection flow](https://stripe.com/docs/terminal/features/collect-inputs) on a Reader to display input forms and collect information from your customers.
1105#[derive(Clone)]
1106#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1107#[derive(serde::Serialize)]
1108pub struct CollectInputsTerminalReader {
1109    inner: CollectInputsTerminalReaderBuilder,
1110    reader: stripe_terminal::TerminalReaderId,
1111}
1112#[cfg(feature = "redact-generated-debug")]
1113impl std::fmt::Debug for CollectInputsTerminalReader {
1114    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1115        f.debug_struct("CollectInputsTerminalReader").finish_non_exhaustive()
1116    }
1117}
1118impl CollectInputsTerminalReader {
1119    /// Construct a new `CollectInputsTerminalReader`.
1120    pub fn new(
1121        reader: impl Into<stripe_terminal::TerminalReaderId>,
1122        inputs: impl Into<Vec<CollectInputsTerminalReaderInputs>>,
1123    ) -> Self {
1124        Self {
1125            reader: reader.into(),
1126            inner: CollectInputsTerminalReaderBuilder::new(inputs.into()),
1127        }
1128    }
1129    /// Specifies which fields in the response should be expanded.
1130    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
1131        self.inner.expand = Some(expand.into());
1132        self
1133    }
1134    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
1135    /// This can be useful for storing additional information about the object in a structured format.
1136    /// Individual keys can be unset by posting an empty value to them.
1137    /// All keys can be unset by posting an empty value to `metadata`.
1138    pub fn metadata(
1139        mut self,
1140        metadata: impl Into<std::collections::HashMap<String, String>>,
1141    ) -> Self {
1142        self.inner.metadata = Some(metadata.into());
1143        self
1144    }
1145}
1146impl CollectInputsTerminalReader {
1147    /// Send the request and return the deserialized response.
1148    pub async fn send<C: StripeClient>(
1149        &self,
1150        client: &C,
1151    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1152        self.customize().send(client).await
1153    }
1154
1155    /// Send the request and return the deserialized response, blocking until completion.
1156    pub fn send_blocking<C: StripeBlockingClient>(
1157        &self,
1158        client: &C,
1159    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1160        self.customize().send_blocking(client)
1161    }
1162}
1163
1164impl StripeRequest for CollectInputsTerminalReader {
1165    type Output = stripe_terminal::TerminalReader;
1166
1167    fn build(&self) -> RequestBuilder {
1168        let reader = &self.reader;
1169        RequestBuilder::new(
1170            StripeMethod::Post,
1171            format!("/terminal/readers/{reader}/collect_inputs"),
1172        )
1173        .form(&self.inner)
1174    }
1175}
1176#[derive(Clone, Eq, PartialEq)]
1177#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1178#[derive(serde::Serialize)]
1179struct CollectPaymentMethodTerminalReaderBuilder {
1180    #[serde(skip_serializing_if = "Option::is_none")]
1181    collect_config: Option<CollectPaymentMethodTerminalReaderCollectConfig>,
1182    #[serde(skip_serializing_if = "Option::is_none")]
1183    expand: Option<Vec<String>>,
1184    payment_intent: String,
1185}
1186#[cfg(feature = "redact-generated-debug")]
1187impl std::fmt::Debug for CollectPaymentMethodTerminalReaderBuilder {
1188    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1189        f.debug_struct("CollectPaymentMethodTerminalReaderBuilder").finish_non_exhaustive()
1190    }
1191}
1192impl CollectPaymentMethodTerminalReaderBuilder {
1193    fn new(payment_intent: impl Into<String>) -> Self {
1194        Self { collect_config: None, expand: None, payment_intent: payment_intent.into() }
1195    }
1196}
1197/// Configuration overrides for this collection, such as tipping, surcharging, and customer cancellation settings.
1198#[derive(Clone, Eq, PartialEq)]
1199#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1200#[derive(serde::Serialize)]
1201pub struct CollectPaymentMethodTerminalReaderCollectConfig {
1202    /// This field indicates whether this payment method can be shown again to its customer in a checkout flow.
1203    /// Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.
1204    #[serde(skip_serializing_if = "Option::is_none")]
1205    pub allow_redisplay: Option<CollectPaymentMethodTerminalReaderCollectConfigAllowRedisplay>,
1206    /// Enables cancel button on transaction screens.
1207    #[serde(skip_serializing_if = "Option::is_none")]
1208    pub enable_customer_cancellation: Option<bool>,
1209    /// Override showing a tipping selection screen on this transaction.
1210    #[serde(skip_serializing_if = "Option::is_none")]
1211    pub skip_tipping: Option<bool>,
1212    /// Tipping configuration for this transaction.
1213    #[serde(skip_serializing_if = "Option::is_none")]
1214    pub tipping: Option<TippingConfig>,
1215}
1216#[cfg(feature = "redact-generated-debug")]
1217impl std::fmt::Debug for CollectPaymentMethodTerminalReaderCollectConfig {
1218    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1219        f.debug_struct("CollectPaymentMethodTerminalReaderCollectConfig").finish_non_exhaustive()
1220    }
1221}
1222impl CollectPaymentMethodTerminalReaderCollectConfig {
1223    pub fn new() -> Self {
1224        Self {
1225            allow_redisplay: None,
1226            enable_customer_cancellation: None,
1227            skip_tipping: None,
1228            tipping: None,
1229        }
1230    }
1231}
1232impl Default for CollectPaymentMethodTerminalReaderCollectConfig {
1233    fn default() -> Self {
1234        Self::new()
1235    }
1236}
1237/// This field indicates whether this payment method can be shown again to its customer in a checkout flow.
1238/// Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.
1239#[derive(Clone, Eq, PartialEq)]
1240#[non_exhaustive]
1241pub enum CollectPaymentMethodTerminalReaderCollectConfigAllowRedisplay {
1242    Always,
1243    Limited,
1244    Unspecified,
1245    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1246    Unknown(String),
1247}
1248impl CollectPaymentMethodTerminalReaderCollectConfigAllowRedisplay {
1249    pub fn as_str(&self) -> &str {
1250        use CollectPaymentMethodTerminalReaderCollectConfigAllowRedisplay::*;
1251        match self {
1252            Always => "always",
1253            Limited => "limited",
1254            Unspecified => "unspecified",
1255            Unknown(v) => v,
1256        }
1257    }
1258}
1259
1260impl std::str::FromStr for CollectPaymentMethodTerminalReaderCollectConfigAllowRedisplay {
1261    type Err = std::convert::Infallible;
1262    fn from_str(s: &str) -> Result<Self, Self::Err> {
1263        use CollectPaymentMethodTerminalReaderCollectConfigAllowRedisplay::*;
1264        match s {
1265            "always" => Ok(Always),
1266            "limited" => Ok(Limited),
1267            "unspecified" => Ok(Unspecified),
1268            v => {
1269                tracing::warn!(
1270                    "Unknown value '{}' for enum '{}'",
1271                    v,
1272                    "CollectPaymentMethodTerminalReaderCollectConfigAllowRedisplay"
1273                );
1274                Ok(Unknown(v.to_owned()))
1275            }
1276        }
1277    }
1278}
1279impl std::fmt::Display for CollectPaymentMethodTerminalReaderCollectConfigAllowRedisplay {
1280    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1281        f.write_str(self.as_str())
1282    }
1283}
1284
1285#[cfg(not(feature = "redact-generated-debug"))]
1286impl std::fmt::Debug for CollectPaymentMethodTerminalReaderCollectConfigAllowRedisplay {
1287    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1288        f.write_str(self.as_str())
1289    }
1290}
1291#[cfg(feature = "redact-generated-debug")]
1292impl std::fmt::Debug for CollectPaymentMethodTerminalReaderCollectConfigAllowRedisplay {
1293    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1294        f.debug_struct(stringify!(CollectPaymentMethodTerminalReaderCollectConfigAllowRedisplay))
1295            .finish_non_exhaustive()
1296    }
1297}
1298impl serde::Serialize for CollectPaymentMethodTerminalReaderCollectConfigAllowRedisplay {
1299    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1300    where
1301        S: serde::Serializer,
1302    {
1303        serializer.serialize_str(self.as_str())
1304    }
1305}
1306#[cfg(feature = "deserialize")]
1307impl<'de> serde::Deserialize<'de>
1308    for CollectPaymentMethodTerminalReaderCollectConfigAllowRedisplay
1309{
1310    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1311        use std::str::FromStr;
1312        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1313        Ok(Self::from_str(&s).expect("infallible"))
1314    }
1315}
1316/// Initiates a payment flow on a Reader and updates the PaymentIntent with card details before manual confirmation.
1317/// See [Collecting a Payment method](https://stripe.com/docs/terminal/payments/collect-card-payment?terminal-sdk-platform=server-driven&process=inspect#collect-a-paymentmethod) for more details.
1318#[derive(Clone)]
1319#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1320#[derive(serde::Serialize)]
1321pub struct CollectPaymentMethodTerminalReader {
1322    inner: CollectPaymentMethodTerminalReaderBuilder,
1323    reader: stripe_terminal::TerminalReaderId,
1324}
1325#[cfg(feature = "redact-generated-debug")]
1326impl std::fmt::Debug for CollectPaymentMethodTerminalReader {
1327    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1328        f.debug_struct("CollectPaymentMethodTerminalReader").finish_non_exhaustive()
1329    }
1330}
1331impl CollectPaymentMethodTerminalReader {
1332    /// Construct a new `CollectPaymentMethodTerminalReader`.
1333    pub fn new(
1334        reader: impl Into<stripe_terminal::TerminalReaderId>,
1335        payment_intent: impl Into<String>,
1336    ) -> Self {
1337        Self {
1338            reader: reader.into(),
1339            inner: CollectPaymentMethodTerminalReaderBuilder::new(payment_intent.into()),
1340        }
1341    }
1342    /// Configuration overrides for this collection, such as tipping, surcharging, and customer cancellation settings.
1343    pub fn collect_config(
1344        mut self,
1345        collect_config: impl Into<CollectPaymentMethodTerminalReaderCollectConfig>,
1346    ) -> Self {
1347        self.inner.collect_config = Some(collect_config.into());
1348        self
1349    }
1350    /// Specifies which fields in the response should be expanded.
1351    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
1352        self.inner.expand = Some(expand.into());
1353        self
1354    }
1355}
1356impl CollectPaymentMethodTerminalReader {
1357    /// Send the request and return the deserialized response.
1358    pub async fn send<C: StripeClient>(
1359        &self,
1360        client: &C,
1361    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1362        self.customize().send(client).await
1363    }
1364
1365    /// Send the request and return the deserialized response, blocking until completion.
1366    pub fn send_blocking<C: StripeBlockingClient>(
1367        &self,
1368        client: &C,
1369    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1370        self.customize().send_blocking(client)
1371    }
1372}
1373
1374impl StripeRequest for CollectPaymentMethodTerminalReader {
1375    type Output = stripe_terminal::TerminalReader;
1376
1377    fn build(&self) -> RequestBuilder {
1378        let reader = &self.reader;
1379        RequestBuilder::new(
1380            StripeMethod::Post,
1381            format!("/terminal/readers/{reader}/collect_payment_method"),
1382        )
1383        .form(&self.inner)
1384    }
1385}
1386#[derive(Clone, Eq, PartialEq)]
1387#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1388#[derive(serde::Serialize)]
1389struct ConfirmPaymentIntentTerminalReaderBuilder {
1390    #[serde(skip_serializing_if = "Option::is_none")]
1391    confirm_config: Option<ConfirmPaymentIntentTerminalReaderConfirmConfig>,
1392    #[serde(skip_serializing_if = "Option::is_none")]
1393    expand: Option<Vec<String>>,
1394    payment_intent: String,
1395}
1396#[cfg(feature = "redact-generated-debug")]
1397impl std::fmt::Debug for ConfirmPaymentIntentTerminalReaderBuilder {
1398    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1399        f.debug_struct("ConfirmPaymentIntentTerminalReaderBuilder").finish_non_exhaustive()
1400    }
1401}
1402impl ConfirmPaymentIntentTerminalReaderBuilder {
1403    fn new(payment_intent: impl Into<String>) -> Self {
1404        Self { confirm_config: None, expand: None, payment_intent: payment_intent.into() }
1405    }
1406}
1407/// Configuration overrides for this confirmation, such as surcharge settings and return URL.
1408#[derive(Clone, Eq, PartialEq)]
1409#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1410#[derive(serde::Serialize)]
1411pub struct ConfirmPaymentIntentTerminalReaderConfirmConfig {
1412    /// The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site.
1413    /// If you'd prefer to redirect to a mobile application, you can alternatively supply an application URI scheme.
1414    #[serde(skip_serializing_if = "Option::is_none")]
1415    pub return_url: Option<String>,
1416}
1417#[cfg(feature = "redact-generated-debug")]
1418impl std::fmt::Debug for ConfirmPaymentIntentTerminalReaderConfirmConfig {
1419    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1420        f.debug_struct("ConfirmPaymentIntentTerminalReaderConfirmConfig").finish_non_exhaustive()
1421    }
1422}
1423impl ConfirmPaymentIntentTerminalReaderConfirmConfig {
1424    pub fn new() -> Self {
1425        Self { return_url: None }
1426    }
1427}
1428impl Default for ConfirmPaymentIntentTerminalReaderConfirmConfig {
1429    fn default() -> Self {
1430        Self::new()
1431    }
1432}
1433/// Finalizes a payment on a Reader.
1434/// See [Confirming a Payment](https://stripe.com/docs/terminal/payments/collect-card-payment?terminal-sdk-platform=server-driven&process=inspect#confirm-the-paymentintent) for more details.
1435#[derive(Clone)]
1436#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1437#[derive(serde::Serialize)]
1438pub struct ConfirmPaymentIntentTerminalReader {
1439    inner: ConfirmPaymentIntentTerminalReaderBuilder,
1440    reader: stripe_terminal::TerminalReaderId,
1441}
1442#[cfg(feature = "redact-generated-debug")]
1443impl std::fmt::Debug for ConfirmPaymentIntentTerminalReader {
1444    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1445        f.debug_struct("ConfirmPaymentIntentTerminalReader").finish_non_exhaustive()
1446    }
1447}
1448impl ConfirmPaymentIntentTerminalReader {
1449    /// Construct a new `ConfirmPaymentIntentTerminalReader`.
1450    pub fn new(
1451        reader: impl Into<stripe_terminal::TerminalReaderId>,
1452        payment_intent: impl Into<String>,
1453    ) -> Self {
1454        Self {
1455            reader: reader.into(),
1456            inner: ConfirmPaymentIntentTerminalReaderBuilder::new(payment_intent.into()),
1457        }
1458    }
1459    /// Configuration overrides for this confirmation, such as surcharge settings and return URL.
1460    pub fn confirm_config(
1461        mut self,
1462        confirm_config: impl Into<ConfirmPaymentIntentTerminalReaderConfirmConfig>,
1463    ) -> Self {
1464        self.inner.confirm_config = Some(confirm_config.into());
1465        self
1466    }
1467    /// Specifies which fields in the response should be expanded.
1468    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
1469        self.inner.expand = Some(expand.into());
1470        self
1471    }
1472}
1473impl ConfirmPaymentIntentTerminalReader {
1474    /// Send the request and return the deserialized response.
1475    pub async fn send<C: StripeClient>(
1476        &self,
1477        client: &C,
1478    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1479        self.customize().send(client).await
1480    }
1481
1482    /// Send the request and return the deserialized response, blocking until completion.
1483    pub fn send_blocking<C: StripeBlockingClient>(
1484        &self,
1485        client: &C,
1486    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1487        self.customize().send_blocking(client)
1488    }
1489}
1490
1491impl StripeRequest for ConfirmPaymentIntentTerminalReader {
1492    type Output = stripe_terminal::TerminalReader;
1493
1494    fn build(&self) -> RequestBuilder {
1495        let reader = &self.reader;
1496        RequestBuilder::new(
1497            StripeMethod::Post,
1498            format!("/terminal/readers/{reader}/confirm_payment_intent"),
1499        )
1500        .form(&self.inner)
1501    }
1502}
1503#[derive(Clone, Eq, PartialEq)]
1504#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1505#[derive(serde::Serialize)]
1506struct ProcessPaymentIntentTerminalReaderBuilder {
1507    #[serde(skip_serializing_if = "Option::is_none")]
1508    expand: Option<Vec<String>>,
1509    payment_intent: String,
1510    #[serde(skip_serializing_if = "Option::is_none")]
1511    process_config: Option<ProcessPaymentIntentTerminalReaderProcessConfig>,
1512}
1513#[cfg(feature = "redact-generated-debug")]
1514impl std::fmt::Debug for ProcessPaymentIntentTerminalReaderBuilder {
1515    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1516        f.debug_struct("ProcessPaymentIntentTerminalReaderBuilder").finish_non_exhaustive()
1517    }
1518}
1519impl ProcessPaymentIntentTerminalReaderBuilder {
1520    fn new(payment_intent: impl Into<String>) -> Self {
1521        Self { expand: None, payment_intent: payment_intent.into(), process_config: None }
1522    }
1523}
1524/// Configuration overrides for this transaction, such as tipping and customer cancellation settings.
1525#[derive(Clone, Eq, PartialEq)]
1526#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1527#[derive(serde::Serialize)]
1528pub struct ProcessPaymentIntentTerminalReaderProcessConfig {
1529    /// This field indicates whether this payment method can be shown again to its customer in a checkout flow.
1530    /// Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.
1531    #[serde(skip_serializing_if = "Option::is_none")]
1532    pub allow_redisplay: Option<ProcessPaymentIntentTerminalReaderProcessConfigAllowRedisplay>,
1533    /// Enables cancel button on transaction screens.
1534    #[serde(skip_serializing_if = "Option::is_none")]
1535    pub enable_customer_cancellation: Option<bool>,
1536    /// The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site.
1537    /// If you'd prefer to redirect to a mobile application, you can alternatively supply an application URI scheme.
1538    #[serde(skip_serializing_if = "Option::is_none")]
1539    pub return_url: Option<String>,
1540    /// Override showing a tipping selection screen on this transaction.
1541    #[serde(skip_serializing_if = "Option::is_none")]
1542    pub skip_tipping: Option<bool>,
1543    /// Tipping configuration for this transaction.
1544    #[serde(skip_serializing_if = "Option::is_none")]
1545    pub tipping: Option<TippingConfig>,
1546}
1547#[cfg(feature = "redact-generated-debug")]
1548impl std::fmt::Debug for ProcessPaymentIntentTerminalReaderProcessConfig {
1549    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1550        f.debug_struct("ProcessPaymentIntentTerminalReaderProcessConfig").finish_non_exhaustive()
1551    }
1552}
1553impl ProcessPaymentIntentTerminalReaderProcessConfig {
1554    pub fn new() -> Self {
1555        Self {
1556            allow_redisplay: None,
1557            enable_customer_cancellation: None,
1558            return_url: None,
1559            skip_tipping: None,
1560            tipping: None,
1561        }
1562    }
1563}
1564impl Default for ProcessPaymentIntentTerminalReaderProcessConfig {
1565    fn default() -> Self {
1566        Self::new()
1567    }
1568}
1569/// This field indicates whether this payment method can be shown again to its customer in a checkout flow.
1570/// Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.
1571#[derive(Clone, Eq, PartialEq)]
1572#[non_exhaustive]
1573pub enum ProcessPaymentIntentTerminalReaderProcessConfigAllowRedisplay {
1574    Always,
1575    Limited,
1576    Unspecified,
1577    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1578    Unknown(String),
1579}
1580impl ProcessPaymentIntentTerminalReaderProcessConfigAllowRedisplay {
1581    pub fn as_str(&self) -> &str {
1582        use ProcessPaymentIntentTerminalReaderProcessConfigAllowRedisplay::*;
1583        match self {
1584            Always => "always",
1585            Limited => "limited",
1586            Unspecified => "unspecified",
1587            Unknown(v) => v,
1588        }
1589    }
1590}
1591
1592impl std::str::FromStr for ProcessPaymentIntentTerminalReaderProcessConfigAllowRedisplay {
1593    type Err = std::convert::Infallible;
1594    fn from_str(s: &str) -> Result<Self, Self::Err> {
1595        use ProcessPaymentIntentTerminalReaderProcessConfigAllowRedisplay::*;
1596        match s {
1597            "always" => Ok(Always),
1598            "limited" => Ok(Limited),
1599            "unspecified" => Ok(Unspecified),
1600            v => {
1601                tracing::warn!(
1602                    "Unknown value '{}' for enum '{}'",
1603                    v,
1604                    "ProcessPaymentIntentTerminalReaderProcessConfigAllowRedisplay"
1605                );
1606                Ok(Unknown(v.to_owned()))
1607            }
1608        }
1609    }
1610}
1611impl std::fmt::Display for ProcessPaymentIntentTerminalReaderProcessConfigAllowRedisplay {
1612    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1613        f.write_str(self.as_str())
1614    }
1615}
1616
1617#[cfg(not(feature = "redact-generated-debug"))]
1618impl std::fmt::Debug for ProcessPaymentIntentTerminalReaderProcessConfigAllowRedisplay {
1619    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1620        f.write_str(self.as_str())
1621    }
1622}
1623#[cfg(feature = "redact-generated-debug")]
1624impl std::fmt::Debug for ProcessPaymentIntentTerminalReaderProcessConfigAllowRedisplay {
1625    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1626        f.debug_struct(stringify!(ProcessPaymentIntentTerminalReaderProcessConfigAllowRedisplay))
1627            .finish_non_exhaustive()
1628    }
1629}
1630impl serde::Serialize for ProcessPaymentIntentTerminalReaderProcessConfigAllowRedisplay {
1631    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1632    where
1633        S: serde::Serializer,
1634    {
1635        serializer.serialize_str(self.as_str())
1636    }
1637}
1638#[cfg(feature = "deserialize")]
1639impl<'de> serde::Deserialize<'de>
1640    for ProcessPaymentIntentTerminalReaderProcessConfigAllowRedisplay
1641{
1642    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1643        use std::str::FromStr;
1644        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1645        Ok(Self::from_str(&s).expect("infallible"))
1646    }
1647}
1648/// Initiates a payment flow on a Reader.
1649/// See [process the payment](https://stripe.com/docs/terminal/payments/collect-card-payment?terminal-sdk-platform=server-driven&process=immediately#process-payment) for more details.
1650#[derive(Clone)]
1651#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1652#[derive(serde::Serialize)]
1653pub struct ProcessPaymentIntentTerminalReader {
1654    inner: ProcessPaymentIntentTerminalReaderBuilder,
1655    reader: stripe_terminal::TerminalReaderId,
1656}
1657#[cfg(feature = "redact-generated-debug")]
1658impl std::fmt::Debug for ProcessPaymentIntentTerminalReader {
1659    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1660        f.debug_struct("ProcessPaymentIntentTerminalReader").finish_non_exhaustive()
1661    }
1662}
1663impl ProcessPaymentIntentTerminalReader {
1664    /// Construct a new `ProcessPaymentIntentTerminalReader`.
1665    pub fn new(
1666        reader: impl Into<stripe_terminal::TerminalReaderId>,
1667        payment_intent: impl Into<String>,
1668    ) -> Self {
1669        Self {
1670            reader: reader.into(),
1671            inner: ProcessPaymentIntentTerminalReaderBuilder::new(payment_intent.into()),
1672        }
1673    }
1674    /// Specifies which fields in the response should be expanded.
1675    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
1676        self.inner.expand = Some(expand.into());
1677        self
1678    }
1679    /// Configuration overrides for this transaction, such as tipping and customer cancellation settings.
1680    pub fn process_config(
1681        mut self,
1682        process_config: impl Into<ProcessPaymentIntentTerminalReaderProcessConfig>,
1683    ) -> Self {
1684        self.inner.process_config = Some(process_config.into());
1685        self
1686    }
1687}
1688impl ProcessPaymentIntentTerminalReader {
1689    /// Send the request and return the deserialized response.
1690    pub async fn send<C: StripeClient>(
1691        &self,
1692        client: &C,
1693    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1694        self.customize().send(client).await
1695    }
1696
1697    /// Send the request and return the deserialized response, blocking until completion.
1698    pub fn send_blocking<C: StripeBlockingClient>(
1699        &self,
1700        client: &C,
1701    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1702        self.customize().send_blocking(client)
1703    }
1704}
1705
1706impl StripeRequest for ProcessPaymentIntentTerminalReader {
1707    type Output = stripe_terminal::TerminalReader;
1708
1709    fn build(&self) -> RequestBuilder {
1710        let reader = &self.reader;
1711        RequestBuilder::new(
1712            StripeMethod::Post,
1713            format!("/terminal/readers/{reader}/process_payment_intent"),
1714        )
1715        .form(&self.inner)
1716    }
1717}
1718#[derive(Clone, Eq, PartialEq)]
1719#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1720#[derive(serde::Serialize)]
1721struct ProcessSetupIntentTerminalReaderBuilder {
1722    allow_redisplay: ProcessSetupIntentTerminalReaderAllowRedisplay,
1723    #[serde(skip_serializing_if = "Option::is_none")]
1724    expand: Option<Vec<String>>,
1725    #[serde(skip_serializing_if = "Option::is_none")]
1726    process_config: Option<ProcessSetupIntentTerminalReaderProcessConfig>,
1727    setup_intent: String,
1728}
1729#[cfg(feature = "redact-generated-debug")]
1730impl std::fmt::Debug for ProcessSetupIntentTerminalReaderBuilder {
1731    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1732        f.debug_struct("ProcessSetupIntentTerminalReaderBuilder").finish_non_exhaustive()
1733    }
1734}
1735impl ProcessSetupIntentTerminalReaderBuilder {
1736    fn new(
1737        allow_redisplay: impl Into<ProcessSetupIntentTerminalReaderAllowRedisplay>,
1738        setup_intent: impl Into<String>,
1739    ) -> Self {
1740        Self {
1741            allow_redisplay: allow_redisplay.into(),
1742            expand: None,
1743            process_config: None,
1744            setup_intent: setup_intent.into(),
1745        }
1746    }
1747}
1748/// This field indicates whether this payment method can be shown again to its customer in a checkout flow.
1749/// Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.
1750#[derive(Clone, Eq, PartialEq)]
1751#[non_exhaustive]
1752pub enum ProcessSetupIntentTerminalReaderAllowRedisplay {
1753    Always,
1754    Limited,
1755    Unspecified,
1756    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1757    Unknown(String),
1758}
1759impl ProcessSetupIntentTerminalReaderAllowRedisplay {
1760    pub fn as_str(&self) -> &str {
1761        use ProcessSetupIntentTerminalReaderAllowRedisplay::*;
1762        match self {
1763            Always => "always",
1764            Limited => "limited",
1765            Unspecified => "unspecified",
1766            Unknown(v) => v,
1767        }
1768    }
1769}
1770
1771impl std::str::FromStr for ProcessSetupIntentTerminalReaderAllowRedisplay {
1772    type Err = std::convert::Infallible;
1773    fn from_str(s: &str) -> Result<Self, Self::Err> {
1774        use ProcessSetupIntentTerminalReaderAllowRedisplay::*;
1775        match s {
1776            "always" => Ok(Always),
1777            "limited" => Ok(Limited),
1778            "unspecified" => Ok(Unspecified),
1779            v => {
1780                tracing::warn!(
1781                    "Unknown value '{}' for enum '{}'",
1782                    v,
1783                    "ProcessSetupIntentTerminalReaderAllowRedisplay"
1784                );
1785                Ok(Unknown(v.to_owned()))
1786            }
1787        }
1788    }
1789}
1790impl std::fmt::Display for ProcessSetupIntentTerminalReaderAllowRedisplay {
1791    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1792        f.write_str(self.as_str())
1793    }
1794}
1795
1796#[cfg(not(feature = "redact-generated-debug"))]
1797impl std::fmt::Debug for ProcessSetupIntentTerminalReaderAllowRedisplay {
1798    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1799        f.write_str(self.as_str())
1800    }
1801}
1802#[cfg(feature = "redact-generated-debug")]
1803impl std::fmt::Debug for ProcessSetupIntentTerminalReaderAllowRedisplay {
1804    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1805        f.debug_struct(stringify!(ProcessSetupIntentTerminalReaderAllowRedisplay))
1806            .finish_non_exhaustive()
1807    }
1808}
1809impl serde::Serialize for ProcessSetupIntentTerminalReaderAllowRedisplay {
1810    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1811    where
1812        S: serde::Serializer,
1813    {
1814        serializer.serialize_str(self.as_str())
1815    }
1816}
1817#[cfg(feature = "deserialize")]
1818impl<'de> serde::Deserialize<'de> for ProcessSetupIntentTerminalReaderAllowRedisplay {
1819    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1820        use std::str::FromStr;
1821        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1822        Ok(Self::from_str(&s).expect("infallible"))
1823    }
1824}
1825/// Configuration overrides for this setup, such as MOTO and customer cancellation settings.
1826#[derive(Copy, Clone, Eq, PartialEq)]
1827#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1828#[derive(serde::Serialize)]
1829pub struct ProcessSetupIntentTerminalReaderProcessConfig {
1830    /// Enables cancel button on transaction screens.
1831    #[serde(skip_serializing_if = "Option::is_none")]
1832    pub enable_customer_cancellation: Option<bool>,
1833}
1834#[cfg(feature = "redact-generated-debug")]
1835impl std::fmt::Debug for ProcessSetupIntentTerminalReaderProcessConfig {
1836    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1837        f.debug_struct("ProcessSetupIntentTerminalReaderProcessConfig").finish_non_exhaustive()
1838    }
1839}
1840impl ProcessSetupIntentTerminalReaderProcessConfig {
1841    pub fn new() -> Self {
1842        Self { enable_customer_cancellation: None }
1843    }
1844}
1845impl Default for ProcessSetupIntentTerminalReaderProcessConfig {
1846    fn default() -> Self {
1847        Self::new()
1848    }
1849}
1850/// Initiates a SetupIntent flow on a Reader.
1851/// See [Save directly without charging](https://stripe.com/docs/terminal/features/saving-payment-details/save-directly) for more details.
1852#[derive(Clone)]
1853#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1854#[derive(serde::Serialize)]
1855pub struct ProcessSetupIntentTerminalReader {
1856    inner: ProcessSetupIntentTerminalReaderBuilder,
1857    reader: stripe_terminal::TerminalReaderId,
1858}
1859#[cfg(feature = "redact-generated-debug")]
1860impl std::fmt::Debug for ProcessSetupIntentTerminalReader {
1861    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1862        f.debug_struct("ProcessSetupIntentTerminalReader").finish_non_exhaustive()
1863    }
1864}
1865impl ProcessSetupIntentTerminalReader {
1866    /// Construct a new `ProcessSetupIntentTerminalReader`.
1867    pub fn new(
1868        reader: impl Into<stripe_terminal::TerminalReaderId>,
1869        allow_redisplay: impl Into<ProcessSetupIntentTerminalReaderAllowRedisplay>,
1870        setup_intent: impl Into<String>,
1871    ) -> Self {
1872        Self {
1873            reader: reader.into(),
1874            inner: ProcessSetupIntentTerminalReaderBuilder::new(
1875                allow_redisplay.into(),
1876                setup_intent.into(),
1877            ),
1878        }
1879    }
1880    /// Specifies which fields in the response should be expanded.
1881    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
1882        self.inner.expand = Some(expand.into());
1883        self
1884    }
1885    /// Configuration overrides for this setup, such as MOTO and customer cancellation settings.
1886    pub fn process_config(
1887        mut self,
1888        process_config: impl Into<ProcessSetupIntentTerminalReaderProcessConfig>,
1889    ) -> Self {
1890        self.inner.process_config = Some(process_config.into());
1891        self
1892    }
1893}
1894impl ProcessSetupIntentTerminalReader {
1895    /// Send the request and return the deserialized response.
1896    pub async fn send<C: StripeClient>(
1897        &self,
1898        client: &C,
1899    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1900        self.customize().send(client).await
1901    }
1902
1903    /// Send the request and return the deserialized response, blocking until completion.
1904    pub fn send_blocking<C: StripeBlockingClient>(
1905        &self,
1906        client: &C,
1907    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1908        self.customize().send_blocking(client)
1909    }
1910}
1911
1912impl StripeRequest for ProcessSetupIntentTerminalReader {
1913    type Output = stripe_terminal::TerminalReader;
1914
1915    fn build(&self) -> RequestBuilder {
1916        let reader = &self.reader;
1917        RequestBuilder::new(
1918            StripeMethod::Post,
1919            format!("/terminal/readers/{reader}/process_setup_intent"),
1920        )
1921        .form(&self.inner)
1922    }
1923}
1924#[derive(Clone)]
1925#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1926#[derive(serde::Serialize)]
1927struct RefundPaymentTerminalReaderBuilder {
1928    #[serde(skip_serializing_if = "Option::is_none")]
1929    amount: Option<i64>,
1930    #[serde(skip_serializing_if = "Option::is_none")]
1931    charge: Option<String>,
1932    #[serde(skip_serializing_if = "Option::is_none")]
1933    expand: Option<Vec<String>>,
1934    #[serde(skip_serializing_if = "Option::is_none")]
1935    metadata: Option<std::collections::HashMap<String, String>>,
1936    #[serde(skip_serializing_if = "Option::is_none")]
1937    payment_intent: Option<String>,
1938    #[serde(skip_serializing_if = "Option::is_none")]
1939    refund_application_fee: Option<bool>,
1940    #[serde(skip_serializing_if = "Option::is_none")]
1941    refund_payment_config: Option<RefundPaymentTerminalReaderRefundPaymentConfig>,
1942    #[serde(skip_serializing_if = "Option::is_none")]
1943    reverse_transfer: Option<bool>,
1944}
1945#[cfg(feature = "redact-generated-debug")]
1946impl std::fmt::Debug for RefundPaymentTerminalReaderBuilder {
1947    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1948        f.debug_struct("RefundPaymentTerminalReaderBuilder").finish_non_exhaustive()
1949    }
1950}
1951impl RefundPaymentTerminalReaderBuilder {
1952    fn new() -> Self {
1953        Self {
1954            amount: None,
1955            charge: None,
1956            expand: None,
1957            metadata: None,
1958            payment_intent: None,
1959            refund_application_fee: None,
1960            refund_payment_config: None,
1961            reverse_transfer: None,
1962        }
1963    }
1964}
1965/// Configuration overrides for this refund, such as customer cancellation settings.
1966#[derive(Copy, Clone, Eq, PartialEq)]
1967#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1968#[derive(serde::Serialize)]
1969pub struct RefundPaymentTerminalReaderRefundPaymentConfig {
1970    /// Enables cancel button on transaction screens.
1971    #[serde(skip_serializing_if = "Option::is_none")]
1972    pub enable_customer_cancellation: Option<bool>,
1973}
1974#[cfg(feature = "redact-generated-debug")]
1975impl std::fmt::Debug for RefundPaymentTerminalReaderRefundPaymentConfig {
1976    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1977        f.debug_struct("RefundPaymentTerminalReaderRefundPaymentConfig").finish_non_exhaustive()
1978    }
1979}
1980impl RefundPaymentTerminalReaderRefundPaymentConfig {
1981    pub fn new() -> Self {
1982        Self { enable_customer_cancellation: None }
1983    }
1984}
1985impl Default for RefundPaymentTerminalReaderRefundPaymentConfig {
1986    fn default() -> Self {
1987        Self::new()
1988    }
1989}
1990/// Initiates an in-person refund on a Reader.
1991/// See [Refund an Interac Payment](https://stripe.com/docs/terminal/payments/regional?integration-country=CA#refund-an-interac-payment) for more details.
1992#[derive(Clone)]
1993#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1994#[derive(serde::Serialize)]
1995pub struct RefundPaymentTerminalReader {
1996    inner: RefundPaymentTerminalReaderBuilder,
1997    reader: stripe_terminal::TerminalReaderId,
1998}
1999#[cfg(feature = "redact-generated-debug")]
2000impl std::fmt::Debug for RefundPaymentTerminalReader {
2001    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2002        f.debug_struct("RefundPaymentTerminalReader").finish_non_exhaustive()
2003    }
2004}
2005impl RefundPaymentTerminalReader {
2006    /// Construct a new `RefundPaymentTerminalReader`.
2007    pub fn new(reader: impl Into<stripe_terminal::TerminalReaderId>) -> Self {
2008        Self { reader: reader.into(), inner: RefundPaymentTerminalReaderBuilder::new() }
2009    }
2010    /// A positive integer in __cents__ representing how much of this charge to refund.
2011    pub fn amount(mut self, amount: impl Into<i64>) -> Self {
2012        self.inner.amount = Some(amount.into());
2013        self
2014    }
2015    /// ID of the Charge to refund.
2016    pub fn charge(mut self, charge: impl Into<String>) -> Self {
2017        self.inner.charge = Some(charge.into());
2018        self
2019    }
2020    /// Specifies which fields in the response should be expanded.
2021    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2022        self.inner.expand = Some(expand.into());
2023        self
2024    }
2025    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
2026    /// This can be useful for storing additional information about the object in a structured format.
2027    /// Individual keys can be unset by posting an empty value to them.
2028    /// All keys can be unset by posting an empty value to `metadata`.
2029    pub fn metadata(
2030        mut self,
2031        metadata: impl Into<std::collections::HashMap<String, String>>,
2032    ) -> Self {
2033        self.inner.metadata = Some(metadata.into());
2034        self
2035    }
2036    /// ID of the PaymentIntent to refund.
2037    pub fn payment_intent(mut self, payment_intent: impl Into<String>) -> Self {
2038        self.inner.payment_intent = Some(payment_intent.into());
2039        self
2040    }
2041    /// Boolean indicating whether the application fee should be refunded when refunding this charge.
2042    /// If a full charge refund is given, the full application fee will be refunded.
2043    /// Otherwise, the application fee will be refunded in an amount proportional to the amount of the charge refunded.
2044    /// An application fee can be refunded only by the application that created the charge.
2045    pub fn refund_application_fee(mut self, refund_application_fee: impl Into<bool>) -> Self {
2046        self.inner.refund_application_fee = Some(refund_application_fee.into());
2047        self
2048    }
2049    /// Configuration overrides for this refund, such as customer cancellation settings.
2050    pub fn refund_payment_config(
2051        mut self,
2052        refund_payment_config: impl Into<RefundPaymentTerminalReaderRefundPaymentConfig>,
2053    ) -> Self {
2054        self.inner.refund_payment_config = Some(refund_payment_config.into());
2055        self
2056    }
2057    /// Boolean indicating whether the transfer should be reversed when refunding this charge.
2058    /// The transfer will be reversed proportionally to the amount being refunded (either the entire or partial amount).
2059    /// A transfer can be reversed only by the application that created the charge.
2060    pub fn reverse_transfer(mut self, reverse_transfer: impl Into<bool>) -> Self {
2061        self.inner.reverse_transfer = Some(reverse_transfer.into());
2062        self
2063    }
2064}
2065impl RefundPaymentTerminalReader {
2066    /// Send the request and return the deserialized response.
2067    pub async fn send<C: StripeClient>(
2068        &self,
2069        client: &C,
2070    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2071        self.customize().send(client).await
2072    }
2073
2074    /// Send the request and return the deserialized response, blocking until completion.
2075    pub fn send_blocking<C: StripeBlockingClient>(
2076        &self,
2077        client: &C,
2078    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2079        self.customize().send_blocking(client)
2080    }
2081}
2082
2083impl StripeRequest for RefundPaymentTerminalReader {
2084    type Output = stripe_terminal::TerminalReader;
2085
2086    fn build(&self) -> RequestBuilder {
2087        let reader = &self.reader;
2088        RequestBuilder::new(
2089            StripeMethod::Post,
2090            format!("/terminal/readers/{reader}/refund_payment"),
2091        )
2092        .form(&self.inner)
2093    }
2094}
2095#[derive(Clone, Eq, PartialEq)]
2096#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2097#[derive(serde::Serialize)]
2098struct SetReaderDisplayTerminalReaderBuilder {
2099    #[serde(skip_serializing_if = "Option::is_none")]
2100    cart: Option<SetReaderDisplayTerminalReaderCart>,
2101    #[serde(skip_serializing_if = "Option::is_none")]
2102    expand: Option<Vec<String>>,
2103    #[serde(rename = "type")]
2104    type_: SetReaderDisplayTerminalReaderType,
2105}
2106#[cfg(feature = "redact-generated-debug")]
2107impl std::fmt::Debug for SetReaderDisplayTerminalReaderBuilder {
2108    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2109        f.debug_struct("SetReaderDisplayTerminalReaderBuilder").finish_non_exhaustive()
2110    }
2111}
2112impl SetReaderDisplayTerminalReaderBuilder {
2113    fn new(type_: impl Into<SetReaderDisplayTerminalReaderType>) -> Self {
2114        Self { cart: None, expand: None, type_: type_.into() }
2115    }
2116}
2117/// Cart details to display on the reader screen, including line items, amounts, and currency.
2118#[derive(Clone, Eq, PartialEq)]
2119#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2120#[derive(serde::Serialize)]
2121pub struct SetReaderDisplayTerminalReaderCart {
2122    /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
2123    /// Must be a [supported currency](https://stripe.com/docs/currencies).
2124    pub currency: stripe_types::Currency,
2125    /// Array of line items to display.
2126    pub line_items: Vec<SetReaderDisplayTerminalReaderCartLineItems>,
2127    /// The amount of tax in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
2128    #[serde(skip_serializing_if = "Option::is_none")]
2129    pub tax: Option<i64>,
2130    /// Total balance of cart due in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
2131    pub total: i64,
2132}
2133#[cfg(feature = "redact-generated-debug")]
2134impl std::fmt::Debug for SetReaderDisplayTerminalReaderCart {
2135    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2136        f.debug_struct("SetReaderDisplayTerminalReaderCart").finish_non_exhaustive()
2137    }
2138}
2139impl SetReaderDisplayTerminalReaderCart {
2140    pub fn new(
2141        currency: impl Into<stripe_types::Currency>,
2142        line_items: impl Into<Vec<SetReaderDisplayTerminalReaderCartLineItems>>,
2143        total: impl Into<i64>,
2144    ) -> Self {
2145        Self {
2146            currency: currency.into(),
2147            line_items: line_items.into(),
2148            tax: None,
2149            total: total.into(),
2150        }
2151    }
2152}
2153/// Array of line items to display.
2154#[derive(Clone, Eq, PartialEq)]
2155#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2156#[derive(serde::Serialize)]
2157pub struct SetReaderDisplayTerminalReaderCartLineItems {
2158    /// The price of the item in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
2159    pub amount: i64,
2160    /// The description or name of the item.
2161    pub description: String,
2162    /// The quantity of the line item being purchased.
2163    pub quantity: u64,
2164}
2165#[cfg(feature = "redact-generated-debug")]
2166impl std::fmt::Debug for SetReaderDisplayTerminalReaderCartLineItems {
2167    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2168        f.debug_struct("SetReaderDisplayTerminalReaderCartLineItems").finish_non_exhaustive()
2169    }
2170}
2171impl SetReaderDisplayTerminalReaderCartLineItems {
2172    pub fn new(
2173        amount: impl Into<i64>,
2174        description: impl Into<String>,
2175        quantity: impl Into<u64>,
2176    ) -> Self {
2177        Self { amount: amount.into(), description: description.into(), quantity: quantity.into() }
2178    }
2179}
2180/// Type of information to display. Only `cart` is currently supported.
2181#[derive(Clone, Eq, PartialEq)]
2182#[non_exhaustive]
2183pub enum SetReaderDisplayTerminalReaderType {
2184    Cart,
2185    /// An unrecognized value from Stripe. Should not be used as a request parameter.
2186    Unknown(String),
2187}
2188impl SetReaderDisplayTerminalReaderType {
2189    pub fn as_str(&self) -> &str {
2190        use SetReaderDisplayTerminalReaderType::*;
2191        match self {
2192            Cart => "cart",
2193            Unknown(v) => v,
2194        }
2195    }
2196}
2197
2198impl std::str::FromStr for SetReaderDisplayTerminalReaderType {
2199    type Err = std::convert::Infallible;
2200    fn from_str(s: &str) -> Result<Self, Self::Err> {
2201        use SetReaderDisplayTerminalReaderType::*;
2202        match s {
2203            "cart" => Ok(Cart),
2204            v => {
2205                tracing::warn!(
2206                    "Unknown value '{}' for enum '{}'",
2207                    v,
2208                    "SetReaderDisplayTerminalReaderType"
2209                );
2210                Ok(Unknown(v.to_owned()))
2211            }
2212        }
2213    }
2214}
2215impl std::fmt::Display for SetReaderDisplayTerminalReaderType {
2216    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2217        f.write_str(self.as_str())
2218    }
2219}
2220
2221#[cfg(not(feature = "redact-generated-debug"))]
2222impl std::fmt::Debug for SetReaderDisplayTerminalReaderType {
2223    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2224        f.write_str(self.as_str())
2225    }
2226}
2227#[cfg(feature = "redact-generated-debug")]
2228impl std::fmt::Debug for SetReaderDisplayTerminalReaderType {
2229    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2230        f.debug_struct(stringify!(SetReaderDisplayTerminalReaderType)).finish_non_exhaustive()
2231    }
2232}
2233impl serde::Serialize for SetReaderDisplayTerminalReaderType {
2234    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2235    where
2236        S: serde::Serializer,
2237    {
2238        serializer.serialize_str(self.as_str())
2239    }
2240}
2241#[cfg(feature = "deserialize")]
2242impl<'de> serde::Deserialize<'de> for SetReaderDisplayTerminalReaderType {
2243    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2244        use std::str::FromStr;
2245        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2246        Ok(Self::from_str(&s).expect("infallible"))
2247    }
2248}
2249/// Sets the reader display to show [cart details](https://stripe.com/docs/terminal/features/display).
2250#[derive(Clone)]
2251#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2252#[derive(serde::Serialize)]
2253pub struct SetReaderDisplayTerminalReader {
2254    inner: SetReaderDisplayTerminalReaderBuilder,
2255    reader: stripe_terminal::TerminalReaderId,
2256}
2257#[cfg(feature = "redact-generated-debug")]
2258impl std::fmt::Debug for SetReaderDisplayTerminalReader {
2259    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2260        f.debug_struct("SetReaderDisplayTerminalReader").finish_non_exhaustive()
2261    }
2262}
2263impl SetReaderDisplayTerminalReader {
2264    /// Construct a new `SetReaderDisplayTerminalReader`.
2265    pub fn new(
2266        reader: impl Into<stripe_terminal::TerminalReaderId>,
2267        type_: impl Into<SetReaderDisplayTerminalReaderType>,
2268    ) -> Self {
2269        Self {
2270            reader: reader.into(),
2271            inner: SetReaderDisplayTerminalReaderBuilder::new(type_.into()),
2272        }
2273    }
2274    /// Cart details to display on the reader screen, including line items, amounts, and currency.
2275    pub fn cart(mut self, cart: impl Into<SetReaderDisplayTerminalReaderCart>) -> Self {
2276        self.inner.cart = Some(cart.into());
2277        self
2278    }
2279    /// Specifies which fields in the response should be expanded.
2280    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2281        self.inner.expand = Some(expand.into());
2282        self
2283    }
2284}
2285impl SetReaderDisplayTerminalReader {
2286    /// Send the request and return the deserialized response.
2287    pub async fn send<C: StripeClient>(
2288        &self,
2289        client: &C,
2290    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2291        self.customize().send(client).await
2292    }
2293
2294    /// Send the request and return the deserialized response, blocking until completion.
2295    pub fn send_blocking<C: StripeBlockingClient>(
2296        &self,
2297        client: &C,
2298    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2299        self.customize().send_blocking(client)
2300    }
2301}
2302
2303impl StripeRequest for SetReaderDisplayTerminalReader {
2304    type Output = stripe_terminal::TerminalReader;
2305
2306    fn build(&self) -> RequestBuilder {
2307        let reader = &self.reader;
2308        RequestBuilder::new(
2309            StripeMethod::Post,
2310            format!("/terminal/readers/{reader}/set_reader_display"),
2311        )
2312        .form(&self.inner)
2313    }
2314}
2315#[derive(Clone, Eq, PartialEq)]
2316#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2317#[derive(serde::Serialize)]
2318struct PresentPaymentMethodTerminalReaderBuilder {
2319    #[serde(skip_serializing_if = "Option::is_none")]
2320    amount_tip: Option<i64>,
2321    #[serde(skip_serializing_if = "Option::is_none")]
2322    card: Option<PresentPaymentMethodTerminalReaderCard>,
2323    #[serde(skip_serializing_if = "Option::is_none")]
2324    card_present: Option<PresentPaymentMethodTerminalReaderCardPresent>,
2325    #[serde(skip_serializing_if = "Option::is_none")]
2326    expand: Option<Vec<String>>,
2327    #[serde(skip_serializing_if = "Option::is_none")]
2328    interac_present: Option<PresentPaymentMethodTerminalReaderInteracPresent>,
2329    #[serde(rename = "type")]
2330    #[serde(skip_serializing_if = "Option::is_none")]
2331    type_: Option<PresentPaymentMethodTerminalReaderType>,
2332}
2333#[cfg(feature = "redact-generated-debug")]
2334impl std::fmt::Debug for PresentPaymentMethodTerminalReaderBuilder {
2335    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2336        f.debug_struct("PresentPaymentMethodTerminalReaderBuilder").finish_non_exhaustive()
2337    }
2338}
2339impl PresentPaymentMethodTerminalReaderBuilder {
2340    fn new() -> Self {
2341        Self {
2342            amount_tip: None,
2343            card: None,
2344            card_present: None,
2345            expand: None,
2346            interac_present: None,
2347            type_: None,
2348        }
2349    }
2350}
2351/// Simulated data for the card payment method.
2352#[derive(Clone, Eq, PartialEq)]
2353#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2354#[derive(serde::Serialize)]
2355pub struct PresentPaymentMethodTerminalReaderCard {
2356    /// Card security code.
2357    #[serde(skip_serializing_if = "Option::is_none")]
2358    pub cvc: Option<String>,
2359    /// Two-digit number representing the card's expiration month.
2360    pub exp_month: i64,
2361    /// Two- or four-digit number representing the card's expiration year.
2362    pub exp_year: i64,
2363    /// The card number, as a string without any separators.
2364    pub number: String,
2365}
2366#[cfg(feature = "redact-generated-debug")]
2367impl std::fmt::Debug for PresentPaymentMethodTerminalReaderCard {
2368    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2369        f.debug_struct("PresentPaymentMethodTerminalReaderCard").finish_non_exhaustive()
2370    }
2371}
2372impl PresentPaymentMethodTerminalReaderCard {
2373    pub fn new(
2374        exp_month: impl Into<i64>,
2375        exp_year: impl Into<i64>,
2376        number: impl Into<String>,
2377    ) -> Self {
2378        Self {
2379            cvc: None,
2380            exp_month: exp_month.into(),
2381            exp_year: exp_year.into(),
2382            number: number.into(),
2383        }
2384    }
2385}
2386/// Simulated data for the card_present payment method.
2387#[derive(Clone, Eq, PartialEq)]
2388#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2389#[derive(serde::Serialize)]
2390pub struct PresentPaymentMethodTerminalReaderCardPresent {
2391    /// The card number, as a string without any separators.
2392    #[serde(skip_serializing_if = "Option::is_none")]
2393    pub number: Option<String>,
2394}
2395#[cfg(feature = "redact-generated-debug")]
2396impl std::fmt::Debug for PresentPaymentMethodTerminalReaderCardPresent {
2397    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2398        f.debug_struct("PresentPaymentMethodTerminalReaderCardPresent").finish_non_exhaustive()
2399    }
2400}
2401impl PresentPaymentMethodTerminalReaderCardPresent {
2402    pub fn new() -> Self {
2403        Self { number: None }
2404    }
2405}
2406impl Default for PresentPaymentMethodTerminalReaderCardPresent {
2407    fn default() -> Self {
2408        Self::new()
2409    }
2410}
2411/// Simulated data for the interac_present payment method.
2412#[derive(Clone, Eq, PartialEq)]
2413#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2414#[derive(serde::Serialize)]
2415pub struct PresentPaymentMethodTerminalReaderInteracPresent {
2416    /// The Interac card number.
2417    #[serde(skip_serializing_if = "Option::is_none")]
2418    pub number: Option<String>,
2419}
2420#[cfg(feature = "redact-generated-debug")]
2421impl std::fmt::Debug for PresentPaymentMethodTerminalReaderInteracPresent {
2422    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2423        f.debug_struct("PresentPaymentMethodTerminalReaderInteracPresent").finish_non_exhaustive()
2424    }
2425}
2426impl PresentPaymentMethodTerminalReaderInteracPresent {
2427    pub fn new() -> Self {
2428        Self { number: None }
2429    }
2430}
2431impl Default for PresentPaymentMethodTerminalReaderInteracPresent {
2432    fn default() -> Self {
2433        Self::new()
2434    }
2435}
2436/// Simulated payment type.
2437#[derive(Clone, Eq, PartialEq)]
2438#[non_exhaustive]
2439pub enum PresentPaymentMethodTerminalReaderType {
2440    Card,
2441    CardPresent,
2442    InteracPresent,
2443    /// An unrecognized value from Stripe. Should not be used as a request parameter.
2444    Unknown(String),
2445}
2446impl PresentPaymentMethodTerminalReaderType {
2447    pub fn as_str(&self) -> &str {
2448        use PresentPaymentMethodTerminalReaderType::*;
2449        match self {
2450            Card => "card",
2451            CardPresent => "card_present",
2452            InteracPresent => "interac_present",
2453            Unknown(v) => v,
2454        }
2455    }
2456}
2457
2458impl std::str::FromStr for PresentPaymentMethodTerminalReaderType {
2459    type Err = std::convert::Infallible;
2460    fn from_str(s: &str) -> Result<Self, Self::Err> {
2461        use PresentPaymentMethodTerminalReaderType::*;
2462        match s {
2463            "card" => Ok(Card),
2464            "card_present" => Ok(CardPresent),
2465            "interac_present" => Ok(InteracPresent),
2466            v => {
2467                tracing::warn!(
2468                    "Unknown value '{}' for enum '{}'",
2469                    v,
2470                    "PresentPaymentMethodTerminalReaderType"
2471                );
2472                Ok(Unknown(v.to_owned()))
2473            }
2474        }
2475    }
2476}
2477impl std::fmt::Display for PresentPaymentMethodTerminalReaderType {
2478    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2479        f.write_str(self.as_str())
2480    }
2481}
2482
2483#[cfg(not(feature = "redact-generated-debug"))]
2484impl std::fmt::Debug for PresentPaymentMethodTerminalReaderType {
2485    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2486        f.write_str(self.as_str())
2487    }
2488}
2489#[cfg(feature = "redact-generated-debug")]
2490impl std::fmt::Debug for PresentPaymentMethodTerminalReaderType {
2491    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2492        f.debug_struct(stringify!(PresentPaymentMethodTerminalReaderType)).finish_non_exhaustive()
2493    }
2494}
2495impl serde::Serialize for PresentPaymentMethodTerminalReaderType {
2496    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2497    where
2498        S: serde::Serializer,
2499    {
2500        serializer.serialize_str(self.as_str())
2501    }
2502}
2503#[cfg(feature = "deserialize")]
2504impl<'de> serde::Deserialize<'de> for PresentPaymentMethodTerminalReaderType {
2505    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2506        use std::str::FromStr;
2507        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2508        Ok(Self::from_str(&s).expect("infallible"))
2509    }
2510}
2511/// Presents a payment method on a simulated reader.
2512/// Can be used to simulate accepting a payment, saving a card or refunding a transaction.
2513#[derive(Clone)]
2514#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2515#[derive(serde::Serialize)]
2516pub struct PresentPaymentMethodTerminalReader {
2517    inner: PresentPaymentMethodTerminalReaderBuilder,
2518    reader: String,
2519}
2520#[cfg(feature = "redact-generated-debug")]
2521impl std::fmt::Debug for PresentPaymentMethodTerminalReader {
2522    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2523        f.debug_struct("PresentPaymentMethodTerminalReader").finish_non_exhaustive()
2524    }
2525}
2526impl PresentPaymentMethodTerminalReader {
2527    /// Construct a new `PresentPaymentMethodTerminalReader`.
2528    pub fn new(reader: impl Into<String>) -> Self {
2529        Self { reader: reader.into(), inner: PresentPaymentMethodTerminalReaderBuilder::new() }
2530    }
2531    /// Simulated on-reader tip amount.
2532    pub fn amount_tip(mut self, amount_tip: impl Into<i64>) -> Self {
2533        self.inner.amount_tip = Some(amount_tip.into());
2534        self
2535    }
2536    /// Simulated data for the card payment method.
2537    pub fn card(mut self, card: impl Into<PresentPaymentMethodTerminalReaderCard>) -> Self {
2538        self.inner.card = Some(card.into());
2539        self
2540    }
2541    /// Simulated data for the card_present payment method.
2542    pub fn card_present(
2543        mut self,
2544        card_present: impl Into<PresentPaymentMethodTerminalReaderCardPresent>,
2545    ) -> Self {
2546        self.inner.card_present = Some(card_present.into());
2547        self
2548    }
2549    /// Specifies which fields in the response should be expanded.
2550    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2551        self.inner.expand = Some(expand.into());
2552        self
2553    }
2554    /// Simulated data for the interac_present payment method.
2555    pub fn interac_present(
2556        mut self,
2557        interac_present: impl Into<PresentPaymentMethodTerminalReaderInteracPresent>,
2558    ) -> Self {
2559        self.inner.interac_present = Some(interac_present.into());
2560        self
2561    }
2562    /// Simulated payment type.
2563    pub fn type_(mut self, type_: impl Into<PresentPaymentMethodTerminalReaderType>) -> Self {
2564        self.inner.type_ = Some(type_.into());
2565        self
2566    }
2567}
2568impl PresentPaymentMethodTerminalReader {
2569    /// Send the request and return the deserialized response.
2570    pub async fn send<C: StripeClient>(
2571        &self,
2572        client: &C,
2573    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2574        self.customize().send(client).await
2575    }
2576
2577    /// Send the request and return the deserialized response, blocking until completion.
2578    pub fn send_blocking<C: StripeBlockingClient>(
2579        &self,
2580        client: &C,
2581    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2582        self.customize().send_blocking(client)
2583    }
2584}
2585
2586impl StripeRequest for PresentPaymentMethodTerminalReader {
2587    type Output = stripe_terminal::TerminalReader;
2588
2589    fn build(&self) -> RequestBuilder {
2590        let reader = &self.reader;
2591        RequestBuilder::new(
2592            StripeMethod::Post,
2593            format!("/test_helpers/terminal/readers/{reader}/present_payment_method"),
2594        )
2595        .form(&self.inner)
2596    }
2597}
2598#[derive(Clone, Eq, PartialEq)]
2599#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2600#[derive(serde::Serialize)]
2601struct SucceedInputCollectionTerminalReaderBuilder {
2602    #[serde(skip_serializing_if = "Option::is_none")]
2603    expand: Option<Vec<String>>,
2604    #[serde(skip_serializing_if = "Option::is_none")]
2605    skip_non_required_inputs: Option<SucceedInputCollectionTerminalReaderSkipNonRequiredInputs>,
2606}
2607#[cfg(feature = "redact-generated-debug")]
2608impl std::fmt::Debug for SucceedInputCollectionTerminalReaderBuilder {
2609    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2610        f.debug_struct("SucceedInputCollectionTerminalReaderBuilder").finish_non_exhaustive()
2611    }
2612}
2613impl SucceedInputCollectionTerminalReaderBuilder {
2614    fn new() -> Self {
2615        Self { expand: None, skip_non_required_inputs: None }
2616    }
2617}
2618/// This parameter defines the skip behavior for input collection.
2619#[derive(Clone, Eq, PartialEq)]
2620#[non_exhaustive]
2621pub enum SucceedInputCollectionTerminalReaderSkipNonRequiredInputs {
2622    All,
2623    None,
2624    /// An unrecognized value from Stripe. Should not be used as a request parameter.
2625    Unknown(String),
2626}
2627impl SucceedInputCollectionTerminalReaderSkipNonRequiredInputs {
2628    pub fn as_str(&self) -> &str {
2629        use SucceedInputCollectionTerminalReaderSkipNonRequiredInputs::*;
2630        match self {
2631            All => "all",
2632            None => "none",
2633            Unknown(v) => v,
2634        }
2635    }
2636}
2637
2638impl std::str::FromStr for SucceedInputCollectionTerminalReaderSkipNonRequiredInputs {
2639    type Err = std::convert::Infallible;
2640    fn from_str(s: &str) -> Result<Self, Self::Err> {
2641        use SucceedInputCollectionTerminalReaderSkipNonRequiredInputs::*;
2642        match s {
2643            "all" => Ok(All),
2644            "none" => Ok(None),
2645            v => {
2646                tracing::warn!(
2647                    "Unknown value '{}' for enum '{}'",
2648                    v,
2649                    "SucceedInputCollectionTerminalReaderSkipNonRequiredInputs"
2650                );
2651                Ok(Unknown(v.to_owned()))
2652            }
2653        }
2654    }
2655}
2656impl std::fmt::Display for SucceedInputCollectionTerminalReaderSkipNonRequiredInputs {
2657    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2658        f.write_str(self.as_str())
2659    }
2660}
2661
2662#[cfg(not(feature = "redact-generated-debug"))]
2663impl std::fmt::Debug for SucceedInputCollectionTerminalReaderSkipNonRequiredInputs {
2664    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2665        f.write_str(self.as_str())
2666    }
2667}
2668#[cfg(feature = "redact-generated-debug")]
2669impl std::fmt::Debug for SucceedInputCollectionTerminalReaderSkipNonRequiredInputs {
2670    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2671        f.debug_struct(stringify!(SucceedInputCollectionTerminalReaderSkipNonRequiredInputs))
2672            .finish_non_exhaustive()
2673    }
2674}
2675impl serde::Serialize for SucceedInputCollectionTerminalReaderSkipNonRequiredInputs {
2676    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2677    where
2678        S: serde::Serializer,
2679    {
2680        serializer.serialize_str(self.as_str())
2681    }
2682}
2683#[cfg(feature = "deserialize")]
2684impl<'de> serde::Deserialize<'de> for SucceedInputCollectionTerminalReaderSkipNonRequiredInputs {
2685    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2686        use std::str::FromStr;
2687        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2688        Ok(Self::from_str(&s).expect("infallible"))
2689    }
2690}
2691/// Use this endpoint to trigger a successful input collection on a simulated reader.
2692#[derive(Clone)]
2693#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2694#[derive(serde::Serialize)]
2695pub struct SucceedInputCollectionTerminalReader {
2696    inner: SucceedInputCollectionTerminalReaderBuilder,
2697    reader: String,
2698}
2699#[cfg(feature = "redact-generated-debug")]
2700impl std::fmt::Debug for SucceedInputCollectionTerminalReader {
2701    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2702        f.debug_struct("SucceedInputCollectionTerminalReader").finish_non_exhaustive()
2703    }
2704}
2705impl SucceedInputCollectionTerminalReader {
2706    /// Construct a new `SucceedInputCollectionTerminalReader`.
2707    pub fn new(reader: impl Into<String>) -> Self {
2708        Self { reader: reader.into(), inner: SucceedInputCollectionTerminalReaderBuilder::new() }
2709    }
2710    /// Specifies which fields in the response should be expanded.
2711    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2712        self.inner.expand = Some(expand.into());
2713        self
2714    }
2715    /// This parameter defines the skip behavior for input collection.
2716    pub fn skip_non_required_inputs(
2717        mut self,
2718        skip_non_required_inputs: impl Into<SucceedInputCollectionTerminalReaderSkipNonRequiredInputs>,
2719    ) -> Self {
2720        self.inner.skip_non_required_inputs = Some(skip_non_required_inputs.into());
2721        self
2722    }
2723}
2724impl SucceedInputCollectionTerminalReader {
2725    /// Send the request and return the deserialized response.
2726    pub async fn send<C: StripeClient>(
2727        &self,
2728        client: &C,
2729    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2730        self.customize().send(client).await
2731    }
2732
2733    /// Send the request and return the deserialized response, blocking until completion.
2734    pub fn send_blocking<C: StripeBlockingClient>(
2735        &self,
2736        client: &C,
2737    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2738        self.customize().send_blocking(client)
2739    }
2740}
2741
2742impl StripeRequest for SucceedInputCollectionTerminalReader {
2743    type Output = stripe_terminal::TerminalReader;
2744
2745    fn build(&self) -> RequestBuilder {
2746        let reader = &self.reader;
2747        RequestBuilder::new(
2748            StripeMethod::Post,
2749            format!("/test_helpers/terminal/readers/{reader}/succeed_input_collection"),
2750        )
2751        .form(&self.inner)
2752    }
2753}
2754#[derive(Clone, Eq, PartialEq)]
2755#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2756#[derive(serde::Serialize)]
2757struct TimeoutInputCollectionTerminalReaderBuilder {
2758    #[serde(skip_serializing_if = "Option::is_none")]
2759    expand: Option<Vec<String>>,
2760}
2761#[cfg(feature = "redact-generated-debug")]
2762impl std::fmt::Debug for TimeoutInputCollectionTerminalReaderBuilder {
2763    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2764        f.debug_struct("TimeoutInputCollectionTerminalReaderBuilder").finish_non_exhaustive()
2765    }
2766}
2767impl TimeoutInputCollectionTerminalReaderBuilder {
2768    fn new() -> Self {
2769        Self { expand: None }
2770    }
2771}
2772/// Use this endpoint to complete an input collection with a timeout error on a simulated reader.
2773#[derive(Clone)]
2774#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2775#[derive(serde::Serialize)]
2776pub struct TimeoutInputCollectionTerminalReader {
2777    inner: TimeoutInputCollectionTerminalReaderBuilder,
2778    reader: String,
2779}
2780#[cfg(feature = "redact-generated-debug")]
2781impl std::fmt::Debug for TimeoutInputCollectionTerminalReader {
2782    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2783        f.debug_struct("TimeoutInputCollectionTerminalReader").finish_non_exhaustive()
2784    }
2785}
2786impl TimeoutInputCollectionTerminalReader {
2787    /// Construct a new `TimeoutInputCollectionTerminalReader`.
2788    pub fn new(reader: impl Into<String>) -> Self {
2789        Self { reader: reader.into(), inner: TimeoutInputCollectionTerminalReaderBuilder::new() }
2790    }
2791    /// Specifies which fields in the response should be expanded.
2792    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2793        self.inner.expand = Some(expand.into());
2794        self
2795    }
2796}
2797impl TimeoutInputCollectionTerminalReader {
2798    /// Send the request and return the deserialized response.
2799    pub async fn send<C: StripeClient>(
2800        &self,
2801        client: &C,
2802    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2803        self.customize().send(client).await
2804    }
2805
2806    /// Send the request and return the deserialized response, blocking until completion.
2807    pub fn send_blocking<C: StripeBlockingClient>(
2808        &self,
2809        client: &C,
2810    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2811        self.customize().send_blocking(client)
2812    }
2813}
2814
2815impl StripeRequest for TimeoutInputCollectionTerminalReader {
2816    type Output = stripe_terminal::TerminalReader;
2817
2818    fn build(&self) -> RequestBuilder {
2819        let reader = &self.reader;
2820        RequestBuilder::new(
2821            StripeMethod::Post,
2822            format!("/test_helpers/terminal/readers/{reader}/timeout_input_collection"),
2823        )
2824        .form(&self.inner)
2825    }
2826}
2827
2828#[derive(Copy, Clone, Eq, PartialEq)]
2829#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2830#[derive(serde::Serialize)]
2831pub struct TippingConfig {
2832    /// Amount used to calculate tip suggestions on tipping selection screen for this transaction.
2833    /// Must be a positive integer in the smallest currency unit (e.g., 100 cents to represent $1.00 or 100 to represent ¥100, a zero-decimal currency).
2834    #[serde(skip_serializing_if = "Option::is_none")]
2835    pub amount_eligible: Option<i64>,
2836}
2837#[cfg(feature = "redact-generated-debug")]
2838impl std::fmt::Debug for TippingConfig {
2839    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2840        f.debug_struct("TippingConfig").finish_non_exhaustive()
2841    }
2842}
2843impl TippingConfig {
2844    pub fn new() -> Self {
2845        Self { amount_eligible: None }
2846    }
2847}
2848impl Default for TippingConfig {
2849    fn default() -> Self {
2850        Self::new()
2851    }
2852}