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