When an invoice is paid, numerous transactions (payments, credits) will be generated. Either all or none of these need to be successfully processed; we can't have partially paid invoices. This presents a challenge of scale. There could feasibly be hundreds of payments for an invoice.
Several options were weighed and the most attractive approach was documented on the wiki .
Given that this is a novel solution it makes sense to start with a POC to validate the proposed approach.
- Is the basic approach feasible?
- Use of standard tables instead of jsonb?
- Cleanup of zombie records left by removing invoices that are approved is outside the scope of this story.
- Any issues with "insert if not exist" when creating invoice_payment_summary records (to avoid potential race conditions)?
- A POC is created
- Discoveries/difficulties/findings are documented on the wiki
- Findings are presented to the team
- Follow-on stories are created as needed (to formalize the approach, additional investigation, etc.)
- Questions above are answered.