dodopayments_rust 2.2.2

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};

/// OneTimePrice : One-time price details.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct OneTimePrice {
    /// 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,
    /// Indicates whether the customer can pay any amount they choose. If set to `true`, the [`price`](Self::price) field is the minimum amount.
    #[serde(rename = "pay_what_you_want", skip_serializing_if = "Option::is_none")]
    pub pay_what_you_want: Option<bool>,
    /// The payment amount, in the smallest denomination of the currency (e.g., cents for USD). For example, to charge $1.00, pass `100`.  If [`pay_what_you_want`](Self::pay_what_you_want) is set to `true`, this field represents the **minimum** amount the customer must pay.
    #[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,
    /// A suggested price for the user to pay. This value is only considered if [`pay_what_you_want`](Self::pay_what_you_want) is `true`. Otherwise, it is ignored.
    #[serde(rename = "suggested_price", skip_serializing_if = "Option::is_none")]
    pub suggested_price: Option<i32>,
    /// Indicates if the price is tax inclusive.
    #[serde(rename = "tax_inclusive", skip_serializing_if = "Option::is_none")]
    pub tax_inclusive: Option<bool>,
    #[serde(rename = "type")]
    pub r#type: Type,
}

impl OneTimePrice {
    /// One-time price details.
    pub fn new(currency: models::Currency, discount: i64, price: i32, purchasing_power_parity: bool, r#type: Type) -> OneTimePrice {
        OneTimePrice {
            currency,
            discount,
            pay_what_you_want: None,
            price,
            purchasing_power_parity,
            suggested_price: None,
            tax_inclusive: None,
            r#type,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "one_time_price")]
    OneTimePrice,
}

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