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(rename = "cadence", alias = "Cadence")]
26 pub cadence: models::PlanCadenceType,
27 #[serde(rename = "planTier", alias = "PlanTier")]
28 pub plan_tier: models::PlanTierType,
29 #[serde(
30 rename = "discounts",
31 alias = "Discounts",
32 skip_serializing_if = "Option::is_none"
33 )]
34 pub discounts: Option<Vec<models::InvoicePreviewDiscount>>,
35 #[serde(
36 rename = "startingBalance",
37 alias = "StartingBalance",
38 skip_serializing_if = "Option::is_none"
39 )]
40 pub starting_balance: Option<f64>,
41 #[serde(rename = "estimatedTax", alias = "EstimatedTax")]
42 pub estimated_tax: f64,
43 #[serde(rename = "total", alias = "Total")]
44 pub total: f64,
45 #[serde(rename = "amountDue", alias = "AmountDue")]
46 pub amount_due: f64,
47 #[serde(
48 rename = "nextPaymentAttempt",
49 alias = "NextPaymentAttempt",
50 skip_serializing_if = "Option::is_none"
51 )]
52 pub next_payment_attempt: Option<String>,
53}
54
55impl InvoicePreview {
56 pub fn new(
57 password_manager: models::PasswordManagerInvoiceItems,
58 cadence: models::PlanCadenceType,
59 plan_tier: models::PlanTierType,
60 estimated_tax: f64,
61 total: f64,
62 amount_due: f64,
63 ) -> InvoicePreview {
64 InvoicePreview {
65 password_manager: Box::new(password_manager),
66 secrets_manager: None,
67 cadence,
68 plan_tier,
69 discounts: None,
70 starting_balance: None,
71 estimated_tax,
72 total,
73 amount_due,
74 next_payment_attempt: None,
75 }
76 }
77}