Where should I put database transactions. Let's say I am building an e-commerce website, and I want to create a feature to order an item with a third-party payment. The simplified flow:
- Deduct item stock in database
- Charge to Paypal
- Create invoice in database
Where should I put the transaction implementation? It should not be in the repository layer no?