/*
* public
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.87.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// SubscriptionResponse : Response struct representing subscription details
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SubscriptionResponse {
/// Addons associated with this subscription
#[serde(rename = "addons")]
pub addons: Vec<models::AddonCartResponseItem>,
/// Billing address details for payments
#[serde(rename = "billing")]
pub billing: Box<models::BillingAddress>,
/// Indicates if the subscription will cancel at the next billing date
#[serde(rename = "cancel_at_next_billing_date")]
pub cancel_at_next_billing_date: bool,
/// Cancelled timestamp if the subscription is cancelled
#[serde(rename = "cancelled_at", skip_serializing_if = "Option::is_none")]
pub cancelled_at: Option<String>,
/// Timestamp when the subscription was created
#[serde(rename = "created_at")]
pub created_at: String,
/// Credit entitlement cart settings for this subscription
#[serde(rename = "credit_entitlement_cart")]
pub credit_entitlement_cart: Vec<models::CreditEntitlementCartResponse>,
/// Currency used for the subscription payments
#[serde(rename = "currency")]
pub currency: models::Currency,
/// Customer's responses to custom fields collected during checkout
#[serde(rename = "custom_field_responses", skip_serializing_if = "Option::is_none")]
pub custom_field_responses: Option<Vec<models::CustomFieldResponse>>,
/// Customer details associated with the subscription
#[serde(rename = "customer")]
pub customer: Box<models::CustomerLimitedDetailsResponse>,
/// Number of remaining discount cycles if discount is applied
#[serde(rename = "discount_cycles_remaining", skip_serializing_if = "Option::is_none")]
pub discount_cycles_remaining: Option<i32>,
/// The discount id if discount is applied
#[serde(rename = "discount_id", skip_serializing_if = "Option::is_none")]
pub discount_id: Option<String>,
/// Timestamp when the subscription will expire
#[serde(rename = "expires_at", skip_serializing_if = "Option::is_none")]
pub expires_at: Option<String>,
/// Additional custom data associated with the subscription
#[serde(rename = "metadata")]
pub metadata: std::collections::HashMap<String, String>,
/// Meter credit entitlement cart settings for this subscription
#[serde(rename = "meter_credit_entitlement_cart")]
pub meter_credit_entitlement_cart: Vec<models::MeterCreditEntitlementCartResponse>,
/// Meters associated with this subscription (for usage-based billing)
#[serde(rename = "meters")]
pub meters: Vec<models::MeterCartResponseItem>,
/// Timestamp of the next scheduled billing. Indicates the end of current billing period
#[serde(rename = "next_billing_date")]
pub next_billing_date: String,
/// Wether the subscription is on-demand or not
#[serde(rename = "on_demand")]
pub on_demand: bool,
/// Number of payment frequency intervals
#[serde(rename = "payment_frequency_count")]
pub payment_frequency_count: i32,
/// Time interval for payment frequency (e.g. month, year)
#[serde(rename = "payment_frequency_interval")]
pub payment_frequency_interval: models::TimeInterval,
/// Saved payment method id used for recurring charges
#[serde(rename = "payment_method_id", skip_serializing_if = "Option::is_none")]
pub payment_method_id: Option<String>,
/// Timestamp of the last payment. Indicates the start of current billing period
#[serde(rename = "previous_billing_date")]
pub previous_billing_date: String,
/// Identifier of the product associated with this subscription
#[serde(rename = "product_id")]
pub product_id: String,
/// Number of units/items included in the subscription
#[serde(rename = "quantity")]
pub quantity: i32,
/// Amount charged before tax for each recurring payment in smallest currency unit (e.g. cents)
#[serde(rename = "recurring_pre_tax_amount")]
pub recurring_pre_tax_amount: i32,
/// Current status of the subscription
#[serde(rename = "status")]
pub status: models::SubscriptionStatus,
/// Unique identifier for the subscription
#[serde(rename = "subscription_id")]
pub subscription_id: String,
/// Number of subscription period intervals
#[serde(rename = "subscription_period_count")]
pub subscription_period_count: i32,
/// Time interval for the subscription period (e.g. month, year)
#[serde(rename = "subscription_period_interval")]
pub subscription_period_interval: models::TimeInterval,
/// Tax identifier provided for this subscription (if applicable)
#[serde(rename = "tax_id", skip_serializing_if = "Option::is_none")]
pub tax_id: Option<String>,
/// Indicates if the recurring_pre_tax_amount is tax inclusive
#[serde(rename = "tax_inclusive")]
pub tax_inclusive: bool,
/// Number of days in the trial period (0 if no trial)
#[serde(rename = "trial_period_days")]
pub trial_period_days: i32,
}
impl SubscriptionResponse {
/// Response struct representing subscription details
pub fn new(addons: Vec<models::AddonCartResponseItem>, billing: models::BillingAddress, cancel_at_next_billing_date: bool, created_at: String, credit_entitlement_cart: Vec<models::CreditEntitlementCartResponse>, currency: models::Currency, customer: models::CustomerLimitedDetailsResponse, metadata: std::collections::HashMap<String, String>, meter_credit_entitlement_cart: Vec<models::MeterCreditEntitlementCartResponse>, meters: Vec<models::MeterCartResponseItem>, next_billing_date: String, on_demand: bool, payment_frequency_count: i32, payment_frequency_interval: models::TimeInterval, previous_billing_date: String, product_id: String, quantity: i32, recurring_pre_tax_amount: i32, status: models::SubscriptionStatus, subscription_id: String, subscription_period_count: i32, subscription_period_interval: models::TimeInterval, tax_inclusive: bool, trial_period_days: i32) -> SubscriptionResponse {
SubscriptionResponse {
addons,
billing: Box::new(billing),
cancel_at_next_billing_date,
cancelled_at: None,
created_at,
credit_entitlement_cart,
currency,
custom_field_responses: None,
customer: Box::new(customer),
discount_cycles_remaining: None,
discount_id: None,
expires_at: None,
metadata,
meter_credit_entitlement_cart,
meters,
next_billing_date,
on_demand,
payment_frequency_count,
payment_frequency_interval,
payment_method_id: None,
previous_billing_date,
product_id,
quantity,
recurring_pre_tax_amount,
status,
subscription_id,
subscription_period_count,
subscription_period_interval,
tax_id: None,
tax_inclusive,
trial_period_days,
}
}
}