Add independent payment-service (port 8012, payment_db) with foundation licensing, BYO-PSP, merchant accounts, idempotent requests, callbacks, and immutable ledger. Co-authored-by: Cursor <cursoragent@cursor.com>
8 lines
506 B
Python
8 lines
506 B
Python
from uuid import uuid4
|
|
from app.models import OutboxEvent
|
|
class TransactionalEventPublisher:
|
|
def __init__(self, session): self.session=session
|
|
async def publish(self, *, event_type, aggregate_type, aggregate_id, tenant_id, payload=None):
|
|
row=OutboxEvent(tenant_id=tenant_id,event_type=str(getattr(event_type,"value",event_type)),aggregate_type=aggregate_type,aggregate_id=str(aggregate_id),payload=payload or {})
|
|
self.session.add(row); await self.session.flush(); return row
|