bitwarden_api_api/models/
invoice_preview.rs1use serde::{Deserialize, Serialize};
12
13use crate::models;
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct InvoicePreview {
17 #[serde(rename = "passwordManager", alias = "PasswordManager")]
18 pub password_manager: Box<models::PasswordManagerInvoiceItems>,
19 #[serde(
20 rename = "secretsManager",
21 alias = "SecretsManager",
22 skip_serializing_if = "Option::is_none"
23 )]
24 pub secrets_manager: Option<Box<models::SecretsManagerInvoiceItems>>,
25 #[serde(
26 rename = "privilegedControls",
27 alias = "PrivilegedControls",
28 skip_serializing_if = "Option::is_none"
29 )]
30 pub privileged_controls: Option<Box<models::PrivilegedControlsInvoiceItems>>,
31 #[serde(rename = "cadence", alias = "Cadence")]
32 pub cadence: models::PlanCadenceType,
33 #[serde(rename = "planTier", alias = "PlanTier")]
34 pub plan_tier: models::PlanTierType,
35 #[serde(
36 rename = "discounts",
37 alias = "Discounts",
38 skip_serializing_if = "Option::is_none"
39 )]
40 pub discounts: Option<Vec<models::InvoicePreviewDiscount>>,
41 #[serde(
42 rename = "startingBalance",
43 alias = "StartingBalance",
44 skip_serializing_if = "Option::is_none"
45 )]
46 pub starting_balance: Option<f64>,
47 #[serde(rename = "estimatedTax", alias = "EstimatedTax")]
48 pub estimated_tax: f64,
49 #[serde(rename = "total", alias = "Total")]
50 pub total: f64,
51 #[serde(rename = "amountDue", alias = "AmountDue")]
52 pub amount_due: f64,
53 #[serde(
54 rename = "nextPaymentAttempt",
55 alias = "NextPaymentAttempt",
56 skip_serializing_if = "Option::is_none"
57 )]
58 pub next_payment_attempt: Option<String>,
59}
60
61impl InvoicePreview {
62 pub fn new(
63 password_manager: models::PasswordManagerInvoiceItems,
64 cadence: models::PlanCadenceType,
65 plan_tier: models::PlanTierType,
66 estimated_tax: f64,
67 total: f64,
68 amount_due: f64,
69 ) -> InvoicePreview {
70 InvoicePreview {
71 password_manager: Box::new(password_manager),
72 secrets_manager: None,
73 privileged_controls: None,
74 cadence,
75 plan_tier,
76 discounts: None,
77 starting_balance: None,
78 estimated_tax,
79 total,
80 amount_due,
81 next_payment_attempt: None,
82 }
83 }
84}