From 8b850f14108bc453d1e768230683253ade9e5992 Mon Sep 17 00:00:00 2001 From: Dan D <dan.dulaney07@gmail.com> Date: Mon, 10 Jun 2024 17:42:45 -0500 Subject: [PATCH] Handle Null Org Domain in SimpleFIN for bank_id (#2836) * Update main.ts - Handle Null Org Domain in SimpleFIN SimpleFIN (currently) uses the org domain as the bank ID. According to SimpleFIN docs, this can possibly be a null value, as can the org name. However, at least one of the two must be present. In Actual, org name is set to "Unknown" if it comes in as null, but the bank_id (previously just set to the org domain) was not, resulting in a null bank_id value at times. * Create 2836.md * Fix release notes format. * Small change to release note. * Change to use new org Id as fallback for bank_id * Add orgId property, for new org id from SimpleFIN --- .../src/components/modals/CreateAccountModal.tsx | 2 ++ packages/loot-core/src/server/main.ts | 2 +- upcoming-release-notes/2836.md | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 upcoming-release-notes/2836.md diff --git a/packages/desktop-client/src/components/modals/CreateAccountModal.tsx b/packages/desktop-client/src/components/modals/CreateAccountModal.tsx index fb229e9f4..4a81c360b 100644 --- a/packages/desktop-client/src/components/modals/CreateAccountModal.tsx +++ b/packages/desktop-client/src/components/modals/CreateAccountModal.tsx @@ -71,6 +71,7 @@ export function CreateAccountModal({ name: string; institution: string; orgDomain: string; + orgId: string; balance: number; }; @@ -80,6 +81,7 @@ export function CreateAccountModal({ name: oldAccount.name, institution: oldAccount.org.name, orgDomain: oldAccount.org.domain, + orgId: oldAccount.org.id, balance: oldAccount.balance, }; diff --git a/packages/loot-core/src/server/main.ts b/packages/loot-core/src/server/main.ts index ea4a001b9..6af6f82dc 100644 --- a/packages/loot-core/src/server/main.ts +++ b/packages/loot-core/src/server/main.ts @@ -659,7 +659,7 @@ handlers['simplefin-accounts-link'] = async function ({ const bank = await link.findOrCreateBank( institution, - externalAccount.orgDomain, + externalAccount.orgDomain ?? externalAccount.orgId, ); if (upgradingId) { diff --git a/upcoming-release-notes/2836.md b/upcoming-release-notes/2836.md new file mode 100644 index 000000000..254334332 --- /dev/null +++ b/upcoming-release-notes/2836.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [duplaja] +--- + +Fix null bank_id for SimpleFIN caused when no org domain is sent. -- GitLab