dodopayments_rust 2.2.1

Rust SDK for Dodo Payments API
Documentation
/*
 * 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};

/// RecurringPrice : Recurring price details.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct RecurringPrice {
    /// The currency in which the payment is made.
    #[serde(rename = "currency")]
    pub currency: models::Currency,
    /// Discount applied to the price, represented as a percentage (0 to 100).
    #[serde(rename = "discount")]
    pub discount: i64,
    /// Number of units for the payment frequency. For example, a value of `1` with a `payment_frequency_interval` of `month` represents monthly payments.
    #[serde(rename = "payment_frequency_count")]
    pub payment_frequency_count: i32,
    /// The time interval for the payment frequency (e.g., day, month, year).
    #[serde(rename = "payment_frequency_interval")]
    pub payment_frequency_interval: models::TimeInterval,
    /// The payment amount. Represented in the lowest denomination of the currency (e.g., cents for USD). For example, to charge $1.00, pass `100`.
    #[serde(rename = "price")]
    pub price: i32,
    /// Indicates if purchasing power parity adjustments are applied to the price. Purchasing power parity feature is not available as of now
    #[serde(rename = "purchasing_power_parity")]
    pub purchasing_power_parity: bool,
    /// Number of units for the subscription period. For example, a value of `12` with a `subscription_period_interval` of `month` represents a one-year subscription.
    #[serde(rename = "subscription_period_count")]
    pub subscription_period_count: i32,
    /// The time interval for the subscription period (e.g., day, month, year).
    #[serde(rename = "subscription_period_interval")]
    pub subscription_period_interval: models::TimeInterval,
    /// Indicates if the price is tax inclusive
    #[serde(rename = "tax_inclusive", skip_serializing_if = "Option::is_none")]
    pub tax_inclusive: Option<bool>,
    /// Number of days for the trial period. A value of `0` indicates no trial period.
    #[serde(rename = "trial_period_days", skip_serializing_if = "Option::is_none")]
    pub trial_period_days: Option<i32>,
    #[serde(rename = "type")]
    pub r#type: Type,
}

impl RecurringPrice {
    /// Recurring price details.
    pub fn new(currency: models::Currency, discount: i64, payment_frequency_count: i32, payment_frequency_interval: models::TimeInterval, price: i32, purchasing_power_parity: bool, subscription_period_count: i32, subscription_period_interval: models::TimeInterval, r#type: Type) -> RecurringPrice {
        RecurringPrice {
            currency,
            discount,
            payment_frequency_count,
            payment_frequency_interval,
            price,
            purchasing_power_parity,
            subscription_period_count,
            subscription_period_interval,
            tax_inclusive: None,
            trial_period_days: None,
            r#type,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "recurring_price")]
    RecurringPrice,
}

impl Default for Type {
    fn default() -> Type {
        Self::RecurringPrice
    }
}