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 ProductItemReq {
    /// only valid if product is a subscription
    #[serde(rename = "addons", skip_serializing_if = "Option::is_none")]
    pub addons: Option<Vec<models::AttachAddonReq>>,
    /// Amount the customer pays if pay_what_you_want is enabled. If disabled then amount will be ignored Represented in the lowest denomination of the currency (e.g., cents for USD). For example, to charge $1.00, pass `100`. Only applicable for one time payments  If amount is not set for pay_what_you_want product, customer is allowed to select the amount.
    #[serde(rename = "amount", skip_serializing_if = "Option::is_none")]
    pub amount: Option<i32>,
    /// unique id of the product
    #[serde(rename = "product_id")]
    pub product_id: String,
    #[serde(rename = "quantity")]
    pub quantity: i32,
}

impl ProductItemReq {
    pub fn new(product_id: String, quantity: i32) -> ProductItemReq {
        ProductItemReq {
            addons: None,
            amount: None,
            product_id,
            quantity,
        }
    }
}