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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Refund {
    /// The refunded amount.
    #[serde(rename = "amount", skip_serializing_if = "Option::is_none")]
    pub amount: Option<i32>,
    /// The unique identifier of the business issuing the refund.
    #[serde(rename = "business_id")]
    pub business_id: String,
    /// The timestamp of when the refund was created in UTC.
    #[serde(rename = "created_at")]
    pub created_at: String,
    /// The currency of the refund, represented as an ISO 4217 currency code.
    #[serde(rename = "currency", skip_serializing_if = "Option::is_none")]
    pub currency: Option<models::Currency>,
    /// Details about the customer for this refund (from the associated payment)
    #[serde(rename = "customer")]
    pub customer: Box<models::CustomerLimitedDetailsResponse>,
    /// If true the refund is a partial refund
    #[serde(rename = "is_partial")]
    pub is_partial: bool,
    /// Additional metadata stored with the refund.
    #[serde(rename = "metadata")]
    pub metadata: std::collections::HashMap<String, String>,
    /// The unique identifier of the payment associated with the refund.
    #[serde(rename = "payment_id")]
    pub payment_id: String,
    /// The reason provided for the refund, if any. Optional.
    #[serde(rename = "reason", skip_serializing_if = "Option::is_none")]
    pub reason: Option<String>,
    /// The unique identifier of the refund.
    #[serde(rename = "refund_id")]
    pub refund_id: String,
    /// The current status of the refund.
    #[serde(rename = "status")]
    pub status: models::RefundStatus,
    #[serde(rename = "payload_type")]
    pub payload_type: PayloadType,
}

impl Refund {
    pub fn new(business_id: String, created_at: String, customer: models::CustomerLimitedDetailsResponse, is_partial: bool, metadata: std::collections::HashMap<String, String>, payment_id: String, refund_id: String, status: models::RefundStatus, payload_type: PayloadType) -> Refund {
        Refund {
            amount: None,
            business_id,
            created_at,
            currency: None,
            customer: Box::new(customer),
            is_partial,
            metadata,
            payment_id,
            reason: None,
            refund_id,
            status,
            payload_type,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum PayloadType {
    #[serde(rename = "Refund")]
    Refund,
}

impl Default for PayloadType {
    fn default() -> PayloadType {
        Self::Refund
    }
}