Add bank account fields to businesses for transaction matching - #4027
Open
gilgardosh wants to merge 1 commit into
Open
Add bank account fields to businesses for transaction matching#4027gilgardosh wants to merge 1 commit into
gilgardosh wants to merge 1 commit into
Conversation
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
gilgardosh
temporarily deployed
to
accounter-fullstack
July 22, 2026 12:28 — with
GitHub Actions
Inactive
gilgardosh
temporarily deployed
to
accounter-fullstack
July 22, 2026 12:28 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Pull request overview
Adds bank-account details to businesses and wires them through DB → GraphQL → client UI so incoming bank transactions can be auto-matched to a local business using contra/counterparty account information.
Changes:
- Adds
bank_account_*columns toaccounter_schema.businessesand introduces an index intended to speed up contra-account matching. - Adds
match_business_by_bank_account()and updates multiple bank-transaction insert handlers to populatetransactions.business_idwhen a matching business exists. - Extends the GraphQL
Businessmodel + client business contact form to view/edit the bank account fields.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/server/src/modules/onboarding/providers/shaam-import.provider.ts | Initializes new business bank-account fields to null during SHAAM import. |
| packages/server/src/modules/financial-entities/typeDefs/businesses.graphql.ts | Adds BusinessBankAccount types and exposes bankAccount on Business + inputs. |
| packages/server/src/modules/financial-entities/resolvers/businesses.resolver.ts | Maps GraphQL bankAccount input/output to DB columns. |
| packages/server/src/modules/financial-entities/providers/businesses.provider.ts | Extends business SELECT/INSERT/UPDATE SQL to include new bank-account columns. |
| packages/server/src/modules/financial-entities/helpers/update-business.helper.ts | Passes bank-account fields through the update helper. |
| packages/migrations/src/run-pg-migrations.ts | Registers the two new migrations. |
| packages/migrations/src/actions/2026-07-22T10-00-00.add-business-bank-account-fields.ts | Adds the three columns + an index for matching lookups. |
| packages/migrations/src/actions/2026-07-22T10-30-00.match-business-by-contra-account.ts | Adds match function and updates bank transaction handlers to set business_id. |
| packages/client/src/components/business/contact-info-section.tsx | Adds bank-account inputs and sends bankAccount in update mutation payloads. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+14
to
+23
| -- Index to speed up (and enforce lookup semantics of) matching a contra account | ||
| -- to a business within a given owner scope. | ||
| CREATE INDEX IF NOT EXISTS businesses_bank_account_idx | ||
| ON accounter_schema.businesses ( | ||
| owner_id, | ||
| bank_account_bank_number, | ||
| bank_account_branch_number, | ||
| bank_account_account_number | ||
| ) | ||
| WHERE bank_account_account_number IS NOT NULL; |
Comment on lines
+18
to
+27
| SELECT b.id | ||
| FROM accounter_schema.businesses b | ||
| WHERE p_owner_id IS NOT NULL | ||
| AND p_account_number IS NOT NULL | ||
| AND p_account_number <> 0 | ||
| AND b.owner_id = p_owner_id | ||
| AND b.bank_account_bank_number = p_bank_number | ||
| AND b.bank_account_branch_number = p_branch_number | ||
| AND b.bank_account_account_number = p_account_number | ||
| LIMIT 1; |
Comment on lines
+83
to
+85
| bankNumber: z.number().int().nonnegative().optional().nullable(), | ||
| bankBranchNumber: z.number().int().nonnegative().optional().nullable(), | ||
| bankAccountNumber: z.number().int().nonnegative().optional().nullable(), |
Comment on lines
65
to
69
| bankAccountBankNumber: fields.bankAccount?.bankNumber ?? null, | ||
| bankAccountBranchNumber: fields.bankAccount?.branchNumber ?? null, | ||
| bankAccountAccountNumber: fields.bankAccount?.accountNumber ?? null, | ||
| }; | ||
|
|
gilgardosh
force-pushed
the
claude/business-bank-data-setup-h4u85f
branch
from
August 4, 2026 10:21
a887f71 to
e0b926a
Compare
gilgardosh
temporarily deployed
to
accounter-fullstack
August 4, 2026 10:21 — with
GitHub Actions
Inactive
gilgardosh
temporarily deployed
to
accounter-fullstack
August 4, 2026 10:21 — with
GitHub Actions
Inactive
gilgardosh
force-pushed
the
claude/business-bank-data-setup-h4u85f
branch
from
August 17, 2026 14:17
e0b926a to
2518a35
Compare
gilgardosh
temporarily deployed
to
accounter-fullstack
August 17, 2026 14:17 — with
GitHub Actions
Inactive
gilgardosh
temporarily deployed
to
accounter-fullstack
August 17, 2026 14:17 — with
GitHub Actions
Inactive
Copilot stopped reviewing on behalf of
gilgardosh due to an error
August 17, 2026 14:19
…ss by contra account Store each business' bank accounts (a business may have several) and use them to set the counterparty business on incoming bank transactions at insertion time. - migrations (single, consolidated): add businesses_bank_accounts link table with RLS tenant isolation, dedup unique index and updated_at trigger; add match_business_by_bank_account() helper and wire it into the latest Poalim ILS, Poalim foreign and Otsar Hahayal ILS insert-trigger handlers so an exact contra/correspondent-account match sets transactions.business_id. - server: BusinessBankAccountsProvider (DataLoader + replace-set), a zod-validated bankAccounts input, a bankAccounts list on the Business GraphQL type, and update/insert business wiring. - client: manage a dynamic list of bank accounts (add/remove) in the business contact section. Closes #3967 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wy7Xya5fazLb7ctUpY9LX5
gilgardosh
force-pushed
the
claude/business-bank-data-setup-h4u85f
branch
from
August 23, 2026 10:23
2518a35 to
a08092e
Compare
gilgardosh
temporarily deployed
to
accounter-fullstack
August 23, 2026 10:23 — with
GitHub Actions
Inactive
gilgardosh
temporarily deployed
to
accounter-fullstack
August 23, 2026 10:23 — with
GitHub Actions
Inactive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for storing bank account details (bank number, branch number, account number) on business entities, enabling automatic matching of incoming bank transactions to local businesses by their counterparty (contra) account information.
Key Changes
Database Schema
businessestable:bank_account_bank_numberbank_account_branch_numberbank_account_account_numberowner_id) to optimize contra account lookupsTransaction Processing
match_business_by_bank_account()SQL function to look up a business by its bank account details within an owner's scopeinsert_poalim_ils_transaction_handler()insert_poalim_foreign_transaction_handler()insert_otsar_hahayal_ils_transaction_handler()business_idfield on created transactions when a matching business is foundGraphQL API
BusinessBankAccounttype withbankNumber,branchNumber, andaccountNumberfieldsBusinessBankAccountInputfor mutationsBusinesstype andUpdateBusinessInput/CreateBusinessInputto includebankAccountfieldClient UI
NumberInputfields to the business contact info form:Implementation Details
match_business_by_bank_account()function returns a single business ID or NULL, enforcing one-to-one matching semantics per ownerWHEREclause to exclude NULL account numbers, optimizing for the common case of businesses without bank account datahttps://claude.ai/code/session_01Wy7Xya5fazLb7ctUpY9LX5