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

/// CalculateSessionResponse : Data returned by the calculate checkout session API
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CalculateSessionResponse {
    /// Billing country
    #[serde(rename = "billing_country")]
    pub billing_country: models::CountryCodeAlpha2,
    /// Currency in which the calculations were made
    #[serde(rename = "currency")]
    pub currency: models::Currency,
    /// Breakup of the current payment
    #[serde(rename = "current_breakup")]
    pub current_breakup: Box<models::CurrentBreakup>,
    /// The total product cart
    #[serde(rename = "product_cart")]
    pub product_cart: Vec<models::CalculatedProductCartItem>,
    /// Breakup of recurring payments (None for one-time only)
    #[serde(rename = "recurring_breakup", skip_serializing_if = "Option::is_none")]
    pub recurring_breakup: Option<Box<models::RecurringBreakup>>,
    /// Error message if tax ID validation failed
    #[serde(rename = "tax_id_err_msg", skip_serializing_if = "Option::is_none")]
    pub tax_id_err_msg: Option<String>,
    /// Total calculate price of the product cart
    #[serde(rename = "total_price")]
    pub total_price: i32,
    /// Total tax
    #[serde(rename = "total_tax", skip_serializing_if = "Option::is_none")]
    pub total_tax: Option<i32>,
}

impl CalculateSessionResponse {
    /// Data returned by the calculate checkout session API
    pub fn new(billing_country: models::CountryCodeAlpha2, currency: models::Currency, current_breakup: models::CurrentBreakup, product_cart: Vec<models::CalculatedProductCartItem>, total_price: i32) -> CalculateSessionResponse {
        CalculateSessionResponse {
            billing_country,
            currency,
            current_breakup: Box::new(current_breakup),
            product_cart,
            recurring_breakup: None,
            tax_id_err_msg: None,
            total_price,
            total_tax: None,
        }
    }
}