Skip to content

feat: import a Splitwise friend export into a contact - #58

Merged
ame180 merged 9 commits into
mainfrom
feat/splitwise-import
Nov 28, 2026
Merged

ame180 merged 9 commits into
mainfrom
feat/splitwise-import

Conversation

@ame180

@ame180 ame180 commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner
  • POST /api/contacts/{userId}/import/splitwise/preview with JSON {csv} writes nothing and returns the file's two names, how far the PLN rows are off the file's own PLN total (if at all), and a summary (counts, skipped, resulting PLN balance) for each way the two people could map onto the pair. POST /api/contacts/{userId}/import/splitwise with JSON {csv, ownColumn} imports the rows in one transaction, with ownColumn picking the user's column.
  • The file is read by position, since Splitwise translates its labels (English and Polish exports tested). The parser checks only the shape, in any currency; the PLN rows and the PLN total must also have valid amounts (2 decimals, both sides cancel out, the cost fits the amount column and covers what's owed). Anything else is rejected with 422. Payment rows (Payment / Płatność) become transfers without a description; other rows become exact-split expenses where the person owed paid the cost. Splitwise categories map onto Settle's in both languages, and unknown ones fall back to general.
  • Skipped: non-PLN rows (the app shows PLN balances only), net-zero rows, and rows the pair already has (expenses by date, amount, payer and title; transfers by date, amount and direction), so re-importing, also in the other language, adds nothing.
  • Edit contact gets a quiet "Import from Splitwise" row. It opens a bottom sheet with "Which one are you?" (no preselection), a plain summary with the resulting balance, a muted line and "Import anyway" when the PLN rows don't add up to the file's PLN total, and states for an unsupported file, a failed check, nothing new to import and a failed import. A toast confirms. Copy is in English and Polish.

Proved with PHPUnit (parser shapes in both languages, preview, import from either side, dedupe across languages, PLN amount checks, other currencies skipped whatever their amounts, 404/400/422) and vitest (picker, summary, mismatch, nothing new, error states), and in the running app at 390×844: a real 187-row export imported with the balance matching its own total, and the Polish export of the same history re-imported adding nothing.

@ame180
ame180 merged commit 8e5c7ab into main Nov 28, 2026
4 checks passed
@ame180
ame180 deleted the feat/splitwise-import branch November 28, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant