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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateOneTimePaymentResponse {
    /// Client secret used to load Dodo checkout SDK NOTE : Dodo checkout SDK will be coming soon
    #[serde(rename = "client_secret")]
    pub client_secret: String,
    /// Limited details about the customer making the payment
    #[serde(rename = "customer")]
    pub customer: Box<models::CustomerLimitedDetailsResponse>,
    /// The discount id if discount is applied
    #[serde(rename = "discount_id", skip_serializing_if = "Option::is_none")]
    pub discount_id: Option<String>,
    /// Expiry timestamp of the payment link
    #[serde(rename = "expires_on", skip_serializing_if = "Option::is_none")]
    pub expires_on: Option<String>,
    /// Additional metadata associated with the payment
    #[serde(rename = "metadata")]
    pub metadata: std::collections::HashMap<String, String>,
    /// Unique identifier for the payment
    #[serde(rename = "payment_id")]
    pub payment_id: String,
    /// Optional URL to a hosted payment page
    #[serde(rename = "payment_link", skip_serializing_if = "Option::is_none")]
    pub payment_link: Option<String>,
    /// Optional list of products included in the payment
    #[serde(rename = "product_cart", skip_serializing_if = "Option::is_none")]
    pub product_cart: Option<Vec<models::OneTimeProductCartItemReq>>,
    /// Total amount of the payment in smallest currency unit (e.g. cents)
    #[serde(rename = "total_amount")]
    pub total_amount: i32,
}

impl CreateOneTimePaymentResponse {
    pub fn new(client_secret: String, customer: models::CustomerLimitedDetailsResponse, metadata: std::collections::HashMap<String, String>, payment_id: String, total_amount: i32) -> CreateOneTimePaymentResponse {
        CreateOneTimePaymentResponse {
            client_secret,
            customer: Box::new(customer),
            discount_id: None,
            expires_on: None,
            metadata,
            payment_id,
            payment_link: None,
            product_cart: None,
            total_amount,
        }
    }
}