Refactor payment service, fix DB session, and consolidate endpoints

- Fix critical NameError in database.py by restoring Session factory
- Refactor payment_service.py and crud.py to use shared constants.py and utils.py
- Deduplicate state mapping and input sanitization logic
- Move transaction amount calculation logic from CRUD to Router layer
- Enforce type safety in schemas using IntEnum for TransactionType/Status
- Move capture endpoint from transaction.py to payment.py (now /payments/capture)
- Update create_customer_profile signature for clarity
This commit is contained in:
2026-02-01 12:31:42 -05:00
parent 449eb74279
commit 97261f6c51
13 changed files with 335 additions and 428 deletions

View File

@@ -1,4 +1,4 @@
## File: your_app/models.py
## File: app/models.py
from sqlalchemy import Column, Integer, String, DateTime, Boolean, ForeignKey, Numeric
from .database import Base
@@ -118,7 +118,7 @@ class Tickets_Auto_Delivery(Base):
price_per_gallon = Column(Numeric(10, 2), nullable=True)
total_amount_customer = Column(Numeric(10, 2), nullable=True)
customer_town = Column(String(140))
# customer_town removed (duplicate)
payment_type = Column(Integer, nullable=True)
payment_card_id = Column(Integer, nullable=True)