Closed marlemion closed 1 year ago
I have checked and the IBAN is transferred correctly into firefly. Hence, I have enabled DEBUG mode therein and get the following output:
[2023-01-11 15:26:39] local.DEBUG: Now creating journal 1/1
[2023-01-11 15:26:39] local.DEBUG: The hash is: ae9c2b2f1427ca44b9ecb7ae56444ed26a5619a594cccb170ca09334311f884c {"type":"withdrawal","date":"2022-10-17 00:00:00","order":null,"currency_id":null,"currency_code":"","foreign_currency_id":null,"foreign_currency_code":"","amount":"4000","foreign_amount":"","description":"Order-Nr. 00024090203 DA-Nr./Ref. Lebenshaltung","source_id":81,"source_name":"","source_iban":"","source_number":"","source_bic":"","destination_id":null,"destination_name":"PETER","destination_iban":"DE5555","destination_number":"","destination_bic":"","budget_id":null,"budget_name":"","category_id":null,"category_name":"","bill_id":null,"bill_name":"","piggy_bank_id":null,"piggy_bank_name":"","reconciled":false,"notes":"","tags":null,"internal_reference":"","external_id":"","recurrence_id":null,"bunq_payment_id":"","external_url":"","sepa_cc":"","sepa_ct_op":"","sepa_ct_id":"","sepa_db":"","sepa_country":"","sepa_ep":"","sepa_ci":"","sepa_batch_id":"","interest_date":null,"book_date":null,"process_date":null,"due_date":null,"payment_date":null,"invoice_date":null}
[2023-01-11 15:26:39] local.DEBUG: In errorIfDuplicate(ae9c2b2f1427ca44b9ecb7ae56444ed26a5619a594cccb170ca09334311f884c)
[2023-01-11 15:26:39] local.DEBUG: Will verify duplicate!
[2023-01-11 15:26:39] local.DEBUG: Now looking for a transaction type.
[2023-01-11 15:26:39] local.DEBUG: Tried to search for "withdrawal", came up with "Withdrawal". Will return it.
[2023-01-11 15:26:39] local.DEBUG: Now in findCurrencyNull()
[2023-01-11 15:26:39] local.DEBUG: Searching for currency with code ...
[2023-01-11 15:26:39] local.DEBUG: Grabbing default currency for this user...
[2023-01-11 15:26:39] local.DEBUG: Final result: EUR
[2023-01-11 15:26:39] local.DEBUG: Now in findCurrencyNull()
[2023-01-11 15:26:39] local.DEBUG: Searching for currency with code ...
[2023-01-11 15:26:39] local.DEBUG: Found nothing
[2023-01-11 15:26:39] local.DEBUG: Now in FireflyIII\Factory\TransactionJournalFactory::validateAccounts
[2023-01-11 15:26:39] local.DEBUG: Transaction type for validator is now "Withdrawal".
[2023-01-11 15:26:39] local.DEBUG: Now in AccountValidator::validateSource() {"id":81,"name":null,"iban":null,"number":null}
[2023-01-11 15:26:39] local.DEBUG: Now in validateWithdrawalSource {"id":81,"name":null,"iban":null,"number":null}
[2023-01-11 15:26:39] local.DEBUG: Now in findExistingAccount {"id":81,"name":null,"iban":null,"number":null}
[2023-01-11 15:26:39] local.DEBUG: Valid source account!
[2023-01-11 15:26:39] local.DEBUG: Source seems valid.
[2023-01-11 15:26:39] local.DEBUG: Now in AccountValidator::validateDestination() {"id":null,"name":"PETER","iban":"DE5555","number":null}
[2023-01-11 15:26:39] local.DEBUG: Now in validateWithdrawalDestination() {"id":null,"name":"PETER","iban":"DE5555","number":null}
[2023-01-11 15:26:39] local.DEBUG: Can we create any of these types? ["Expense account","Loan","Debt","Mortgage","Cash account"]
[2023-01-11 15:26:39] local.DEBUG: YES, we can create a Expense account
[2023-01-11 15:26:39] local.DEBUG: Source info: {"id":81,"name":"","iban":"","number":"","bic":"","currency_id":1}
[2023-01-11 15:26:39] local.DEBUG: Destination info: {"id":null,"name":"PETER","iban":"DE5555","number":"","bic":"","currency_id":1}
[2023-01-11 15:26:39] local.DEBUG: Now calling getAccount for the source.
[2023-01-11 15:26:39] local.DEBUG: Now in getAccount(source) {"id":81,"name":"","iban":"","number":"","bic":"","currency_id":1}
[2023-01-11 15:26:39] local.DEBUG: Based on the fact that the transaction is a Withdrawal, the source account should be in: Asset account, Loan, Debt, Mortgage. Direction is source.
[2023-01-11 15:26:39] local.DEBUG: Now searching by ID
[2023-01-11 15:26:39] local.DEBUG: Found "account_id" object: #81, "HVB" of type Asset account
[2023-01-11 15:26:39] local.DEBUG: If nothing is found, searching by IBAN
[2023-01-11 15:26:39] local.DEBUG: If nothing is found, searching by number
[2023-01-11 15:26:39] local.DEBUG: If nothing is found, searching by name
[2023-01-11 15:26:39] local.DEBUG: If nothing is found, create it.
[2023-01-11 15:26:39] local.DEBUG: Now in createAccount() {"id":81,"name":"","iban":"","number":"","bic":"","currency_id":1}
[2023-01-11 15:26:39] local.DEBUG: Was given Asset account account #81 ("HVB") so will simply return that.
[2023-01-11 15:26:39] local.DEBUG: If cant be created, return cash account.
[2023-01-11 15:26:39] local.DEBUG: Now calling getAccount for the destination.
[2023-01-11 15:26:39] local.DEBUG: Now in getAccount(destination) {"id":null,"name":"PETER","iban":"DE5555","number":"","bic":"","currency_id":1}
[2023-01-11 15:26:39] local.DEBUG: Based on the fact that the transaction is a Withdrawal, the destination account should be in: Expense account, Cash account, Loan, Debt, Mortgage. Direction is destination.
[2023-01-11 15:26:39] local.DEBUG: Now searching by ID
[2023-01-11 15:26:39] local.DEBUG: If nothing is found, searching by IBAN
[2023-01-11 15:26:39] local.DEBUG: Found nothing by account iban "DE5555".
[2023-01-11 15:26:39] local.DEBUG: If nothing is found, searching by number
[2023-01-11 15:26:39] local.DEBUG: If nothing is found, searching by name
[2023-01-11 15:26:39] local.DEBUG: Searching for account named "PETER" (of user #1) of the following type(s) {"types":["Expense account"]}
[2023-01-11 15:26:39] local.DEBUG: Found #215 (PETER) with type id 4
[2023-01-11 15:26:39] local.DEBUG: Found "account_name" object: #215, PETER
[2023-01-11 15:26:39] local.DEBUG: If nothing is found, create it.
[2023-01-11 15:26:39] local.DEBUG: Now in createAccount() {"id":null,"name":"PETER","iban":"DE5555","number":"","bic":"","currency_id":1}
[2023-01-11 15:26:39] local.DEBUG: Was given Expense account account #215 ("PETER") so will simply return that.
[2023-01-11 15:26:39] local.DEBUG: If cant be created, return cash account.
[2023-01-11 15:26:39] local.DEBUG: Done with getAccount(2x)
[2023-01-11 15:26:39] local.DEBUG: Now ingetCurrencyByAccount()
[2023-01-11 15:26:39] local.DEBUG: Now in getCurrency()
[2023-01-11 15:26:39] local.DEBUG: Currency is now #1 (EUR) because of account #81 (HVB)
[2023-01-11 15:26:39] local.DEBUG: Created new journal #798: "Order-Nr. 00024090203 DA-Nr./Ref. Lebenshaltung"
[2023-01-11 15:26:39] local.DEBUG: Created transaction #1595 (EUR -4000.000000000000000000000000, account HVB), part of journal #798
[2023-01-11 15:26:39] local.DEBUG: Created transaction #1596 (EUR 4000, account PETER), part of journal #798
As you can see, the system chose account 215 because of the name. However, this account 215 has DE1000 as iban instead of DE5555.
Seems to be a bug in createAccount() ?
I got a bit deeper into the topic at the firefly code base. The FinTS Importer seems to handle the situation correctly:
Hello, I have a case where I have to transactions from the same account to different IBAN numbers having exactly the same name.
Lets say I have two transactions:
Account 1 --> 4000€ --> PETER (IBAN 1000) Account 2 --> 666€ --> PETER (IBAN 5555)
I could verify that the IBAN numbers are indeed different and that the data from the bank includes these IBAN numbers. Hence, those two transactions should be distinguishable.
However, the transactions are saved upon import in firefly as:
Account 1 --> 4000€ --> PETER (IBAN 5555) Account 2 --> 666€ --> PETER (IBAN 5555)
or
Account 1 --> 4000€ --> PETER (IBAN 1000) Account 2 --> 666€ --> PETER (IBAN 1000)
Apparently it depends, which IBAN is used to create the account PETER first.
It appears to me that this is a bug. Either two PETERs should be created having different IBAN numbers or one of the PETERs should have a different name (if that is necessary in firefly).
Is this a bug?