Conversation

How I built this πŸ‘‡ A big goal was to automate as much as possible. But pulling from Stripe can be slow and I didn't want to introduce caching yet. Instead, I wrote a rake task that normalizes all the data once per day.
1
1
This task does a few things: 1. Queries Stripe for BalanceTransactions to use for revenue and fees 2. Queries Stripe for Subscriptions to calculate MRR 3. Normalizes this data to a single record per month 4. Merges it with manual entry of expenses and contributions (admin CRUD)
1
1
Testing this was a little tough. I didn't want to integrate VCR for Stripe because it felt like too much infrastructure for two queries. Instead, I wrapped the Stripe (and Fathom) APIs in their own POROs.
1
These objects were mocked under test to return my own versions of Stripe's responses. This resulted in a lot less code to manage because the new models only use exactly what I needed.
1