Files
life-echo/api/payment/exceptions.py
iammm0 e39fd97e06 feat: 新增后端支付模块,支持微信和支付宝
- 新增api/payment/支付服务(微信、支付宝)
- 新增api/routers/payment.py支付路由
- 更新database/models.py支付相关模型
- 新增数据库迁移文件(订单表、用户订阅字段)
- 更新main.py、requirements.txt、.env.production

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-10 14:23:29 +08:00

41 lines
1.1 KiB
Python

"""
支付模块异常定义
"""
class PaymentError(Exception):
"""支付基础异常"""
def __init__(self, message: str = "支付异常", code: str = "PAYMENT_ERROR"):
self.message = message
self.code = code
super().__init__(self.message)
class PaymentConfigError(PaymentError):
"""支付配置异常"""
def __init__(self, message: str = "支付配置错误"):
super().__init__(message=message, code="PAYMENT_CONFIG_ERROR")
class PaymentCreateError(PaymentError):
"""创建支付订单异常"""
def __init__(self, message: str = "创建支付订单失败"):
super().__init__(message=message, code="PAYMENT_CREATE_ERROR")
class PaymentNotifyError(PaymentError):
"""支付回调通知处理异常"""
def __init__(self, message: str = "支付回调处理失败"):
super().__init__(message=message, code="PAYMENT_NOTIFY_ERROR")
class PaymentQueryError(PaymentError):
"""查询支付状态异常"""
def __init__(self, message: str = "查询支付状态失败"):
super().__init__(message=message, code="PAYMENT_QUERY_ERROR")