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::{make_place, Deserialize, Result};
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
146                _ => <dyn Visitor>::ignore(),
147            })
148        }
149
150        fn deser_default() -> Self {
151            Self {
152                add_invoice_items: Deserialize::default(),
153                application_fee_percent: Deserialize::default(),
154                automatic_tax: Deserialize::default(),
155                billing_cycle_anchor: Deserialize::default(),
156                billing_thresholds: Deserialize::default(),
157                collection_method: Deserialize::default(),
158                currency: Deserialize::default(),
159                default_payment_method: Deserialize::default(),
160                default_tax_rates: Deserialize::default(),
161                description: Deserialize::default(),
162                discounts: Deserialize::default(),
163                end_date: Deserialize::default(),
164                invoice_settings: Deserialize::default(),
165                items: Deserialize::default(),
166                metadata: Deserialize::default(),
167                on_behalf_of: Deserialize::default(),
168                proration_behavior: Deserialize::default(),
169                start_date: Deserialize::default(),
170                transfer_data: Deserialize::default(),
171                trial_end: Deserialize::default(),
172            }
173        }
174
175        fn take_out(&mut self) -> Option<Self::Out> {
176            let (
177                Some(add_invoice_items),
178                Some(application_fee_percent),
179                Some(automatic_tax),
180                Some(billing_cycle_anchor),
181                Some(billing_thresholds),
182                Some(collection_method),
183                Some(currency),
184                Some(default_payment_method),
185                Some(default_tax_rates),
186                Some(description),
187                Some(discounts),
188                Some(end_date),
189                Some(invoice_settings),
190                Some(items),
191                Some(metadata),
192                Some(on_behalf_of),
193                Some(proration_behavior),
194                Some(start_date),
195                Some(transfer_data),
196                Some(trial_end),
197            ) = (
198                self.add_invoice_items.take(),
199                self.application_fee_percent,
200                self.automatic_tax.take(),
201                self.billing_cycle_anchor,
202                self.billing_thresholds,
203                self.collection_method,
204                self.currency.take(),
205                self.default_payment_method.take(),
206                self.default_tax_rates.take(),
207                self.description.take(),
208                self.discounts.take(),
209                self.end_date,
210                self.invoice_settings.take(),
211                self.items.take(),
212                self.metadata.take(),
213                self.on_behalf_of.take(),
214                self.proration_behavior,
215                self.start_date,
216                self.transfer_data.take(),
217                self.trial_end,
218            )
219            else {
220                return None;
221            };
222            Some(Self::Out {
223                add_invoice_items,
224                application_fee_percent,
225                automatic_tax,
226                billing_cycle_anchor,
227                billing_thresholds,
228                collection_method,
229                currency,
230                default_payment_method,
231                default_tax_rates,
232                description,
233                discounts,
234                end_date,
235                invoice_settings,
236                items,
237                metadata,
238                on_behalf_of,
239                proration_behavior,
240                start_date,
241                transfer_data,
242                trial_end,
243            })
244        }
245    }
246
247    impl Map for Builder<'_> {
248        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
249            self.builder.key(k)
250        }
251
252        fn finish(&mut self) -> Result<()> {
253            *self.out = self.builder.take_out();
254            Ok(())
255        }
256    }
257
258    impl ObjectDeser for SubscriptionSchedulePhaseConfiguration {
259        type Builder = SubscriptionSchedulePhaseConfigurationBuilder;
260    }
261
262    impl FromValueOpt for SubscriptionSchedulePhaseConfiguration {
263        fn from_value(v: Value) -> Option<Self> {
264            let Value::Object(obj) = v else {
265                return None;
266            };
267            let mut b = SubscriptionSchedulePhaseConfigurationBuilder::deser_default();
268            for (k, v) in obj {
269                match k.as_str() {
270                    "add_invoice_items" => b.add_invoice_items = FromValueOpt::from_value(v),
271                    "application_fee_percent" => {
272                        b.application_fee_percent = FromValueOpt::from_value(v)
273                    }
274                    "automatic_tax" => b.automatic_tax = FromValueOpt::from_value(v),
275                    "billing_cycle_anchor" => b.billing_cycle_anchor = FromValueOpt::from_value(v),
276                    "billing_thresholds" => b.billing_thresholds = FromValueOpt::from_value(v),
277                    "collection_method" => b.collection_method = FromValueOpt::from_value(v),
278                    "currency" => b.currency = FromValueOpt::from_value(v),
279                    "default_payment_method" => {
280                        b.default_payment_method = FromValueOpt::from_value(v)
281                    }
282                    "default_tax_rates" => b.default_tax_rates = FromValueOpt::from_value(v),
283                    "description" => b.description = FromValueOpt::from_value(v),
284                    "discounts" => b.discounts = FromValueOpt::from_value(v),
285                    "end_date" => b.end_date = FromValueOpt::from_value(v),
286                    "invoice_settings" => b.invoice_settings = FromValueOpt::from_value(v),
287                    "items" => b.items = FromValueOpt::from_value(v),
288                    "metadata" => b.metadata = FromValueOpt::from_value(v),
289                    "on_behalf_of" => b.on_behalf_of = FromValueOpt::from_value(v),
290                    "proration_behavior" => b.proration_behavior = FromValueOpt::from_value(v),
291                    "start_date" => b.start_date = FromValueOpt::from_value(v),
292                    "transfer_data" => b.transfer_data = FromValueOpt::from_value(v),
293                    "trial_end" => b.trial_end = FromValueOpt::from_value(v),
294
295                    _ => {}
296                }
297            }
298            b.take_out()
299        }
300    }
301};
302/// Possible values are `phase_start` or `automatic`.
303/// If `phase_start` then billing cycle anchor of the subscription is set to the start of the phase when entering the phase.
304/// If `automatic` then the billing cycle anchor is automatically modified as needed when entering the phase.
305/// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
306#[derive(Copy, Clone, Eq, PartialEq)]
307pub enum SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
308    Automatic,
309    PhaseStart,
310}
311impl SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
312    pub fn as_str(self) -> &'static str {
313        use SubscriptionSchedulePhaseConfigurationBillingCycleAnchor::*;
314        match self {
315            Automatic => "automatic",
316            PhaseStart => "phase_start",
317        }
318    }
319}
320
321impl std::str::FromStr for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
322    type Err = stripe_types::StripeParseError;
323    fn from_str(s: &str) -> Result<Self, Self::Err> {
324        use SubscriptionSchedulePhaseConfigurationBillingCycleAnchor::*;
325        match s {
326            "automatic" => Ok(Automatic),
327            "phase_start" => Ok(PhaseStart),
328            _ => Err(stripe_types::StripeParseError),
329        }
330    }
331}
332impl std::fmt::Display for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
333    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
334        f.write_str(self.as_str())
335    }
336}
337
338impl std::fmt::Debug for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
339    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
340        f.write_str(self.as_str())
341    }
342}
343#[cfg(feature = "serialize")]
344impl serde::Serialize for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
345    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
346    where
347        S: serde::Serializer,
348    {
349        serializer.serialize_str(self.as_str())
350    }
351}
352impl miniserde::Deserialize for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
353    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
354        crate::Place::new(out)
355    }
356}
357
358impl miniserde::de::Visitor
359    for crate::Place<SubscriptionSchedulePhaseConfigurationBillingCycleAnchor>
360{
361    fn string(&mut self, s: &str) -> miniserde::Result<()> {
362        use std::str::FromStr;
363        self.out = Some(
364            SubscriptionSchedulePhaseConfigurationBillingCycleAnchor::from_str(s)
365                .map_err(|_| miniserde::Error)?,
366        );
367        Ok(())
368    }
369}
370
371stripe_types::impl_from_val_with_from_str!(
372    SubscriptionSchedulePhaseConfigurationBillingCycleAnchor
373);
374#[cfg(feature = "deserialize")]
375impl<'de> serde::Deserialize<'de> for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
376    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
377        use std::str::FromStr;
378        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
379        Self::from_str(&s).map_err(|_| {
380            serde::de::Error::custom(
381                "Unknown value for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor",
382            )
383        })
384    }
385}
386/// Either `charge_automatically`, or `send_invoice`.
387/// 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.
388/// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`.
389#[derive(Copy, Clone, Eq, PartialEq)]
390pub enum SubscriptionSchedulePhaseConfigurationCollectionMethod {
391    ChargeAutomatically,
392    SendInvoice,
393}
394impl SubscriptionSchedulePhaseConfigurationCollectionMethod {
395    pub fn as_str(self) -> &'static str {
396        use SubscriptionSchedulePhaseConfigurationCollectionMethod::*;
397        match self {
398            ChargeAutomatically => "charge_automatically",
399            SendInvoice => "send_invoice",
400        }
401    }
402}
403
404impl std::str::FromStr for SubscriptionSchedulePhaseConfigurationCollectionMethod {
405    type Err = stripe_types::StripeParseError;
406    fn from_str(s: &str) -> Result<Self, Self::Err> {
407        use SubscriptionSchedulePhaseConfigurationCollectionMethod::*;
408        match s {
409            "charge_automatically" => Ok(ChargeAutomatically),
410            "send_invoice" => Ok(SendInvoice),
411            _ => Err(stripe_types::StripeParseError),
412        }
413    }
414}
415impl std::fmt::Display for SubscriptionSchedulePhaseConfigurationCollectionMethod {
416    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
417        f.write_str(self.as_str())
418    }
419}
420
421impl std::fmt::Debug for SubscriptionSchedulePhaseConfigurationCollectionMethod {
422    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
423        f.write_str(self.as_str())
424    }
425}
426#[cfg(feature = "serialize")]
427impl serde::Serialize for SubscriptionSchedulePhaseConfigurationCollectionMethod {
428    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
429    where
430        S: serde::Serializer,
431    {
432        serializer.serialize_str(self.as_str())
433    }
434}
435impl miniserde::Deserialize for SubscriptionSchedulePhaseConfigurationCollectionMethod {
436    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
437        crate::Place::new(out)
438    }
439}
440
441impl miniserde::de::Visitor
442    for crate::Place<SubscriptionSchedulePhaseConfigurationCollectionMethod>
443{
444    fn string(&mut self, s: &str) -> miniserde::Result<()> {
445        use std::str::FromStr;
446        self.out = Some(
447            SubscriptionSchedulePhaseConfigurationCollectionMethod::from_str(s)
448                .map_err(|_| miniserde::Error)?,
449        );
450        Ok(())
451    }
452}
453
454stripe_types::impl_from_val_with_from_str!(SubscriptionSchedulePhaseConfigurationCollectionMethod);
455#[cfg(feature = "deserialize")]
456impl<'de> serde::Deserialize<'de> for SubscriptionSchedulePhaseConfigurationCollectionMethod {
457    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
458        use std::str::FromStr;
459        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
460        Self::from_str(&s).map_err(|_| {
461            serde::de::Error::custom(
462                "Unknown value for SubscriptionSchedulePhaseConfigurationCollectionMethod",
463            )
464        })
465    }
466}
467/// When transitioning phases, controls how prorations are handled (if any).
468/// Possible values are `create_prorations`, `none`, and `always_invoice`.
469#[derive(Copy, Clone, Eq, PartialEq)]
470pub enum SubscriptionSchedulePhaseConfigurationProrationBehavior {
471    AlwaysInvoice,
472    CreateProrations,
473    None,
474}
475impl SubscriptionSchedulePhaseConfigurationProrationBehavior {
476    pub fn as_str(self) -> &'static str {
477        use SubscriptionSchedulePhaseConfigurationProrationBehavior::*;
478        match self {
479            AlwaysInvoice => "always_invoice",
480            CreateProrations => "create_prorations",
481            None => "none",
482        }
483    }
484}
485
486impl std::str::FromStr for SubscriptionSchedulePhaseConfigurationProrationBehavior {
487    type Err = stripe_types::StripeParseError;
488    fn from_str(s: &str) -> Result<Self, Self::Err> {
489        use SubscriptionSchedulePhaseConfigurationProrationBehavior::*;
490        match s {
491            "always_invoice" => Ok(AlwaysInvoice),
492            "create_prorations" => Ok(CreateProrations),
493            "none" => Ok(None),
494            _ => Err(stripe_types::StripeParseError),
495        }
496    }
497}
498impl std::fmt::Display for SubscriptionSchedulePhaseConfigurationProrationBehavior {
499    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
500        f.write_str(self.as_str())
501    }
502}
503
504impl std::fmt::Debug for SubscriptionSchedulePhaseConfigurationProrationBehavior {
505    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
506        f.write_str(self.as_str())
507    }
508}
509#[cfg(feature = "serialize")]
510impl serde::Serialize for SubscriptionSchedulePhaseConfigurationProrationBehavior {
511    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
512    where
513        S: serde::Serializer,
514    {
515        serializer.serialize_str(self.as_str())
516    }
517}
518impl miniserde::Deserialize for SubscriptionSchedulePhaseConfigurationProrationBehavior {
519    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
520        crate::Place::new(out)
521    }
522}
523
524impl miniserde::de::Visitor
525    for crate::Place<SubscriptionSchedulePhaseConfigurationProrationBehavior>
526{
527    fn string(&mut self, s: &str) -> miniserde::Result<()> {
528        use std::str::FromStr;
529        self.out = Some(
530            SubscriptionSchedulePhaseConfigurationProrationBehavior::from_str(s)
531                .map_err(|_| miniserde::Error)?,
532        );
533        Ok(())
534    }
535}
536
537stripe_types::impl_from_val_with_from_str!(SubscriptionSchedulePhaseConfigurationProrationBehavior);
538#[cfg(feature = "deserialize")]
539impl<'de> serde::Deserialize<'de> for SubscriptionSchedulePhaseConfigurationProrationBehavior {
540    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
541        use std::str::FromStr;
542        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
543        Self::from_str(&s).map_err(|_| {
544            serde::de::Error::custom(
545                "Unknown value for SubscriptionSchedulePhaseConfigurationProrationBehavior",
546            )
547        })
548    }
549}