/*
* 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};
/// SubscriptionListResponseItem : Response struct representing subscription details
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SubscriptionListResponseItem {
/// 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,
/// Currency used for the subscription payments
#[serde(rename = "currency")]
pub currency: models::Currency,
/// 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>,
/// Additional custom data associated with the subscription
#[serde(rename = "metadata")]
pub metadata: std::collections::HashMap<String, String>,
/// 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,
/// Name of the product associated with this subscription
#[serde(rename = "product_name", skip_serializing_if = "Option::is_none")]
pub product_name: Option<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 SubscriptionListResponseItem {
/// Response struct representing subscription details
pub fn new(billing: models::BillingAddress, cancel_at_next_billing_date: bool, created_at: String, currency: models::Currency, customer: models::CustomerLimitedDetailsResponse, metadata: std::collections::HashMap<String, String>, 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) -> SubscriptionListResponseItem {
SubscriptionListResponseItem {
billing: Box::new(billing),
cancel_at_next_billing_date,
cancelled_at: None,
created_at,
currency,
customer: Box::new(customer),
discount_cycles_remaining: None,
discount_id: None,
metadata,
next_billing_date,
on_demand,
payment_frequency_count,
payment_frequency_interval,
payment_method_id: None,
previous_billing_date,
product_id,
product_name: None,
quantity,
recurring_pre_tax_amount,
status,
subscription_id,
subscription_period_count,
subscription_period_interval,
tax_id: None,
tax_inclusive,
trial_period_days,
}
}
}