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 /// List of Stripe product IDs that this discount applies to (e.g., [\"prod_premium\",
52 /// \"prod_families\"]). Null: discount applies to all products with no restrictions
53 /// (AppliesTo not specified in Stripe). Empty list: discount restricted to zero products (edge
54 /// case - AppliesTo.Products = [] in Stripe). Non-empty list: discount applies only to the
55 /// specified product IDs.
56 #[serde(
57 rename = "appliesTo",
58 alias = "AppliesTo",
59 skip_serializing_if = "Option::is_none"
60 )]
61 pub applies_to: Option<Vec<String>>,
62}
63
64impl BillingCustomerDiscount {
65 /// Customer discount information from Stripe billing.
66 pub fn new() -> BillingCustomerDiscount {
67 BillingCustomerDiscount {
68 id: None,
69 active: None,
70 percent_off: None,
71 amount_off: None,
72 applies_to: None,
73 }
74 }
75}