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:
@@ -0,0 +1,43 @@
|
||||
"""add payment_transactions table
|
||||
|
||||
Revision ID: add_payment_transactions
|
||||
Revises: add_ai_providers_table
|
||||
Create Date: 2026-05-29
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
|
||||
revision = "add_payment_transactions"
|
||||
down_revision = "add_ai_providers_table"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
"payment_transactions",
|
||||
sa.Column("id", UUID(as_uuid=True), primary_key=True),
|
||||
sa.Column("user_id", UUID(as_uuid=True), nullable=False, index=True),
|
||||
sa.Column("order_no", sa.String(64), unique=True, nullable=False, index=True),
|
||||
sa.Column("gateway_order_id", sa.String(128), nullable=True),
|
||||
sa.Column("gateway_order_no", sa.String(128), nullable=True),
|
||||
sa.Column("plan", sa.String(50), nullable=False),
|
||||
sa.Column("amount", sa.Float, nullable=False),
|
||||
sa.Column("currency", sa.String(10), default="CNY"),
|
||||
sa.Column("gateway", sa.String(20), nullable=False),
|
||||
sa.Column("pay_type", sa.String(20), nullable=False),
|
||||
sa.Column("status", sa.String(20), default="pending"),
|
||||
sa.Column("description", sa.Text, nullable=True),
|
||||
sa.Column("refund_amount", sa.Float, default=0),
|
||||
sa.Column("refund_reason", sa.Text, nullable=True),
|
||||
sa.Column("paid_at", sa.DateTime, nullable=True),
|
||||
sa.Column("refunded_at", sa.DateTime, nullable=True),
|
||||
sa.Column("notify_raw", sa.Text, nullable=True),
|
||||
sa.Column("created_at", sa.DateTime, default=sa.func.now()),
|
||||
sa.Column("updated_at", sa.DateTime, default=sa.func.now()),
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_table("payment_transactions")
|
||||
Reference in New Issue
Block a user