Files
life-echo/api/app/features/payment/deps.py
Sully 53e0065e3e refactor(api): TOML 配置 SSOT、统一错误契约、Auth/事务加固与可观测性 (#33)
配置 SSOT(TOML + .env)
统一错误契约
Auth 与事务边界
Redis / Celery 可靠性:业务 Redis(DB/0)与 Celery broker/backend(DB/1)显式拆分;连接池、sync client
可观测性(OpenTelemetry + LGTM)
2026-05-22 13:44:50 +08:00

28 lines
978 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from fastapi import Depends
from app.features.payment.order_service import PaymentOrderService
from app.features.payment.payment_config import PaymentConfig
from app.features.payment.payment_facade import PaymentService
from app.features.plan.deps import get_plan_service
from app.features.plan.service import PlanService
from app.core.deps_types import DbDep
_payment_service = None
def get_payment_service() -> PaymentService:
"""统一支付门面wechat/alipay供 PaymentOrderService 与 startup 使用。"""
global _payment_service
if _payment_service is None:
config = PaymentConfig.from_env()
_payment_service = PaymentService(config)
return _payment_service
def get_payment_order_service(
db: DbDep,
plan_service: PlanService = Depends(get_plan_service),
) -> PaymentOrderService:
"""Payment order facade: create_order, callbacks, list/status."""
return PaymentOrderService(db=db, plan_service=plan_service)