infrasynth-backend-kit/infrasynth/billing/gateways/base.py
2026-08-28 14:38:47 -05:00

36 lines
792 B
Python

from abc import ABC, abstractmethod
from dataclasses import dataclass
@dataclass
class CheckoutSessionResult:
session_id: str
checkout_url: str
client_secret: str
@dataclass
class WebhookResult:
event_type: str
is_handled: bool
data: dict
class BasePaymentGateway(ABC):
@abstractmethod
def create_checkout_session(self, plan, user, **kwargs) -> CheckoutSessionResult: ...
@abstractmethod
def handle_webhook(self, payload, headers) -> WebhookResult: ...
@abstractmethod
def cancel_subscription(self, subscription) -> bool: ...
@abstractmethod
def sync_subscription(self, subscription) -> dict: ...
@abstractmethod
def get_invoice(self, invoice) -> dict: ...
@abstractmethod
def health_check(self) -> bool: ...