refactor: replace direct WeChat/Alipay with unified pay-api gateway
Switch from direct WeChat Pay / Alipay integrations to the unified
宇之然 pay-api gateway (HMAC-SHA256 auth). Removes wechat_pay.py,
keeps PaymentGateway abstraction, adds UnifiedPayService. Simplifies
payment.py create_order to {plan, pay_type} params. Single webhook
endpoint replaces separate WeChat/Alipay notify handlers.
This commit is contained in:
@@ -18,26 +18,23 @@ from .referral import ReferralCode, Referral
|
||||
from .search_provider import SearchProvider
|
||||
from .discovery_record import DiscoveryRecord
|
||||
from .ai_provider import AIProvider
|
||||
from .payment_transaction import PaymentTransaction
|
||||
|
||||
__all__ = [
|
||||
"User", "Product",
|
||||
"Customer", "Conversation", "Message",
|
||||
"Quotation", "QuotationItem",
|
||||
"CorpusEntry",
|
||||
"Team", "TeamMember",
|
||||
"UsageLog",
|
||||
"Notification",
|
||||
"Feedback",
|
||||
"Subscription",
|
||||
"CorpusEntry",
|
||||
"Notification",
|
||||
"Team", "TeamMember",
|
||||
"Feedback",
|
||||
"PreferenceAnalysis", "MarketingEffect",
|
||||
"Device",
|
||||
"FollowupStrategy", "FollowupLog",
|
||||
"SystemConfig",
|
||||
"TranslationQuota",
|
||||
"Certification", "CertType", "CertStatus",
|
||||
"Invoice", "InvoiceType", "InvoiceStatus",
|
||||
"Certification", "Invoice", "InvoiceType", "InvoiceStatus",
|
||||
"ReferralCode", "Referral",
|
||||
"SearchProvider",
|
||||
"DiscoveryRecord",
|
||||
"AIProvider",
|
||||
"PaymentTransaction",
|
||||
]
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
from sqlalchemy import Column, String, Integer, DateTime, Float, Text, Boolean
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from datetime import datetime
|
||||
from app.database import Base
|
||||
import uuid
|
||||
|
||||
|
||||
class PaymentTransaction(Base):
|
||||
__tablename__ = "payment_transactions"
|
||||
|
||||
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
user_id = Column(UUID(as_uuid=True), nullable=False, index=True)
|
||||
order_no = Column(String(64), unique=True, nullable=False, index=True)
|
||||
gateway_order_id = Column(String(128), nullable=True)
|
||||
gateway_order_no = Column(String(128), nullable=True)
|
||||
plan = Column(String(50), nullable=False)
|
||||
amount = Column(Float, nullable=False)
|
||||
currency = Column(String(10), default="CNY")
|
||||
gateway = Column(String(20), nullable=False)
|
||||
pay_type = Column(String(20), nullable=False)
|
||||
status = Column(String(20), default="pending")
|
||||
description = Column(Text, nullable=True)
|
||||
refund_amount = Column(Float, default=0)
|
||||
refund_reason = Column(Text, nullable=True)
|
||||
paid_at = Column(DateTime, nullable=True)
|
||||
refunded_at = Column(DateTime, nullable=True)
|
||||
notify_raw = Column(Text, nullable=True)
|
||||
created_at = Column(DateTime, default=datetime.utcnow)
|
||||
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
Reference in New Issue
Block a user