arborrow / montserrat

A retreat management application written in Laravel
12 stars 4 forks source link

Health Check(s): Stripe Balance Transaction #563

Open arborrow opened 4 months ago

arborrow commented 4 months ago

All reconciled SBTs should have at least one associated payment.

I want to review the results of:

SELECT sbt.* , p.payment_id, p.payment_amount, p.payment_date
FROM stripe_balance_transaction as sbt 
LEFT JOIN Donations_payment as p ON (p.stripe_balance_transaction_id = sbt.id)
WHERE sbt.deleted_at IS NULL AND p.deleted_at IS NULL AND p.payment_amount IS NULL AND sbt.reconcile_date IS NOT NULL

I figured it would be good to add a database health check for reconciled SBTs without a payment. Going one step further, we could also have another check to ensure that the sum of the associated payments is equal to the amount of payout. Having both of those flagged would give us a good internal check on the data in addition to end of month reconciliation done by Finance.

arborrow commented 4 months ago

Reviewed existing SBTs without corresponding payments and was able to get the list down to 4.