Skip to content

A local-first personal finance app

fix(#2495): fix GoCardless transaction ID to fallback to it's own generated ID on sync (#4241)

Bruno Ribeirobd063423e56a
diff --git a/packages/loot-core/src/server/accounts/sync.ts b/packages/loot-core/src/server/accounts/sync.ts
index 5add734d79..7565116421 100644
--- a/packages/loot-core/src/server/accounts/sync.ts
+++ b/packages/loot-core/src/server/accounts/sync.ts
@@ -351,6 +351,12 @@ async function normalizeBankSyncTransactions(transactions, acctId) {
trans.cleared = Boolean(trans.booked);
+ let imported_id = trans.transactionId;
+
+ if (trans.cleared && !trans.transactionId && trans.internalTransactionId) {
+ imported_id = `${trans.account}-${trans.internalTransactionId}`;
+ }
+
const notes =
trans.remittanceInformationUnstructured ||
(trans.remittanceInformationUnstructuredArray || []).join(', ');
@@ -364,7 +370,7 @@ async function normalizeBankSyncTransactions(transactions, acctId) {
date: trans.date,
notes: notes.trim().replace('#', '##'),
category: trans.category ?? null,
- imported_id: trans.transactionId,
+ imported_id,
imported_payee: trans.imported_payee,
cleared: trans.cleared,
},
diff --git a/upcoming-release-notes/4241.md b/upcoming-release-notes/4241.md
new file mode 100644
index 0000000000..386e085851
--- /dev/null
+++ b/upcoming-release-notes/4241.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [NullScope]
+---
+
+Fix GoCardless transaction ID to fallback to it's own generated ID on sync