Skip to content

Commit

Permalink
🐛 (gocardless) fix sync when additionalInformation field is null (act…
Browse files Browse the repository at this point in the history
  • Loading branch information
MatissJanis authored Jan 18, 2024
1 parent 9cc5c1b commit 30b4d7f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
34 changes: 18 additions & 16 deletions packages/loot-core/src/server/accounts/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,14 +309,15 @@ async function normalizeGoCardlessTransactions(transactions, acctId) {
// that it matters whether the amount is a positive or negative zero.
if (trans.amount > 0 || Object.is(Number(trans.amount), 0)) {
const nameParts = [];
nameParts.push(
title(
trans.debtorName ||
trans.remittanceInformationUnstructured ||
(trans.remittanceInformationUnstructuredArray || []).join(', ') ||
trans.additionalInformation,
),
);
const name =
trans.debtorName ||
trans.remittanceInformationUnstructured ||
(trans.remittanceInformationUnstructuredArray || []).join(', ') ||
trans.additionalInformation;

if (name) {
nameParts.push(title(name));
}
if (trans.debtorAccount && trans.debtorAccount.iban) {
nameParts.push(
'(' +
Expand All @@ -329,14 +330,15 @@ async function normalizeGoCardlessTransactions(transactions, acctId) {
payee_name = nameParts.join(' ');
} else {
const nameParts = [];
nameParts.push(
title(
trans.creditorName ||
trans.remittanceInformationUnstructured ||
(trans.remittanceInformationUnstructuredArray || []).join(', ') ||
trans.additionalInformation,
),
);
const name =
trans.creditorName ||
trans.remittanceInformationUnstructured ||
(trans.remittanceInformationUnstructuredArray || []).join(', ') ||
trans.additionalInformation;

if (name) {
nameParts.push(title(name));
}
if (trans.creditorAccount && trans.creditorAccount.iban) {
nameParts.push(
'(' +
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/2238.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [MatissJanis]
---

GoCardless: fix sync not working if `additionalInformation` fallback field is null

0 comments on commit 30b4d7f

Please sign in to comment.