pipedrive-rs 0.1.0

Rust PipedriveClient
Documentation
/*
 * Pipedrive API v1
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 * Generated by: https://openapi-generator.tech
 */




#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct PaymentResponse200AllOfDataInner {
    /// The ID of the payment
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<i32>,
    /// The ID of the subscription this payment is associated with
    #[serde(rename = "subscription_id", skip_serializing_if = "Option::is_none")]
    pub subscription_id: Option<i32>,
    /// The ID of the deal this payment is associated with
    #[serde(rename = "deal_id", skip_serializing_if = "Option::is_none")]
    pub deal_id: Option<i32>,
    /// The payment status
    #[serde(rename = "is_active", skip_serializing_if = "Option::is_none")]
    pub is_active: Option<bool>,
    /// The payment amount
    #[serde(rename = "amount", skip_serializing_if = "Option::is_none")]
    pub amount: Option<f64>,
    /// The currency of the payment
    #[serde(rename = "currency", skip_serializing_if = "Option::is_none")]
    pub currency: Option<String>,
    /// The difference between the amount of the current payment and the previous payment. The value can be either positive or negative.
    #[serde(rename = "change_amount", skip_serializing_if = "Option::is_none")]
    pub change_amount: Option<f64>,
    /// The date when payment occurs
    #[serde(rename = "due_at", skip_serializing_if = "Option::is_none")]
    pub due_at: Option<String>,
    /// Represents the movement of revenue in comparison with the previous payment. Possible values are: `New` - first payment of the subscription. `Recurring` - no movement. `Expansion` - current payment amount > previous payment amount. `Contraction` - current payment amount < previous payment amount. `Churn` - last payment of the subscription.
    #[serde(rename = "revenue_movement_type", skip_serializing_if = "Option::is_none")]
    pub revenue_movement_type: Option<RevenueMovementType>,
    /// The type of the payment. Possible values are: `Recurring` - payments occur over fixed intervals of time, `Additional` - extra payment not the recurring payment of the recurring subscription, `Installment` - payment of the installment subscription.
    #[serde(rename = "payment_type", skip_serializing_if = "Option::is_none")]
    pub payment_type: Option<PaymentType>,
    /// The description of the payment
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// The creation time of the payment
    #[serde(rename = "add_time", skip_serializing_if = "Option::is_none")]
    pub add_time: Option<String>,
    /// The update time of the payment
    #[serde(rename = "update_time", skip_serializing_if = "Option::is_none")]
    pub update_time: Option<String>,
}

impl PaymentResponse200AllOfDataInner {
    pub fn new() -> PaymentResponse200AllOfDataInner {
        PaymentResponse200AllOfDataInner {
            id: None,
            subscription_id: None,
            deal_id: None,
            is_active: None,
            amount: None,
            currency: None,
            change_amount: None,
            due_at: None,
            revenue_movement_type: None,
            payment_type: None,
            description: None,
            add_time: None,
            update_time: None,
        }
    }
}

/// Represents the movement of revenue in comparison with the previous payment. Possible values are: `New` - first payment of the subscription. `Recurring` - no movement. `Expansion` - current payment amount > previous payment amount. `Contraction` - current payment amount < previous payment amount. `Churn` - last payment of the subscription.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum RevenueMovementType {
    #[serde(rename = "new")]
    New,
    #[serde(rename = "recurring")]
    Recurring,
    #[serde(rename = "expansion")]
    Expansion,
    #[serde(rename = "contraction")]
    Contraction,
    #[serde(rename = "none")]
    None,
    #[serde(rename = "churn")]
    Churn,
}

impl Default for RevenueMovementType {
    fn default() -> RevenueMovementType {
        Self::New
    }
}
/// The type of the payment. Possible values are: `Recurring` - payments occur over fixed intervals of time, `Additional` - extra payment not the recurring payment of the recurring subscription, `Installment` - payment of the installment subscription.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum PaymentType {
    #[serde(rename = "recurring")]
    Recurring,
    #[serde(rename = "additional")]
    Additional,
    #[serde(rename = "installment")]
    Installment,
}

impl Default for PaymentType {
    fn default() -> PaymentType {
        Self::Recurring
    }
}