mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-28 10:33:02 -05:00
* fix detailedAccount could be null or undefined * add release notes
This commit is contained in:
@@ -426,16 +426,21 @@ export const goCardlessService = {
|
||||
handleGoCardlessError(error);
|
||||
}
|
||||
|
||||
// Handle cases where either response is null/undefined
|
||||
const accountDetails = detailedAccount?.account || {};
|
||||
const metadata = metadataAccount || {};
|
||||
|
||||
// Some banks provide additional data in both fields, but can do yucky things like have an empty
|
||||
// string in one place but not the other. We'll fix this by merging the two objects, but preferring truthy values
|
||||
// from the metadata object over the details object.
|
||||
const mergedAccount = {};
|
||||
const uniqueKeys = new Set([
|
||||
...Object.keys(detailedAccount.account),
|
||||
...Object.keys(metadataAccount),
|
||||
...Object.keys(accountDetails),
|
||||
...Object.keys(metadata),
|
||||
]);
|
||||
|
||||
for (const key of uniqueKeys) {
|
||||
mergedAccount[key] = metadataAccount[key] || detailedAccount.account[key];
|
||||
mergedAccount[key] = metadata[key] || accountDetails[key];
|
||||
}
|
||||
|
||||
return mergedAccount;
|
||||
|
||||
6
upcoming-release-notes/5706.md
Normal file
6
upcoming-release-notes/5706.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [mauroartizzu]
|
||||
---
|
||||
|
||||
Fixes detailedAccounts that might me null or undefined with some Italian Banks (Widiba, Poste, Intesa)
|
||||
Reference in New Issue
Block a user