feat: integer cents money handling, order page fixes, and vendor filter persistence
Money Handling Architecture: - Store all monetary values as integer cents (€105.91 = 10591) - Add app/utils/money.py with Money class and conversion helpers - Add static/shared/js/money.js for frontend formatting - Update all database models to use _cents columns (Product, Order, etc.) - Update CSV processor to convert prices to cents on import - Add Alembic migration for Float to Integer conversion - Create .architecture-rules/money.yaml with 7 validation rules - Add docs/architecture/money-handling.md documentation Order Details Page Fixes: - Fix customer name showing 'undefined undefined' - use flat field names - Fix vendor info empty - add vendor_name/vendor_code to OrderDetailResponse - Fix shipping address using wrong nested object structure - Enrich order detail API response with vendor info Vendor Filter Persistence Fixes: - Fix orders.js: restoreSavedVendor now sets selectedVendor and filters - Fix orders.js: init() only loads orders if no saved vendor to restore - Fix marketplace-letzshop.js: restoreSavedVendor calls selectVendor() - Fix marketplace-letzshop.js: clearVendorSelection clears TomSelect dropdown - Align vendor selector placeholder text between pages 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -148,17 +148,17 @@ TEST001,Product 1,Description 1,19.99 EUR,Brand1,Category1"""
|
||||
assert product_data["price"] == "19.99"
|
||||
assert product_data["brand"] == "TestBrand"
|
||||
|
||||
def test_parse_price_to_numeric(self):
|
||||
"""Test price string to numeric conversion"""
|
||||
assert self.processor._parse_price_to_numeric("19.99 EUR") == 19.99
|
||||
assert self.processor._parse_price_to_numeric("19,99 EUR") == 19.99
|
||||
assert self.processor._parse_price_to_numeric("$29.99") == 29.99
|
||||
assert self.processor._parse_price_to_numeric("100") == 100.0
|
||||
assert self.processor._parse_price_to_numeric(None) is None
|
||||
assert self.processor._parse_price_to_numeric("") is None
|
||||
def test_parse_price_to_cents(self):
|
||||
"""Test price string to cents conversion"""
|
||||
assert self.processor._parse_price_to_cents("19.99 EUR") == 1999
|
||||
assert self.processor._parse_price_to_cents("19,99 EUR") == 1999
|
||||
assert self.processor._parse_price_to_cents("$29.99") == 2999
|
||||
assert self.processor._parse_price_to_cents("100") == 10000
|
||||
assert self.processor._parse_price_to_cents(None) is None
|
||||
assert self.processor._parse_price_to_cents("") is None
|
||||
|
||||
def test_clean_row_data_with_prices(self):
|
||||
"""Test row data cleaning with price parsing"""
|
||||
"""Test row data cleaning with price parsing to cents"""
|
||||
row_data = {
|
||||
"marketplace_product_id": "TEST001",
|
||||
"title": "Test Product",
|
||||
@@ -169,8 +169,8 @@ TEST001,Product 1,Description 1,19.99 EUR,Brand1,Category1"""
|
||||
|
||||
cleaned = self.processor._clean_row_data(row_data)
|
||||
|
||||
assert cleaned["price_numeric"] == 19.99
|
||||
assert cleaned["sale_price_numeric"] == 14.99
|
||||
assert cleaned["price_cents"] == 1999 # Integer cents
|
||||
assert cleaned["sale_price_cents"] == 1499 # Integer cents
|
||||
assert cleaned["currency"] == "EUR"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user