Skip to main content

stripe_issuing/issuing_personalization_design/
requests.rs

1use stripe_client_core::{
2    RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5#[derive(Clone, Eq, PartialEq)]
6#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
7#[derive(serde::Serialize)]
8struct ListIssuingPersonalizationDesignBuilder {
9    #[serde(skip_serializing_if = "Option::is_none")]
10    ending_before: Option<String>,
11    #[serde(skip_serializing_if = "Option::is_none")]
12    expand: Option<Vec<String>>,
13    #[serde(skip_serializing_if = "Option::is_none")]
14    limit: Option<i64>,
15    #[serde(skip_serializing_if = "Option::is_none")]
16    lookup_keys: Option<Vec<String>>,
17    #[serde(skip_serializing_if = "Option::is_none")]
18    preferences: Option<ListIssuingPersonalizationDesignPreferences>,
19    #[serde(skip_serializing_if = "Option::is_none")]
20    starting_after: Option<String>,
21    #[serde(skip_serializing_if = "Option::is_none")]
22    status: Option<stripe_shared::IssuingPersonalizationDesignStatus>,
23}
24#[cfg(feature = "redact-generated-debug")]
25impl std::fmt::Debug for ListIssuingPersonalizationDesignBuilder {
26    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
27        f.debug_struct("ListIssuingPersonalizationDesignBuilder").finish_non_exhaustive()
28    }
29}
30impl ListIssuingPersonalizationDesignBuilder {
31    fn new() -> Self {
32        Self {
33            ending_before: None,
34            expand: None,
35            limit: None,
36            lookup_keys: None,
37            preferences: None,
38            starting_after: None,
39            status: None,
40        }
41    }
42}
43/// Only return personalization designs with the given preferences.
44#[derive(Copy, Clone, Eq, PartialEq)]
45#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
46#[derive(serde::Serialize)]
47pub struct ListIssuingPersonalizationDesignPreferences {
48    /// Only return the personalization design that's set as the default.
49    /// A connected account uses the Connect platform's default design if no personalization design is set as the default.
50    #[serde(skip_serializing_if = "Option::is_none")]
51    pub is_default: Option<bool>,
52    /// Only return the personalization design that is set as the Connect platform's default.
53    /// This parameter is only applicable to connected accounts.
54    #[serde(skip_serializing_if = "Option::is_none")]
55    pub is_platform_default: Option<bool>,
56}
57#[cfg(feature = "redact-generated-debug")]
58impl std::fmt::Debug for ListIssuingPersonalizationDesignPreferences {
59    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
60        f.debug_struct("ListIssuingPersonalizationDesignPreferences").finish_non_exhaustive()
61    }
62}
63impl ListIssuingPersonalizationDesignPreferences {
64    pub fn new() -> Self {
65        Self { is_default: None, is_platform_default: None }
66    }
67}
68impl Default for ListIssuingPersonalizationDesignPreferences {
69    fn default() -> Self {
70        Self::new()
71    }
72}
73/// Returns a list of personalization design objects.
74/// The objects are sorted in descending order by creation date, with the most recently created object appearing first.
75#[derive(Clone)]
76#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
77#[derive(serde::Serialize)]
78pub struct ListIssuingPersonalizationDesign {
79    inner: ListIssuingPersonalizationDesignBuilder,
80}
81#[cfg(feature = "redact-generated-debug")]
82impl std::fmt::Debug for ListIssuingPersonalizationDesign {
83    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
84        f.debug_struct("ListIssuingPersonalizationDesign").finish_non_exhaustive()
85    }
86}
87impl ListIssuingPersonalizationDesign {
88    /// Construct a new `ListIssuingPersonalizationDesign`.
89    pub fn new() -> Self {
90        Self { inner: ListIssuingPersonalizationDesignBuilder::new() }
91    }
92    /// A cursor for use in pagination.
93    /// `ending_before` is an object ID that defines your place in the list.
94    /// 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.
95    pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
96        self.inner.ending_before = Some(ending_before.into());
97        self
98    }
99    /// Specifies which fields in the response should be expanded.
100    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
101        self.inner.expand = Some(expand.into());
102        self
103    }
104    /// A limit on the number of objects to be returned.
105    /// Limit can range between 1 and 100, and the default is 10.
106    pub fn limit(mut self, limit: impl Into<i64>) -> Self {
107        self.inner.limit = Some(limit.into());
108        self
109    }
110    /// Only return personalization designs with the given lookup keys.
111    pub fn lookup_keys(mut self, lookup_keys: impl Into<Vec<String>>) -> Self {
112        self.inner.lookup_keys = Some(lookup_keys.into());
113        self
114    }
115    /// Only return personalization designs with the given preferences.
116    pub fn preferences(
117        mut self,
118        preferences: impl Into<ListIssuingPersonalizationDesignPreferences>,
119    ) -> Self {
120        self.inner.preferences = Some(preferences.into());
121        self
122    }
123    /// A cursor for use in pagination.
124    /// `starting_after` is an object ID that defines your place in the list.
125    /// 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.
126    pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
127        self.inner.starting_after = Some(starting_after.into());
128        self
129    }
130    /// Only return personalization designs with the given status.
131    pub fn status(
132        mut self,
133        status: impl Into<stripe_shared::IssuingPersonalizationDesignStatus>,
134    ) -> Self {
135        self.inner.status = Some(status.into());
136        self
137    }
138}
139impl Default for ListIssuingPersonalizationDesign {
140    fn default() -> Self {
141        Self::new()
142    }
143}
144impl ListIssuingPersonalizationDesign {
145    /// Send the request and return the deserialized response.
146    pub async fn send<C: StripeClient>(
147        &self,
148        client: &C,
149    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
150        self.customize().send(client).await
151    }
152
153    /// Send the request and return the deserialized response, blocking until completion.
154    pub fn send_blocking<C: StripeBlockingClient>(
155        &self,
156        client: &C,
157    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
158        self.customize().send_blocking(client)
159    }
160
161    pub fn paginate(
162        &self,
163    ) -> stripe_client_core::ListPaginator<
164        stripe_types::List<stripe_shared::IssuingPersonalizationDesign>,
165    > {
166        stripe_client_core::ListPaginator::new_list("/issuing/personalization_designs", &self.inner)
167    }
168}
169
170impl StripeRequest for ListIssuingPersonalizationDesign {
171    type Output = stripe_types::List<stripe_shared::IssuingPersonalizationDesign>;
172
173    fn build(&self) -> RequestBuilder {
174        RequestBuilder::new(StripeMethod::Get, "/issuing/personalization_designs")
175            .query(&self.inner)
176    }
177}
178#[derive(Clone, Eq, PartialEq)]
179#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
180#[derive(serde::Serialize)]
181struct RetrieveIssuingPersonalizationDesignBuilder {
182    #[serde(skip_serializing_if = "Option::is_none")]
183    expand: Option<Vec<String>>,
184}
185#[cfg(feature = "redact-generated-debug")]
186impl std::fmt::Debug for RetrieveIssuingPersonalizationDesignBuilder {
187    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
188        f.debug_struct("RetrieveIssuingPersonalizationDesignBuilder").finish_non_exhaustive()
189    }
190}
191impl RetrieveIssuingPersonalizationDesignBuilder {
192    fn new() -> Self {
193        Self { expand: None }
194    }
195}
196/// Retrieves a personalization design object.
197#[derive(Clone)]
198#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
199#[derive(serde::Serialize)]
200pub struct RetrieveIssuingPersonalizationDesign {
201    inner: RetrieveIssuingPersonalizationDesignBuilder,
202    personalization_design: stripe_shared::IssuingPersonalizationDesignId,
203}
204#[cfg(feature = "redact-generated-debug")]
205impl std::fmt::Debug for RetrieveIssuingPersonalizationDesign {
206    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
207        f.debug_struct("RetrieveIssuingPersonalizationDesign").finish_non_exhaustive()
208    }
209}
210impl RetrieveIssuingPersonalizationDesign {
211    /// Construct a new `RetrieveIssuingPersonalizationDesign`.
212    pub fn new(
213        personalization_design: impl Into<stripe_shared::IssuingPersonalizationDesignId>,
214    ) -> Self {
215        Self {
216            personalization_design: personalization_design.into(),
217            inner: RetrieveIssuingPersonalizationDesignBuilder::new(),
218        }
219    }
220    /// Specifies which fields in the response should be expanded.
221    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
222        self.inner.expand = Some(expand.into());
223        self
224    }
225}
226impl RetrieveIssuingPersonalizationDesign {
227    /// Send the request and return the deserialized response.
228    pub async fn send<C: StripeClient>(
229        &self,
230        client: &C,
231    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
232        self.customize().send(client).await
233    }
234
235    /// Send the request and return the deserialized response, blocking until completion.
236    pub fn send_blocking<C: StripeBlockingClient>(
237        &self,
238        client: &C,
239    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
240        self.customize().send_blocking(client)
241    }
242}
243
244impl StripeRequest for RetrieveIssuingPersonalizationDesign {
245    type Output = stripe_shared::IssuingPersonalizationDesign;
246
247    fn build(&self) -> RequestBuilder {
248        let personalization_design = &self.personalization_design;
249        RequestBuilder::new(
250            StripeMethod::Get,
251            format!("/issuing/personalization_designs/{personalization_design}"),
252        )
253        .query(&self.inner)
254    }
255}
256#[derive(Clone)]
257#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
258#[derive(serde::Serialize)]
259struct CreateIssuingPersonalizationDesignBuilder {
260    #[serde(skip_serializing_if = "Option::is_none")]
261    card_logo: Option<String>,
262    #[serde(skip_serializing_if = "Option::is_none")]
263    carrier_text: Option<CarrierTextParam>,
264    #[serde(skip_serializing_if = "Option::is_none")]
265    expand: Option<Vec<String>>,
266    #[serde(skip_serializing_if = "Option::is_none")]
267    lookup_key: Option<String>,
268    #[serde(skip_serializing_if = "Option::is_none")]
269    metadata: Option<std::collections::HashMap<String, String>>,
270    #[serde(skip_serializing_if = "Option::is_none")]
271    name: Option<String>,
272    physical_bundle: String,
273    #[serde(skip_serializing_if = "Option::is_none")]
274    preferences: Option<PreferencesParam>,
275    #[serde(skip_serializing_if = "Option::is_none")]
276    transfer_lookup_key: Option<bool>,
277}
278#[cfg(feature = "redact-generated-debug")]
279impl std::fmt::Debug for CreateIssuingPersonalizationDesignBuilder {
280    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
281        f.debug_struct("CreateIssuingPersonalizationDesignBuilder").finish_non_exhaustive()
282    }
283}
284impl CreateIssuingPersonalizationDesignBuilder {
285    fn new(physical_bundle: impl Into<String>) -> Self {
286        Self {
287            card_logo: None,
288            carrier_text: None,
289            expand: None,
290            lookup_key: None,
291            metadata: None,
292            name: None,
293            physical_bundle: physical_bundle.into(),
294            preferences: None,
295            transfer_lookup_key: None,
296        }
297    }
298}
299/// Creates a personalization design object.
300#[derive(Clone)]
301#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
302#[derive(serde::Serialize)]
303pub struct CreateIssuingPersonalizationDesign {
304    inner: CreateIssuingPersonalizationDesignBuilder,
305}
306#[cfg(feature = "redact-generated-debug")]
307impl std::fmt::Debug for CreateIssuingPersonalizationDesign {
308    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
309        f.debug_struct("CreateIssuingPersonalizationDesign").finish_non_exhaustive()
310    }
311}
312impl CreateIssuingPersonalizationDesign {
313    /// Construct a new `CreateIssuingPersonalizationDesign`.
314    pub fn new(physical_bundle: impl Into<String>) -> Self {
315        Self { inner: CreateIssuingPersonalizationDesignBuilder::new(physical_bundle.into()) }
316    }
317    /// The file for the card logo, for use with physical bundles that support card logos.
318    /// Must have a `purpose` value of `issuing_logo`.
319    pub fn card_logo(mut self, card_logo: impl Into<String>) -> Self {
320        self.inner.card_logo = Some(card_logo.into());
321        self
322    }
323    /// Hash containing carrier text, for use with physical bundles that support carrier text.
324    pub fn carrier_text(mut self, carrier_text: impl Into<CarrierTextParam>) -> Self {
325        self.inner.carrier_text = Some(carrier_text.into());
326        self
327    }
328    /// Specifies which fields in the response should be expanded.
329    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
330        self.inner.expand = Some(expand.into());
331        self
332    }
333    /// A lookup key used to retrieve personalization designs dynamically from a static string.
334    /// This may be up to 200 characters.
335    pub fn lookup_key(mut self, lookup_key: impl Into<String>) -> Self {
336        self.inner.lookup_key = Some(lookup_key.into());
337        self
338    }
339    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
340    /// This can be useful for storing additional information about the object in a structured format.
341    /// Individual keys can be unset by posting an empty value to them.
342    /// All keys can be unset by posting an empty value to `metadata`.
343    pub fn metadata(
344        mut self,
345        metadata: impl Into<std::collections::HashMap<String, String>>,
346    ) -> Self {
347        self.inner.metadata = Some(metadata.into());
348        self
349    }
350    /// Friendly display name.
351    pub fn name(mut self, name: impl Into<String>) -> Self {
352        self.inner.name = Some(name.into());
353        self
354    }
355    /// Information on whether this personalization design is used to create cards when one is not specified.
356    pub fn preferences(mut self, preferences: impl Into<PreferencesParam>) -> Self {
357        self.inner.preferences = Some(preferences.into());
358        self
359    }
360    /// If set to true, will atomically remove the lookup key from the existing personalization design, and assign it to this personalization design.
361    pub fn transfer_lookup_key(mut self, transfer_lookup_key: impl Into<bool>) -> Self {
362        self.inner.transfer_lookup_key = Some(transfer_lookup_key.into());
363        self
364    }
365}
366impl CreateIssuingPersonalizationDesign {
367    /// Send the request and return the deserialized response.
368    pub async fn send<C: StripeClient>(
369        &self,
370        client: &C,
371    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
372        self.customize().send(client).await
373    }
374
375    /// Send the request and return the deserialized response, blocking until completion.
376    pub fn send_blocking<C: StripeBlockingClient>(
377        &self,
378        client: &C,
379    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
380        self.customize().send_blocking(client)
381    }
382}
383
384impl StripeRequest for CreateIssuingPersonalizationDesign {
385    type Output = stripe_shared::IssuingPersonalizationDesign;
386
387    fn build(&self) -> RequestBuilder {
388        RequestBuilder::new(StripeMethod::Post, "/issuing/personalization_designs")
389            .form(&self.inner)
390    }
391}
392#[derive(Clone)]
393#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
394#[derive(serde::Serialize)]
395struct UpdateIssuingPersonalizationDesignBuilder {
396    #[serde(skip_serializing_if = "Option::is_none")]
397    card_logo: Option<String>,
398    #[serde(skip_serializing_if = "Option::is_none")]
399    carrier_text: Option<CarrierTextParam>,
400    #[serde(skip_serializing_if = "Option::is_none")]
401    expand: Option<Vec<String>>,
402    #[serde(skip_serializing_if = "Option::is_none")]
403    lookup_key: Option<String>,
404    #[serde(skip_serializing_if = "Option::is_none")]
405    metadata: Option<std::collections::HashMap<String, String>>,
406    #[serde(skip_serializing_if = "Option::is_none")]
407    name: Option<String>,
408    #[serde(skip_serializing_if = "Option::is_none")]
409    physical_bundle: Option<String>,
410    #[serde(skip_serializing_if = "Option::is_none")]
411    preferences: Option<PreferencesParam>,
412    #[serde(skip_serializing_if = "Option::is_none")]
413    transfer_lookup_key: Option<bool>,
414}
415#[cfg(feature = "redact-generated-debug")]
416impl std::fmt::Debug for UpdateIssuingPersonalizationDesignBuilder {
417    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
418        f.debug_struct("UpdateIssuingPersonalizationDesignBuilder").finish_non_exhaustive()
419    }
420}
421impl UpdateIssuingPersonalizationDesignBuilder {
422    fn new() -> Self {
423        Self {
424            card_logo: None,
425            carrier_text: None,
426            expand: None,
427            lookup_key: None,
428            metadata: None,
429            name: None,
430            physical_bundle: None,
431            preferences: None,
432            transfer_lookup_key: None,
433        }
434    }
435}
436/// Updates a card personalization object.
437#[derive(Clone)]
438#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
439#[derive(serde::Serialize)]
440pub struct UpdateIssuingPersonalizationDesign {
441    inner: UpdateIssuingPersonalizationDesignBuilder,
442    personalization_design: stripe_shared::IssuingPersonalizationDesignId,
443}
444#[cfg(feature = "redact-generated-debug")]
445impl std::fmt::Debug for UpdateIssuingPersonalizationDesign {
446    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
447        f.debug_struct("UpdateIssuingPersonalizationDesign").finish_non_exhaustive()
448    }
449}
450impl UpdateIssuingPersonalizationDesign {
451    /// Construct a new `UpdateIssuingPersonalizationDesign`.
452    pub fn new(
453        personalization_design: impl Into<stripe_shared::IssuingPersonalizationDesignId>,
454    ) -> Self {
455        Self {
456            personalization_design: personalization_design.into(),
457            inner: UpdateIssuingPersonalizationDesignBuilder::new(),
458        }
459    }
460    /// The file for the card logo, for use with physical bundles that support card logos.
461    /// Must have a `purpose` value of `issuing_logo`.
462    pub fn card_logo(mut self, card_logo: impl Into<String>) -> Self {
463        self.inner.card_logo = Some(card_logo.into());
464        self
465    }
466    /// Hash containing carrier text, for use with physical bundles that support carrier text.
467    pub fn carrier_text(mut self, carrier_text: impl Into<CarrierTextParam>) -> Self {
468        self.inner.carrier_text = Some(carrier_text.into());
469        self
470    }
471    /// Specifies which fields in the response should be expanded.
472    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
473        self.inner.expand = Some(expand.into());
474        self
475    }
476    /// A lookup key used to retrieve personalization designs dynamically from a static string.
477    /// This may be up to 200 characters.
478    pub fn lookup_key(mut self, lookup_key: impl Into<String>) -> Self {
479        self.inner.lookup_key = Some(lookup_key.into());
480        self
481    }
482    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
483    /// This can be useful for storing additional information about the object in a structured format.
484    /// Individual keys can be unset by posting an empty value to them.
485    /// All keys can be unset by posting an empty value to `metadata`.
486    pub fn metadata(
487        mut self,
488        metadata: impl Into<std::collections::HashMap<String, String>>,
489    ) -> Self {
490        self.inner.metadata = Some(metadata.into());
491        self
492    }
493    /// Friendly display name. Providing an empty string will set the field to null.
494    pub fn name(mut self, name: impl Into<String>) -> Self {
495        self.inner.name = Some(name.into());
496        self
497    }
498    /// The physical bundle object belonging to this personalization design.
499    pub fn physical_bundle(mut self, physical_bundle: impl Into<String>) -> Self {
500        self.inner.physical_bundle = Some(physical_bundle.into());
501        self
502    }
503    /// Information on whether this personalization design is used to create cards when one is not specified.
504    pub fn preferences(mut self, preferences: impl Into<PreferencesParam>) -> Self {
505        self.inner.preferences = Some(preferences.into());
506        self
507    }
508    /// If set to true, will atomically remove the lookup key from the existing personalization design, and assign it to this personalization design.
509    pub fn transfer_lookup_key(mut self, transfer_lookup_key: impl Into<bool>) -> Self {
510        self.inner.transfer_lookup_key = Some(transfer_lookup_key.into());
511        self
512    }
513}
514impl UpdateIssuingPersonalizationDesign {
515    /// Send the request and return the deserialized response.
516    pub async fn send<C: StripeClient>(
517        &self,
518        client: &C,
519    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
520        self.customize().send(client).await
521    }
522
523    /// Send the request and return the deserialized response, blocking until completion.
524    pub fn send_blocking<C: StripeBlockingClient>(
525        &self,
526        client: &C,
527    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
528        self.customize().send_blocking(client)
529    }
530}
531
532impl StripeRequest for UpdateIssuingPersonalizationDesign {
533    type Output = stripe_shared::IssuingPersonalizationDesign;
534
535    fn build(&self) -> RequestBuilder {
536        let personalization_design = &self.personalization_design;
537        RequestBuilder::new(
538            StripeMethod::Post,
539            format!("/issuing/personalization_designs/{personalization_design}"),
540        )
541        .form(&self.inner)
542    }
543}
544#[derive(Clone, Eq, PartialEq)]
545#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
546#[derive(serde::Serialize)]
547struct ActivateIssuingPersonalizationDesignBuilder {
548    #[serde(skip_serializing_if = "Option::is_none")]
549    expand: Option<Vec<String>>,
550}
551#[cfg(feature = "redact-generated-debug")]
552impl std::fmt::Debug for ActivateIssuingPersonalizationDesignBuilder {
553    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
554        f.debug_struct("ActivateIssuingPersonalizationDesignBuilder").finish_non_exhaustive()
555    }
556}
557impl ActivateIssuingPersonalizationDesignBuilder {
558    fn new() -> Self {
559        Self { expand: None }
560    }
561}
562/// Updates the `status` of the specified testmode personalization design object to `active`.
563#[derive(Clone)]
564#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
565#[derive(serde::Serialize)]
566pub struct ActivateIssuingPersonalizationDesign {
567    inner: ActivateIssuingPersonalizationDesignBuilder,
568    personalization_design: String,
569}
570#[cfg(feature = "redact-generated-debug")]
571impl std::fmt::Debug for ActivateIssuingPersonalizationDesign {
572    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
573        f.debug_struct("ActivateIssuingPersonalizationDesign").finish_non_exhaustive()
574    }
575}
576impl ActivateIssuingPersonalizationDesign {
577    /// Construct a new `ActivateIssuingPersonalizationDesign`.
578    pub fn new(personalization_design: impl Into<String>) -> Self {
579        Self {
580            personalization_design: personalization_design.into(),
581            inner: ActivateIssuingPersonalizationDesignBuilder::new(),
582        }
583    }
584    /// Specifies which fields in the response should be expanded.
585    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
586        self.inner.expand = Some(expand.into());
587        self
588    }
589}
590impl ActivateIssuingPersonalizationDesign {
591    /// Send the request and return the deserialized response.
592    pub async fn send<C: StripeClient>(
593        &self,
594        client: &C,
595    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
596        self.customize().send(client).await
597    }
598
599    /// Send the request and return the deserialized response, blocking until completion.
600    pub fn send_blocking<C: StripeBlockingClient>(
601        &self,
602        client: &C,
603    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
604        self.customize().send_blocking(client)
605    }
606}
607
608impl StripeRequest for ActivateIssuingPersonalizationDesign {
609    type Output = stripe_shared::IssuingPersonalizationDesign;
610
611    fn build(&self) -> RequestBuilder {
612        let personalization_design = &self.personalization_design;
613        RequestBuilder::new(
614            StripeMethod::Post,
615            format!(
616                "/test_helpers/issuing/personalization_designs/{personalization_design}/activate"
617            ),
618        )
619        .form(&self.inner)
620    }
621}
622#[derive(Clone, Eq, PartialEq)]
623#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
624#[derive(serde::Serialize)]
625struct DeactivateIssuingPersonalizationDesignBuilder {
626    #[serde(skip_serializing_if = "Option::is_none")]
627    expand: Option<Vec<String>>,
628}
629#[cfg(feature = "redact-generated-debug")]
630impl std::fmt::Debug for DeactivateIssuingPersonalizationDesignBuilder {
631    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
632        f.debug_struct("DeactivateIssuingPersonalizationDesignBuilder").finish_non_exhaustive()
633    }
634}
635impl DeactivateIssuingPersonalizationDesignBuilder {
636    fn new() -> Self {
637        Self { expand: None }
638    }
639}
640/// Updates the `status` of the specified testmode personalization design object to `inactive`.
641#[derive(Clone)]
642#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
643#[derive(serde::Serialize)]
644pub struct DeactivateIssuingPersonalizationDesign {
645    inner: DeactivateIssuingPersonalizationDesignBuilder,
646    personalization_design: String,
647}
648#[cfg(feature = "redact-generated-debug")]
649impl std::fmt::Debug for DeactivateIssuingPersonalizationDesign {
650    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
651        f.debug_struct("DeactivateIssuingPersonalizationDesign").finish_non_exhaustive()
652    }
653}
654impl DeactivateIssuingPersonalizationDesign {
655    /// Construct a new `DeactivateIssuingPersonalizationDesign`.
656    pub fn new(personalization_design: impl Into<String>) -> Self {
657        Self {
658            personalization_design: personalization_design.into(),
659            inner: DeactivateIssuingPersonalizationDesignBuilder::new(),
660        }
661    }
662    /// Specifies which fields in the response should be expanded.
663    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
664        self.inner.expand = Some(expand.into());
665        self
666    }
667}
668impl DeactivateIssuingPersonalizationDesign {
669    /// Send the request and return the deserialized response.
670    pub async fn send<C: StripeClient>(
671        &self,
672        client: &C,
673    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
674        self.customize().send(client).await
675    }
676
677    /// Send the request and return the deserialized response, blocking until completion.
678    pub fn send_blocking<C: StripeBlockingClient>(
679        &self,
680        client: &C,
681    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
682        self.customize().send_blocking(client)
683    }
684}
685
686impl StripeRequest for DeactivateIssuingPersonalizationDesign {
687    type Output = stripe_shared::IssuingPersonalizationDesign;
688
689    fn build(&self) -> RequestBuilder {
690        let personalization_design = &self.personalization_design;
691        RequestBuilder::new(
692            StripeMethod::Post,
693            format!(
694                "/test_helpers/issuing/personalization_designs/{personalization_design}/deactivate"
695            ),
696        )
697        .form(&self.inner)
698    }
699}
700#[derive(Clone, Eq, PartialEq)]
701#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
702#[derive(serde::Serialize)]
703struct RejectIssuingPersonalizationDesignBuilder {
704    #[serde(skip_serializing_if = "Option::is_none")]
705    expand: Option<Vec<String>>,
706    rejection_reasons: RejectIssuingPersonalizationDesignRejectionReasons,
707}
708#[cfg(feature = "redact-generated-debug")]
709impl std::fmt::Debug for RejectIssuingPersonalizationDesignBuilder {
710    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
711        f.debug_struct("RejectIssuingPersonalizationDesignBuilder").finish_non_exhaustive()
712    }
713}
714impl RejectIssuingPersonalizationDesignBuilder {
715    fn new(
716        rejection_reasons: impl Into<RejectIssuingPersonalizationDesignRejectionReasons>,
717    ) -> Self {
718        Self { expand: None, rejection_reasons: rejection_reasons.into() }
719    }
720}
721/// The reason(s) the personalization design was rejected.
722#[derive(Clone, Eq, PartialEq)]
723#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
724#[derive(serde::Serialize)]
725pub struct RejectIssuingPersonalizationDesignRejectionReasons {
726    /// The reason(s) the card logo was rejected.
727    #[serde(skip_serializing_if = "Option::is_none")]
728    pub card_logo: Option<Vec<RejectIssuingPersonalizationDesignRejectionReasonsCardLogo>>,
729    /// The reason(s) the carrier text was rejected.
730    #[serde(skip_serializing_if = "Option::is_none")]
731    pub carrier_text: Option<Vec<RejectIssuingPersonalizationDesignRejectionReasonsCarrierText>>,
732}
733#[cfg(feature = "redact-generated-debug")]
734impl std::fmt::Debug for RejectIssuingPersonalizationDesignRejectionReasons {
735    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
736        f.debug_struct("RejectIssuingPersonalizationDesignRejectionReasons").finish_non_exhaustive()
737    }
738}
739impl RejectIssuingPersonalizationDesignRejectionReasons {
740    pub fn new() -> Self {
741        Self { card_logo: None, carrier_text: None }
742    }
743}
744impl Default for RejectIssuingPersonalizationDesignRejectionReasons {
745    fn default() -> Self {
746        Self::new()
747    }
748}
749/// The reason(s) the card logo was rejected.
750#[derive(Clone, Eq, PartialEq)]
751#[non_exhaustive]
752pub enum RejectIssuingPersonalizationDesignRejectionReasonsCardLogo {
753    GeographicLocation,
754    Inappropriate,
755    NetworkName,
756    NonBinaryImage,
757    NonFiatCurrency,
758    Other,
759    OtherEntity,
760    PromotionalMaterial,
761    /// An unrecognized value from Stripe. Should not be used as a request parameter.
762    Unknown(String),
763}
764impl RejectIssuingPersonalizationDesignRejectionReasonsCardLogo {
765    pub fn as_str(&self) -> &str {
766        use RejectIssuingPersonalizationDesignRejectionReasonsCardLogo::*;
767        match self {
768            GeographicLocation => "geographic_location",
769            Inappropriate => "inappropriate",
770            NetworkName => "network_name",
771            NonBinaryImage => "non_binary_image",
772            NonFiatCurrency => "non_fiat_currency",
773            Other => "other",
774            OtherEntity => "other_entity",
775            PromotionalMaterial => "promotional_material",
776            Unknown(v) => v,
777        }
778    }
779}
780
781impl std::str::FromStr for RejectIssuingPersonalizationDesignRejectionReasonsCardLogo {
782    type Err = std::convert::Infallible;
783    fn from_str(s: &str) -> Result<Self, Self::Err> {
784        use RejectIssuingPersonalizationDesignRejectionReasonsCardLogo::*;
785        match s {
786            "geographic_location" => Ok(GeographicLocation),
787            "inappropriate" => Ok(Inappropriate),
788            "network_name" => Ok(NetworkName),
789            "non_binary_image" => Ok(NonBinaryImage),
790            "non_fiat_currency" => Ok(NonFiatCurrency),
791            "other" => Ok(Other),
792            "other_entity" => Ok(OtherEntity),
793            "promotional_material" => Ok(PromotionalMaterial),
794            v => {
795                tracing::warn!(
796                    "Unknown value '{}' for enum '{}'",
797                    v,
798                    "RejectIssuingPersonalizationDesignRejectionReasonsCardLogo"
799                );
800                Ok(Unknown(v.to_owned()))
801            }
802        }
803    }
804}
805impl std::fmt::Display for RejectIssuingPersonalizationDesignRejectionReasonsCardLogo {
806    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
807        f.write_str(self.as_str())
808    }
809}
810
811#[cfg(not(feature = "redact-generated-debug"))]
812impl std::fmt::Debug for RejectIssuingPersonalizationDesignRejectionReasonsCardLogo {
813    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
814        f.write_str(self.as_str())
815    }
816}
817#[cfg(feature = "redact-generated-debug")]
818impl std::fmt::Debug for RejectIssuingPersonalizationDesignRejectionReasonsCardLogo {
819    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
820        f.debug_struct(stringify!(RejectIssuingPersonalizationDesignRejectionReasonsCardLogo))
821            .finish_non_exhaustive()
822    }
823}
824impl serde::Serialize for RejectIssuingPersonalizationDesignRejectionReasonsCardLogo {
825    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
826    where
827        S: serde::Serializer,
828    {
829        serializer.serialize_str(self.as_str())
830    }
831}
832#[cfg(feature = "deserialize")]
833impl<'de> serde::Deserialize<'de> for RejectIssuingPersonalizationDesignRejectionReasonsCardLogo {
834    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
835        use std::str::FromStr;
836        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
837        Ok(Self::from_str(&s).expect("infallible"))
838    }
839}
840/// The reason(s) the carrier text was rejected.
841#[derive(Clone, Eq, PartialEq)]
842#[non_exhaustive]
843pub enum RejectIssuingPersonalizationDesignRejectionReasonsCarrierText {
844    GeographicLocation,
845    Inappropriate,
846    NetworkName,
847    NonFiatCurrency,
848    Other,
849    OtherEntity,
850    PromotionalMaterial,
851    /// An unrecognized value from Stripe. Should not be used as a request parameter.
852    Unknown(String),
853}
854impl RejectIssuingPersonalizationDesignRejectionReasonsCarrierText {
855    pub fn as_str(&self) -> &str {
856        use RejectIssuingPersonalizationDesignRejectionReasonsCarrierText::*;
857        match self {
858            GeographicLocation => "geographic_location",
859            Inappropriate => "inappropriate",
860            NetworkName => "network_name",
861            NonFiatCurrency => "non_fiat_currency",
862            Other => "other",
863            OtherEntity => "other_entity",
864            PromotionalMaterial => "promotional_material",
865            Unknown(v) => v,
866        }
867    }
868}
869
870impl std::str::FromStr for RejectIssuingPersonalizationDesignRejectionReasonsCarrierText {
871    type Err = std::convert::Infallible;
872    fn from_str(s: &str) -> Result<Self, Self::Err> {
873        use RejectIssuingPersonalizationDesignRejectionReasonsCarrierText::*;
874        match s {
875            "geographic_location" => Ok(GeographicLocation),
876            "inappropriate" => Ok(Inappropriate),
877            "network_name" => Ok(NetworkName),
878            "non_fiat_currency" => Ok(NonFiatCurrency),
879            "other" => Ok(Other),
880            "other_entity" => Ok(OtherEntity),
881            "promotional_material" => Ok(PromotionalMaterial),
882            v => {
883                tracing::warn!(
884                    "Unknown value '{}' for enum '{}'",
885                    v,
886                    "RejectIssuingPersonalizationDesignRejectionReasonsCarrierText"
887                );
888                Ok(Unknown(v.to_owned()))
889            }
890        }
891    }
892}
893impl std::fmt::Display for RejectIssuingPersonalizationDesignRejectionReasonsCarrierText {
894    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
895        f.write_str(self.as_str())
896    }
897}
898
899#[cfg(not(feature = "redact-generated-debug"))]
900impl std::fmt::Debug for RejectIssuingPersonalizationDesignRejectionReasonsCarrierText {
901    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
902        f.write_str(self.as_str())
903    }
904}
905#[cfg(feature = "redact-generated-debug")]
906impl std::fmt::Debug for RejectIssuingPersonalizationDesignRejectionReasonsCarrierText {
907    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
908        f.debug_struct(stringify!(RejectIssuingPersonalizationDesignRejectionReasonsCarrierText))
909            .finish_non_exhaustive()
910    }
911}
912impl serde::Serialize for RejectIssuingPersonalizationDesignRejectionReasonsCarrierText {
913    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
914    where
915        S: serde::Serializer,
916    {
917        serializer.serialize_str(self.as_str())
918    }
919}
920#[cfg(feature = "deserialize")]
921impl<'de> serde::Deserialize<'de>
922    for RejectIssuingPersonalizationDesignRejectionReasonsCarrierText
923{
924    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
925        use std::str::FromStr;
926        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
927        Ok(Self::from_str(&s).expect("infallible"))
928    }
929}
930/// Updates the `status` of the specified testmode personalization design object to `rejected`.
931#[derive(Clone)]
932#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
933#[derive(serde::Serialize)]
934pub struct RejectIssuingPersonalizationDesign {
935    inner: RejectIssuingPersonalizationDesignBuilder,
936    personalization_design: String,
937}
938#[cfg(feature = "redact-generated-debug")]
939impl std::fmt::Debug for RejectIssuingPersonalizationDesign {
940    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
941        f.debug_struct("RejectIssuingPersonalizationDesign").finish_non_exhaustive()
942    }
943}
944impl RejectIssuingPersonalizationDesign {
945    /// Construct a new `RejectIssuingPersonalizationDesign`.
946    pub fn new(
947        personalization_design: impl Into<String>,
948        rejection_reasons: impl Into<RejectIssuingPersonalizationDesignRejectionReasons>,
949    ) -> Self {
950        Self {
951            personalization_design: personalization_design.into(),
952            inner: RejectIssuingPersonalizationDesignBuilder::new(rejection_reasons.into()),
953        }
954    }
955    /// Specifies which fields in the response should be expanded.
956    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
957        self.inner.expand = Some(expand.into());
958        self
959    }
960}
961impl RejectIssuingPersonalizationDesign {
962    /// Send the request and return the deserialized response.
963    pub async fn send<C: StripeClient>(
964        &self,
965        client: &C,
966    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
967        self.customize().send(client).await
968    }
969
970    /// Send the request and return the deserialized response, blocking until completion.
971    pub fn send_blocking<C: StripeBlockingClient>(
972        &self,
973        client: &C,
974    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
975        self.customize().send_blocking(client)
976    }
977}
978
979impl StripeRequest for RejectIssuingPersonalizationDesign {
980    type Output = stripe_shared::IssuingPersonalizationDesign;
981
982    fn build(&self) -> RequestBuilder {
983        let personalization_design = &self.personalization_design;
984        RequestBuilder::new(
985            StripeMethod::Post,
986            format!(
987                "/test_helpers/issuing/personalization_designs/{personalization_design}/reject"
988            ),
989        )
990        .form(&self.inner)
991    }
992}
993
994#[derive(Clone, Eq, PartialEq)]
995#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
996#[derive(serde::Serialize)]
997pub struct CarrierTextParam {
998    /// The footer body text of the carrier letter.
999    #[serde(skip_serializing_if = "Option::is_none")]
1000    pub footer_body: Option<String>,
1001    /// The footer title text of the carrier letter.
1002    #[serde(skip_serializing_if = "Option::is_none")]
1003    pub footer_title: Option<String>,
1004    /// The header body text of the carrier letter.
1005    #[serde(skip_serializing_if = "Option::is_none")]
1006    pub header_body: Option<String>,
1007    /// The header title text of the carrier letter.
1008    #[serde(skip_serializing_if = "Option::is_none")]
1009    pub header_title: Option<String>,
1010}
1011#[cfg(feature = "redact-generated-debug")]
1012impl std::fmt::Debug for CarrierTextParam {
1013    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1014        f.debug_struct("CarrierTextParam").finish_non_exhaustive()
1015    }
1016}
1017impl CarrierTextParam {
1018    pub fn new() -> Self {
1019        Self { footer_body: None, footer_title: None, header_body: None, header_title: None }
1020    }
1021}
1022impl Default for CarrierTextParam {
1023    fn default() -> Self {
1024        Self::new()
1025    }
1026}
1027#[derive(Copy, Clone, Eq, PartialEq)]
1028#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1029#[derive(serde::Serialize)]
1030pub struct PreferencesParam {
1031    /// Whether we use this personalization design to create cards when one isn't specified.
1032    /// A connected account uses the Connect platform's default design if no personalization design is set as the default design.
1033    pub is_default: bool,
1034}
1035#[cfg(feature = "redact-generated-debug")]
1036impl std::fmt::Debug for PreferencesParam {
1037    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1038        f.debug_struct("PreferencesParam").finish_non_exhaustive()
1039    }
1040}
1041impl PreferencesParam {
1042    pub fn new(is_default: impl Into<bool>) -> Self {
1043        Self { is_default: is_default.into() }
1044    }
1045}