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 CustomerLedgerEntryRequest {
    #[serde(rename = "amount")]
    pub amount: i64,
    /// Currency of the wallet to adjust
    #[serde(rename = "currency")]
    pub currency: models::Currency,
    /// Type of ledger entry - credit or debit
    #[serde(rename = "entry_type")]
    pub entry_type: models::CustomerLedgerEntryType,
    /// Optional idempotency key to prevent duplicate entries
    #[serde(rename = "idempotency_key", skip_serializing_if = "Option::is_none")]
    pub idempotency_key: Option<String>,
    #[serde(rename = "reason", skip_serializing_if = "Option::is_none")]
    pub reason: Option<String>,
}

impl CustomerLedgerEntryRequest {
    pub fn new(amount: i64, currency: models::Currency, entry_type: models::CustomerLedgerEntryType) -> CustomerLedgerEntryRequest {
        CustomerLedgerEntryRequest {
            amount,
            currency,
            entry_type,
            idempotency_key: None,
            reason: None,
        }
    }
}