8000 Transaction transfers, payments, and matching by zachgoll · Pull Request #883 · maybe-finance/maybe · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Transaction transfers, payments, and matching #883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

zachgoll
Copy link
Collaborator
@zachgoll zachgoll commented Jun 17, 2024
CleanShot.2024-06-18.at.14.32.13.mp4

Overview

This PR enables transaction transfers and subsets (payments).

Additionally, I have cleaned up some of the snapshot fixtures to make them easier to modify and more clear to read.

What is a "Transfer"?

A transfer represents a pair of transactions that:

  • Have opposite amounts (net zero)
  • Come from different accounts
  • Are generally (but not always) posted on the same day
  • Represent an outflow from one account and inflow to another account
  • Do not affect income or expense calculations

Transaction Matching

In a personal finance app like Maybe, we cannot guarantee the user will have both accounts "connected" to the app. Because of this, a transfer can also be represented by a single outgoing/incoming transaction to/from some external account. Even in these cases, the user generally will not want these transactions to be included in any "budgeting" calculations like income/expense.

Because we cannot guarantee both sides of the transfer can be found within the user's data, transaction "matching" must happen in two separate steps:

  1. Mark a transactions as a transfer by setting marked_as_transfer: true
  2. Create a Transfer record by asking the user to confirm both transactions for the identified transfer

The marked_as_transfer is a slightly denormalized convenience field that serves a few purposes:

  • Allows a user to easily mark 1+ transactions as "transfers" without having to manually confirm the details.
  • In the future, allows the system to auto-classify transfers without having to confirm that the match is correct
  • Improved query performance in both aggregation queries (summing income/expense and excluding transfers) and listing transactions in the global transactions view (no need to join to display a transaction row)

zachgoll added 5 commits June 14, 2024 16:40
…users-to-mark-transactions-as-payments-or-transfers-which-are-excluded-from-income-and-expense-calculations

# Conflicts:
#	db/schema.rb
#	test/fixtures/accounts.yml
…users-to-mark-transactions-as-payments-or-transfers-which-are-excluded-from-income-and-expense-calculations
@zachgoll zachgoll marked this pull request as ready for review June 17, 2024 18:35
@zachgoll zachgoll marked this pull request as draft June 17, 2024 18:39
zachgoll added 3 commits June 18, 2024 14:10
…users-to-mark-transactions-as-payments-or-transfers-which-are-excluded-from-income-and-expense-calculations

# Conflicts:
#	app/views/transactions/show.html.erb
#	config/locales/views/transactions/en.yml
@zachgoll zachgoll marked this pull request as ready for review June 18, 2024 18:19
@zachgoll zachgoll merged commit ca39b26 into main Jun 19, 2024
4 checks passed
@zachgoll zachgoll deleted the 858-allow-users-to-mark-transactions-as-payments-or-transfers-which-are-excluded-from-income-and-expense-calculations branch June 19, 2024 10:52
karankiri pushed a commit to karankiri/maybe that referenced this pull request Jun 20, 2024
* Add transfer model and clean up family snapshot fixtures

* Ignore transfers in income and expense snapshots

* Add transfer validations

* Implement basic transfer matching UI

* Fix merge conflicts

* Add missing translations

* Tweak selection states for transfer types

* Add missing i18n translation
karankiri pushed a commit to karankiri/maybe that referenced this pull request Jun 20, 2024
* Add transfer model and clean up family snapshot fixtures

* Ignore transfers in income and expense snapshots

* Add transfer validations

* Implement basic transfer matching UI

* Fix merge conflicts

* Add missing translations

* Tweak selection states for transfer types

* Add missing i18n translation
zachgoll added a commit that referenced this pull request Jun 21, 2024
* feat: make transaction container fixed height

* feat: pagination per page query

* fix: linting errors

* Changelog page that pulls from Github Release notes (#867)

* Changelog page that pulls from Github Release notes

* Review changelog page styles

* Move changelog page title to i18n translations

* Bump to 0.1.0-alpha.6

Signed-off-by: Zach Gollwitzer <zach@maybe.co>

* Bump aws-sdk-s3 from 1.152.0 to 1.152.3 (#880)

Bumps [aws-sdk-s3](https://github.com/aws/aws-sdk-ruby) from 1.152.0 to 1.152.3.
- [Release notes](https://github.com/aws/aws-sdk-ruby/releases)
- [Changelog](https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sdk-s3/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-ruby/commits)

---
updated-dependencies:
- dependency-name: aws-sdk-s3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump mocha from 2.3.0 to 2.4.0 (#878)

Bumps [mocha](https://github.com/freerange/mocha) from 2.3.0 to 2.4.0.
- [Changelog](https://github.com/freerange/mocha/blob/main/RELEASE.md)
- [Commits](freerange/mocha@v2.3.0...v2.4.0)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump octokit from 8.1.0 to 9.1.0 (#877)

Bumps [octokit](https://github.com/octokit/octokit.rb) from 8.1.0 to 9.1.0.
- [Release notes](https://github.com/octokit/octokit.rb/releases)
- [Changelog](https://github.com/octokit/octokit.rb/blob/main/RELEASE.md)
- [Commits](octokit/octokit.rb@v8.1.0...v9.1.0)

---
updated-dependencies:
- dependency-name: octokit
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump rails from `f9c847f` to `5d34172` (#879)

Bumps [rails](https://github.com/rails/rails) from `f9c847f` to `5d34172`.
- [Release notes](https://github.com/rails/rails/releases)
- [Commits](rails/rails@f9c847f...5d34172)

---
updated-dependencies:
- dependency-name: rails
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Zach Gollwitzer <zach@maybe.co>

* Update issue templates

* Add merchant select when editing transaction (#885)

* Transaction transfers, payments, and matching (#883)

* Add transfer model and clean up family snapshot fixtures

* Ignore transfers in income and expense snapshots

* Add transfer validations

* Implement basic transfer matching UI

* Fix merge conflicts

* Add missing translations

* Tweak selection states for transfer types

* Add missing i18n translation

* Ensure correct form's hidden input for selectedIds (#891)

* feat: make transaction container fixed height

* feat: pagination per page query

* fix: linting errors

* Transaction transfers, payments, and matching (#883)

* Add transfer model and clean up family snapshot fixtures

* Ignore transfers in income and expense snapshots

* Add transfer validations

* Implement basic transfer matching UI

* Fix merge conflicts

* Add missing translations

* Tweak selection states for transfer types

* Add missing i18n translation

* feat: make transaction container fixed height

* feat: pagination per page query

* fix: linting errors

* revert unnecessary changes

* revert unnecessary changes

* code review changes

* code review changes

* code review changes

* remove unused imports

* fix: unit tests

* remove border

* fix: transaction padding

* fix: transaction container height

---------

Signed-off-by: Zach Gollwitzer <zach@maybe.co>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Karan Kiri <karankiri.96@gmail.com>
Co-authored-by: Mattia <malnis.mattia@gmail.com>
Co-authored-by: Zach Gollwitzer <zach@maybe.co>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Zach Gollwitzer <zach.gollwitzer@gmail.com>
Co-authored-by: Jakub Kottnauer <jk@jakubkottnauer.com>
Co-authored-by: ziraq young <ziraqyoung@outlook.com>
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.

Allow users to mark transactions as "payments" or "transfers", which are excluded from income and expense calculations
2 participants
0