/*
* Firefly III API v6.4.14
*
* This is the documentation of the Firefly III API. Please report any bugs or issues. You may use the \"Authorize\" button to try the API below. <br><br> Please keep in mind that the demo site does **not** accept requests from `curl`, `colly`, `wget`, etc. You must use a browser or a tool like Insomnia to make your test requests. <br><br> To learn more about the idiosyncrasies of this API, please read about the API in the [Firefly III API documentation](https://docs.firefly-iii.org/references/firefly-iii/api/). <br><br> <small>This file was last generated on 2025-12-26 @ 15:17:41 (Europe/Amsterdam)</small>
*
* The version of the OpenAPI document: v6.4.14
* Contact: james@firefly-iii.org
* Generated by: https://openapi-generator.tech
*/
#![allow(unused_imports)]
use crate::models::{self, *};
use std::fmt;
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct TransactionSplit {
/// User ID
#[serde(rename = "user", skip_serializing_if = "Option::is_none")]
pub user: Option<String>,
/// ID of the underlying transaction journal. Each transaction consists of a transaction group (see the top ID) and one or more journals making up the splits of the transaction.
#[serde(
rename = "transaction_journal_id",
skip_serializing_if = "Option::is_none"
)]
pub transaction_journal_id: Option<String>,
#[serde(rename = "type")]
pub r#type: models::TransactionTypeProperty,
/// Date of the transaction
#[serde(rename = "date")]
pub date: String,
/// Order of this entry in the list of transactions.
#[serde(rename = "order", skip_serializing_if = "Option::is_none")]
pub order: Option<i32>,
/// Indicates whether the transaction has a currency setting. For transactions this is always true.
#[serde(
rename = "object_has_currency_setting",
skip_serializing_if = "Option::is_none"
)]
pub object_has_currency_setting: Option<bool>,
/// Currency ID for the currency of this transaction.
#[serde(rename = "currency_id", skip_serializing_if = "Option::is_none")]
pub currency_id: Option<String>,
/// Currency code for the currency of this transaction.
#[serde(rename = "currency_code", skip_serializing_if = "Option::is_none")]
pub currency_code: Option<String>,
/// Currency symbol for the currency of this transaction.
#[serde(rename = "currency_symbol", skip_serializing_if = "Option::is_none")]
pub currency_symbol: Option<String>,
/// Currency name for the currency of this transaction.
#[serde(rename = "currency_name", skip_serializing_if = "Option::is_none")]
pub currency_name: Option<String>,
/// Number of decimals used in this currency.
#[serde(
rename = "currency_decimal_places",
skip_serializing_if = "Option::is_none"
)]
pub currency_decimal_places: Option<i32>,
/// Currency ID of the foreign currency, if this transaction has a foreign amount.
#[serde(
rename = "foreign_currency_id",
skip_serializing_if = "Option::is_none"
)]
pub foreign_currency_id: Option<String>,
/// Currency code of the foreign currency. Default is NULL.
#[serde(
rename = "foreign_currency_code",
skip_serializing_if = "Option::is_none"
)]
pub foreign_currency_code: Option<String>,
#[serde(
rename = "foreign_currency_symbol",
skip_serializing_if = "Option::is_none"
)]
pub foreign_currency_symbol: Option<String>,
/// Number of decimals in the foreign currency.
#[serde(
rename = "foreign_currency_decimal_places",
skip_serializing_if = "Option::is_none"
)]
pub foreign_currency_decimal_places: Option<i32>,
/// Returns the primary currency ID of the administration. This currency is used as the currency for all `pc_*` amount and balance fields of this account.
#[serde(
rename = "primary_currency_id",
skip_serializing_if = "Option::is_none"
)]
pub primary_currency_id: Option<String>,
/// Returns the primary currency code of the administration. This currency is used as the currency for all `pc_*` amount and balance fields of this account.
#[serde(
rename = "primary_currency_code",
skip_serializing_if = "Option::is_none"
)]
pub primary_currency_code: Option<String>,
/// See the other `primary_*` fields.
#[serde(
rename = "primary_currency_symbol",
skip_serializing_if = "Option::is_none"
)]
pub primary_currency_symbol: Option<String>,
/// See the other `primary_*` fields.
#[serde(
rename = "primary_currency_decimal_places",
skip_serializing_if = "Option::is_none"
)]
pub primary_currency_decimal_places: Option<i32>,
/// Amount of the transaction.
#[serde(rename = "amount")]
pub amount: String,
/// Amount of the transaction in the primary currency of this administration. The `primary_currency_*` fields reflect the currency used. This field is NULL if the user does have 'convert to primary' set to true in their settings.
#[serde(rename = "pc_amount", skip_serializing_if = "Option::is_none")]
pub pc_amount: Option<String>,
/// The amount in the set foreign currency. May be NULL if the transaction does not have a foreign amount.
#[serde(rename = "foreign_amount", skip_serializing_if = "Option::is_none")]
pub foreign_amount: Option<String>,
/// Foreign amount of the transaction in the primary currency of this administration. The `primary_currency_*` fields reflect the currency used. This field is NULL if the user does have 'convert to primary' set to true in their settings.
#[serde(rename = "pc_foreign_amount", skip_serializing_if = "Option::is_none")]
pub pc_foreign_amount: Option<String>,
/// The balance of the source account. This is the balance in the account's currency which may be different from this transaction, and is not provided in this model.
#[serde(
rename = "source_balance_after",
skip_serializing_if = "Option::is_none"
)]
pub source_balance_after: Option<String>,
/// The balance of the source account in the primary currency of this administration. The `primary_currency_*` fields reflect the currency used. This field is NULL if the user does have 'convert to primary' set to true in their settings.
#[serde(
rename = "pc_source_balance_after",
skip_serializing_if = "Option::is_none"
)]
pub pc_source_balance_after: Option<String>,
/// The balance of the destination account. This is the balance in the account's currency which may be different from this transaction, and is not provided in this model.
#[serde(
rename = "destination_balance_after",
skip_serializing_if = "Option::is_none"
)]
pub destination_balance_after: Option<String>,
/// The balance of the destination account in the primary currency of this administration. The `primary_currency_*` fields reflect the currency used. This field is NULL if the user does have 'convert to primary' set to true in their settings.
#[serde(
rename = "pc_destination_balance_after",
skip_serializing_if = "Option::is_none"
)]
pub pc_destination_balance_after: Option<String>,
/// Description of the transaction.
#[serde(rename = "description")]
pub description: String,
/// ID of the source account. For a withdrawal or a transfer, this must always be an asset account. For deposits, this must be a revenue account.
#[serde(rename = "source_id")]
pub source_id: Option<String>,
/// Name of the source account. For a withdrawal or a transfer, this must always be an asset account. For deposits, this must be a revenue account. Can be used instead of the source_id. If the transaction is a deposit, the source_name can be filled in freely: the account will be created based on the name.
#[serde(rename = "source_name", skip_serializing_if = "Option::is_none")]
pub source_name: Option<String>,
#[serde(rename = "source_iban", skip_serializing_if = "Option::is_none")]
pub source_iban: Option<String>,
#[serde(rename = "source_type", skip_serializing_if = "Option::is_none")]
pub source_type: Option<models::AccountTypeProperty>,
/// ID of the destination account. For a deposit or a transfer, this must always be an asset account. For withdrawals this must be an expense account.
#[serde(rename = "destination_id")]
pub destination_id: Option<String>,
/// Name of the destination account. You can submit the name instead of the ID. For everything except transfers, the account will be auto-generated if unknown, so submitting a name is enough.
#[serde(rename = "destination_name", skip_serializing_if = "Option::is_none")]
pub destination_name: Option<String>,
#[serde(rename = "destination_iban", skip_serializing_if = "Option::is_none")]
pub destination_iban: Option<String>,
#[serde(rename = "destination_type", skip_serializing_if = "Option::is_none")]
pub destination_type: Option<models::AccountTypeProperty>,
/// The budget ID for this transaction.
#[serde(rename = "budget_id", skip_serializing_if = "Option::is_none")]
pub budget_id: Option<String>,
/// The name of the budget used.
#[serde(rename = "budget_name", skip_serializing_if = "Option::is_none")]
pub budget_name: Option<String>,
/// The category ID for this transaction.
#[serde(rename = "category_id", skip_serializing_if = "Option::is_none")]
pub category_id: Option<String>,
/// The name of the category to be used. If the category is unknown, it will be created. If the ID and the name point to different categories, the ID overrules the name.
#[serde(rename = "category_name", skip_serializing_if = "Option::is_none")]
pub category_name: Option<String>,
/// The associated subscription ID for this transaction. `bill` refers to the OLD name for subscriptions and this field will be removed.
#[serde(rename = "bill_id", skip_serializing_if = "Option::is_none")]
pub bill_id: Option<String>,
/// The associated subscription name for this transaction. `bill` refers to the OLD name for subscriptions and this field will be removed.
#[serde(rename = "bill_name", skip_serializing_if = "Option::is_none")]
pub bill_name: Option<String>,
/// The associated subscription ID for this transaction.
#[serde(rename = "subscription_id", skip_serializing_if = "Option::is_none")]
pub subscription_id: Option<String>,
/// The associated subscription name for this transaction.
#[serde(rename = "subscription_name", skip_serializing_if = "Option::is_none")]
pub subscription_name: Option<String>,
/// If the transaction has been reconciled already. When you set this, the amount can no longer be edited by the user.
#[serde(rename = "reconciled", skip_serializing_if = "Option::is_none")]
pub reconciled: Option<bool>,
#[serde(rename = "notes", skip_serializing_if = "Option::is_none")]
pub notes: Option<String>,
/// Array of tags.
#[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<String>>,
/// Reference to internal reference of other systems.
#[serde(rename = "internal_reference", skip_serializing_if = "Option::is_none")]
pub internal_reference: Option<String>,
/// Reference to external ID in other systems.
#[serde(rename = "external_id", skip_serializing_if = "Option::is_none")]
pub external_id: Option<String>,
/// External, custom URL for this transaction.
#[serde(rename = "external_url", skip_serializing_if = "Option::is_none")]
pub external_url: Option<String>,
/// System generated identifier for original creator of transaction.
#[serde(rename = "original_source", skip_serializing_if = "Option::is_none")]
pub original_source: Option<String>,
/// Reference to recurrence that made the transaction.
#[serde(rename = "recurrence_id", skip_serializing_if = "Option::is_none")]
pub recurrence_id: Option<String>,
/// Total number of transactions expected to be created by this recurrence repetition. Will be 0 if infinite.
#[serde(rename = "recurrence_total", skip_serializing_if = "Option::is_none")]
pub recurrence_total: Option<i32>,
/// The # of the current transaction created under this recurrence.
#[serde(rename = "recurrence_count", skip_serializing_if = "Option::is_none")]
pub recurrence_count: Option<i32>,
/// Hash value of original import transaction (for duplicate detection).
#[serde(rename = "import_hash_v2", skip_serializing_if = "Option::is_none")]
pub import_hash_v2: Option<String>,
/// SEPA Clearing Code
#[serde(rename = "sepa_cc", skip_serializing_if = "Option::is_none")]
pub sepa_cc: Option<String>,
/// SEPA Opposing Account Identifier
#[serde(rename = "sepa_ct_op", skip_serializing_if = "Option::is_none")]
pub sepa_ct_op: Option<String>,
/// SEPA end-to-end Identifier
#[serde(rename = "sepa_ct_id", skip_serializing_if = "Option::is_none")]
pub sepa_ct_id: Option<String>,
/// SEPA mandate identifier
#[serde(rename = "sepa_db", skip_serializing_if = "Option::is_none")]
pub sepa_db: Option<String>,
/// SEPA Country
#[serde(rename = "sepa_country", skip_serializing_if = "Option::is_none")]
pub sepa_country: Option<String>,
/// SEPA External Purpose indicator
#[serde(rename = "sepa_ep", skip_serializing_if = "Option::is_none")]
pub sepa_ep: Option<String>,
/// SEPA Creditor Identifier
#[serde(rename = "sepa_ci", skip_serializing_if = "Option::is_none")]
pub sepa_ci: Option<String>,
/// SEPA Batch ID
#[serde(rename = "sepa_batch_id", skip_serializing_if = "Option::is_none")]
pub sepa_batch_id: Option<String>,
#[serde(rename = "interest_date", skip_serializing_if = "Option::is_none")]
pub interest_date: Option<String>,
#[serde(rename = "book_date", skip_serializing_if = "Option::is_none")]
pub book_date: Option<String>,
#[serde(rename = "process_date", skip_serializing_if = "Option::is_none")]
pub process_date: Option<String>,
#[serde(rename = "due_date", skip_serializing_if = "Option::is_none")]
pub due_date: Option<String>,
#[serde(rename = "payment_date", skip_serializing_if = "Option::is_none")]
pub payment_date: Option<String>,
#[serde(rename = "invoice_date", skip_serializing_if = "Option::is_none")]
pub invoice_date: Option<String>,
/// Latitude of the transaction's location, if applicable. Can be used to draw a map.
#[serde(rename = "latitude", skip_serializing_if = "Option::is_none")]
pub latitude: Option<f64>,
/// Latitude of the transaction's location, if applicable. Can be used to draw a map.
#[serde(rename = "longitude", skip_serializing_if = "Option::is_none")]
pub longitude: Option<f64>,
/// Zoom level for the map, if drawn. This to set the box right. Unfortunately this is a proprietary value because each map provider has different zoom levels.
#[serde(rename = "zoom_level", skip_serializing_if = "Option::is_none")]
pub zoom_level: Option<i32>,
/// If the transaction has attachments.
#[serde(rename = "has_attachments", skip_serializing_if = "Option::is_none")]
pub has_attachments: Option<bool>,
}
impl TransactionSplit {
pub fn new(
r#type: models::TransactionTypeProperty,
date: String,
amount: String,
description: String,
source_id: Option<String>,
destination_id: Option<String>,
) -> TransactionSplit {
TransactionSplit {
user: None,
transaction_journal_id: None,
r#type,
date,
order: None,
object_has_currency_setting: None,
currency_id: None,
currency_code: None,
currency_symbol: None,
currency_name: None,
currency_decimal_places: None,
foreign_currency_id: None,
foreign_currency_code: None,
foreign_currency_symbol: None,
foreign_currency_decimal_places: None,
primary_currency_id: None,
primary_currency_code: None,
primary_currency_symbol: None,
primary_currency_decimal_places: None,
amount,
pc_amount: None,
foreign_amount: None,
pc_foreign_amount: None,
source_balance_after: None,
pc_source_balance_after: None,
destination_balance_after: None,
pc_destination_balance_after: None,
description,
source_id,
source_name: None,
source_iban: None,
source_type: None,
destination_id,
destination_name: None,
destination_iban: None,
destination_type: None,
budget_id: None,
budget_name: None,
category_id: None,
category_name: None,
bill_id: None,
bill_name: None,
subscription_id: None,
subscription_name: None,
reconciled: None,
notes: None,
tags: None,
internal_reference: None,
external_id: None,
external_url: None,
original_source: None,
recurrence_id: None,
recurrence_total: None,
recurrence_count: None,
import_hash_v2: None,
sepa_cc: None,
sepa_ct_op: None,
sepa_ct_id: None,
sepa_db: None,
sepa_country: None,
sepa_ep: None,
sepa_ci: None,
sepa_batch_id: None,
interest_date: None,
book_date: None,
process_date: None,
due_date: None,
payment_date: None,
invoice_date: None,
latitude: None,
longitude: None,
zoom_level: None,
has_attachments: None,
}
}
}
impl fmt::Display for TransactionSplit {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match serde_json::to_string(self) {
Ok(json) => write!(f, "{}", json),
Err(_) => write!(f, "{{{{}}}}"),
}
}
}