sellapp-sdk 0.1.1

Official Rust SDK for the SellApp API: manage products, orders, subscriptions, and customers.
// This file is auto-generated by oagen. Do not edit.

#[allow(unused_imports)]
use super::*;
#[allow(unused_imports)]
use crate::enums::*;
use serde::{Deserialize, Serialize};
/// The customer's purchase summary. Seller-only payment details and status timelines are not included.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(remote = "Self")]
pub struct CustomerPortalOrder {
    pub id: i64,
    pub status: String,
    /// Uppercase currency code for the order amounts.
    pub currency: String,
    /// Order subtotal in minor currency units; 1999 means USD 19.99 when currency is USD.
    pub subtotal_cents: i64,
    /// Order total including tax, in minor currency units.
    pub total_cents: i64,
    pub line_items: Vec<CustomerPortalOrderLineItem>,
    pub created_at: Option<String>,
    pub updated_at: Option<String>,
    /// Fields returned by a newer API version that are not yet known to this SDK.
    #[serde(default, flatten)]
    pub additional_properties: std::collections::HashMap<String, serde_json::Value>,
}
impl Serialize for CustomerPortalOrder {
    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        Self::serialize(self, serializer)
    }
}
impl<'de> Deserialize<'de> for CustomerPortalOrder {
    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        let mut value = serde_json::Value::deserialize(deserializer)?;
        crate::runtime_schema::model(&value, "CustomerPortalOrder", false)
            .map_err(serde::de::Error::custom)?;
        crate::runtime_schema::retain_model_fields(&mut value, "CustomerPortalOrder");
        Self::deserialize(value).map_err(serde::de::Error::custom)
    }
}
impl CustomerPortalOrder {
    /// Validate the serialized request, including schema constraints and compatibility rules.
    pub fn validate_request(&self) -> Result<(), crate::error::Error> {
        let value = serde_json::to_value(self)
            .map_err(|e| crate::error::Error::Serialization(e.to_string()))?;
        crate::runtime_schema::model(&value, "CustomerPortalOrder", true)
    }
}