
- Complete FastAPI application with JWT authentication
- SQLite database with SQLAlchemy ORM and Alembic migrations
- User registration/login with secure password hashing
- Multi-cryptocurrency wallet system with balance tracking
- Advertisement system for buy/sell listings with fund locking
- Order management with automatic payment integration
- Payment provider API integration with mock fallback
- Automatic crypto release after payment confirmation
- Health monitoring endpoint and CORS configuration
- Comprehensive API documentation with OpenAPI/Swagger
- Database models for users, wallets, ads, orders, and payments
- Complete CRUD operations for all entities
- Security features including fund locking and order expiration
- Detailed README with setup and usage instructions
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
from sqlalchemy import Column, Integer, String, Float, DateTime, ForeignKey, Enum
|
|
from sqlalchemy.orm import relationship
|
|
from sqlalchemy.sql import func
|
|
from app.db.base import Base
|
|
import enum
|
|
|
|
class PaymentStatus(str, enum.Enum):
|
|
PENDING = "pending"
|
|
CONFIRMED = "confirmed"
|
|
FAILED = "failed"
|
|
CANCELLED = "cancelled"
|
|
|
|
class Payment(Base):
|
|
__tablename__ = "payments"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
order_id = Column(Integer, ForeignKey("orders.id"), nullable=False)
|
|
account_number = Column(String, nullable=False) # Account provided by payment provider
|
|
account_name = Column(String, nullable=False)
|
|
bank_name = Column(String, nullable=False)
|
|
amount = Column(Float, nullable=False)
|
|
reference = Column(String, unique=True, nullable=False) # Payment reference
|
|
|
|
status = Column(Enum(PaymentStatus), default=PaymentStatus.PENDING)
|
|
provider_transaction_id = Column(String) # Transaction ID from payment provider
|
|
confirmed_at = Column(DateTime)
|
|
|
|
created_at = Column(DateTime, server_default=func.now())
|
|
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())
|
|
|
|
# Relationships
|
|
order = relationship("Order", back_populates="payments") |