bitwarden_api_api/models/billing_customer_discount.rs
1/*
2 * Bitwarden Internal API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: latest
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12
13use crate::models;
14
15/// BillingCustomerDiscount : Customer discount information from Stripe billing.
16#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
17pub struct BillingCustomerDiscount {
18 /// The Stripe coupon ID (e.g., \"cm3nHfO1\").
19 #[serde(rename = "id", alias = "Id", skip_serializing_if = "Option::is_none")]
20 pub id: Option<String>,
21 /// Whether the discount is a recurring/perpetual discount with no expiration date. This
22 /// property is true only when the discount has no end date, meaning it applies indefinitely to
23 /// all future renewals. This is a product decision for Milestone 2 to only display perpetual
24 /// discounts in the UI. Note: This does NOT indicate whether the discount is \"currently
25 /// active\" in the billing sense. A discount with a future end date is functionally active and
26 /// will be applied by Stripe, but this property will be false because it has an expiration
27 /// date.
28 #[serde(
29 rename = "active",
30 alias = "Active",
31 skip_serializing_if = "Option::is_none"
32 )]
33 pub active: Option<bool>,
34 /// Percentage discount applied to the subscription (e.g., 20.0 for 20% off). Null if this is
35 /// an amount-based discount.
36 #[serde(
37 rename = "percentOff",
38 alias = "PercentOff",
39 skip_serializing_if = "Option::is_none"
40 )]
41 pub percent_off: Option<f64>,
42 /// Fixed amount discount in USD (e.g., 14.00 for $14 off). Converted from Stripe's cent-based
43 /// values (1400 cents → $14.00). Null if this is a percentage-based discount. Note: Stripe
44 /// stores amounts in the smallest currency unit. This value is always in USD.
45 #[serde(
46 rename = "amountOff",
47 alias = "AmountOff",
48 skip_serializing_if = "Option::is_none"
49 )]
50 pub amount_off: Option<f64>,
51 /// The instant the discount stops applying (Stripe Discount.end). Null = no end date /
52 /// perpetual.
53 #[serde(rename = "end", alias = "End", skip_serializing_if = "Option::is_none")]
54 pub end: Option<String>,
55 /// For a repeating coupon, the number of months it applies. Null for once/forever.
56 #[serde(
57 rename = "durationInMonths",
58 alias = "DurationInMonths",
59 skip_serializing_if = "Option::is_none"
60 )]
61 pub duration_in_months: Option<i64>,
62 /// List of Stripe product IDs that this discount applies to (e.g., [\"prod_premium\",
63 /// \"prod_families\"]). Null: discount applies to all products with no restrictions
64 /// (AppliesTo not specified in Stripe). Empty list: discount restricted to zero products (edge
65 /// case - AppliesTo.Products = [] in Stripe). Non-empty list: discount applies only to the
66 /// specified product IDs.
67 #[serde(
68 rename = "appliesTo",
69 alias = "AppliesTo",
70 skip_serializing_if = "Option::is_none"
71 )]
72 pub applies_to: Option<Vec<String>>,
73 /// True when this discount was surfaced from a price-migration schedule's Phase 2 coupon
74 /// rather than a genuine customer- or subscription-level discount. Lets clients distinguish a
75 /// deferred price-migration coupon from a real discount.
76 #[serde(
77 rename = "isFromSchedule",
78 alias = "IsFromSchedule",
79 skip_serializing_if = "Option::is_none"
80 )]
81 pub is_from_schedule: Option<bool>,
82}
83
84impl BillingCustomerDiscount {
85 /// Customer discount information from Stripe billing.
86 pub fn new() -> BillingCustomerDiscount {
87 BillingCustomerDiscount {
88 id: None,
89 active: None,
90 percent_off: None,
91 amount_off: None,
92 end: None,
93 duration_in_months: None,
94 applies_to: None,
95 is_from_schedule: None,
96 }
97 }
98}