stripe_shared/
subscription_schedule_phase_configuration.rs

1/// A phase describes the plans, coupon, and trialing status of a subscription for a predefined time period.
2#[derive(Clone, Debug)]
3#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
4#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
5pub struct SubscriptionSchedulePhaseConfiguration {
6    /// A list of prices and quantities that will generate invoice items appended to the next invoice for this phase.
7    pub add_invoice_items: Vec<stripe_shared::SubscriptionScheduleAddInvoiceItem>,
8    /// A non-negative decimal between 0 and 100, with at most two decimal places.
9    /// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account during this phase of the schedule.
10    pub application_fee_percent: Option<f64>,
11    pub automatic_tax: Option<stripe_shared::SchedulesPhaseAutomaticTax>,
12    /// Possible values are `phase_start` or `automatic`.
13    /// If `phase_start` then billing cycle anchor of the subscription is set to the start of the phase when entering the phase.
14    /// If `automatic` then the billing cycle anchor is automatically modified as needed when entering the phase.
15    /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
16    pub billing_cycle_anchor: Option<SubscriptionSchedulePhaseConfigurationBillingCycleAnchor>,
17    /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.
18    pub billing_thresholds: Option<stripe_shared::SubscriptionBillingThresholds>,
19    /// Either `charge_automatically`, or `send_invoice`.
20    /// When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer.
21    /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`.
22    pub collection_method: Option<SubscriptionSchedulePhaseConfigurationCollectionMethod>,
23    /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
24    /// Must be a [supported currency](https://stripe.com/docs/currencies).
25    pub currency: stripe_types::Currency,
26    /// ID of the default payment method for the subscription schedule.
27    /// It must belong to the customer associated with the subscription schedule.
28    /// If not set, invoices will use the default payment method in the customer's invoice settings.
29    pub default_payment_method: Option<stripe_types::Expandable<stripe_shared::PaymentMethod>>,
30    /// The default tax rates to apply to the subscription during this phase of the subscription schedule.
31    pub default_tax_rates: Option<Vec<stripe_shared::TaxRate>>,
32    /// Subscription description, meant to be displayable to the customer.
33    /// Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
34    pub description: Option<String>,
35    /// The stackable discounts that will be applied to the subscription on this phase.
36    /// Subscription item discounts are applied before subscription discounts.
37    pub discounts: Vec<stripe_shared::DiscountsResourceStackableDiscount>,
38    /// The end of this phase of the subscription schedule.
39    pub end_date: stripe_types::Timestamp,
40    /// The invoice settings applicable during this phase.
41    pub invoice_settings: Option<stripe_shared::InvoiceSettingSubscriptionSchedulePhaseSetting>,
42    /// Subscription items to configure the subscription to during this phase of the subscription schedule.
43    pub items: Vec<stripe_shared::SubscriptionScheduleConfigurationItem>,
44    /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a phase.
45    /// Metadata on a schedule's phase will update the underlying subscription's `metadata` when the phase is entered.
46    /// Updating the underlying subscription's `metadata` directly will not affect the current phase's `metadata`.
47    pub metadata: Option<std::collections::HashMap<String, String>>,
48    /// The account (if any) the charge was made on behalf of for charges associated with the schedule's subscription.
49    /// See the Connect documentation for details.
50    pub on_behalf_of: Option<stripe_types::Expandable<stripe_shared::Account>>,
51    /// When transitioning phases, controls how prorations are handled (if any).
52    /// Possible values are `create_prorations`, `none`, and `always_invoice`.
53    pub proration_behavior: SubscriptionSchedulePhaseConfigurationProrationBehavior,
54    /// The start of this phase of the subscription schedule.
55    pub start_date: stripe_types::Timestamp,
56    /// The account (if any) the associated subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices.
57    pub transfer_data: Option<stripe_shared::SubscriptionTransferData>,
58    /// When the trial ends within the phase.
59    pub trial_end: Option<stripe_types::Timestamp>,
60}
61#[doc(hidden)]
62pub struct SubscriptionSchedulePhaseConfigurationBuilder {
63    add_invoice_items: Option<Vec<stripe_shared::SubscriptionScheduleAddInvoiceItem>>,
64    application_fee_percent: Option<Option<f64>>,
65    automatic_tax: Option<Option<stripe_shared::SchedulesPhaseAutomaticTax>>,
66    billing_cycle_anchor: Option<Option<SubscriptionSchedulePhaseConfigurationBillingCycleAnchor>>,
67    billing_thresholds: Option<Option<stripe_shared::SubscriptionBillingThresholds>>,
68    collection_method: Option<Option<SubscriptionSchedulePhaseConfigurationCollectionMethod>>,
69    currency: Option<stripe_types::Currency>,
70    default_payment_method: Option<Option<stripe_types::Expandable<stripe_shared::PaymentMethod>>>,
71    default_tax_rates: Option<Option<Vec<stripe_shared::TaxRate>>>,
72    description: Option<Option<String>>,
73    discounts: Option<Vec<stripe_shared::DiscountsResourceStackableDiscount>>,
74    end_date: Option<stripe_types::Timestamp>,
75    invoice_settings: Option<Option<stripe_shared::InvoiceSettingSubscriptionSchedulePhaseSetting>>,
76    items: Option<Vec<stripe_shared::SubscriptionScheduleConfigurationItem>>,
77    metadata: Option<Option<std::collections::HashMap<String, String>>>,
78    on_behalf_of: Option<Option<stripe_types::Expandable<stripe_shared::Account>>>,
79    proration_behavior: Option<SubscriptionSchedulePhaseConfigurationProrationBehavior>,
80    start_date: Option<stripe_types::Timestamp>,
81    transfer_data: Option<Option<stripe_shared::SubscriptionTransferData>>,
82    trial_end: Option<Option<stripe_types::Timestamp>>,
83}
84
85#[allow(
86    unused_variables,
87    irrefutable_let_patterns,
88    clippy::let_unit_value,
89    clippy::match_single_binding,
90    clippy::single_match
91)]
92const _: () = {
93    use miniserde::de::{Map, Visitor};
94    use miniserde::json::Value;
95    use miniserde::{Deserialize, Result, make_place};
96    use stripe_types::miniserde_helpers::FromValueOpt;
97    use stripe_types::{MapBuilder, ObjectDeser};
98
99    make_place!(Place);
100
101    impl Deserialize for SubscriptionSchedulePhaseConfiguration {
102        fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
103            Place::new(out)
104        }
105    }
106
107    struct Builder<'a> {
108        out: &'a mut Option<SubscriptionSchedulePhaseConfiguration>,
109        builder: SubscriptionSchedulePhaseConfigurationBuilder,
110    }
111
112    impl Visitor for Place<SubscriptionSchedulePhaseConfiguration> {
113        fn map(&mut self) -> Result<Box<dyn Map + '_>> {
114            Ok(Box::new(Builder {
115                out: &mut self.out,
116                builder: SubscriptionSchedulePhaseConfigurationBuilder::deser_default(),
117            }))
118        }
119    }
120
121    impl MapBuilder for SubscriptionSchedulePhaseConfigurationBuilder {
122        type Out = SubscriptionSchedulePhaseConfiguration;
123        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
124            Ok(match k {
125                "add_invoice_items" => Deserialize::begin(&mut self.add_invoice_items),
126                "application_fee_percent" => Deserialize::begin(&mut self.application_fee_percent),
127                "automatic_tax" => Deserialize::begin(&mut self.automatic_tax),
128                "billing_cycle_anchor" => Deserialize::begin(&mut self.billing_cycle_anchor),
129                "billing_thresholds" => Deserialize::begin(&mut self.billing_thresholds),
130                "collection_method" => Deserialize::begin(&mut self.collection_method),
131                "currency" => Deserialize::begin(&mut self.currency),
132                "default_payment_method" => Deserialize::begin(&mut self.default_payment_method),
133                "default_tax_rates" => Deserialize::begin(&mut self.default_tax_rates),
134                "description" => Deserialize::begin(&mut self.description),
135                "discounts" => Deserialize::begin(&mut self.discounts),
136                "end_date" => Deserialize::begin(&mut self.end_date),
137                "invoice_settings" => Deserialize::begin(&mut self.invoice_settings),
138                "items" => Deserialize::begin(&mut self.items),
139                "metadata" => Deserialize::begin(&mut self.metadata),
140                "on_behalf_of" => Deserialize::begin(&mut self.on_behalf_of),
141                "proration_behavior" => Deserialize::begin(&mut self.proration_behavior),
142                "start_date" => Deserialize::begin(&mut self.start_date),
143                "transfer_data" => Deserialize::begin(&mut self.transfer_data),
144                "trial_end" => Deserialize::begin(&mut self.trial_end),
145                _ => <dyn Visitor>::ignore(),
146            })
147        }
148
149        fn deser_default() -> Self {
150            Self {
151                add_invoice_items: Deserialize::default(),
152                application_fee_percent: Deserialize::default(),
153                automatic_tax: Deserialize::default(),
154                billing_cycle_anchor: Deserialize::default(),
155                billing_thresholds: Deserialize::default(),
156                collection_method: Deserialize::default(),
157                currency: Deserialize::default(),
158                default_payment_method: Deserialize::default(),
159                default_tax_rates: Deserialize::default(),
160                description: Deserialize::default(),
161                discounts: Deserialize::default(),
162                end_date: Deserialize::default(),
163                invoice_settings: Deserialize::default(),
164                items: Deserialize::default(),
165                metadata: Deserialize::default(),
166                on_behalf_of: Deserialize::default(),
167                proration_behavior: Deserialize::default(),
168                start_date: Deserialize::default(),
169                transfer_data: Deserialize::default(),
170                trial_end: Deserialize::default(),
171            }
172        }
173
174        fn take_out(&mut self) -> Option<Self::Out> {
175            let (
176                Some(add_invoice_items),
177                Some(application_fee_percent),
178                Some(automatic_tax),
179                Some(billing_cycle_anchor),
180                Some(billing_thresholds),
181                Some(collection_method),
182                Some(currency),
183                Some(default_payment_method),
184                Some(default_tax_rates),
185                Some(description),
186                Some(discounts),
187                Some(end_date),
188                Some(invoice_settings),
189                Some(items),
190                Some(metadata),
191                Some(on_behalf_of),
192                Some(proration_behavior),
193                Some(start_date),
194                Some(transfer_data),
195                Some(trial_end),
196            ) = (
197                self.add_invoice_items.take(),
198                self.application_fee_percent,
199                self.automatic_tax.take(),
200                self.billing_cycle_anchor,
201                self.billing_thresholds,
202                self.collection_method,
203                self.currency.take(),
204                self.default_payment_method.take(),
205                self.default_tax_rates.take(),
206                self.description.take(),
207                self.discounts.take(),
208                self.end_date,
209                self.invoice_settings.take(),
210                self.items.take(),
211                self.metadata.take(),
212                self.on_behalf_of.take(),
213                self.proration_behavior,
214                self.start_date,
215                self.transfer_data.take(),
216                self.trial_end,
217            )
218            else {
219                return None;
220            };
221            Some(Self::Out {
222                add_invoice_items,
223                application_fee_percent,
224                automatic_tax,
225                billing_cycle_anchor,
226                billing_thresholds,
227                collection_method,
228                currency,
229                default_payment_method,
230                default_tax_rates,
231                description,
232                discounts,
233                end_date,
234                invoice_settings,
235                items,
236                metadata,
237                on_behalf_of,
238                proration_behavior,
239                start_date,
240                transfer_data,
241                trial_end,
242            })
243        }
244    }
245
246    impl Map for Builder<'_> {
247        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
248            self.builder.key(k)
249        }
250
251        fn finish(&mut self) -> Result<()> {
252            *self.out = self.builder.take_out();
253            Ok(())
254        }
255    }
256
257    impl ObjectDeser for SubscriptionSchedulePhaseConfiguration {
258        type Builder = SubscriptionSchedulePhaseConfigurationBuilder;
259    }
260
261    impl FromValueOpt for SubscriptionSchedulePhaseConfiguration {
262        fn from_value(v: Value) -> Option<Self> {
263            let Value::Object(obj) = v else {
264                return None;
265            };
266            let mut b = SubscriptionSchedulePhaseConfigurationBuilder::deser_default();
267            for (k, v) in obj {
268                match k.as_str() {
269                    "add_invoice_items" => b.add_invoice_items = FromValueOpt::from_value(v),
270                    "application_fee_percent" => {
271                        b.application_fee_percent = FromValueOpt::from_value(v)
272                    }
273                    "automatic_tax" => b.automatic_tax = FromValueOpt::from_value(v),
274                    "billing_cycle_anchor" => b.billing_cycle_anchor = FromValueOpt::from_value(v),
275                    "billing_thresholds" => b.billing_thresholds = FromValueOpt::from_value(v),
276                    "collection_method" => b.collection_method = FromValueOpt::from_value(v),
277                    "currency" => b.currency = FromValueOpt::from_value(v),
278                    "default_payment_method" => {
279                        b.default_payment_method = FromValueOpt::from_value(v)
280                    }
281                    "default_tax_rates" => b.default_tax_rates = FromValueOpt::from_value(v),
282                    "description" => b.description = FromValueOpt::from_value(v),
283                    "discounts" => b.discounts = FromValueOpt::from_value(v),
284                    "end_date" => b.end_date = FromValueOpt::from_value(v),
285                    "invoice_settings" => b.invoice_settings = FromValueOpt::from_value(v),
286                    "items" => b.items = FromValueOpt::from_value(v),
287                    "metadata" => b.metadata = FromValueOpt::from_value(v),
288                    "on_behalf_of" => b.on_behalf_of = FromValueOpt::from_value(v),
289                    "proration_behavior" => b.proration_behavior = FromValueOpt::from_value(v),
290                    "start_date" => b.start_date = FromValueOpt::from_value(v),
291                    "transfer_data" => b.transfer_data = FromValueOpt::from_value(v),
292                    "trial_end" => b.trial_end = FromValueOpt::from_value(v),
293                    _ => {}
294                }
295            }
296            b.take_out()
297        }
298    }
299};
300/// Possible values are `phase_start` or `automatic`.
301/// If `phase_start` then billing cycle anchor of the subscription is set to the start of the phase when entering the phase.
302/// If `automatic` then the billing cycle anchor is automatically modified as needed when entering the phase.
303/// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
304#[derive(Copy, Clone, Eq, PartialEq)]
305pub enum SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
306    Automatic,
307    PhaseStart,
308}
309impl SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
310    pub fn as_str(self) -> &'static str {
311        use SubscriptionSchedulePhaseConfigurationBillingCycleAnchor::*;
312        match self {
313            Automatic => "automatic",
314            PhaseStart => "phase_start",
315        }
316    }
317}
318
319impl std::str::FromStr for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
320    type Err = stripe_types::StripeParseError;
321    fn from_str(s: &str) -> Result<Self, Self::Err> {
322        use SubscriptionSchedulePhaseConfigurationBillingCycleAnchor::*;
323        match s {
324            "automatic" => Ok(Automatic),
325            "phase_start" => Ok(PhaseStart),
326            _ => Err(stripe_types::StripeParseError),
327        }
328    }
329}
330impl std::fmt::Display for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
331    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
332        f.write_str(self.as_str())
333    }
334}
335
336impl std::fmt::Debug for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
337    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
338        f.write_str(self.as_str())
339    }
340}
341#[cfg(feature = "serialize")]
342impl serde::Serialize for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
343    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
344    where
345        S: serde::Serializer,
346    {
347        serializer.serialize_str(self.as_str())
348    }
349}
350impl miniserde::Deserialize for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
351    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
352        crate::Place::new(out)
353    }
354}
355
356impl miniserde::de::Visitor
357    for crate::Place<SubscriptionSchedulePhaseConfigurationBillingCycleAnchor>
358{
359    fn string(&mut self, s: &str) -> miniserde::Result<()> {
360        use std::str::FromStr;
361        self.out = Some(
362            SubscriptionSchedulePhaseConfigurationBillingCycleAnchor::from_str(s)
363                .map_err(|_| miniserde::Error)?,
364        );
365        Ok(())
366    }
367}
368
369stripe_types::impl_from_val_with_from_str!(
370    SubscriptionSchedulePhaseConfigurationBillingCycleAnchor
371);
372#[cfg(feature = "deserialize")]
373impl<'de> serde::Deserialize<'de> for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
374    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
375        use std::str::FromStr;
376        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
377        Self::from_str(&s).map_err(|_| {
378            serde::de::Error::custom(
379                "Unknown value for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor",
380            )
381        })
382    }
383}
384/// Either `charge_automatically`, or `send_invoice`.
385/// When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer.
386/// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`.
387#[derive(Copy, Clone, Eq, PartialEq)]
388pub enum SubscriptionSchedulePhaseConfigurationCollectionMethod {
389    ChargeAutomatically,
390    SendInvoice,
391}
392impl SubscriptionSchedulePhaseConfigurationCollectionMethod {
393    pub fn as_str(self) -> &'static str {
394        use SubscriptionSchedulePhaseConfigurationCollectionMethod::*;
395        match self {
396            ChargeAutomatically => "charge_automatically",
397            SendInvoice => "send_invoice",
398        }
399    }
400}
401
402impl std::str::FromStr for SubscriptionSchedulePhaseConfigurationCollectionMethod {
403    type Err = stripe_types::StripeParseError;
404    fn from_str(s: &str) -> Result<Self, Self::Err> {
405        use SubscriptionSchedulePhaseConfigurationCollectionMethod::*;
406        match s {
407            "charge_automatically" => Ok(ChargeAutomatically),
408            "send_invoice" => Ok(SendInvoice),
409            _ => Err(stripe_types::StripeParseError),
410        }
411    }
412}
413impl std::fmt::Display for SubscriptionSchedulePhaseConfigurationCollectionMethod {
414    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
415        f.write_str(self.as_str())
416    }
417}
418
419impl std::fmt::Debug for SubscriptionSchedulePhaseConfigurationCollectionMethod {
420    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
421        f.write_str(self.as_str())
422    }
423}
424#[cfg(feature = "serialize")]
425impl serde::Serialize for SubscriptionSchedulePhaseConfigurationCollectionMethod {
426    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
427    where
428        S: serde::Serializer,
429    {
430        serializer.serialize_str(self.as_str())
431    }
432}
433impl miniserde::Deserialize for SubscriptionSchedulePhaseConfigurationCollectionMethod {
434    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
435        crate::Place::new(out)
436    }
437}
438
439impl miniserde::de::Visitor
440    for crate::Place<SubscriptionSchedulePhaseConfigurationCollectionMethod>
441{
442    fn string(&mut self, s: &str) -> miniserde::Result<()> {
443        use std::str::FromStr;
444        self.out = Some(
445            SubscriptionSchedulePhaseConfigurationCollectionMethod::from_str(s)
446                .map_err(|_| miniserde::Error)?,
447        );
448        Ok(())
449    }
450}
451
452stripe_types::impl_from_val_with_from_str!(SubscriptionSchedulePhaseConfigurationCollectionMethod);
453#[cfg(feature = "deserialize")]
454impl<'de> serde::Deserialize<'de> for SubscriptionSchedulePhaseConfigurationCollectionMethod {
455    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
456        use std::str::FromStr;
457        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
458        Self::from_str(&s).map_err(|_| {
459            serde::de::Error::custom(
460                "Unknown value for SubscriptionSchedulePhaseConfigurationCollectionMethod",
461            )
462        })
463    }
464}
465/// When transitioning phases, controls how prorations are handled (if any).
466/// Possible values are `create_prorations`, `none`, and `always_invoice`.
467#[derive(Copy, Clone, Eq, PartialEq)]
468pub enum SubscriptionSchedulePhaseConfigurationProrationBehavior {
469    AlwaysInvoice,
470    CreateProrations,
471    None,
472}
473impl SubscriptionSchedulePhaseConfigurationProrationBehavior {
474    pub fn as_str(self) -> &'static str {
475        use SubscriptionSchedulePhaseConfigurationProrationBehavior::*;
476        match self {
477            AlwaysInvoice => "always_invoice",
478            CreateProrations => "create_prorations",
479            None => "none",
480        }
481    }
482}
483
484impl std::str::FromStr for SubscriptionSchedulePhaseConfigurationProrationBehavior {
485    type Err = stripe_types::StripeParseError;
486    fn from_str(s: &str) -> Result<Self, Self::Err> {
487        use SubscriptionSchedulePhaseConfigurationProrationBehavior::*;
488        match s {
489            "always_invoice" => Ok(AlwaysInvoice),
490            "create_prorations" => Ok(CreateProrations),
491            "none" => Ok(None),
492            _ => Err(stripe_types::StripeParseError),
493        }
494    }
495}
496impl std::fmt::Display for SubscriptionSchedulePhaseConfigurationProrationBehavior {
497    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
498        f.write_str(self.as_str())
499    }
500}
501
502impl std::fmt::Debug for SubscriptionSchedulePhaseConfigurationProrationBehavior {
503    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
504        f.write_str(self.as_str())
505    }
506}
507#[cfg(feature = "serialize")]
508impl serde::Serialize for SubscriptionSchedulePhaseConfigurationProrationBehavior {
509    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
510    where
511        S: serde::Serializer,
512    {
513        serializer.serialize_str(self.as_str())
514    }
515}
516impl miniserde::Deserialize for SubscriptionSchedulePhaseConfigurationProrationBehavior {
517    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
518        crate::Place::new(out)
519    }
520}
521
522impl miniserde::de::Visitor
523    for crate::Place<SubscriptionSchedulePhaseConfigurationProrationBehavior>
524{
525    fn string(&mut self, s: &str) -> miniserde::Result<()> {
526        use std::str::FromStr;
527        self.out = Some(
528            SubscriptionSchedulePhaseConfigurationProrationBehavior::from_str(s)
529                .map_err(|_| miniserde::Error)?,
530        );
531        Ok(())
532    }
533}
534
535stripe_types::impl_from_val_with_from_str!(SubscriptionSchedulePhaseConfigurationProrationBehavior);
536#[cfg(feature = "deserialize")]
537impl<'de> serde::Deserialize<'de> for SubscriptionSchedulePhaseConfigurationProrationBehavior {
538    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
539        use std::str::FromStr;
540        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
541        Self::from_str(&s).map_err(|_| {
542            serde::de::Error::custom(
543                "Unknown value for SubscriptionSchedulePhaseConfigurationProrationBehavior",
544            )
545        })
546    }
547}