Extend `db/seeds.rb` to create mock financial data from Column & Stripe transactions
- Dominant language
- Ruby
- Stars
- 870
- Forks
- 138
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 208
Description
At the moment our database seed is very limited, it only has the `RawCSVTransaction` type which hasn't been used much in production in HCB. As we open source HCB, it'd be incredible to be able to provide contributors with a richer set of testing data. Specifically there are four types of transactions that'd be nice to include in our seed: outgoing Column transactions, incoming Column transactions, Stripe card charges and Stripe payouts for invoices and donations.
## Outgoing Column transactions
For example, `AchTransfer`. These are already create-able from a development environment. And after https://github.com/hackclub/hcb/issues/9659 it should be possible to canonise these transactions. We should have a script that can ran in development that will run the import and map all these transactions appropriately.
## Incoming Column transactions
This should involve simulating a payment: https://column.com/docs/guides/sandbox-and-testing#incoming-transfers and then using the job created in https://github.com/hackclub/hcb/issues/9659 to turn these into `RawColumnTransaction`s.
Just make sure that we're also mapping these to an event. We should simulate transfers to org-specific account numbers, if Column supports.
## Stripe card charges
We should simulate an authorisation with https://docs.stripe.com/issuing/testing?testing-method=with-code and then create a matching `RawPendingStripeTransaction`. And then transform it into a `CanonicalPendingTransaction` that gets mapped. See `CreateFromWebhook` for a rough outline of this process.
Afterwards, we should simulate capturing the transaction: https://docs.stripe.com/issuing/testing?testing-method=with-code#capture-authorization and create a `RawStripeTransaction`.
## Stripe payouts
This by far the hardest one! We'll need to create an invoice on HCB's end, simulate paying it, then simulate a payout from Stripe, and then create the associated incoming transfer on Column (see above section on simulating incoming Column transactions).
Overall, it'd be nice for this all to be as modular as possible so that you can simulate even more transactions from the Rails console.
Contributor guide
Research direction
Start with db/seeds.rb, the transaction-mapping work from issue #9659, and CreateFromWebhook. Run the existing development transaction flows from a Rails console and review the linked Column and Stripe testing guides. Done means modular seed or console helpers can simulate outgoing and incoming Column transactions, Stripe card charges, and Stripe payouts with the described mappings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- backend, database, payments
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100