feat: Airwallex 发卡管理后台完整实现

- 后端: FastAPI + SQLAlchemy + SQLite, JWT认证, 代理支持的AirwallexClient
- 前端: React 18 + Vite + Ant Design 5, 中文界面
- 功能: 卡片管理, 持卡人管理, 交易记录, API令牌, 系统设置, 审计日志
- 第三方API: X-API-Key认证, 权限控制
- Docker部署: docker-compose编排前后端
This commit is contained in:
zqq61
2026-03-15 23:05:08 +08:00
commit 4f53889a8e
98 changed files with 10847 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
"""
Models for the Airwallex FX API.
"""
from typing import Optional, List, Dict, Any
from datetime import datetime
from pydantic import Field
from .base import AirwallexModel
class ExchangeRate(AirwallexModel):
"""Model for exchange rate information."""
source_currency: str = Field(..., description="Source currency code (ISO 4217)")
target_currency: str = Field(..., description="Target currency code (ISO 4217)")
rate: float = Field(..., description="Exchange rate")
timestamp: datetime = Field(..., description="Timestamp when the rate was fetched")
class FXQuote(AirwallexModel):
"""Model for FX quote."""
id: str = Field(..., description="Quote ID")
source_currency: str = Field(..., description="Source currency code (ISO 4217)")
target_currency: str = Field(..., description="Target currency code (ISO 4217)")
source_amount: Optional[float] = Field(None, description="Source amount")
target_amount: Optional[float] = Field(None, description="Target amount")
rate: float = Field(..., description="Exchange rate")
fee: Optional[Dict[str, Any]] = Field(None, description="Fee details")
expires_at: datetime = Field(..., description="Quote expiration timestamp")
created_at: datetime = Field(..., description="Quote creation timestamp")
class FXConversion(AirwallexModel):
"""Model for an FX conversion."""
resource_name: str = "fx/conversions"
id: str = Field(..., description="Conversion ID")
request_id: str = Field(..., description="Client-generated request ID")
source_currency: str = Field(..., description="Source currency code (ISO 4217)")
target_currency: str = Field(..., description="Target currency code (ISO 4217)")
source_amount: float = Field(..., description="Source amount")
target_amount: float = Field(..., description="Target amount")
rate: float = Field(..., description="Exchange rate")
status: str = Field(..., description="Conversion status")
created_at: datetime = Field(..., description="Conversion creation timestamp")
updated_at: Optional[datetime] = Field(None, description="Conversion last update timestamp")
account_id: str = Field(..., description="Source account ID")
settlement_date: Optional[datetime] = Field(None, description="Settlement date")
quote_id: Optional[str] = Field(None, description="Quote ID used for this conversion")
class FXConversionCreateRequest(AirwallexModel):
"""Model for FX conversion creation request."""
request_id: str = Field(..., description="Client-generated unique ID for the request")
source_currency: str = Field(..., description="Source currency code (ISO 4217)")
target_currency: str = Field(..., description="Target currency code (ISO 4217)")
source_amount: Optional[float] = Field(None, description="Source amount (required if target_amount is not provided)")
target_amount: Optional[float] = Field(None, description="Target amount (required if source_amount is not provided)")
account_id: str = Field(..., description="Source account ID")
quote_id: Optional[str] = Field(None, description="Quote ID to use for this conversion")