Skip to content

Commit db04a78

Browse files
alexanderwassbjerfrdrkolssonkrokosik
authored
🚀 Add bank account transaction integration (#132)
* Add bank account transaction integration * Fixup indent * Correct types * Refactor some new code * Add missing env in docker compose file * Remove duplicates of docker files * Update env to not use NEXT_PUBLIC * Revert the country code in getInstitutions * Refactor a on transaction row click function * Remove unused imports/consts to make lint happy * Fixed some comments from Fredrik Co-authored-by: Fredrik Olsson <fredrik.olsson@precisit.com> * Revert theme support * Fix bug with floating numbers on exact split calculator * Add verified transaction label * Fixup linebreak in transactions list * Order by expense created date in the groups list * Redirect to groupexpense or expense in activity list based on groupId * Fixup transaction row * Make the checkbox bigger on mobile * Make expenses lines thicker * Fixup * Add isloading to submit all on bank transaction to prevent adding multiple * Fix * Make changes so it works with new versions of splitpro * Add missing translations * Update to new code * Add missing translations * Fix lint * Change translations * Make it compile * Changes from codereview * Add translations for feature on homepage * Move the envs to page hoc * Refactor to make it easier to add more providers * Reuse * Fix ts error * poc with pg_cron * Remove the testing cron job * Refactor to make it even easier to add more providers * Move some reusable code * User language to gocardless session * Fix import * Change some locales * Add plaid along side with gocardless * Update plaid support * Whitespace and locale key regression fixes * Changes according to review * Add migration * Update cache from migration * Update according to review * Fix missing translation * Comment out multiple transactions * Merge migrations, setup the cron jobs * Add check for db url * Changes after review * UI fixes and optional transactionId * Hide clear button when its disabled * Fix peer dep issues and next runtime check * Fix build * Fix lint --------- Co-authored-by: Fredrik Olsson <fredrik.olsson@precisit.com> Co-authored-by: krokosik <krokosik@pm.me>
1 parent 1c2559c commit db04a78

52 files changed

Lines changed: 2027 additions & 148 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,26 @@ EMAIL_SERVER_PORT=
4646
EMAIL_SERVER_USER=
4747
EMAIL_SERVER_PASSWORD=
4848

49+
# GoCardless options
50+
GOCARDLESS_COUNTRY=
51+
GOCARDLESS_SECRET_ID=
52+
GOCARDLESS_SECRET_KEY=
53+
# Bank Transactions will be fetched from today and 30 days back as default.
54+
GOCARDLESS_INTERVAL_IN_DAYS=
55+
56+
# Plaid options
57+
PLAID_CLIENT_ID=
58+
PLAID_SECRET=
59+
# sandbox/development/production
60+
PLAID_ENVIRONMENT=
61+
# https://plaid.com/docs/institutions/
62+
PLAID_COUNTRY_CODES=
63+
# Bank Transactions will be fetched from today and 30 days back as default.
64+
PLAID_INTERVAL_IN_DAYS=
65+
66+
# Cron-job options
67+
CLEAR_BANK_CACHE_FREQUENCY=
68+
4969
# Google Provider : https://next-auth.js.org/providers/google
5070
GOOGLE_CLIENT_ID=
5171
GOOGLE_CLIENT_SECRET=

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
pnpm lint-staged
2-
pnpm tsgo --noEmit
2+
pnpm tsgo --noEmit

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22.16.0
1+
22.16.0

.oxlintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"prefer-default-export": "off",
3333
"yoda": "off",
3434
"new-cap": "off",
35+
"no-named-export": "off",
3536
"id-length": "off",
3637
"react_perf/jsx-no-jsx-as-prop": "off",
3738
"no-nested-ternary": "off",

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ pnpm i
129129
- Copy the env.example file into .env
130130
- Setup google oauth required for auth https://next-auth.js.org/providers/google or Email provider by setting SMTP details
131131
- Login to minio console using `splitpro` user and password `password` and [create access keys](http://localhost:9001/access-keys/new-account) and the R2 related env variables
132+
- If you want to use bank integration please create a free account on [GoCardless](https://gocardless.com/bank-account-data/) or [Plaid](https://plaid.com) and then enter the the related env variables, read more in the README_BANKTRANSACTIONS.md` file.
132133

133134
### Run the app
134135

README_BANKTRANSACTIONS.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## Bank Account Connection
2+
3+
> GoCardless is deprecated. Please use Plaid instead.
4+
5+
### To get started with Plaid:
6+
7+
1. Create an account on Plaid.
8+
2. Obtain your API keys (client_id and secret).
9+
3. Add the API keys as environment variables in the split-pro repo. See the example in .env.example.
10+
4. You’re done! ✅
11+
12+
### How to use the bank connection:
13+
14+
1. Connect your bank provider to your split-pro account. Log in to split-pro, go to your account page. If Plaid is set up correctly according to the steps above, you will see a “Connect to bank” option on the account page.
15+
2. Once the connection is complete, you can start adding bank transactions. Go to Add new expense in either a group or friend page. There you will find “Transactions”. Click it, select the transactions you want to add, and then click “Submit all.”

docker/dev/compose.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: split-pro-dev
22

33
services:
44
postgres:
5-
image: postgres:16
5+
image: ossapps/postgres
66
container_name: ${POSTGRES_CONTAINER_NAME:-splitpro-db}
77
restart: always
88
environment:
@@ -14,6 +14,11 @@ services:
1414
- database:/var/lib/postgresql/data
1515
ports:
1616
- '${POSTGRES_PORT:-5432}:${POSTGRES_PORT:-5432}'
17+
command: >
18+
postgres
19+
-c shared_preload_libraries=pg_cron
20+
-c cron.database_name=${POSTGRES_DB:-splitpro}
21+
-c cron.timezone=${TZ:-UTC}
1722
1823
minio:
1924
image: minio/minio:RELEASE.2025-04-22T22-12-26Z

docker/prod/compose.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: split-pro-prod
22

33
services:
44
postgres:
5-
image: postgres:16
5+
image: ossapps/postgres
66
container_name: ${POSTGRES_CONTAINER_NAME:-splitpro-db}
77
restart: always
88
environment:
@@ -20,6 +20,11 @@ services:
2020
env_file: .env
2121
volumes:
2222
- database:/var/lib/postgresql/data
23+
command: >
24+
postgres
25+
-c shared_preload_libraries=pg_cron
26+
-c cron.database_name=${POSTGRES_DB:-splitpro}
27+
-c cron.timezone=${TZ:-UTC}
2328
2429
splitpro:
2530
image: ossapps/splitpro:latest

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,19 @@
5252
"lucide-react": "^0.544.0",
5353
"nanoid": "^5.0.6",
5454
"next": "15.4.7",
55-
"next-auth": "^4.24.5",
55+
"next-auth": "^4.24.11",
5656
"next-i18next": "^15.4.2",
5757
"next-themes": "^0.2.1",
5858
"nodemailer": "^6.9.8",
59+
"nordigen-node": "^1.4.1",
60+
"plaid": "^38.1.0",
5961
"radix-ui": "^1.4.2",
6062
"react": "19.1.1",
6163
"react-day-picker": "^9.7.0",
6264
"react-dom": "19.1.1",
6365
"react-hook-form": "^7.50.1",
6466
"react-i18next": "^15.5.3",
67+
"react-plaid-link": "4.1.1",
6568
"sonner": "^1.4.0",
6669
"superjson": "^2.2.1",
6770
"vaul": "^1.1.2",

0 commit comments

Comments
 (0)