fix: Correctly map transactions without counterparty

Before this change, transactions that did not have a counterparty were
not correctly mapped and could not be insterted into Firefly III. That
is not correct: _all_ transactions must be added to Firefly III.

Furthermore, Firefly III already has logic to deal with this, and rules
that can solve it manually as well.
This commit is contained in:
2025-11-27 21:04:41 +01:00
parent baac50c36a
commit 21ef49ee38
2 changed files with 3 additions and 6 deletions

View File

@@ -146,9 +146,7 @@ impl TransactionDestination for FireflyAdapter {
None None
}, },
source_name: if is_credit { source_name: if is_credit {
tx.counterparty_name tx.counterparty_name.clone()
.clone()
.or(Some("Unknown Sender".to_string()))
} else { } else {
None None
}, },
@@ -158,9 +156,7 @@ impl TransactionDestination for FireflyAdapter {
None None
}, },
destination_name: if !is_credit { destination_name: if !is_credit {
tx.counterparty_name tx.counterparty_name.clone()
.clone()
.or(Some("Unknown Recipient".to_string()))
} else { } else {
None None
}, },

View File

@@ -8,6 +8,7 @@ use std::str::FromStr;
pub fn map_transaction(tx: Transaction) -> Result<BankTransaction> { pub fn map_transaction(tx: Transaction) -> Result<BankTransaction> {
let internal_id = tx let internal_id = tx
.transaction_id .transaction_id
.or(tx.internal_transaction_id)
.ok_or_else(|| anyhow::anyhow!("Transaction ID missing"))?; .ok_or_else(|| anyhow::anyhow!("Transaction ID missing"))?;
let date_str = tx let date_str = tx