Skip to main content

firefly_iii/models/
transaction_split_store.rs

1/*
2 * Firefly III API v6.4.14
3 *
4 * 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>
5 *
6 * The version of the OpenAPI document: v6.4.14
7 * Contact: james@firefly-iii.org
8 * Generated by: https://openapi-generator.tech
9 */
10
11#![allow(unused_imports)]
12
13use crate::models::{self, *};
14use std::fmt;
15
16#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
17pub struct TransactionSplitStore {
18    #[serde(rename = "type")]
19    pub r#type: models::TransactionTypeProperty,
20    /// Date of the transaction
21    #[serde(rename = "date")]
22    pub date: String,
23    /// Amount of the transaction.
24    #[serde(rename = "amount")]
25    pub amount: String,
26    /// Description of the transaction.
27    #[serde(rename = "description")]
28    pub description: String,
29    /// Order of this entry in the list of transactions.
30    #[serde(rename = "order", skip_serializing_if = "Option::is_none")]
31    pub order: Option<i32>,
32    /// Currency ID. Default is the source account's currency, or the user's financial administration's currency. The value you submit may be overruled by the source or destination account.
33    #[serde(rename = "currency_id", skip_serializing_if = "Option::is_none")]
34    pub currency_id: Option<String>,
35    /// Currency code. Default is the source account's currency, or the user's financial administration's primary currency. The value you submit may be overruled by the source or destination account.
36    #[serde(rename = "currency_code", skip_serializing_if = "Option::is_none")]
37    pub currency_code: Option<String>,
38    /// The amount in a foreign currency.
39    #[serde(rename = "foreign_amount", skip_serializing_if = "Option::is_none")]
40    pub foreign_amount: Option<String>,
41    /// Currency ID of the foreign currency. Default is null. Is required when you submit a foreign amount.
42    #[serde(
43        rename = "foreign_currency_id",
44        skip_serializing_if = "Option::is_none"
45    )]
46    pub foreign_currency_id: Option<String>,
47    /// Currency code of the foreign currency. Default is NULL. Can be used instead of the foreign_currency_id, but this or the ID is required when submitting a foreign amount.
48    #[serde(
49        rename = "foreign_currency_code",
50        skip_serializing_if = "Option::is_none"
51    )]
52    pub foreign_currency_code: Option<String>,
53    /// The budget ID for this transaction.
54    #[serde(rename = "budget_id", skip_serializing_if = "Option::is_none")]
55    pub budget_id: Option<String>,
56    /// The name of the budget to be used. If the budget name is unknown, the ID will be used or the value will be ignored.
57    #[serde(rename = "budget_name", skip_serializing_if = "Option::is_none")]
58    pub budget_name: Option<String>,
59    /// The category ID for this transaction.
60    #[serde(rename = "category_id", skip_serializing_if = "Option::is_none")]
61    pub category_id: Option<String>,
62    /// 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.
63    #[serde(rename = "category_name", skip_serializing_if = "Option::is_none")]
64    pub category_name: Option<String>,
65    /// 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.
66    #[serde(rename = "source_id", skip_serializing_if = "Option::is_none")]
67    pub source_id: Option<String>,
68    /// 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.
69    #[serde(rename = "source_name", skip_serializing_if = "Option::is_none")]
70    pub source_name: Option<String>,
71    /// 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.
72    #[serde(rename = "destination_id", skip_serializing_if = "Option::is_none")]
73    pub destination_id: Option<String>,
74    /// 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.
75    #[serde(rename = "destination_name", skip_serializing_if = "Option::is_none")]
76    pub destination_name: Option<String>,
77    /// If the transaction has been reconciled already. When you set this, the amount can no longer be edited by the user.
78    #[serde(rename = "reconciled", skip_serializing_if = "Option::is_none")]
79    pub reconciled: Option<bool>,
80    /// Optional. Use either this or the piggy_bank_name
81    #[serde(rename = "piggy_bank_id", skip_serializing_if = "Option::is_none")]
82    pub piggy_bank_id: Option<i32>,
83    /// Optional. Use either this or the piggy_bank_id
84    #[serde(rename = "piggy_bank_name", skip_serializing_if = "Option::is_none")]
85    pub piggy_bank_name: Option<String>,
86    /// Optional. Use either this or the bill_name
87    #[serde(rename = "bill_id", skip_serializing_if = "Option::is_none")]
88    pub bill_id: Option<String>,
89    /// Optional. Use either this or the bill_id
90    #[serde(rename = "bill_name", skip_serializing_if = "Option::is_none")]
91    pub bill_name: Option<String>,
92    /// Array of tags.
93    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
94    pub tags: Option<Vec<String>>,
95    #[serde(rename = "notes", skip_serializing_if = "Option::is_none")]
96    pub notes: Option<String>,
97    /// Reference to internal reference of other systems.
98    #[serde(rename = "internal_reference", skip_serializing_if = "Option::is_none")]
99    pub internal_reference: Option<String>,
100    /// Reference to external ID in other systems.
101    #[serde(rename = "external_id", skip_serializing_if = "Option::is_none")]
102    pub external_id: Option<String>,
103    /// External, custom URL for this transaction.
104    #[serde(rename = "external_url", skip_serializing_if = "Option::is_none")]
105    pub external_url: Option<String>,
106    /// SEPA Clearing Code
107    #[serde(rename = "sepa_cc", skip_serializing_if = "Option::is_none")]
108    pub sepa_cc: Option<String>,
109    /// SEPA Opposing Account Identifier
110    #[serde(rename = "sepa_ct_op", skip_serializing_if = "Option::is_none")]
111    pub sepa_ct_op: Option<String>,
112    /// SEPA end-to-end Identifier
113    #[serde(rename = "sepa_ct_id", skip_serializing_if = "Option::is_none")]
114    pub sepa_ct_id: Option<String>,
115    /// SEPA mandate identifier
116    #[serde(rename = "sepa_db", skip_serializing_if = "Option::is_none")]
117    pub sepa_db: Option<String>,
118    /// SEPA Country
119    #[serde(rename = "sepa_country", skip_serializing_if = "Option::is_none")]
120    pub sepa_country: Option<String>,
121    /// SEPA External Purpose indicator
122    #[serde(rename = "sepa_ep", skip_serializing_if = "Option::is_none")]
123    pub sepa_ep: Option<String>,
124    /// SEPA Creditor Identifier
125    #[serde(rename = "sepa_ci", skip_serializing_if = "Option::is_none")]
126    pub sepa_ci: Option<String>,
127    /// SEPA Batch ID
128    #[serde(rename = "sepa_batch_id", skip_serializing_if = "Option::is_none")]
129    pub sepa_batch_id: Option<String>,
130    #[serde(rename = "interest_date", skip_serializing_if = "Option::is_none")]
131    pub interest_date: Option<String>,
132    #[serde(rename = "book_date", skip_serializing_if = "Option::is_none")]
133    pub book_date: Option<String>,
134    #[serde(rename = "process_date", skip_serializing_if = "Option::is_none")]
135    pub process_date: Option<String>,
136    #[serde(rename = "due_date", skip_serializing_if = "Option::is_none")]
137    pub due_date: Option<String>,
138    #[serde(rename = "payment_date", skip_serializing_if = "Option::is_none")]
139    pub payment_date: Option<String>,
140    #[serde(rename = "invoice_date", skip_serializing_if = "Option::is_none")]
141    pub invoice_date: Option<String>,
142}
143
144impl TransactionSplitStore {
145    pub fn new(
146        r#type: models::TransactionTypeProperty,
147        date: String,
148        amount: String,
149        description: String,
150    ) -> TransactionSplitStore {
151        TransactionSplitStore {
152            r#type,
153            date,
154            amount,
155            description,
156            order: None,
157            currency_id: None,
158            currency_code: None,
159            foreign_amount: None,
160            foreign_currency_id: None,
161            foreign_currency_code: None,
162            budget_id: None,
163            budget_name: None,
164            category_id: None,
165            category_name: None,
166            source_id: None,
167            source_name: None,
168            destination_id: None,
169            destination_name: None,
170            reconciled: None,
171            piggy_bank_id: None,
172            piggy_bank_name: None,
173            bill_id: None,
174            bill_name: None,
175            tags: None,
176            notes: None,
177            internal_reference: None,
178            external_id: None,
179            external_url: None,
180            sepa_cc: None,
181            sepa_ct_op: None,
182            sepa_ct_id: None,
183            sepa_db: None,
184            sepa_country: None,
185            sepa_ep: None,
186            sepa_ci: None,
187            sepa_batch_id: None,
188            interest_date: None,
189            book_date: None,
190            process_date: None,
191            due_date: None,
192            payment_date: None,
193            invoice_date: None,
194        }
195    }
196}
197
198impl fmt::Display for TransactionSplitStore {
199    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
200        match serde_json::to_string(self) {
201            Ok(json) => write!(f, "{}", json),
202            Err(_) => write!(f, "{{{{}}}}"),
203        }
204    }
205}