fix: update letzshop API to use unified Order model properties

- Change message exceptions (MessageAttachmentException,
  InvalidConversationTypeException, InvalidRecipientTypeException)
  to extend BusinessLogicException instead of ValidationException
  which doesn't accept error_code parameter

- Update vendor letzshop API endpoints:
  - Change sync_status query param to status in list_orders()
  - Fix response mapping to use unified Order model properties
    (external_order_id, external_shipment_id, status, etc.)
  - Fix confirm_order() to get inventory unit IDs from order items
  - Fix set_tracking() to use external_shipment_id

- Add order_date to test fixtures (required NOT NULL field)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-22 23:13:00 +01:00
parent 6f8434f200
commit feca2e19fe
4 changed files with 86 additions and 45 deletions

View File

@@ -246,6 +246,8 @@ class TestAdminLetzshopOrdersAPI:
def test_list_vendor_orders_with_data(self, client, db, admin_headers, test_vendor):
"""Test listing vendor orders with data."""
from datetime import datetime, timezone
from models.database.order import Order
# Create test order using unified Order model with all required fields
@@ -256,6 +258,7 @@ class TestAdminLetzshopOrdersAPI:
channel="letzshop",
external_order_id="admin_order_1",
status="pending",
order_date=datetime.now(timezone.utc),
customer_first_name="Admin",
customer_last_name="Test",
customer_email="admin-test@example.com",